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
diff --git a/src/image/SkSurface_Picture.cpp b/src/image/SkSurface_Picture.cpp
index affa05c..79812c4 100644
--- a/src/image/SkSurface_Picture.cpp
+++ b/src/image/SkSurface_Picture.cpp
@@ -24,7 +24,7 @@
virtual SkImage* onNewImageSnapshot() SK_OVERRIDE;
virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
const SkPaint*) SK_OVERRIDE;
- virtual void onCopyOnWrite() SK_OVERRIDE;
+ virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE;
private:
SkPicture* fPicture;
@@ -75,7 +75,7 @@
SkImagePrivDrawPicture(canvas, fPicture, x, y, paint);
}
-void SkSurface_Picture::onCopyOnWrite() {
+void SkSurface_Picture::onCopyOnWrite(ContentChangeMode /*mode*/) {
// We always spawn a copy of the recording picture when we
// are asked for a snapshot, so we never need to do anything here.
}