| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(NULL); |
| 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->SetAnchorPoint(gfx::Point()); | |
| 90 new_layer->SetPosition(gfx::PointF(position_x, position_y)); | 89 new_layer->SetPosition(gfx::PointF(position_x, position_y)); |
| 91 new_layer->SetBounds(gfx::Size(width, height)); | 90 new_layer->SetBounds(gfx::Size(width, height)); |
| 92 new_layer->SetIsDrawable(draws_content); | 91 new_layer->SetIsDrawable(draws_content); |
| 93 | 92 |
| 94 double opacity; | 93 double opacity; |
| 95 if (dict->GetDouble("Opacity", &opacity)) | 94 if (dict->GetDouble("Opacity", &opacity)) |
| 96 new_layer->SetOpacity(opacity); | 95 new_layer->SetOpacity(opacity); |
| 97 | 96 |
| 98 bool contents_opaque; | 97 bool contents_opaque; |
| 99 if (dict->GetBoolean("ContentsOpaque", &contents_opaque)) | 98 if (dict->GetBoolean("ContentsOpaque", &contents_opaque)) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 166 |
| 168 } // namespace | 167 } // namespace |
| 169 | 168 |
| 170 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 169 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
| 171 ContentLayerClient* content_client) { | 170 ContentLayerClient* content_client) { |
| 172 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 171 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
| 173 return ParseTreeFromValue(val.get(), content_client); | 172 return ParseTreeFromValue(val.get(), content_client); |
| 174 } | 173 } |
| 175 | 174 |
| 176 } // namespace cc | 175 } // namespace cc |
| OLD | NEW |