From fa309e5069c84a47fa9510c7b9962bd07b9ee17a Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sat, 23 Apr 2011 02:02:45 +0000 Subject: [PATCH] nash -> i fixed your mask rendering. interesting you only mask *IF* you have 1:1 scaling. you could do this with scaled imaged (and unscaled masks) with ease. both smooth and nearest. SVN revision: 58838 --- legacy/evas/src/lib/canvas/evas_render.c | 4 +-- .../lib/engines/common/evas_scale_sample.c | 34 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/legacy/evas/src/lib/canvas/evas_render.c b/legacy/evas/src/lib/canvas/evas_render.c index 013c189016..6beac80eec 100644 --- a/legacy/evas/src/lib/canvas/evas_render.c +++ b/legacy/evas/src/lib/canvas/evas_render.c @@ -1297,8 +1297,8 @@ evas_render_updates_internal(Evas *e, e->engine.func->context_mask_set(e->engine.data.output, e->engine.data.context, obj->cur.mask->func->engine_data_get(obj->cur.mask), - obj->cur.mask->cur.geometry.x, - obj->cur.mask->cur.geometry.y, + obj->cur.mask->cur.geometry.x + off_x, + obj->cur.mask->cur.geometry.y + off_y, obj->cur.mask->cur.geometry.w, obj->cur.mask->cur.geometry.h); else diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c index 6feb8e646e..54b8e92dc7 100644 --- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c +++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c @@ -92,6 +92,7 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, DATA32 *ptr, *dst_ptr, *src_data, *dst_data; int dst_jump; int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h; + int m_clip_x = 0, m_clip_y = 0, m_clip_w = 0, m_clip_h = 0, mdx = 0, mdy = 0; int src_w, src_h, dst_w, dst_h; RGBA_Gfx_Func func; RGBA_Image *maskobj = NULL; @@ -139,6 +140,21 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, dst_clip_h = dst_h; } + if (dc->mask.mask) + { + m_clip_x = dc->mask.x; + m_clip_y = dc->mask.y; + m_clip_w = dc->mask.mask->cache_entry.w; + m_clip_h = dc->mask.mask->cache_entry.h; + RECTS_CLIP_TO_RECT(m_clip_x, m_clip_y, m_clip_w, m_clip_h, + dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h); + if ((m_clip_w <= 0) || (m_clip_h <= 0)) return; + dst_clip_x = m_clip_x; + dst_clip_y = m_clip_y; + dst_clip_w = m_clip_w; + dst_clip_h = m_clip_h; + } + if (dst_clip_x < dst_region_x) { dst_clip_w += dst_clip_x - dst_region_x; @@ -283,21 +299,15 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, #endif { ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x; + if (mask) + { + mdx = (m_clip_x - dc->mask.x) + (m_clip_x - dst_clip_x); + mdy = (m_clip_y - dc->mask.y) + (m_clip_y - dst_clip_y); + mask += mdx + (mdy * maskobj->cache_entry.w); + } for (y = 0; y < dst_clip_h; y++) { /* * blend here [clip_w *] ptr -> dst_ptr * */ - if (mask) - { - // nash: problem here. normally dst_clip_x == dc->mask.x - // but then... at some point they cease to be equal - // and thus you add a negative value to mask here - // in fact... u simply don't handle the mask being - // disjoint from the object. now maybe the test in - // expedite has a bug where it moves the mask img - // wrongly - but... i can see this code is fragile - mask += dst_clip_x - dc->mask.x; - mask += (dst_clip_y - dc->mask.y) * maskobj->cache_entry.w; - } #ifdef EVAS_SLI if (((y + dst_clip_y) % dc->sli.h) == dc->sli.y) #endif