| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 double opacity; | 73 double opacity; |
| 74 if (dict->GetDouble("Opacity", &opacity)) | 74 if (dict->GetDouble("Opacity", &opacity)) |
| 75 new_layer->SetOpacity(opacity); | 75 new_layer->SetOpacity(opacity); |
| 76 | 76 |
| 77 success &= dict->GetList("DrawTransform", &list); | 77 success &= dict->GetList("DrawTransform", &list); |
| 78 double transform[16]; | 78 double transform[16]; |
| 79 for (int i = 0; i < 16; ++i) | 79 for (int i = 0; i < 16; ++i) |
| 80 success &= list->GetDouble(i, &transform[i]); | 80 success &= list->GetDouble(i, &transform[i]); |
| 81 | 81 |
| 82 gfx::Transform gfxTransform; | 82 gfx::Transform layer_transform; |
| 83 gfxTransform.matrix().setColMajord(transform); | 83 layer_transform.matrix().setColMajord(transform); |
| 84 new_layer->SetTransform(gfxTransform); | 84 new_layer->SetTransform(layer_transform); |
| 85 | 85 |
| 86 success &= dict->GetList("Children", &list); | 86 success &= dict->GetList("Children", &list); |
| 87 for (ListValue::const_iterator it = list->begin(); | 87 for (ListValue::const_iterator it = list->begin(); |
| 88 it != list->end(); ++it) { | 88 it != list->end(); ++it) { |
| 89 new_layer->AddChild(ParseTreeFromValue(*it, content_client)); | 89 new_layer->AddChild(ParseTreeFromValue(*it, content_client)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (!success) | 92 if (!success) |
| 93 return NULL; | 93 return NULL; |
| 94 | 94 |
| 95 return new_layer; | 95 return new_layer; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace | 98 } // namespace |
| 99 | 99 |
| 100 scoped_refptr<Layer> ParseTreeFromJson(std::string json, | 100 scoped_refptr<Layer> ParseTreeFromJson(std::string json, |
| 101 ContentLayerClient* content_client) { | 101 ContentLayerClient* content_client) { |
| 102 scoped_ptr<base::Value> val = base::test::ParseJson(json); | 102 scoped_ptr<base::Value> val = base::test::ParseJson(json); |
| 103 return ParseTreeFromValue(val.get(), content_client); | 103 return ParseTreeFromValue(val.get(), content_client); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace cc | 106 } // namespace cc |
| OLD | NEW |