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

Unified Diff: include/core/SkCanvas.h

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 | « gyp/core.gypi ('k') | include/gpu/GrColor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 3eadb4cccabd207953579a51b7a6627527800814..4d9c462b73c36ab5a506e5eb07ed20da570c30ab 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -597,6 +597,20 @@ public:
virtual void clear(SkColor);
/**
+ * This makes the contents of the canvas undefined. Subsequent calls that
+ * require reading the canvas contents will produce undefined results. Examples
+ * include blending and readPixels. The actual implementation is backend-
+ * dependent and one legal implementation is to do nothing. Like clear(), this
+ * ignores the clip.
+ *
+ * This function should only be called if the caller intends to subsequently
+ * draw to the canvas. The canvas may do real work at discard() time in order
+ * to optimize performance on subsequent draws. Thus, if you call this and then
+ * never draw to the canvas subsequently you may pay a perfomance penalty.
+ */
+ void discard() { this->onDiscard(); }
+
+ /**
* Fill the entire canvas' bitmap (restricted to the current clip) with the
* specified paint.
* @param paint The paint used to fill the canvas
@@ -1176,6 +1190,8 @@ protected:
virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle);
virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
+ virtual void onDiscard();
+
// Returns the canvas to be used by DrawIter. Default implementation
// returns this. Subclasses that encapsulate an indirect canvas may
// need to overload this method. The impl must keep track of this, as it
« no previous file with comments | « gyp/core.gypi ('k') | include/gpu/GrColor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698