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

Unified Diff: ui/gfx/canvas.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: rebase Created 3 years, 8 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
Index: ui/gfx/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index 47347f3cea0227718765c252ebfa1e5aa0d0ca3d..60128fe01c86d99dbcd5d200fd7c3a2700690cd8 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -525,15 +525,7 @@ void Canvas::Transform(const gfx::Transform& transform) {
SkBitmap Canvas::GetBitmap() const {
DCHECK(bitmap_);
- SkBitmap bitmap = bitmap_.value();
- // When the bitmap is copied, it shares the underlying pixelref, but doesn't
- // initialize pixels unless they are locked. Hence, ensure that the returned
- // bitmap keeps the pixelref alive by locking it. Note that the dtor of
- // SkBitmap will unlock the pixelrefs, so this won't leak. Also note that
- // moving SkBitmap retains the same lock as the source, so the caller
- // will receive a locked-pixels bitmap.
- bitmap.lockPixels();
- return bitmap;
+ return bitmap_.value();
}
bool Canvas::IntersectsClipRect(const SkRect& rect) {

Powered by Google App Engine
This is Rietveld 408576698