Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: include/core/SkDevice.h

Issue 1008863002: Revert of Change device creation to see the (optional) layer-paint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/device/xps/SkXPSDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDevice.h
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 684a08404c02f036184fc38b7c7d866ece8cea42..c7c5c30b3a03fd19909db1d5ca2d861c9ffc278e 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -125,9 +125,10 @@
};
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 @@
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;
@@ -252,6 +253,14 @@
*/
virtual void lockPixels() {}
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
@@ -327,38 +336,23 @@
const SkPaint*);
struct CreateInfo {
- static SkPixelGeometry AdjustGeometry(const SkImageInfo&, TileUsage, SkPixelGeometry);
-
- // The constructor may change the pixel geometry based on other parameters.
- CreateInfo(const SkImageInfo& info, TileUsage tileUsage, SkPixelGeometry geo)
+ static SkPixelGeometry AdjustGeometry(const SkImageInfo&, Usage, 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;
- };
-
-#ifdef SK_SUPPORT_LEGACY_ONCREATECOMPATIBLEDEVICE
- // legacy method name -- please override onCreateDevice instead
+ const SkImageInfo fInfo;
+ const Usage fUsage;
+ const SkPixelGeometry fPixelGeometry;
+ };
+
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);
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/device/xps/SkXPSDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698