Chromium Code Reviews| 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 = |
|
chrishtr
2017/05/11 20:07:00
The old test code assumed that a layer "owned" a r
chrishtr
2017/05/11 22:15:39
Right.
| |
| 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; | |
| 42 } | |
| 43 | 41 |
| 44 const RenderSurfaceImpl* GetRenderSurface(const LayerImpl* layer_impl) { | 42 return effect_tree.GetRenderSurface( |
| 45 EffectTree& effect_tree = | 43 effect_tree.Node(layer_impl->effect_tree_index())->target_id); |
| 46 layer_impl->layer_tree_impl()->property_trees()->effect_tree; | |
| 47 | |
| 48 EffectNode* effect_node = effect_tree.Node(layer_impl->effect_tree_index()); | |
| 49 if (effect_node->owning_layer_id == layer_impl->id()) | |
| 50 return effect_tree.GetRenderSurface(layer_impl->effect_tree_index()); | |
| 51 return nullptr; | |
| 52 } | 44 } |
| 53 | 45 |
| 54 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { | 46 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { |
| 55 // Ensure that range of float values is not beyond integer range. | 47 // Ensure that range of float values is not beyond integer range. |
| 56 if (!r.IsExpressibleAsRect()) | 48 if (!r.IsExpressibleAsRect()) |
| 57 return false; | 49 return false; |
| 58 | 50 |
| 59 // Ensure that the values are actually integers. | 51 // Ensure that the values are actually integers. |
| 60 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), | 52 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), |
| 61 std::floor(r.width()), std::floor(r.height())); | 53 std::floor(r.width()), std::floor(r.height())); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 } | 229 } |
| 238 | 230 |
| 239 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 231 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 240 | 232 |
| 241 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { | 233 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { |
| 242 root_layer_for_testing()->test_properties()->copy_requests.push_back( | 234 root_layer_for_testing()->test_properties()->copy_requests.push_back( |
| 243 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 235 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
| 244 } | 236 } |
| 245 | 237 |
| 246 } // namespace cc | 238 } // namespace cc |
| OLD | NEW |