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

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: move to ToT 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
« no previous file with comments | « 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..8f65b3eb557d4d57328b97c8bc4c417fb211d78d 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() {
+ if (NULL != fPicture) {
+ fPicture->beginRecording(this->width(), this->height());
+ }
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698