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) { |