Revert[6] of Change device creation to see the (optional) layer-paint
This reverts commit 173e5fe5f4be28272246e5676f5d2e5c4b1f9167.
BUG=skia:
TBR=
Review URL: https://codereview.chromium.org/1010503002
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 99f3ce1..273b958 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -566,13 +566,19 @@
}
}
-SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) {
+static bool not_supported_for_layers(const SkPaint& layerPaint) {
// PDF does not support image filters, so render them on CPU.
// Note that this rendering is done at "screen" resolution (100dpi), not
// printer resolution.
// FIXME: It may be possible to express some filters natively using PDF
// to improve quality and file size (http://skbug.com/3043)
- if (kImageFilter_Usage == cinfo.fUsage) {
+
+ // TODO: should we return true if there is a colorfilter?
+ return layerPaint.getImageFilter() != NULL;
+}
+
+SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint* layerPaint) {
+ if (layerPaint && not_supported_for_layers(*layerPaint)) {
return SkBitmapDevice::Create(cinfo.fInfo);
}
SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());