From: Mike Blumenkrantz Date: Mon, 13 May 2019 15:44:18 +0000 (-0400) Subject: evas/scale_sample: fix mask geometry clamping in scale thread X-Git-Tag: submit/tizen/20190530.111225~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=315d025f24443102bd7f24704640ef7f73ff7cf2;p=platform%2Fupstream%2Fefl.git evas/scale_sample: fix mask geometry clamping in scale thread Summary: the 'y' parameter is not relevant here. this clamping exists solely to avoid reading outside the bounds of the mask, and 'y' is the scanline at which to begin the masking subtracting the mask size here does not make sense: we are attempting to clamp to the size of the mask in order to avoid buffer over-read, so this means that we are mapping the maximum y coordinate of the mask (mask_y + mask_h) to be relative to the clipped y coordinate (dst_clip_y) Depends on D8838 Reviewers: cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, #reviewers, #committers Tags: #efl_rendering Differential Revision: https://phab.enlightenment.org/D8839 --- diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c index 139f032..6fc54de 100644 --- a/src/lib/evas/common/evas_scale_sample.c +++ b/src/lib/evas/common/evas_scale_sample.c @@ -146,12 +146,12 @@ _evas_common_scale_rgba_sample_scale_mask(int y, /* clamp/map to mask geometry */ if (EINA_UNLIKELY(dst_clip_x < mask_x)) dst_clip_x = mask_x; - if (EINA_UNLIKELY(dst_clip_y + y < mask_y)) - dst_clip_y = mask_y + y; + if (EINA_UNLIKELY(dst_clip_y < mask_y)) + dst_clip_y = mask_y; if (EINA_UNLIKELY(dst_clip_x + dst_clip_w > mask_x + (int)mask_ie->cache_entry.w)) - dst_clip_w = mask_x - mask_ie->cache_entry.w - dst_clip_x; - if (EINA_UNLIKELY(dst_clip_y + dst_clip_h + y > mask_y + (int)mask_ie->cache_entry.h)) - dst_clip_h = mask_y + y - mask_ie->cache_entry.h - dst_clip_y; + dst_clip_w = mask_x + mask_ie->cache_entry.w - dst_clip_x; + if (EINA_UNLIKELY(dst_clip_y + dst_clip_h > mask_y + (int)mask_ie->cache_entry.h)) + dst_clip_h = mask_y + mask_ie->cache_entry.h - dst_clip_y; dptr = dptr + dst_w * y; for (; y < dst_clip_h; y++)