]> O.S.I.I.S - jp/vkvg.git/commitdiff
swapchain color to unorm
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 21 Dec 2021 07:27:31 +0000 (08:27 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 21 Dec 2021 07:27:31 +0000 (08:27 +0100)
src/vkvg_surface.c
tests/common/vkengine.c
tests/curve.c

index b183a9a36a0abd3e8bfd6c9038531e3a23243d2f..04325bc2b8cd6d0f25ca90adb99c96fcbe0e1170 100644 (file)
@@ -318,7 +318,7 @@ void vkvg_surface_write_to_memory (VkvgSurface surf, unsigned char* const bitmap
        uint32_t dest_stride = surf->width * 4;
 
        char* img = vkh_image_map (stagImg);
-       char* row = bitmap;
+       char* row = (char*)bitmap;
        for (uint32_t y = 0; y < surf->height; y++) {
                memcpy(row, img, dest_stride);
                row += dest_stride;
index 90884f1a1396858858f2ae714e02ab217de13e87..a442c1f404779778b09aedabc37e5c2e757d15e2 100644 (file)
@@ -218,7 +218,7 @@ vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, VkPresentModeKHR
        e->dev = vkh_device_create(e->app, pi, &device_info);
 
        e->renderer = vkh_presenter_create
-                       (e->dev, (uint32_t) pi->pQueue, surf, width, height, VK_FORMAT_B8G8R8A8_SRGB, presentMode);
+                       (e->dev, (uint32_t) pi->pQueue, surf, width, height, VK_FORMAT_B8G8R8A8_UNORM, presentMode);
 
        vkh_app_free_phyinfos (phyCount, phys);
 
index b944c710f98e52d92aec003b25b68e7257eb474c..6ad3d269a917ddd1afb1156d8ffe91fd433d8c00 100644 (file)
@@ -118,8 +118,8 @@ void random_curves_stroke () {
 
        for (uint32_t i=0; i<test_size; i++) {
                randomize_color(ctx);
-               float x1 = w*rand()/RAND_MAX;
-               float y1 = h*rand()/RAND_MAX;
+               float x1 = rndf() * w;
+               float y1 = rndf() * h;
 
                vkvg_move_to (ctx, x1, y1);
                draw_random_curve(ctx);
@@ -137,8 +137,8 @@ void _long_curv () {
        vkvg_set_fill_rule(ctx, fill_rule);
 
        randomize_color(ctx);
-       float x1 = w*rand()/RAND_MAX;
-       float y1 = h*rand()/RAND_MAX;
+       float x1 = rndf() * w;
+       float y1 = rndf() * h;
        vkvg_move_to (ctx, x1, y1);
 
        for (uint32_t i=0; i<test_size; i++) {