| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_host_common_test.h" | 5 #include "cc/test/layer_tree_host_common_test.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| 11 #include "cc/test/fake_layer_tree_host.h" | 11 #include "cc/test/fake_layer_tree_host.h" |
| 12 #include "cc/trees/draw_property_utils.h" | 12 #include "cc/trees/draw_property_utils.h" |
| 13 #include "cc/trees/layer_tree_host_common.h" | 13 #include "cc/trees/layer_tree_host_common.h" |
| 14 #include "cc/trees/property_tree_builder.h" | 14 #include "cc/trees/property_tree_builder.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase( | 17 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase( |
| 18 const LayerTreeSettings& settings) | 18 const LayerTreeSettings& settings) |
| 19 : LayerTestCommon::LayerImplTest(settings) {} | 19 : LayerTestCommon::LayerImplTest(settings) {} |
| 20 | 20 |
| 21 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() { | 21 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() = default; |
| 22 } | |
| 23 | |
| 24 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | |
| 25 Layer* layer, | |
| 26 const gfx::Transform& transform, | |
| 27 const gfx::Point3F& transform_origin, | |
| 28 const gfx::PointF& position, | |
| 29 const gfx::Size& bounds, | |
| 30 bool flatten_transform, | |
| 31 bool is_3d_sorted) { | |
| 32 SetLayerPropertiesForTestingInternal(layer, transform, position, bounds, | |
| 33 is_3d_sorted); | |
| 34 layer->SetTransformOrigin(transform_origin); | |
| 35 layer->SetShouldFlattenTransform(flatten_transform); | |
| 36 } | |
| 37 | |
| 38 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | |
| 39 LayerImpl* layer, | |
| 40 const gfx::Transform& transform, | |
| 41 const gfx::Point3F& transform_origin, | |
| 42 const gfx::PointF& position, | |
| 43 const gfx::Size& bounds, | |
| 44 bool flatten_transform, | |
| 45 bool is_3d_sorted) { | |
| 46 SetLayerPropertiesForTestingInternal(layer, transform, position, bounds, | |
| 47 is_3d_sorted); | |
| 48 layer->test_properties()->transform_origin = transform_origin; | |
| 49 layer->test_properties()->should_flatten_transform = flatten_transform; | |
| 50 } | |
| 51 | |
| 52 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | |
| 53 LayerImpl* layer, | |
| 54 const gfx::Transform& transform, | |
| 55 const gfx::Point3F& transform_origin, | |
| 56 const gfx::PointF& position, | |
| 57 const gfx::Size& bounds, | |
| 58 bool flatten_transform, | |
| 59 bool is_3d_sorted, | |
| 60 bool create_render_surface) { | |
| 61 SetLayerPropertiesForTestingInternal(layer, transform, position, bounds, | |
| 62 is_3d_sorted); | |
| 63 layer->test_properties()->transform_origin = transform_origin; | |
| 64 layer->test_properties()->should_flatten_transform = flatten_transform; | |
| 65 if (create_render_surface) { | |
| 66 layer->test_properties()->force_render_surface = true; | |
| 67 } | |
| 68 } | |
| 69 | 22 |
| 70 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( | 23 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( |
| 71 Layer* root_layer, | 24 Layer* root_layer, |
| 72 float device_scale_factor, | 25 float device_scale_factor, |
| 73 float page_scale_factor, | 26 float page_scale_factor, |
| 74 Layer* page_scale_layer) { | 27 Layer* page_scale_layer) { |
| 75 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); | 28 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); |
| 76 | 29 |
| 77 EXPECT_TRUE(page_scale_layer || (page_scale_factor == 1.f)); | 30 EXPECT_TRUE(page_scale_layer || (page_scale_factor == 1.f)); |
| 78 gfx::Transform identity_matrix; | 31 gfx::Transform identity_matrix; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 181 |
| 229 LayerTreeHostCommonTest::LayerTreeHostCommonTest() | 182 LayerTreeHostCommonTest::LayerTreeHostCommonTest() |
| 230 : LayerTreeHostCommonTestBase(LayerTreeHostCommonTestSettings()) {} | 183 : LayerTreeHostCommonTestBase(LayerTreeHostCommonTestSettings()) {} |
| 231 | 184 |
| 232 LayerTreeHostCommonTest::LayerTreeHostCommonTest( | 185 LayerTreeHostCommonTest::LayerTreeHostCommonTest( |
| 233 const LayerTreeSettings& settings) | 186 const LayerTreeSettings& settings) |
| 234 : LayerTreeHostCommonTestBase(settings) { | 187 : LayerTreeHostCommonTestBase(settings) { |
| 235 } | 188 } |
| 236 | 189 |
| 237 } // namespace cc | 190 } // namespace cc |
| OLD | NEW |