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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: fix mac 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: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index ca08b6f24da33a3b3a56811fee6ffd2e2cf9bc5a..451b793e172355799ed3d019543df567a72e72cd 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3901,9 +3901,7 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
gfx::ColorSpace::CreateSRGB());
if (!scaled) {
- AutoLockUIResourceBitmap bitmap_lock(bitmap);
- auto* pixels = bitmap_lock.GetPixels();
- resource_provider_->CopyToResource(id, pixels, source_size);
+ resource_provider_->CopyToResource(id, bitmap.GetPixels(), source_size);
} else {
// Only support auto-resizing for N32 textures (since this is primarily for
// scrollbars). Users of other types need to ensure they are not too big.
@@ -3920,10 +3918,9 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
source_size.width(), source_size.height(), kPremul_SkAlphaType);
int row_bytes = source_size.width() * 4;
- AutoLockUIResourceBitmap bitmap_lock(bitmap);
SkBitmap source_bitmap;
source_bitmap.setInfo(info, row_bytes);
- source_bitmap.setPixels(const_cast<uint8_t*>(bitmap_lock.GetPixels()));
+ source_bitmap.setPixels(const_cast<uint8_t*>(bitmap.GetPixels()));
// This applies the scale to draw the |bitmap| into |scaled_bitmap|.
SkBitmap scaled_bitmap;
@@ -3937,7 +3934,6 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
scaled_canvas.clear(SK_ColorTRANSPARENT);
scaled_canvas.drawBitmap(source_bitmap, 0, 0);
- SkAutoLockPixels scaled_bitmap_lock(scaled_bitmap);
auto* pixels = static_cast<uint8_t*>(scaled_bitmap.getPixels());
resource_provider_->CopyToResource(id, pixels, upload_size);
}

Powered by Google App Engine
This is Rietveld 408576698