From 667de22fd3c747c21bf967cd4ad6bb727fe95ec7 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Fri, 3 Jan 2014 01:43:21 +0000 Subject: [PATCH] clip by adjusting pointer BUG=302 TEST=ARGBScaleDownClipBy2_None R=tpsiaki@google.com Review URL: https://webrtc-codereview.appspot.com/6529004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@945 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- source/scale_argb.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/scale_argb.cc b/source/scale_argb.cc index 6d688570e..6b32768fd 100644 --- a/source/scale_argb.cc +++ b/source/scale_argb.cc @@ -676,11 +676,15 @@ static void ScaleARGB(const uint8* src, int src_stride, ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y, &dx, &dy); if (clip_x) { - x += clip_x * dx; + int64 clipf = static_cast(clip_x) * dx; + x += (clipf & 0xffff); + src += (clipf >> 16) * 4; dst += clip_x * 4; } if (clip_y) { - y += clip_y * dy; + int64 clipf = static_cast(clip_y) * dy; + y += (clipf & 0xffff); + src += (clipf >> 16) * src_stride; dst += clip_y * dst_stride; }