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: |