oh dear.. lewft and right pixle duplication for interpolation had the
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 25 Oct 2011 09:27:54 +0000 (09:27 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 25 Oct 2011 09:27:54 +0000 (09:27 +0000)
WRONG PIXELS!!! amazing it never crashed! fix fix! (also handle
opengls that doesnt support unpack row length)

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@64377 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_texture.c

index a25faa1..47b29b8 100644 (file)
@@ -865,20 +865,6 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
                im->cache_entry.w, im->cache_entry.h,
                fmt, tex->pt->dataformat,
                im->image.data);
-   // |xxx
-   // |xxx
-   //
-   _tex_sub_2d(tex->x - 1, tex->y,
-               1, im->cache_entry.h,
-               fmt, tex->pt->dataformat,
-               im->image.data);
-   //  xxx|
-   //  xxx|
-   //
-   _tex_sub_2d(tex->x + im->cache_entry.w, tex->y,
-               1, im->cache_entry.h,
-               fmt, tex->pt->dataformat,
-               im->image.data + (im->cache_entry.w - 1));
    //  xxx
    //  xxx
    //  ---
@@ -900,6 +886,61 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
                1, 1,
                fmt, tex->pt->dataformat,
                im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1));
+#ifdef GL_UNPACK_ROW_LENGTH
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, im->cache_entry.w);
+   GLERR(__FUNCTION__, __FILE__, __LINE__, "");
+   // |xxx
+   // |xxx
+   //
+   _tex_sub_2d(tex->x - 1, tex->y,
+               1, im->cache_entry.h,
+               fmt, tex->pt->dataformat,
+               im->image.data);
+   //  xxx|
+   //  xxx|
+   //
+   _tex_sub_2d(tex->x + im->cache_entry.w, tex->y,
+               1, im->cache_entry.h,
+               fmt, tex->pt->dataformat,
+               im->image.data + (im->cache_entry.w - 1));
+#else
+     {
+        DATA32 *tpix, *ps, *pd;
+        int i;
+        
+        tpix = alloca(im->cache_entry.h * sizeof(DATA32));
+        pd = tpix;
+        ps = im->image.data;
+        for (i = 0; i < im->cache_entry.h; i++)
+          {
+             *pd = *ps;
+             pd++;
+             ps += im->cache_entry.w;
+          }
+        // |xxx
+        // |xxx
+        //
+        _tex_sub_2d(tex->x - 1, tex->y,
+                    1, im->cache_entry.h,
+                    fmt, tex->pt->dataformat,
+                    tpix);
+        pd = tpix;
+        ps = im->image.data + (im->cache_entry.w - 1);
+        for (i = 0; i < im->cache_entry.h; i++)
+          {
+             *pd = *ps;
+             pd++;
+             ps += im->cache_entry.w;
+          }
+        //  xxx|
+        //  xxx|
+        //
+        _tex_sub_2d(tex->x + im->cache_entry.w, tex->y,
+                    1, im->cache_entry.h,
+                    fmt, tex->pt->dataformat,
+                    tpix);
+     }
+#endif
    if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
      {
         glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);