| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ui/gfx/geometry/point_conversions.h" | 24 #include "ui/gfx/geometry/point_conversions.h" |
| 25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 26 #include "ui/gfx/geometry/rect_conversions.h" | 26 #include "ui/gfx/geometry/rect_conversions.h" |
| 27 #include "ui/gfx/geometry/size_conversions.h" | 27 #include "ui/gfx/geometry/size_conversions.h" |
| 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) { |
| 35 EffectTree& effect_tree = |
| 36 layer_impl->layer_tree_impl()->property_trees()->effect_tree; |
| 37 |
| 38 EffectNode* effect_node = effect_tree.Node(layer_impl->effect_tree_index()); |
| 39 if (effect_node->owning_layer_id == layer_impl->id()) |
| 40 return effect_tree.GetRenderSurface(layer_impl->effect_tree_index()); |
| 41 return nullptr; |
| 42 } |
| 43 |
| 44 const RenderSurfaceImpl* GetRenderSurface(const LayerImpl* layer_impl) { |
| 45 EffectTree& effect_tree = |
| 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 } |
| 53 |
| 34 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { | 54 static bool CanRectFBeSafelyRoundedToRect(const gfx::RectF& r) { |
| 35 // Ensure that range of float values is not beyond integer range. | 55 // Ensure that range of float values is not beyond integer range. |
| 36 if (!r.IsExpressibleAsRect()) | 56 if (!r.IsExpressibleAsRect()) |
| 37 return false; | 57 return false; |
| 38 | 58 |
| 39 // Ensure that the values are actually integers. | 59 // Ensure that the values are actually integers. |
| 40 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), | 60 gfx::RectF floored_rect(std::floor(r.x()), std::floor(r.y()), |
| 41 std::floor(r.width()), std::floor(r.height())); | 61 std::floor(r.width()), std::floor(r.height())); |
| 42 return floored_rect == r; | 62 return floored_rect == r; |
| 43 } | 63 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 237 } |
| 218 | 238 |
| 219 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 239 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 220 | 240 |
| 221 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { | 241 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { |
| 222 root_layer_for_testing()->test_properties()->copy_requests.push_back( | 242 root_layer_for_testing()->test_properties()->copy_requests.push_back( |
| 223 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 243 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
| 224 } | 244 } |
| 225 | 245 |
| 226 } // namespace cc | 246 } // namespace cc |
| OLD | NEW |