Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/gl_common
Modified Files:
evas_gl_context.c evas_gl_font.c evas_gl_texture.c
Log Message:
improve optimal nature of code.. get some more speed....
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_context.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_gl_context.c 10 Sep 2003 08:52:18 -0000 1.3
+++ evas_gl_context.c 10 Sep 2003 14:33:39 -0000 1.4
@@ -183,6 +183,7 @@
gc->font_texture_not_power_of_two = ft->pool->not_power_of_two;
gc->change.texture = 1;
}
+ if (!gc->change.texture) return;
if (_evas_gl_common_context == gc) _evas_gl_common_texture_set(gc);
}
@@ -282,7 +283,7 @@
{
if (gc->font_texture_not_power_of_two)
{
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, gc->font_texture);
}
@@ -298,14 +299,14 @@
{
if (gc->texture->not_power_of_two)
{
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, gc->texture->texture);
}
else
{
if (gc->ext.nv_texture_rectangle) glDisable(GL_TEXTURE_RECTANGLE_NV);
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, gc->texture->texture);
}
if (gc->texture->not_power_of_two)
@@ -319,18 +320,34 @@
{
if (gc->texture->changed)
{
- if (gc->texture->smooth)
+ if (gc->texture->not_power_of_two)
{
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
- if (gc->texture->have_mipmaps)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
+ if (gc->texture->smooth)
+ {
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV,
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV,
GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ }
else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
+ {
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV,
GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV,
GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ }
}
else
{
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
+ if (gc->texture->smooth)
+ {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
+ if (gc->texture->have_mipmaps)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
+ else
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
+ }
+ else
+ {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
+ }
}
gc->texture->changed = 0;
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_font.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_gl_font.c 10 Sep 2003 08:52:18 -0000 1.3
+++ evas_gl_font.c 10 Sep 2003 14:33:39 -0000 1.4
@@ -91,6 +91,20 @@
gc->font_texture = ft->texture;
gc->font_texture_not_power_of_two = ft->pool->not_power_of_two;
gc->change.texture = 1;
+ if (ft->pool->not_power_of_two)
+ {
+ ft->tx1 = ft->x;
+ ft->ty1 = ft->y;
+ ft->tx2 = ft->x + ft->w;
+ ft->ty2 = ft->y + ft->h;
+ }
+ else
+ {
+ ft->tx1 = (double)(ft->x ) / (double)(ft->pool->w);
+ ft->ty1 = (double)(ft->y ) / (double)(ft->pool->h);
+ ft->tx2 = (double)(ft->x + ft->w) / (double)(ft->pool->w);
+ ft->ty2 = (double)(ft->y + ft->h) / (double)(ft->pool->h);
+ }
return ft;
}
@@ -110,51 +124,41 @@
void
evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc,
RGBA_Font_Glyph *fg, int x, int y)
{
- int r, g, b, a;
Evas_GL_Font_Texture *ft;
-
+
+ /* 35 */
ft = fg->ext_dat;
if (!ft) return;
- a = (dc->col.col >> 24) & 0xff;
- r = (dc->col.col >> 16) & 0xff;
- g = (dc->col.col >> 8 ) & 0xff;
- b = (dc->col.col ) & 0xff;
- evas_gl_common_context_color_set(gc, r, g, b, a);
- if (dc->clip.use)
- evas_gl_common_context_clip_set(gc, 1,
- dc->clip.x, dc->clip.y,
- dc->clip.w, dc->clip.h);
- else
- evas_gl_common_context_clip_set(gc, 0,
- 0, 0, 0, 0);
- evas_gl_common_context_font_texture_set(gc, ft);
- evas_gl_common_context_blend_set(gc, 1);
- evas_gl_common_context_read_buf_set(gc, GL_BACK);
- evas_gl_common_context_write_buf_set(gc, GL_BACK);
+ if (surface == 0)
{
- double tx1, ty1, tx2, ty2;
+ int r, g, b, a;
- if (ft->pool->not_power_of_two)
- {
- tx1 = ft->x;
- ty1 = ft->y;
- tx2 = ft->x + ft->w;
- ty2 = ft->y + ft->h;
- }
+ a = (dc->col.col >> 24) & 0xff;
+ r = (dc->col.col >> 16) & 0xff;
+ g = (dc->col.col >> 8 ) & 0xff;
+ b = (dc->col.col ) & 0xff;
+ evas_gl_common_context_color_set(gc, r, g, b, a);
+ if (dc->clip.use)
+ evas_gl_common_context_clip_set(gc, 1,
+ dc->clip.x, dc->clip.y,
+ dc->clip.w, dc->clip.h);
else
- {
- tx1 = (double)(ft->x ) / (double)(ft->pool->w);
- ty1 = (double)(ft->y ) / (double)(ft->pool->h);
- tx2 = (double)(ft->x + ft->w) / (double)(ft->pool->w);
- ty2 = (double)(ft->y + ft->h) / (double)(ft->pool->h);
- }
- glBegin(GL_QUADS);
- glTexCoord2d(tx1, ty1); glVertex2i(x , y );
- glTexCoord2d(tx2, ty1); glVertex2i(x + ft->w, y );
- glTexCoord2d(tx2, ty2); glVertex2i(x + ft->w, y + ft->h);
- glTexCoord2d(tx1, ty2); glVertex2i(x , y + ft->h);
- glEnd();
+ evas_gl_common_context_clip_set(gc, 0,
+ 0, 0, 0, 0);
+ evas_gl_common_context_blend_set(gc, 1);
+ evas_gl_common_context_read_buf_set(gc, GL_BACK);
+ evas_gl_common_context_write_buf_set(gc, GL_BACK);
}
+ /* 32 */
+ evas_gl_common_context_font_texture_set(gc, ft);
+ /* 32 */
+ glBegin(GL_QUADS);
+ glTexCoord2d(ft->tx1, ft->ty1); glVertex2i(x , y );
+ glTexCoord2d(ft->tx2, ft->ty1); glVertex2i(x + ft->w, y );
+ glTexCoord2d(ft->tx2, ft->ty2); glVertex2i(x + ft->w, y + ft->h);
+ glTexCoord2d(ft->tx1, ft->ty2); glVertex2i(x , y + ft->h);
+ glEnd();
+ /* 28 */
}
static Evas_GL_Font_Texture_Pool_Allocation *
@@ -220,7 +224,7 @@
/* we dont want this mipmapped if sgis_generate_mipmap will mipmap it */
if (gc->ext.sgis_generate_mipmap)
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
if (fp->not_power_of_two)
{
glEnable(GL_TEXTURE_RECTANGLE_NV);
@@ -228,17 +232,18 @@
/* FIXME check gl error */
glBindTexture(GL_TEXTURE_RECTANGLE_NV, fp->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
- GL_ALPHA8, fp->w, fp->h, 0,
+ GL_ALPHA4, fp->w, fp->h, 0,
GL_ALPHA, GL_UNSIGNED_BYTE, NULL);
/* FIXME check gl error */
}
else
{
+ glEnable(GL_TEXTURE_2D);
glGenTextures(1, &(fp->texture));
/* FIXME check gl error */
@@ -248,7 +253,7 @@
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,
- GL_ALPHA8, fp->w, fp->h, 0,
+ GL_ALPHA4, fp->w, fp->h, 0,
GL_ALPHA, GL_UNSIGNED_BYTE, NULL);
/* FIXME check gl error */
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_texture.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_gl_texture.c 10 Sep 2003 08:52:18 -0000 1.3
+++ evas_gl_texture.c 10 Sep 2003 14:33:39 -0000 1.4
@@ -22,13 +22,23 @@
tex->tw = im->image->w;
tex->th = im->image->h;
tex->references = 0;
- tex->smooth = 0;
+ tex->smooth = smooth;
tex->changed = 1;
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glGenTextures(1, &(tex->texture));
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex->texture);
+ if (smooth)
+ {
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
+ }
+ else
+ {
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
+ }
if (gc->texture) gc->texture->references--;
gc->texture = tex;
@@ -140,7 +150,7 @@
{
void *tmp = NULL, *data;
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex->texture);
@@ -188,7 +198,7 @@
tex->changed = 1;
tex->have_mipmaps = 0;
if (tex->gc->ext.nv_texture_rectangle) glDisable(GL_TEXTURE_RECTANGLE_NV);
- glEnable(GL_TEXTURE_2D);
+// glEnable(GL_TEXTURE_2D);
if (tex->not_power_of_two)
{
glEnable(GL_TEXTURE_RECTANGLE_NV);
@@ -197,6 +207,7 @@
else
{
glDisable(GL_TEXTURE_RECTANGLE_NV);
+ glEnable(GL_TEXTURE_2D);//
target = GL_TEXTURE_2D;
}
@@ -221,6 +232,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ tex->smooth = 0;
im_data = im->image->data;
im_w = im->image->w;
@@ -311,7 +323,6 @@
else texfmt = GL_RGB8;
pixfmt = NATIVE_PIX_FORMAT;
- printf("building mipmaps... [%i x %i]\n", tw, th);
if (tex->gc->ext.nv_texture_rectangle) glDisable(GL_TEXTURE_RECTANGLE_NV);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex->texture);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs