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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 bitmap.setImmutable(); | 73 bitmap.setImmutable(); |
74 nine_patch_layer->SetBitmap(bitmap); | 74 nine_patch_layer->SetBitmap(bitmap); |
75 nine_patch_layer->SetAperture( | 75 nine_patch_layer->SetAperture( |
76 gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height)); | 76 gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height)); |
77 nine_patch_layer->SetBorder( | 77 nine_patch_layer->SetBorder( |
78 gfx::Rect(border_x, border_y, border_width, border_height)); | 78 gfx::Rect(border_x, border_y, border_width, border_height)); |
79 nine_patch_layer->SetFillCenter(fill_center); | 79 nine_patch_layer->SetFillCenter(fill_center); |
80 | 80 |
81 new_layer = nine_patch_layer; | 81 new_layer = nine_patch_layer; |
82 } else if (layer_type == "TextureLayer") { | 82 } else if (layer_type == "TextureLayer") { |
83 new_layer = TextureLayer::CreateForMailbox(NULL); | 83 new_layer = TextureLayer::CreateForMailbox(nullptr); |
84 } else if (layer_type == "PictureLayer") { | 84 } else if (layer_type == "PictureLayer") { |
85 new_layer = PictureLayer::Create(content_client); | 85 new_layer = PictureLayer::Create(content_client); |
86 } else { // Type "Layer" or "unknown" | 86 } else { // Type "Layer" or "unknown" |
87 new_layer = Layer::Create(); | 87 new_layer = Layer::Create(); |
88 } | 88 } |
89 new_layer->SetPosition(gfx::PointF(position_x, position_y)); | 89 new_layer->SetPosition(gfx::PointF(position_x, position_y)); |
90 new_layer->SetBounds(gfx::Size(width, height)); | 90 new_layer->SetBounds(gfx::Size(width, height)); |
91 new_layer->SetIsDrawable(draws_content); | 91 new_layer->SetIsDrawable(draws_content); |
92 | 92 |
93 double opacity; | 93 double opacity; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 layer_transform.matrix().setColMajord(transform); | 158 layer_transform.matrix().setColMajord(transform); |
159 new_layer->SetTransform(layer_transform); | 159 new_layer->SetTransform(layer_transform); |
160 | 160 |
161 success &= dict->GetList("Children", &list); | 161 success &= dict->GetList("Children", &list); |
162 for (base::ListValue::const_iterator it = list->begin(); | 162 for (base::ListValue::const_iterator it = list->begin(); |
163 it != list->end(); ++it) { | 163 it != list->end(); ++it) { |
164 new_layer->AddChild(ParseTreeFromValue(*it, content_client)); | 164 new_layer->AddChild(ParseTreeFromValue(*it, content_client)); |
165 } | 165 } |
166 | 166 |
167 if (!success) | 167 if (!success) |
168 return NULL; | 168 return nullptr; |
169 | 169 |
170 return new_layer; | 170 return new_layer; |
171 } | 171 } |
172 | 172 |
173 } // namespace | 173 } // namespace |
174 | 174 |
175 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 175 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
176 ContentLayerClient* content_client) { | 176 ContentLayerClient* content_client) { |
177 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 177 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
178 return ParseTreeFromValue(val.get(), content_client); | 178 return ParseTreeFromValue(val.get(), content_client); |
179 } | 179 } |
180 | 180 |
181 } // namespace cc | 181 } // namespace cc |
OLD | NEW |