From 315d025f24443102bd7f24704640ef7f73ff7cf2 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 May 2019 11:44:18 -0400 Subject: [PATCH] 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 --- src/lib/evas/common/evas_scale_sample.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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++) -- 2.7.4