OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_test_common.h" | 5 #include "cc/test/layer_test_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
10 #include "cc/animation/animation_id_provider.h" | 10 #include "cc/animation/animation_id_provider.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 | 30 |
31 // Align with expected and actual output. | 31 // Align with expected and actual output. |
32 const char* LayerTestCommon::quad_string = " Quad: "; | 32 const char* LayerTestCommon::quad_string = " Quad: "; |
33 | 33 |
34 RenderSurfaceImpl* GetRenderSurface(LayerImpl* layer_impl) { | 34 RenderSurfaceImpl* GetRenderSurface(LayerImpl* layer_impl) { |
35 EffectTree& effect_tree = | 35 EffectTree& effect_tree = |
36 layer_impl->layer_tree_impl()->property_trees()->effect_tree; | 36 layer_impl->layer_tree_impl()->property_trees()->effect_tree; |
37 | 37 |
38 EffectNode* effect_node = effect_tree.Node(layer_impl->effect_tree_index()); | 38 if (RenderSurfaceImpl* surface = |
39 if (effect_node->owning_layer_id == layer_impl->id()) | 39 effect_tree.GetRenderSurface(layer_impl->effect_tree_index())) |
40 return effect_tree.GetRenderSurface(layer_impl->effect_tree_index()); | 40 return surface; |
41 return nullptr; | 41 |
| 42 return effect_tree.GetRenderSurface( |
| 43 effect_tree.Node(layer_impl->effect_tree_index())->target_id); |
42 } | 44 } |
43 | 45 |
44 const RenderSurfaceImpl* GetRenderSurface(const LayerImpl* layer_impl) { | 46 float OpacityForLayer(LayerImpl* layer_impl) { |
45 EffectTree& effect_tree = | 47 return layer_impl->layer_tree_impl() |
46 layer_impl->layer_tree_impl()->property_trees()->effect_tree; | 48 ->property_trees() |
47 | 49 ->effect_tree.Node(layer_impl->effect_tree_index()) |
48 EffectNode* effect_node = effect_tree.Node(layer_impl->effect_tree_index()); | 50 ->opacity; |
49 if (effect_node->owning_layer_id == layer_impl->id()) | |
50 return effect_tree.GetRenderSurface(layer_impl->effect_tree_index()); | |
51 return nullptr; | |
52 } | 51 } |
53 | 52 |
54 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { | 53 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { |
55 // Ensure that range of float values is not beyond integer range. | 54 // Ensure that range of float values is not beyond integer range. |
56 if (!r.IsExpressibleAsRect()) | 55 if (!r.IsExpressibleAsRect()) |
57 return false; | 56 return false; |
58 | 57 |
59 // Ensure that the values are actually integers. | 58 // Ensure that the values are actually integers. |
60 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), | 59 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), |
61 std::floor(r.width()), std::floor(r.height())); | 60 std::floor(r.width()), std::floor(r.height())); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 236 } |
238 | 237 |
239 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 238 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
240 | 239 |
241 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { | 240 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { |
242 root_layer_for_testing()->test_properties()->copy_requests.push_back( | 241 root_layer_for_testing()->test_properties()->copy_requests.push_back( |
243 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 242 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
244 } | 243 } |
245 | 244 |
246 } // namespace cc | 245 } // namespace cc |
OLD | NEW |