Evas: Fix TGV loader to properly copy ETC1 data
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 3 Apr 2014 09:39:53 +0000 (18:39 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Fri, 4 Apr 2014 01:08:09 +0000 (10:08 +0900)
There was some invalid arithmetics with the buffer offset.

src/modules/evas/loaders/tgv/evas_image_load_tgv.c

index 62df415..49bbfc3 100644 (file)
@@ -220,6 +220,7 @@ evas_image_load_file_data_tgv(void *loader_data,
    Evas_Loader_Internal *loader = loader_data;
    const char *m;
    unsigned int *p = pixels;
+   unsigned char *p_etc1 = pixels;
    char *buffer;
    Eina_Rectangle master;
    unsigned int block_length;
@@ -335,8 +336,8 @@ evas_image_load_file_data_tgv(void *loader_data,
                          }
                        break;
                     case EVAS_COLORSPACE_ETC1:
-                       memcpy(&p[current_etc.x +
-                                 current_etc.y * etc1_width],
+                       memcpy(&p_etc1[(current_etc.x / 4) * 8 +
+                                      (current_etc.y / 4) * etc1_width],
                               it, 8);
                        break;
                     default: