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
This commit is contained in:
Mike Blumenkrantz 2019-05-13 11:44:18 -04:00
parent fa983e9ff1
commit 20cefc8db2
1 changed files with 5 additions and 5 deletions

View File

@ -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++)