Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/modules/engines/gl_common


Modified Files:
        evas_gl_context.c evas_gl_texture.c 


Log Message:


and use pixelstorei to do the row skips :)

===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_context.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evas_gl_context.c   29 Dec 2006 03:32:45 -0000      1.7
+++ evas_gl_context.c   2 Jan 2007 02:43:11 -0000       1.8
@@ -480,6 +480,7 @@
    glDisable(GL_LINE_SMOOTH);
    glDisable(GL_CULL_FACE);
    glDepthMask(GL_FALSE);
-   glPixelStorei(GL_PACK_ALIGNMENT, 1);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
    gc->change.other = 0;
 }
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_texture.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evas_gl_texture.c   31 Dec 2006 07:00:13 -0000      1.7
+++ evas_gl_texture.c   2 Jan 2007 02:43:11 -0000       1.8
@@ -486,13 +486,16 @@
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      }
-   glTexImage2D(GL_TEXTURE_2D, 0,
-               texfmt, tw, th, 0,
+   glTexImage2D(GL_TEXTURE_2D, 0, texfmt, tex->w, tex->h, 0,
                texfmt, GL_UNSIGNED_BYTE, NULL);
-   for (y = 0; y < tex->h; y++)
-     glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    0, y, tex->w, 1,
-                    texfmt, GL_UNSIGNED_BYTE, rows[y]);
+   if (tex->h >= 2)
+     glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h,
+                  texfmt, GL_UNSIGNED_BYTE, rows[0]);
+//   for (y = 0; y < tex->h; y++)
+//     glTexSubImage2D(GL_TEXTURE_2D, 0,
+//                  0, y, tex->w, 1,
+//                  texfmt, GL_UNSIGNED_BYTE, rows[y]);
    
    glGenTextures(1, &(tex->texture2));
    glBindTexture(GL_TEXTURE_2D, tex->texture2);
@@ -509,13 +512,16 @@
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      }
-   glTexImage2D(GL_TEXTURE_2D, 0,
-               texfmt, tw / 2, th / 2, 0,
+   glTexImage2D(GL_TEXTURE_2D, 0, texfmt, tex->w / 2, tex->h / 2, 0,
                texfmt, GL_UNSIGNED_BYTE, NULL);
-   for (y = 0; y < (tex->h / 2); y++)
-     glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    0, y, tex->w / 2, 1,
-                    texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]);
+   if (tex->h >= 4)
+     glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + 1] - rows[tex->h]);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
+                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h]);
+//   for (y = 0; y < (tex->h / 2); y++)
+//     glTexSubImage2D(GL_TEXTURE_2D, 0,
+//                  0, y, tex->w / 2, 1,
+//                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]);
    
    glGenTextures(1, &(tex->texture3));
    glBindTexture(GL_TEXTURE_2D, tex->texture3);
@@ -533,13 +539,18 @@
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      }
    glTexImage2D(GL_TEXTURE_2D, 0,
-               texfmt, tw / 2, th / 2, 0,
+               texfmt, tex->w / 2, tex->h / 2, 0,
                texfmt, GL_UNSIGNED_BYTE, NULL);
-   for (y = 0; y < (tex->h / 2); y++)
-     glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    0, y, tex->w / 2, 1,
-                    texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]);
+   if (tex->h >= 4)
+     glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + (tex->h / 2) + 1] - 
rows[tex->h + (tex->h / 2)]);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
+                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2)]);
+//   for (y = 0; y < (tex->h / 2); y++)
+//     glTexSubImage2D(GL_TEXTURE_2D, 0,
+//                  0, y, tex->w / 2, 1,
+//                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]);
    
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
    glUseProgramObjectARB(0);
    
    if (gc->texture) gc->texture->references--;
@@ -571,10 +582,14 @@
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      }
-   for (y = 0; y < tex->h; y++)
-     glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    0, y, tex->w, 1,
-                    texfmt, GL_UNSIGNED_BYTE, rows[y]);
+   if (tex->h >= 2)
+     glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h,
+                  texfmt, GL_UNSIGNED_BYTE, rows[0]);
+//   for (y = 0; y < tex->h; y++)
+//     glTexSubImage2D(GL_TEXTURE_2D, 0,
+//                  0, y, tex->w, 1,
+//                  texfmt, GL_UNSIGNED_BYTE, rows[y]);
    
    glBindTexture(GL_TEXTURE_2D, tex->texture2);
    if (smooth)
@@ -587,10 +602,14 @@
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      }
-   for (y = 0; y < (tex->h / 2); y++)
-     glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    0, y, tex->w / 2, 1,
-                    texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]);
+   if (tex->h >= 4)
+     glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + 1] - rows[tex->h]);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
+                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h]);
+//   for (y = 0; y < (tex->h / 2); y++)
+//     glTexSubImage2D(GL_TEXTURE_2D, 0,
+//                  0, y, tex->w / 2, 1,
+//                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]);
    
    glBindTexture(GL_TEXTURE_2D, tex->texture3);
    if (smooth)
@@ -603,10 +622,15 @@
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      }
-   for (y = 0; y < (tex->h / 2); y++)
-     glTexSubImage2D(GL_TEXTURE_2D, 0,
-                    0, y, tex->w / 2, 1,
-                    texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]);
+   if (tex->h >= 4)
+     glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + (tex->h / 2) + 1] - 
rows[tex->h + (tex->h / 2)]);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
+                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2)]);
+//   for (y = 0; y < (tex->h / 2); y++)
+//     glTexSubImage2D(GL_TEXTURE_2D, 0,
+//                  0, y, tex->w / 2, 1,
+//                  texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]);
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
 
    if (tex->gc->texture) tex->gc->texture->references--;
    tex->gc->texture = tex;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to