diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkBitmapDevice.h | 8 | ||||
-rw-r--r-- | include/core/SkCanvas.h | 3 | ||||
-rw-r--r-- | include/core/SkDevice.h | 48 |
3 files changed, 30 insertions, 29 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index 8ca6a523be..caff6857da 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -98,11 +98,7 @@ protected: const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], int indexCount, const SkPaint& paint) SK_OVERRIDE; - /** The SkBaseDevice passed will be an SkBaseDevice which was returned by a call to - onCreateCompatibleDevice on this device with kSaveLayer_Usage. - */ - virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, - const SkPaint&) SK_OVERRIDE; + virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) SK_OVERRIDE; /////////////////////////////////////////////////////////////////////////// @@ -145,7 +141,7 @@ private: // any clip information. void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE; - SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; + SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) SK_OVERRIDE; SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE; const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 74bf909c21..836f7b1115 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -1321,8 +1321,7 @@ private: void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, const SkPaint* paint); void internalDrawPaint(const SkPaint& paint); - void internalSaveLayer(const SkRect* bounds, const SkPaint* paint, - SaveFlags, bool justForImageFilter, SaveLayerStrategy strategy); + void internalSaveLayer(const SkRect* bounds, const SkPaint*, SaveFlags, SaveLayerStrategy); void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*); // shared by save() and saveLayer() diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index c7c5c30b3a..684a08404c 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,24 +327,39 @@ 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; } + 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: |