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

Unified Diff: src/image/SkSurface.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/gpu/gl/GrGpuGL.cpp ('k') | src/image/SkSurface_Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface.cpp
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index ecb80427576de2ae2b99bf8235662d8820f65315..edc6ef5fa0e6dd225a0b22b453605f3587c52789 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -43,11 +43,7 @@ void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
this->dirtyGenerationID();
- if (NULL != fCachedCanvas) {
- SkASSERT(fCachedCanvas->getSurfaceBase() == this || \
- NULL == fCachedCanvas->getSurfaceBase());
- fCachedCanvas->setSurfaceBase(NULL);
- }
+ SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
if (NULL != fCachedImage) {
// the surface may need to fork its backend, if its sharing it with
@@ -61,12 +57,13 @@ void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
// that the next request will get our new contents.
fCachedImage->unref();
fCachedImage = NULL;
+ } else if (kDiscard_ContentChangeMode == mode) {
+ this->onDiscard();
}
}
uint32_t SkSurface_Base::newGenerationID() {
- this->installIntoCanvasForDirtyNotification();
-
+ SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
static int32_t gID;
return sk_atomic_inc(&gID) + 1;
}
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | src/image/SkSurface_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698