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

Unified Diff: src/image/SkSurface_Gpu.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_Base.h ('k') | src/image/SkSurface_Picture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Gpu.cpp
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 50d6606145a644d9a69be50613555854cc4d6da6..2f32d2fc7ce3d02225b7b5d516af53f9d6325adf 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -23,6 +23,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:
SkGpuDevice* fDevice;
@@ -86,9 +87,15 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
this->getCachedCanvas()->setRootDevice(newDevice);
SkRefCnt_SafeAssign(fDevice, newDevice);
+ } else if (kDiscard_ContentChangeMode == mode) {
+ this->SkSurface_Gpu::onDiscard();
}
}
+void SkSurface_Gpu::onDiscard() {
+ fDevice->accessRenderTarget()->discard();
+}
+
///////////////////////////////////////////////////////////////////////////////
SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target) {
« no previous file with comments | « src/image/SkSurface_Base.h ('k') | src/image/SkSurface_Picture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698