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

Unified Diff: src/core/SkCanvasDrawable.h

Issue 727363003: wip for drawables (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make the pictures in the array also const (the array already was const) Created 6 years, 1 month 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 | « src/core/SkCanvas.cpp ('k') | src/core/SkCanvasDrawable.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvasDrawable.h
diff --git a/src/core/SkCanvasDrawable.h b/src/core/SkCanvasDrawable.h
index 807bbc7ab1e1d8e731960a8563acc0b0e51ec09f..f189f2d2cc05a339d9ab8a30b4c978c3a42c95a1 100644
--- a/src/core/SkCanvasDrawable.h
+++ b/src/core/SkCanvasDrawable.h
@@ -10,6 +10,7 @@
#include "SkRefCnt.h"
+class SkBBHFactory;
class SkCanvas;
struct SkRect;
@@ -31,6 +32,11 @@ public:
*/
void draw(SkCanvas*);
+ SkPicture* newPictureSnapshot(SkBBHFactory* bbhFactory, uint32_t recordFlags);
+ SkPicture* newPictureSnapshot() {
+ return this->newPictureSnapshot(NULL, 0);
+ }
+
/**
* Return a unique value for this instance. If two calls to this return the same value,
* it is presumed that calling the draw() method will render the same thing as well.
@@ -41,11 +47,11 @@ public:
uint32_t getGenerationID();
/**
- * If the drawable knows a bounds that will contains all of its drawing, return true and
- * set the parameter to that rectangle. If one is not known, ignore the parameter and
- * return false.
+ * Return the (conservative) bounds of what the drawable will draw. If the drawable can
+ * change what it draws (e.g. animation or in response to some external change), then this
+ * must return a bounds that is always valid for all possible states.
*/
- bool getBounds(SkRect*);
+ SkRect getBounds();
/**
* Calling this invalidates the previous generation ID, and causes a new one to be computed
@@ -55,9 +61,9 @@ public:
void notifyDrawingChanged();
protected:
+ virtual SkRect onGetBounds() = 0;
virtual void onDraw(SkCanvas*) = 0;
-
- virtual bool onGetBounds(SkRect*) { return false; }
+ virtual SkPicture* onNewPictureSnapshot(SkBBHFactory*, uint32_t recordFlags);
private:
int32_t fGenerationID;
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkCanvasDrawable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698