From d5424a425bc21280afe2161f6ac1e5d9eb97e6b2 Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Wed, 2 Apr 2014 19:20:05 +0000 Subject: Fix matrix adjustment passed to filter processing. When adjusting the CTM for filter use, we were subtracting off the destination coordinates of the drawDevice() or drawSprite(). This is not quite correct: we should subtract off the coordinates relative to the device origin instead. This occurs when one filtered saveLayer() is drawn inside another saveLayer(), both with non-zero origin. This fixes layout test svg/batik/text/smallFonts.svg in Blink, and is exercised by the provided unit test. BUG=skia: R=bsalomon@google.com Review URL: https://codereview.chromium.org/222723002 git-svn-id: http://skia.googlecode.com/svn/trunk@14029 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkCanvas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/SkCanvas.cpp') diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 1ca9312ce1..c16ac9a09f 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1256,7 +1256,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, SkIPoint offset = SkIPoint::Make(0, 0); const SkBitmap& src = srcDev->accessBitmap(false); SkMatrix matrix = *iter.fMatrix; - matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); + matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y())); SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height()); SkImageFilter::Context ctx(matrix, clipBounds); if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { @@ -1296,7 +1296,7 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, SkBitmap dst; SkIPoint offset = SkIPoint::Make(0, 0); SkMatrix matrix = *iter.fMatrix; - matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); + matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y())); SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()); SkImageFilter::Context ctx(matrix, clipBounds); if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { -- cgit v1.2.3