aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/evas/engines/gl_common/evas_gl_font.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-03-31 18:58:51 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-04-01 09:53:55 +0900
commit32009a0e8c7b9b9c563614be8b832db99cd17112 (patch)
tree6b81419743685e05bef3d667bfe669b85db008b3 /src/modules/evas/engines/gl_common/evas_gl_font.c
parentecore_file - fix nasty memory issues in ecore_file_app_exe_get() (diff)
downloadefl-32009a0e8c7b9b9c563614be8b832db99cd17112.tar.gz
Evas masking: Refactor GL code
Use the same method as for map masking: - Pass absolute geometry of the mask to the push functions, - Compute absolute position in the shader (like gl_Position) and apply scaling factor + offset to sample the mask. Masking now uses a single vec4 attribute instead of hi-jacking other vertices. This way, all masking shaders share the same code and are way simpler. On the other hand, the vertex shaders have a little bit more work to do.
Diffstat (limited to 'src/modules/evas/engines/gl_common/evas_gl_font.c')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_font.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_font.c b/src/modules/evas/engines/gl_common/evas_gl_font.c
index ca6eae9a13..95ac669f50 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_font.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_font.c
@@ -82,30 +82,15 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
b = (dc->col.col ) & 0xff;
sx = 0; sy = 0; sw = tex->w, sh = tex->h;
- if (gc->dc->clip.mask && (sw > 0) && (sh > 0))
+ if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
{
- double nx, ny, nw, nh, dx, dy, dw, dh;
- const double mask_x = gc->dc->clip.mask_x;
- const double mask_y = gc->dc->clip.mask_y;
- const double tmw = mtex->pt->w;
- const double tmh = mtex->pt->h;
- double scalex = 1.0;
- double scaley = 1.0;
-
// canvas coords
- nx = x; ny = y; nw = tex->w; nh = tex->h;
- RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
- gc->dc->clip.x, gc->dc->clip.y,
- gc->dc->clip.w, gc->dc->clip.h);
- if ((nw < 1) || (nh < 1)) return;
- dx = x; dy = y; dw = sw; dh = sh;
- mx = mask_x; my = mask_y;
- if (mask->scaled.origin && mask->scaled.w && mask->scaled.h)
+ mx = dc->clip.mask_x;
+ my = dc->clip.mask_y;
+ if (mask->scaled.origin)
{
mw = mask->scaled.w;
mh = mask->scaled.h;
- scalex = mask->w / (double)mask->scaled.w;
- scaley = mask->h / (double)mask->scaled.h;
mask_smooth = mask->scaled.smooth;
}
else
@@ -113,15 +98,8 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
mw = mask->w;
mh = mask->h;
}
- //RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
- RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
-
- // convert to tex coords
- mx = (mtex->x / tmw) + ((mx - mask_x + (mw * (nx - dx)) / dw) * scalex / tmw);
- my = (mtex->y / tmh) + ((my - mask_y + (mh * (ny - dy)) / dy) * scaley / tmh);
- mw = (mw * nw * scalex / dw) / tmw;
- mh = (mh * nh * scaley / dh) / tmh;
}
+ else mtex = NULL;
if ((!gc->dc->cutout.rects) ||
((gc->shared->info.tune.cutout.max > 0) &&