From f854f1f275f0c855033bbae85851c323aa35de5f Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 24 May 2011 06:51:47 +0000 Subject: [PATCH] fix glpipe optimization that stops the pipes from being used with many maps SVN revision: 59638 --- .../engines/gl_common/evas_gl_context.c | 62 +++++++++++-------- 1 file changed, 37 insertions(+), 25 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 58609b38c5..78c2d02544 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 @@ -2300,7 +2300,8 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, if (a < 255) blend = 1; if (npoints != 4) { - // FIXME: nash - you didnt fix this for n points. its still all 4 point stuff!!! grrrr. + // FIXME: nash - you didnt fix this for n points. its still all + // 4 point stuff!!! grrrr. abort(); } if ((A_VAL(&(p[0].col)) < 0xff) || (A_VAL(&(p[1].col)) < 0xff) || @@ -2392,6 +2393,41 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, } } + x = w = (p[points[0]].x >> FP); + y = h = (p[points[0]].y >> FP); + for (i = 0; i < 4; i++) + { + tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) / + (double)tex->pt->w; + ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) / + (double)tex->pt->h; + px = (p[points[i]].x >> FP); + if (px < x) x = px; + else if (px > w) w = px; + py = (p[points[i]].y >> FP); + if (py < y) y = py; + else if (py > h) h = py; + if (yuv) + { + t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptu->w; + t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptu->h; + } + } + w = w - x; + h = h - y; + + if (clip) + { + int nx = x, ny = y, nw = w, nh = h; + + RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch); + if ((nx == x) && (ny == y) && (nw == w) && (nh == h)) + { + clip = 0; cx = 0; cy = 0; cw = 0; ch = 0; + } + x = nx; y = nw; w = nw; h = nh; + } + if (!flat) { shader_array_flush(gc); @@ -2584,29 +2620,6 @@ again: } #endif - x = w = (p[points[0]].x >> FP); - y = h = (p[points[0]].y >> FP); - for (i = 0; i < 4; i++) - { - tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) / - (double)tex->pt->w; - ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) / - (double)tex->pt->h; - px = (p[points[i]].x >> FP); - if (px < x) x = px; - else if (px > w) w = py; - py = (p[points[i]].y >> FP); - if (py < y) y = py; - else if (py > h) h = py; - if (yuv) - { - t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptu->w; - t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptu->h; - } - } - w = w - x; - h = h - y; - pipe_region_expand(gc, pn, x, y, w, h); pnum = gc->pipe[pn].array.num; @@ -2932,7 +2945,6 @@ shader_array_flush(Evas_Engine_GL_Context *gc) { if (gc->pipe[i].array.use_texm) { - printf("using tex m (%d)\n",gc->pipe[i].shader.cur_texm); glEnableVertexAttribArray(SHAD_TEXM); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texm);