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

Unified Diff: trunk/src/cc/layers/painted_scrollbar_layer.cc

Issue 23740010: Revert 223162 "Update the nine patch layer to use UI resources" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/cc/layers/painted_scrollbar_layer.h ('k') | trunk/src/cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/cc/layers/painted_scrollbar_layer.cc
===================================================================
--- trunk/src/cc/layers/painted_scrollbar_layer.cc (revision 223178)
+++ trunk/src/cc/layers/painted_scrollbar_layer.cc (working copy)
@@ -210,14 +210,20 @@
return true;
}
-UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart(
+scoped_refptr<UIResourceBitmap> PaintedScrollbarLayer::RasterizeScrollbarPart(
gfx::Rect rect,
ScrollbarPart part) {
DCHECK(!rect.size().IsEmpty());
+ scoped_refptr<UIResourceBitmap> bitmap =
+ UIResourceBitmap::Create(new uint8_t[rect.width() * rect.height() * 4],
+ UIResourceBitmap::RGBA8,
+ UIResourceBitmap::CLAMP_TO_EDGE,
+ rect.size());
+
SkBitmap skbitmap;
skbitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height());
- skbitmap.allocPixels();
+ skbitmap.setPixels(bitmap->GetPixels());
SkCanvas skcanvas(skbitmap);
skcanvas.translate(SkFloatToScalar(-rect.x()), SkFloatToScalar(-rect.y()));
@@ -234,11 +240,8 @@
skcanvas.clipRect(layer_skrect);
scrollbar_->PaintPart(&skcanvas, part, layer_rect);
- // Make sure that the pixels are no longer mutable to unavoid unnecessary
- // allocation and copying.
- skbitmap.setImmutable();
- return UIResourceBitmap(skbitmap);
+ return bitmap;
}
} // namespace cc
« no previous file with comments | « trunk/src/cc/layers/painted_scrollbar_layer.h ('k') | trunk/src/cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698