diff options
author | reed <reed@chromium.org> | 2015-03-14 10:54:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-14 10:54:31 -0700 |
commit | 76033be81b82c44fd5d4fdf2672eb22e505da1f0 (patch) | |
tree | d182a160585144a8419c8752484b92437cbdbc3a /include/core/SkDevice.h | |
parent | de7665a6d5b0f11d87abcbbf495d504f5aa419ce (diff) |
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
Diffstat (limited to 'include/core/SkDevice.h')
-rw-r--r-- | include/core/SkDevice.h | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index d9656802ef..ff25e3d05c 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -125,10 +125,9 @@ public: }; protected: - enum Usage { - kGeneral_Usage, - kSaveLayer_Usage, // <! internal use only - kImageFilter_Usage // <! internal use only + enum TileUsage { + kPossible_TileUsage, //!< the created device may be drawn tiled + kNever_TileUsage, //!< the created device will never be drawn tiled }; struct TextFlags { @@ -231,7 +230,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 - onCreateCompatibleDevice on this device with kSaveLayer_Usage. + onCreateDevice on this device with kNeverTile_TileExpectation. */ virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) = 0; @@ -255,14 +254,6 @@ 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). @@ -336,25 +327,31 @@ protected: const SkPaint*); struct CreateInfo { - static SkPixelGeometry AdjustGeometry(const SkImageInfo&, Usage, SkPixelGeometry geo); + static SkPixelGeometry AdjustGeometry(const SkImageInfo&, TileUsage, SkPixelGeometry); - // The construct may change the pixel geometry based on usage as needed. - CreateInfo(const SkImageInfo& info, Usage usage, SkPixelGeometry geo) + // The constructor may change the pixel geometry based on other parameters. + CreateInfo(const SkImageInfo& info, TileUsage tileUsage, SkPixelGeometry geo) : fInfo(info) - , fUsage(usage) - , fPixelGeometry(AdjustGeometry(info, usage, geo)) + , fTileUsage(tileUsage) + , fPixelGeometry(AdjustGeometry(info, tileUsage, geo)) {} - const SkImageInfo fInfo; - const Usage fUsage; - const SkPixelGeometry fPixelGeometry; + const SkImageInfo fInfo; + const TileUsage fTileUsage; + const SkPixelGeometry fPixelGeometry; }; +#ifdef SK_SUPPORT_LEGACY_ONCREATECOMPATIBLEDEVICE + // legacy method name -- please override onCreateDevice instead virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) { return NULL; } +#endif - // Will replace onCreateCompatibleDevice + /** + * 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; } |