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

Unified Diff: cc/test/layer_tree_json_parser.cc

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 | « cc/test/fake_scoped_ui_resource.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_json_parser.cc
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index 51c421feaddaf203aee84389e61df433bb521489..1c47e1ea87b56bf2fdac3c9e4adae4169a817faa 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -54,14 +54,29 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
success &= list->GetInteger(0, &image_width);
success &= list->GetInteger(1, &image_height);
+ success &= dict->GetList("Border", &list);
+ int border_x, border_y, border_width, border_height;
+ success &= list->GetInteger(0, &border_x);
+ success &= list->GetInteger(1, &border_y);
+ success &= list->GetInteger(2, &border_width);
+ success &= list->GetInteger(3, &border_height);
+
+ bool fill_center;
+ success &= dict->GetBoolean("FillCenter", &fill_center);
+
scoped_refptr<NinePatchLayer> nine_patch_layer = NinePatchLayer::Create();
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, image_width, image_height);
bitmap.allocPixels(NULL, NULL);
+ bitmap.setImmutable();
nine_patch_layer->SetBitmap(bitmap,
gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height));
+ nine_patch_layer->SetBorder(
+ gfx::Rect(border_x, border_y, border_width, border_height));
+ nine_patch_layer->SetFillCenter(fill_center);
+
new_layer = nine_patch_layer;
} else if (layer_type == "PictureLayer") {
new_layer = PictureLayer::Create(content_client);
« no previous file with comments | « cc/test/fake_scoped_ui_resource.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698