| 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 "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
| 9 #include "cc/test/fake_layer_tree_host.h" | 9 #include "cc/test/fake_layer_tree_host.h" |
| 10 #include "cc/trees/layer_tree_host_common.h" | 10 #include "cc/trees/layer_tree_host_common.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase() | 14 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase() |
| 15 : client_(FakeLayerTreeHostClient::DIRECT_3D), | 15 : client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 16 render_surface_layer_list_count_(0) { | 16 render_surface_layer_list_count_(0) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() { | 19 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | 22 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( |
| 23 Layer* layer, | 23 Layer* layer, |
| 24 const gfx::Transform& transform, | 24 const gfx::Transform& transform, |
| 25 const gfx::Point3F& transform_origin, | 25 const gfx::Point3F& transform_origin, |
| 26 const gfx::PointF& position, | 26 const gfx::PointF& position, |
| 27 const gfx::Size& bounds, | 27 const gfx::Size& bounds, |
| 28 bool flatten_transform, | 28 bool flatten_transform, |
| 29 bool is_3d_sorted) { | 29 bool is_3d_sorted) { |
| 30 SetLayerPropertiesForTestingInternal<Layer>(layer, | 30 SetLayerPropertiesForTestingInternal(layer, |
| 31 transform, | 31 transform, |
| 32 transform_origin, | 32 transform_origin, |
| 33 position, | 33 position, |
| 34 bounds, | 34 bounds, |
| 35 flatten_transform, | 35 flatten_transform, |
| 36 is_3d_sorted); | 36 is_3d_sorted); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | 39 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( |
| 40 LayerImpl* layer, | 40 LayerImpl* layer, |
| 41 const gfx::Transform& transform, | 41 const gfx::Transform& transform, |
| 42 const gfx::Point3F& transform_origin, | 42 const gfx::Point3F& transform_origin, |
| 43 const gfx::PointF& position, | 43 const gfx::PointF& position, |
| 44 const gfx::Size& bounds, | 44 const gfx::Size& bounds, |
| 45 bool flatten_transform, | 45 bool flatten_transform, |
| 46 bool is_3d_sorted) { | 46 bool is_3d_sorted, |
| 47 SetLayerPropertiesForTestingInternal<LayerImpl>(layer, | 47 bool create_render_surface) { |
| 48 transform, | 48 SetLayerPropertiesForTestingInternal(layer, |
| 49 transform_origin, | 49 transform, |
| 50 position, | 50 transform_origin, |
| 51 bounds, | 51 position, |
| 52 flatten_transform, | 52 bounds, |
| 53 is_3d_sorted); | 53 flatten_transform, |
| 54 is_3d_sorted); |
| 55 if (create_render_surface) { |
| 56 layer->SetHasRenderSurface(true); |
| 57 } |
| 58 |
| 54 layer->SetContentBounds(bounds); | 59 layer->SetContentBounds(bounds); |
| 55 } | 60 } |
| 56 | 61 |
| 57 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( | 62 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( |
| 58 Layer* root_layer, | 63 Layer* root_layer, |
| 59 float device_scale_factor, | 64 float device_scale_factor, |
| 60 float page_scale_factor, | 65 float page_scale_factor, |
| 61 Layer* page_scale_application_layer, | 66 Layer* page_scale_application_layer, |
| 62 bool can_use_lcd_text) { | 67 bool can_use_lcd_text) { |
| 63 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f)); | 68 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f)); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 116 |
| 112 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 117 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 113 } | 118 } |
| 114 | 119 |
| 115 scoped_ptr<FakeLayerTreeHost> | 120 scoped_ptr<FakeLayerTreeHost> |
| 116 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() { | 121 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() { |
| 117 return FakeLayerTreeHost::Create(&client_); | 122 return FakeLayerTreeHost::Create(&client_); |
| 118 } | 123 } |
| 119 | 124 |
| 120 } // namespace cc | 125 } // namespace cc |
| OLD | NEW |