Make SkPictureImageFilter::drawPictureAtLocalResolution use color xform
authorChristopher Cameron <ccameron@chromium.org>
Tue, 23 May 2017 06:12:01 +0000 (23:12 -0700)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 23 May 2017 20:20:54 +0000 (20:20 +0000)
This creates a temporary SkCanvas, which needs to be wrapped in a color
xform canvas to behave appropriately.

bug:725372
Change-Id: I572437770f271b7fb813519c0966cd3177b9eeaf
Reviewed-on: https://skia-review.googlesource.com/17658
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Christopher Cameron <ccameron@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>

src/effects/SkPictureImageFilter.cpp

index 12ec3c2..3c59e5e 100644 (file)
@@ -193,7 +193,14 @@ void SkPictureImageFilter::drawPictureAtLocalResolution(SkSpecialImage* source,
 
         SkCanvas* localCanvas = localSurface->getCanvas();
         SkASSERT(localCanvas);
-        
+        std::unique_ptr<SkCanvas> xformCanvas = nullptr;
+        if (fColorSpace) {
+            // Only non-null in the case where onMakeColorSpace() was called.  This instructs
+            // us to do the color space xform on playback.
+            xformCanvas = SkCreateColorSpaceXformCanvas(localCanvas, fColorSpace);
+            localCanvas = xformCanvas.get();
+        }
+
         localCanvas->clear(0x0);
 
         localCanvas->translate(-SkIntToScalar(localIBounds.fLeft),