aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-03-13 12:34:32 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-13 12:34:32 -0700
commit8e14d660b2a434bc708a70180c84210883611683 (patch)
tree2e5c8df882fdb80a1b5fc7816c9a27de371f034e /src/pdf
parent5bf99f1ca8f30287803b594d06c60a7b6796ad45 (diff)
Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1006923002/)
Reason for revert: platform_canvas tests failures skia_unittests (with patch) skia_unittests (with patch) PlatformCanvas.TranslateLayer failed 2 Flakiness dashboard failures: PlatformCanvas.TranslateLayer PlatformCanvas.FillLayer Original issue's description: > Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1008863002/) > > Reason for revert: > guard in chrome has landed > > Original issue's description: > > Revert of Change device creation to see the (optional) layer-paint (patchset #9 id:160001 of https://codereview.chromium.org/988413003/) > > > > Reason for revert: > > need to have chrome opt-in for the older API before this can land (in chrome) > > > > Original issue's description: > > > Change device creation to see the (optional) layer-paint > > > > > > Motivation: > > > > > > PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice. > > > > > > This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands. > > > > > > Committed: https://skia.googlesource.com/skia/+/1182d9a96b80bd12183ee7c81325a979a51ee0c0 > > > > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > > > Committed: https://skia.googlesource.com/skia/+/0e040f7da2fdfeb49aa60d24117306e3b1e6ea90 > > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > > Committed: https://skia.googlesource.com/skia/+/f7076a13e2d4269903b34ef2780e1c84723e4477 TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1001423002
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFDevice.cpp10
-rw-r--r--src/pdf/SkPDFDevice.h3
2 files changed, 4 insertions, 9 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 273b958a8c..99f3ce1188 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -566,19 +566,13 @@ void GraphicStackState::updateDrawingState(const GraphicStateEntry& state) {
}
}
-static bool not_supported_for_layers(const SkPaint& layerPaint) {
+SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) {
// 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)
-
- // 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)) {
+ if (kImageFilter_Usage == cinfo.fUsage) {
return SkBitmapDevice::Create(cinfo.fInfo);
}
SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index a90ea115c1..8a88314009 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -235,7 +235,8 @@ private:
ContentEntry* getLastContentEntry();
void setLastContentEntry(ContentEntry* contentEntry);
- SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) SK_OVERRIDE;
+ // override from SkBaseDevice
+ SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE;
void init();
void cleanUp(bool clearFontUsage);