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
This commit is contained in:
halcanary 2015-04-15 13:05:18 -07:00 committed by Commit bot
parent 221360a514
commit 00b7e5eb97
3 changed files with 10 additions and 4 deletions

View File

@ -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;
};
/**

View File

@ -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 {

View File

@ -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());