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

Unified Diff: src/image/SkSurface_Picture.cpp

Issue 211683002: Add discard API to SkCanvas, plumb it to glDiscardFramebuffer() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: assert that clear color is pm Created 6 years, 9 months 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
« src/core/SkCanvas.cpp ('K') | « src/image/SkSurface_Gpu.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Picture.cpp
diff --git a/src/image/SkSurface_Picture.cpp b/src/image/SkSurface_Picture.cpp
index 8cfe6e87d564561eed959319cfbe6b58c5482ce5..18e2da6e3d1258fdeb612115188e6a7d56962b24 100644
--- a/src/image/SkSurface_Picture.cpp
+++ b/src/image/SkSurface_Picture.cpp
@@ -25,6 +25,7 @@ public:
virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
const SkPaint*) SK_OVERRIDE;
virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE;
+ virtual void onDiscard() SK_OVERRIDE;
private:
SkPicture* fPicture;
@@ -75,9 +76,18 @@ void SkSurface_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
SkImagePrivDrawPicture(canvas, fPicture, x, y, paint);
}
-void SkSurface_Picture::onCopyOnWrite(ContentChangeMode /*mode*/) {
+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.
+ if (kDiscard_ContentChangeMode == mode) {
+ this->SkSurface_Picture::onDiscard();
+ }
+}
+
+void SkSurface_Picture::onDiscard() {
robertphillips 2014/03/27 12:19:44 NULL != ?
bsalomon 2014/03/27 13:13:17 Done.
+ if (fPicture) {
+ fPicture->beginRecording(this->width(), this->height());
+ }
}
///////////////////////////////////////////////////////////////////////////////
« src/core/SkCanvas.cpp ('K') | « src/image/SkSurface_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698