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

Unified Diff: include/core/SkDrawable.h

Issue 903993002: rename SkCanvasDrawable to SkDrawable, and make public (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox for drawDrawable Created 5 years, 10 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/core/SkPictureRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDrawable.h
diff --git a/src/core/SkCanvasDrawable.h b/include/core/SkDrawable.h
similarity index 82%
rename from src/core/SkCanvasDrawable.h
rename to include/core/SkDrawable.h
index bc5b4fd351e6513d08bf341c6e464e67d967991b..15bb0bbe0fa2aa93e167bf1294d04d6370fb0356 100644
--- a/src/core/SkCanvasDrawable.h
+++ b/include/core/SkDrawable.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef SkCanvasDrawable_DEFINED
-#define SkCanvasDrawable_DEFINED
+#ifndef SkDrawable_DEFINED
+#define SkDrawable_DEFINED
#include "SkRefCnt.h"
@@ -21,9 +21,9 @@ struct SkRect;
* allow for clients of the drawable that may want to cache the results, the drawable must
* change its generation ID whenever its internal state changes such that it will draw differently.
*/
-class SkCanvasDrawable : public SkRefCnt {
+class SkDrawable : public SkRefCnt {
public:
- SkCanvasDrawable();
+ SkDrawable();
/**
* Draws into the specified content. The drawing sequence will be balanced upon return
@@ -60,6 +60,13 @@ public:
protected:
virtual SkRect onGetBounds() = 0;
virtual void onDraw(SkCanvas*) = 0;
+
+ /**
+ * Default implementation calls onDraw() with a canvas that records into a picture. Subclasses
+ * may override if they have a more efficient way to return a picture for the current state
+ * of their drawable. Note: this picture must draw the same as what would be drawn from
+ * onDraw().
+ */
virtual SkPicture* onNewPictureSnapshot();
private:
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/core/SkPictureRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698