summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2007-01-02 02:43:11 +0000
committerCarsten Haitzler <raster@rasterman.com>2007-01-02 02:43:11 +0000
commitfc6ccd21929418355e56ae6523b32fdcacd77a6c (patch)
tree306297091b103a5fd47e41b6397cd2bd674606e3
parentccafed752a73f32ea52bec36b1ce25f8851b52d5 (diff)
and use pixelstorei to do the row skips :)
SVN revision: 27714
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_context.c3
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c82
2 files changed, 55 insertions, 30 deletions
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c
index aac4e6e059..23466788c2 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c
@@ -480,6 +480,7 @@ _evas_gl_common_other_set(Evas_GL_Context *gc)
480 glDisable(GL_LINE_SMOOTH); 480 glDisable(GL_LINE_SMOOTH);
481 glDisable(GL_CULL_FACE); 481 glDisable(GL_CULL_FACE);
482 glDepthMask(GL_FALSE); 482 glDepthMask(GL_FALSE);
483 glPixelStorei(GL_PACK_ALIGNMENT, 1); 483 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
484 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
484 gc->change.other = 0; 485 gc->change.other = 0;
485} 486}
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
index 51d257dc37..a62adee5c1 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
@@ -486,13 +486,16 @@ evas_gl_common_ycbcr601pl_texture_new(Evas_GL_Context *gc, unsigned char **rows,
486 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 486 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
487 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 487 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
488 } 488 }
489 glTexImage2D(GL_TEXTURE_2D, 0, 489 glTexImage2D(GL_TEXTURE_2D, 0, texfmt, tex->w, tex->h, 0,
490 texfmt, tw, th, 0,
491 texfmt, GL_UNSIGNED_BYTE, NULL); 490 texfmt, GL_UNSIGNED_BYTE, NULL);
492 for (y = 0; y < tex->h; y++) 491 if (tex->h >= 2)
493 glTexSubImage2D(GL_TEXTURE_2D, 0, 492 glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
494 0, y, tex->w, 1, 493 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h,
495 texfmt, GL_UNSIGNED_BYTE, rows[y]); 494 texfmt, GL_UNSIGNED_BYTE, rows[0]);
495// for (y = 0; y < tex->h; y++)
496// glTexSubImage2D(GL_TEXTURE_2D, 0,
497// 0, y, tex->w, 1,
498// texfmt, GL_UNSIGNED_BYTE, rows[y]);
496 499
497 glGenTextures(1, &(tex->texture2)); 500 glGenTextures(1, &(tex->texture2));
498 glBindTexture(GL_TEXTURE_2D, tex->texture2); 501 glBindTexture(GL_TEXTURE_2D, tex->texture2);
@@ -509,13 +512,16 @@ evas_gl_common_ycbcr601pl_texture_new(Evas_GL_Context *gc, unsigned char **rows,
509 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 512 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
510 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 513 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
511 } 514 }
512 glTexImage2D(GL_TEXTURE_2D, 0, 515 glTexImage2D(GL_TEXTURE_2D, 0, texfmt, tex->w / 2, tex->h / 2, 0,
513 texfmt, tw / 2, th / 2, 0,
514 texfmt, GL_UNSIGNED_BYTE, NULL); 516 texfmt, GL_UNSIGNED_BYTE, NULL);
515 for (y = 0; y < (tex->h / 2); y++) 517 if (tex->h >= 4)
516 glTexSubImage2D(GL_TEXTURE_2D, 0, 518 glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + 1] - rows[tex->h]);
517 0, y, tex->w / 2, 1, 519 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
518 texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]); 520 texfmt, GL_UNSIGNED_BYTE, rows[tex->h]);
521// for (y = 0; y < (tex->h / 2); y++)
522// glTexSubImage2D(GL_TEXTURE_2D, 0,
523// 0, y, tex->w / 2, 1,
524// texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]);
519 525
520 glGenTextures(1, &(tex->texture3)); 526 glGenTextures(1, &(tex->texture3));
521 glBindTexture(GL_TEXTURE_2D, tex->texture3); 527 glBindTexture(GL_TEXTURE_2D, tex->texture3);
@@ -533,13 +539,18 @@ evas_gl_common_ycbcr601pl_texture_new(Evas_GL_Context *gc, unsigned char **rows,
533 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 539 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
534 } 540 }
535 glTexImage2D(GL_TEXTURE_2D, 0, 541 glTexImage2D(GL_TEXTURE_2D, 0,
536 texfmt, tw / 2, th / 2, 0, 542 texfmt, tex->w / 2, tex->h / 2, 0,
537 texfmt, GL_UNSIGNED_BYTE, NULL); 543 texfmt, GL_UNSIGNED_BYTE, NULL);
538 for (y = 0; y < (tex->h / 2); y++) 544 if (tex->h >= 4)
539 glTexSubImage2D(GL_TEXTURE_2D, 0, 545 glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + (tex->h / 2) + 1] - rows[tex->h + (tex->h / 2)]);
540 0, y, tex->w / 2, 1, 546 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
541 texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]); 547 texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2)]);
548// for (y = 0; y < (tex->h / 2); y++)
549// glTexSubImage2D(GL_TEXTURE_2D, 0,
550// 0, y, tex->w / 2, 1,
551// texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]);
542 552
553 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
543 glUseProgramObjectARB(0); 554 glUseProgramObjectARB(0);
544 555
545 if (gc->texture) gc->texture->references--; 556 if (gc->texture) gc->texture->references--;
@@ -571,10 +582,14 @@ evas_gl_common_ycbcr601pl_texture_update(Evas_GL_Texture *tex, unsigned char **r
571 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 582 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
572 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 583 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
573 } 584 }
574 for (y = 0; y < tex->h; y++) 585 if (tex->h >= 2)
575 glTexSubImage2D(GL_TEXTURE_2D, 0, 586 glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
576 0, y, tex->w, 1, 587 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h,
577 texfmt, GL_UNSIGNED_BYTE, rows[y]); 588 texfmt, GL_UNSIGNED_BYTE, rows[0]);
589// for (y = 0; y < tex->h; y++)
590// glTexSubImage2D(GL_TEXTURE_2D, 0,
591// 0, y, tex->w, 1,
592// texfmt, GL_UNSIGNED_BYTE, rows[y]);
578 593
579 glBindTexture(GL_TEXTURE_2D, tex->texture2); 594 glBindTexture(GL_TEXTURE_2D, tex->texture2);
580 if (smooth) 595 if (smooth)
@@ -587,10 +602,14 @@ evas_gl_common_ycbcr601pl_texture_update(Evas_GL_Texture *tex, unsigned char **r
587 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 602 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
588 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 603 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
589 } 604 }
590 for (y = 0; y < (tex->h / 2); y++) 605 if (tex->h >= 4)
591 glTexSubImage2D(GL_TEXTURE_2D, 0, 606 glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + 1] - rows[tex->h]);
592 0, y, tex->w / 2, 1, 607 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
593 texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]); 608 texfmt, GL_UNSIGNED_BYTE, rows[tex->h]);
609// for (y = 0; y < (tex->h / 2); y++)
610// glTexSubImage2D(GL_TEXTURE_2D, 0,
611// 0, y, tex->w / 2, 1,
612// texfmt, GL_UNSIGNED_BYTE, rows[tex->h + y]);
594 613
595 glBindTexture(GL_TEXTURE_2D, tex->texture3); 614 glBindTexture(GL_TEXTURE_2D, tex->texture3);
596 if (smooth) 615 if (smooth)
@@ -603,10 +622,15 @@ evas_gl_common_ycbcr601pl_texture_update(Evas_GL_Texture *tex, unsigned char **r
603 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 622 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
604 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 623 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
605 } 624 }
606 for (y = 0; y < (tex->h / 2); y++) 625 if (tex->h >= 4)
607 glTexSubImage2D(GL_TEXTURE_2D, 0, 626 glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[tex->h + (tex->h / 2) + 1] - rows[tex->h + (tex->h / 2)]);
608 0, y, tex->w / 2, 1, 627 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w / 2, tex->h / 2,
609 texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]); 628 texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2)]);
629// for (y = 0; y < (tex->h / 2); y++)
630// glTexSubImage2D(GL_TEXTURE_2D, 0,
631// 0, y, tex->w / 2, 1,
632// texfmt, GL_UNSIGNED_BYTE, rows[tex->h + (tex->h / 2) + y]);
633 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
610 634
611 if (tex->gc->texture) tex->gc->texture->references--; 635 if (tex->gc->texture) tex->gc->texture->references--;
612 tex->gc->texture = tex; 636 tex->gc->texture = tex;