aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-22 14:28:01 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-22 14:28:01 +0000
commitc4c9870953037be94da00ac9db887d171f6e479c (patch)
tree3b23c2fd0a4de6ebb38d48b9371a76b9a50296d8 /include/core
parent73c0abc2affdd5703f66c777e1cb3199179f3a09 (diff)
Adding optimization to avoid image copy in SkSurface copy on write when content is discardable
This patch also adds code to SkDeferredCanvas to trigger the optimization. TEST=DeferredSurfaceCopy bench, Surface unit test R=reed@google.com Author: junov@chromium.org Review URL: https://chromiumcodereview.appspot.com/14063015 git-svn-id: http://skia.googlecode.com/svn/trunk@8797 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkSurface.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index d4d5c5237e..cf139b1bc9 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -79,10 +79,26 @@ public:
uint32_t generationID();
/**
- * Call this if the contents have changed. This will (lazily) force a new
+ * Modes that can be passed to notifyContentWillChange
+ */
+ enum ContentChangeMode {
+ /**
+ * Use this mode if it is known that the upcoming content changes will
+ * clear or overwrite prior contents, thus making them discardable.
+ */
+ kDiscard_ContentChangeMode,
+ /**
+ * Use this mode if prior surface contents need to be preserved or
+ * if in doubt.
+ */
+ kRetain_ContentChangeMode,
+ };
+
+ /**
+ * Call this if the contents are about to change. This will (lazily) force a new
* value to be returned from generationID() when it is called next.
*/
- void notifyContentChanged();
+ void notifyContentWillChange(ContentChangeMode mode);
/**
* Return a canvas that will draw into this surface. This will always