From 00b7e5eb973a1b1e4d1affa74fc0341e8c41e3da Mon Sep 17 00:00:00 2001 From: halcanary Date: Wed, 15 Apr 2015 13:05:18 -0700 Subject: [PATCH] SkPDF/Device/ImageFilter: Fix ImageFilter fallback code Broken in https://chromium.googlesource.com/skia/+/76033be I have confirmed that this fixes 470083. BUG=470083 Review URL: https://codereview.chromium.org/1080923004 --- include/core/SkDevice.h | 8 ++++++-- src/core/SkDeviceImageFilterProxy.h | 3 ++- src/pdf/SkPDFDevice.cpp | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 99c29ee2e3..ec57711754 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -330,15 +330,19 @@ protected: static SkPixelGeometry AdjustGeometry(const SkImageInfo&, TileUsage, SkPixelGeometry); // The constructor may change the pixel geometry based on other parameters. - CreateInfo(const SkImageInfo& info, TileUsage tileUsage, SkPixelGeometry geo) + CreateInfo(const SkImageInfo& info, + TileUsage tileUsage, + SkPixelGeometry geo, + bool forImageFilter = false) : fInfo(info) , fTileUsage(tileUsage) , fPixelGeometry(AdjustGeometry(info, tileUsage, geo)) - {} + , fForImageFilter(forImageFilter) {} const SkImageInfo fInfo; const TileUsage fTileUsage; const SkPixelGeometry fPixelGeometry; + const bool fForImageFilter; }; /** diff --git a/src/core/SkDeviceImageFilterProxy.h b/src/core/SkDeviceImageFilterProxy.h index 06df759bc3..dcf12f7c40 100644 --- a/src/core/SkDeviceImageFilterProxy.h +++ b/src/core/SkDeviceImageFilterProxy.h @@ -22,7 +22,8 @@ public: SkBaseDevice* createDevice(int w, int h) override { SkBaseDevice::CreateInfo cinfo(SkImageInfo::MakeN32Premul(w, h), SkBaseDevice::kNever_TileUsage, - kUnknown_SkPixelGeometry); + kUnknown_SkPixelGeometry, + true /*forImageFilter*/); return fDevice->onCreateDevice(cinfo, NULL); } bool canHandleImageFilter(const SkImageFilter* filter) override { diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 5167474f10..1b16397512 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -577,7 +577,8 @@ static bool not_supported_for_layers(const SkPaint& layerPaint) { } SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint* layerPaint) { - if (layerPaint && not_supported_for_layers(*layerPaint)) { + if (cinfo.fForImageFilter || + (layerPaint && not_supported_for_layers(*layerPaint))) { return SkBitmapDevice::Create(cinfo.fInfo); } SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());