diff options
author | 2015-03-13 20:05:18 -0700 | |
---|---|---|
committer | 2015-03-13 20:05:18 -0700 | |
commit | 173e5fe5f4be28272246e5676f5d2e5c4b1f9167 (patch) | |
tree | 2e5c8df882fdb80a1b5fc7816c9a27de371f034e /include/core/SkDevice.h | |
parent | 307d1ed129ff75eb64137dea75df858f9e250b69 (diff) |
Revert of Revert of Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1005173004/)
Reason for revert:
arrrg. this is a staging nightmare. override required on the chrome side. must revert (again)
Original issue's description:
> Revert of Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1001423002/)
>
> Reason for revert:
> chrome now has the new virtual, so trying again
>
> Original issue's description:
> > 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
> >
> > Committed: https://skia.googlesource.com/skia/+/8e14d660b2a434bc708a70180c84210883611683
>
> TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com,reed@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/307d1ed129ff75eb64137dea75df858f9e250b69
TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1005183003
Diffstat (limited to 'include/core/SkDevice.h')
-rw-r--r-- | include/core/SkDevice.h | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 684a08404c..c7c5c30b3a 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -125,9 +125,10 @@ public: }; protected: - enum TileUsage { - kPossible_TileUsage, //!< the created device may be drawn tiled - kNever_TileUsage, //!< the created device will never be drawn tiled + enum Usage { + kGeneral_Usage, + kSaveLayer_Usage, // <! internal use only + kImageFilter_Usage // <! internal use only }; struct TextFlags { @@ -230,7 +231,7 @@ protected: virtual void drawPatch(const SkDraw&, const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint); /** The SkDevice passed will be an SkDevice which was returned by a call to - onCreateDevice on this device with kNeverTile_TileExpectation. + onCreateCompatibleDevice on this device with kSaveLayer_Usage. */ virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) = 0; @@ -254,6 +255,14 @@ protected: virtual void unlockPixels() {} /** + * Returns true if the device allows processing of this imagefilter. If + * false is returned, then the filter is ignored. This may happen for + * some subclasses that do not support pixel manipulations after drawing + * has occurred (e.g. printing). The default implementation returns true. + */ + virtual bool allowImageFilter(const SkImageFilter*) { return true; } + + /** * Override and return true for filters that the device can handle * intrinsically. Doing so means that SkCanvas will pass-through this * filter to drawSprite and drawDevice (and potentially filterImage). @@ -327,39 +336,24 @@ protected: const SkPaint*); struct CreateInfo { - static SkPixelGeometry AdjustGeometry(const SkImageInfo&, TileUsage, SkPixelGeometry); + static SkPixelGeometry AdjustGeometry(const SkImageInfo&, Usage, SkPixelGeometry geo); - // The constructor may change the pixel geometry based on other parameters. - CreateInfo(const SkImageInfo& info, TileUsage tileUsage, SkPixelGeometry geo) + // The construct may change the pixel geometry based on usage as needed. + CreateInfo(const SkImageInfo& info, Usage usage, SkPixelGeometry geo) : fInfo(info) - , fTileUsage(tileUsage) - , fPixelGeometry(AdjustGeometry(info, tileUsage, geo)) + , fUsage(usage) + , fPixelGeometry(AdjustGeometry(info, usage, geo)) {} - const SkImageInfo fInfo; - const TileUsage fTileUsage; - const SkPixelGeometry fPixelGeometry; + const SkImageInfo fInfo; + const Usage fUsage; + const SkPixelGeometry fPixelGeometry; }; -#ifdef SK_SUPPORT_LEGACY_ONCREATECOMPATIBLEDEVICE - // legacy method name -- please override onCreateDevice instead virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) { return NULL; } - virtual SkBaseDevice* onCreateDevice(const CreateInfo& cinfo, const SkPaint* layerPaint) { - return this->onCreateCompatibleDevice(cinfo); - } -#else - /** - * Create a new device based on CreateInfo. If the paint is not null, then it represents a - * preview of how the new device will be composed with its creator device (this). - */ - virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) { - return NULL; - } -#endif - virtual void initForRootLayer(SkPixelGeometry geo); private: |