| 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, transform, transform_origin, |
| 31 transform, | 31 position, bounds, flatten_transform, |
| 32 transform_origin, | 32 is_3d_sorted); |
| 33 position, | |
| 34 bounds, | |
| 35 flatten_transform, | |
| 36 is_3d_sorted); | |
| 37 } | 33 } |
| 38 | 34 |
| 39 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | 35 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( |
| 40 LayerImpl* layer, | 36 LayerImpl* layer, |
| 41 const gfx::Transform& transform, | 37 const gfx::Transform& transform, |
| 42 const gfx::Point3F& transform_origin, | 38 const gfx::Point3F& transform_origin, |
| 43 const gfx::PointF& position, | 39 const gfx::PointF& position, |
| 44 const gfx::Size& bounds, | 40 const gfx::Size& bounds, |
| 45 bool flatten_transform, | 41 bool flatten_transform, |
| 46 bool is_3d_sorted) { | 42 bool is_3d_sorted, |
| 47 SetLayerPropertiesForTestingInternal<LayerImpl>(layer, | 43 bool create_render_surface) { |
| 48 transform, | 44 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin, |
| 49 transform_origin, | 45 position, bounds, flatten_transform, |
| 50 position, | 46 is_3d_sorted); |
| 51 bounds, | 47 if (create_render_surface) { |
| 52 flatten_transform, | 48 layer->SetHasRenderSurface(true); |
| 53 is_3d_sorted); | 49 } |
| 50 |
| 54 layer->SetContentBounds(bounds); | 51 layer->SetContentBounds(bounds); |
| 55 } | 52 } |
| 56 | 53 |
| 57 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( | 54 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( |
| 58 Layer* root_layer, | 55 Layer* root_layer, |
| 59 float device_scale_factor, | 56 float device_scale_factor, |
| 60 float page_scale_factor, | 57 float page_scale_factor, |
| 61 Layer* page_scale_application_layer, | 58 Layer* page_scale_application_layer, |
| 62 bool can_use_lcd_text, | 59 bool can_use_lcd_text, |
| 63 bool layers_always_allowed_lcd_text) { | 60 bool layers_always_allowed_lcd_text) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 112 |
| 116 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 113 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 117 } | 114 } |
| 118 | 115 |
| 119 scoped_ptr<FakeLayerTreeHost> | 116 scoped_ptr<FakeLayerTreeHost> |
| 120 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() { | 117 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() { |
| 121 return FakeLayerTreeHost::Create(&client_); | 118 return FakeLayerTreeHost::Create(&client_); |
| 122 } | 119 } |
| 123 | 120 |
| 124 } // namespace cc | 121 } // namespace cc |
| OLD | NEW |