OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/test/layer_tree_json_parser.h" | 5 #include "cc/test/layer_tree_json_parser.h" |
6 | 6 |
7 #include "base/test/values_test_util.h" | 7 #include "base/test/values_test_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 success &= list->GetInteger(1, &border_y); | 62 success &= list->GetInteger(1, &border_y); |
63 success &= list->GetInteger(2, &border_width); | 63 success &= list->GetInteger(2, &border_width); |
64 success &= list->GetInteger(3, &border_height); | 64 success &= list->GetInteger(3, &border_height); |
65 | 65 |
66 bool fill_center; | 66 bool fill_center; |
67 success &= dict->GetBoolean("FillCenter", &fill_center); | 67 success &= dict->GetBoolean("FillCenter", &fill_center); |
68 | 68 |
69 scoped_refptr<NinePatchLayer> nine_patch_layer = NinePatchLayer::Create(); | 69 scoped_refptr<NinePatchLayer> nine_patch_layer = NinePatchLayer::Create(); |
70 | 70 |
71 SkBitmap bitmap; | 71 SkBitmap bitmap; |
72 bitmap.setConfig(SkBitmap::kARGB_8888_Config, image_width, image_height); | 72 bitmap.setConfig(SkImageInfo::MakeN32Premul(image_width, image_height)); |
danakj
2014/03/25 16:13:59
why isn't this allocN32Pixels()?
reed1
2014/03/25 17:19:41
good catch. Done.
| |
73 bitmap.allocPixels(NULL, NULL); | |
74 bitmap.setImmutable(); | 73 bitmap.setImmutable(); |
75 nine_patch_layer->SetBitmap(bitmap); | 74 nine_patch_layer->SetBitmap(bitmap); |
76 nine_patch_layer->SetAperture( | 75 nine_patch_layer->SetAperture( |
77 gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height)); | 76 gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height)); |
78 nine_patch_layer->SetBorder( | 77 nine_patch_layer->SetBorder( |
79 gfx::Rect(border_x, border_y, border_width, border_height)); | 78 gfx::Rect(border_x, border_y, border_width, border_height)); |
80 nine_patch_layer->SetFillCenter(fill_center); | 79 nine_patch_layer->SetFillCenter(fill_center); |
81 | 80 |
82 new_layer = nine_patch_layer; | 81 new_layer = nine_patch_layer; |
83 } else if (layer_type == "TextureLayer") { | 82 } else if (layer_type == "TextureLayer") { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 | 163 |
165 } // namespace | 164 } // namespace |
166 | 165 |
167 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 166 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
168 ContentLayerClient* content_client) { | 167 ContentLayerClient* content_client) { |
169 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 168 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
170 return ParseTreeFromValue(val.get(), content_client); | 169 return ParseTreeFromValue(val.get(), content_client); |
171 } | 170 } |
172 | 171 |
173 } // namespace cc | 172 } // namespace cc |
OLD | NEW |