evas: fix bug in evas gl texture.
authorJi-Youn Park <jy0703.park@samsung.com>
Mon, 11 May 2015 10:08:12 +0000 (19:08 +0900)
committerJi-Youn Park <jy0703.park@samsung.com>
Mon, 11 May 2015 10:08:12 +0000 (19:08 +0900)
Summary: If the pixel size of image is not 32 bit like EVAS_COLORSPACE_AGRY88,
         GL_UNPACK_ALIGNMENT have to be changed.

src/modules/evas/engines/gl_common/evas_gl_texture.c

index 5c1c07f..e71b8e4 100644 (file)
@@ -1047,7 +1047,10 @@ evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int
      {
         glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
      }
-   glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+   if ((bytes_count == 1) || (bytes_count == 2))
+     glPixelStorei(GL_UNPACK_ALIGNMENT, bytes_count);
+   else
+     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
 //   printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h);
    //  +-+
@@ -1370,7 +1373,10 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
           {
              glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
           }
-        glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+        if ((bytes_count == 1) || (bytes_count == 2))
+          glPixelStorei(GL_UNPACK_ALIGNMENT, bytes_count);
+        else
+          glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
         _tex_sub_2d(tex->gc, u, tex->ty, EVAS_GL_TILE_SIZE, EVAS_GL_TILE_SIZE, fmt, tex->ptt->dataformat, out);