aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-01-25 10:33:58 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-25 10:33:58 -0800
commit96a857ef5a40b3d0751ec9ebaaa96d9f20b82b21 (patch)
tree06ce8d7d5fd00f4e4d0d5d36f1804dd3e6e2ab7e /include
parentdadbb357c87922c0631e66fc9b24313273af11c5 (diff)
initial preroll api
Diffstat (limited to 'include')
-rw-r--r--include/core/SkCanvas.h2
-rw-r--r--include/core/SkImage.h2
-rw-r--r--include/core/SkPicture.h16
-rw-r--r--include/core/SkShader.h3
4 files changed, 22 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 4e7ed3066e..3eecaf760a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -87,7 +87,7 @@ public:
* by any device/pixels. Typically this use used by subclasses who handle
* the draw calls in some other way.
*/
- SkCanvas(int width, int height);
+ SkCanvas(int width, int height, const SkSurfaceProps* = NULL);
/** Construct a canvas with the specified device to draw into.
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index b0587b2c3a..f59042cada 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -131,6 +131,8 @@ public:
*/
SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL) const;
+ void preroll() const;
+
const char* toString(SkString*) const;
/**
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 5b2f7a99f7..5a48476db0 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -171,6 +171,22 @@ public:
*/
bool willPlayBackBitmaps() const;
+ /**
+ * This is a general hint that the picture will (soon) be drawn into a SkCanvas with
+ * corresponding attributes (e.g. clip, matrix, props). No drawing occurs, but some
+ * expensive operations may be run (e.g. image decoding).
+ *
+ * Any of the parameters may be NULL.
+ *
+ * @param srcBounds If not NULL, this is the subset of the picture (in the same coordinates
+ * as the picture's bounds) that preroll() should focus on.
+ * @param initialMatrix If not NULL, this is the initialMatrix that is expected when the
+ * picture is actually drawn.
+ * @param props If not NULL, these are the expected props when the picture is actually drawn.
+ */
+ void preroll(const SkRect* srcBounds, const SkMatrix* initialMatrix, const SkSurfaceProps*,
+ void* gpuCacheAccessor) const;
+
/** Return true if the SkStream/Buffer represents a serialized picture, and
fills out SkPictInfo. After this function returns, the data source is not
rewound so it will have to be manually reset before passing to
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index f8de276c7b..1ae531e2e5 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -478,6 +478,8 @@ public:
*/
virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const;
+ void preroll() const { this->onPreroll(); }
+
SK_TO_STRING_VIRT()
SK_DEFINE_FLATTENABLE_TYPE(SkShader)
@@ -492,6 +494,7 @@ protected:
*/
virtual Context* onCreateContext(const ContextRec&, void* storage) const;
+ virtual void onPreroll() const {}
virtual bool onAsLuminanceColor(SkColor*) const {
return false;
}