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

Unified Diff: include/core/SkCanvas.h

Issue 1236023004: have canvas send discard instead of retain if the draw would overwrite everything (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | src/core/SkCanvas.cpp » ('j') | src/core/SkCanvas.cpp » ('J')
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 ca6818518d74078401d0d73a1b3cfdc61d842010..05f64dfe3361499c73abdf63d7fb69358e839b0d 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1355,11 +1355,22 @@ protected:
SkIRect* intersection,
const SkImageFilter* imageFilter = NULL);
+private:
+ enum ShaderOverrideOpacity {
+ kNone_ShaderOverrideOpacity, //!< there is no overriding shader (bitmap or image)
+ kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque
+ kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not be opaque
+ };
+
// notify our surface (if we have one) that we are about to draw, so it
// can perform copy-on-write or invalidate any cached images
robertphillips 2015/07/20 15:15:29 willOverwriteEntireSurface (no extra 's') ?
- void predrawNotify();
+ void predrawNotify(bool willOverwritesEntireSurface = false);
+ void predrawNotify(const SkRect* rect, const SkPaint* paint, ShaderOverrideOpacity);
+ void predrawNotify(const SkRect* rect, const SkPaint* paint, bool shaderOverrideIsOpaque) {
+ this->predrawNotify(rect, paint, shaderOverrideIsOpaque ? kOpaque_ShaderOverrideOpacity
+ : kNotOpaque_ShaderOverrideOpacity);
+ }
-private:
class MCRec;
SkAutoTUnref<SkClipStack> fClipStack;
@@ -1404,6 +1415,7 @@ private:
friend class SkRecorder; // InitFlags
friend class SkNoSaveLayerCanvas; // InitFlags
friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProps*, InitFlags)
+ friend class SkPictureRecord; // predrawNotify (why does it need it? <reed>)
enum InitFlags {
kDefault_InitFlags = 0,
@@ -1453,6 +1465,14 @@ private:
// only for canvasutils
const SkRegion& internal_private_getTotalClip() const;
+ /*
+ * Returns true if drawing the specified rect (or all if it is null) with the specified
+ * paint (or default if null) would overwrite the entire root device of the canvas
+ * (i.e. the canvas' surface if it had one).
+ */
+ bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverrideOpacity) const;
+
+
/* These maintain a cache of the clip bounds in local coordinates,
(converted to 2s-compliment if floats are slow).
*/
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698