This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9esr-11.0-1 in repository tor-browser.
commit b43a81f502f8890fa71787d1bfd083ead65d77a5 Author: Lee Salzman lsalzman@mozilla.com AuthorDate: Wed Apr 6 16:11:18 2022 +0000
Bug 1706441 - Check for non-empty span. r=gfx-reviewers,aosmond,a=dsmith
Differential Revision: https://phabricator.services.mozilla.com/D142429 --- gfx/wr/swgl/src/swgl_ext.h | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/gfx/wr/swgl/src/swgl_ext.h b/gfx/wr/swgl/src/swgl_ext.h index d3dee3cb88bea..b5cf845ed0a68 100644 --- a/gfx/wr/swgl/src/swgl_ext.h +++ b/gfx/wr/swgl/src/swgl_ext.h @@ -413,26 +413,36 @@ static P* blendTextureLinearDispatch(S sampler, vec2 uv, int span, swgl_LinearQuantizeScale)) - uv.x.x; if (uv_step.x > 0.0f && insideDist >= uv_step.x) { - int inside = int(end - buf); + int32_t inside = int(end - buf); if (filter == LINEAR_FILTER_DOWNSCALE) { - inside = clamp(int(insideDist * (0.5f / swgl_LinearQuantizeScale)) & - ~(swgl_StepSize - 1), - 0, inside); - blendTextureLinearDownscale<BLEND>(sampler, uv, inside, min_uv, max_uv, - color, buf); + inside = min(int(insideDist * (0.5f / swgl_LinearQuantizeScale)) & + ~(swgl_StepSize - 1), + inside); + if (inside > 0) { + blendTextureLinearDownscale<BLEND>(sampler, uv, inside, min_uv, + max_uv, color, buf); + buf += inside; + uv.x += (inside / swgl_StepSize) * uv_step.x; + } } else if (filter == LINEAR_FILTER_UPSCALE) { - inside = clamp(int(insideDist / uv_step.x) * swgl_StepSize, 0, inside); - blendTextureLinearUpscale<BLEND>(sampler, uv, inside, uv_step, min_uv, - max_uv, color, buf); + inside = min(int(insideDist / uv_step.x) * swgl_StepSize, inside); + if (inside > 0) { + blendTextureLinearUpscale<BLEND>(sampler, uv, inside, uv_step, min_uv, + max_uv, color, buf); + buf += inside; + uv.x += (inside / swgl_StepSize) * uv_step.x; + } } else { - inside = clamp(int(insideDist * (1.0f / swgl_LinearQuantizeScale)) & - ~(swgl_StepSize - 1), - 0, inside); - blendTextureLinearFast<BLEND>(sampler, uv, inside, min_uv, max_uv, - color, buf); + inside = min(int(insideDist * (1.0f / swgl_LinearQuantizeScale)) & + ~(swgl_StepSize - 1), + inside); + if (inside > 0) { + blendTextureLinearFast<BLEND>(sampler, uv, inside, min_uv, max_uv, + color, buf); + buf += inside; + uv.x += (inside / swgl_StepSize) * uv_step.x; + } } - buf += inside; - uv.x += (inside / swgl_StepSize) * uv_step.x; } } // If the fallback filter was requested, or if there are any samples left that