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

Unified Diff: skia/ext/skia_utils_mac.h

Issue 462423006: Allow user-specified clip region for SkiaBitLocker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 4 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 | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/skia_utils_mac.h
diff --git a/skia/ext/skia_utils_mac.h b/skia/ext/skia_utils_mac.h
index 6a0efdebfab60b78999e51e845cbf936b49e0e5a..e087867ffb483e4cb3b230d7adf2d9aa59a71a5e 100644
--- a/skia/ext/skia_utils_mac.h
+++ b/skia/ext/skia_utils_mac.h
@@ -109,16 +109,36 @@ SK_API NSImage* SkBitmapToNSImage(const SkBitmap& icon);
class SK_API SkiaBitLocker {
public:
explicit SkiaBitLocker(SkCanvas* canvas);
+ SkiaBitLocker(SkCanvas* canvas, const SkIRect& userClipRect);
~SkiaBitLocker();
CGContextRef cgContext();
+ bool hasEmptyClipRegion() const;
private:
void releaseIfNeeded();
+ SkIRect computeDirtyRect();
+
SkCanvas* canvas_;
+
+ // If the user specified a clip rect it would draw into then the locker may
+ // skip the step of searching for a rect bounding the pixels that the user
+ // has drawn into.
+ bool userClipRectSpecified_;
+
CGContextRef cgContext_;
SkBitmap bitmap_;
SkIPoint bitmapOffset_;
+
+ // True if we are drawing to |canvas_|'s SkBaseDevice's bits directly through
+ // |bitmap_|. Otherwise, the bits in |bitmap_| are our allocation and need to
+ // be copied over to |canvas_|.
bool useDeviceBits_;
+
+ // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating
+ // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not
+ // be copied to |canvas_|. This will happen if |canvas_|'s clip region is
+ // empty.
+ bool bitmapIsDummy_;
};
« no previous file with comments | « no previous file | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698