Chromium Code Reviews| 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/trees/layer_tree_host_common.h" | 9 #include "cc/trees/layer_tree_host_common.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase() | 13 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase() |
| 14 : render_surface_layer_list_count_(0) { | 14 : render_surface_layer_list_count_(0) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() { | 17 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | 20 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( |
| 21 Layer* layer, | 21 Layer* layer, |
| 22 const gfx::Transform& transform, | 22 const gfx::Transform& transform, |
| 23 const gfx::Point3F& transform_origin, | 23 const gfx::Point3F& transform_origin, |
| 24 const gfx::PointF& position, | 24 const gfx::PointF& position, |
| 25 const gfx::Size& bounds, | 25 const gfx::Size& bounds, |
| 26 bool flatten_transform, | 26 bool flatten_transform, |
| 27 bool is_3d_sorted) { | 27 bool is_3d_sorted) { |
| 28 SetLayerPropertiesForTestingInternal<Layer>(layer, | 28 SetLayerPropertiesForTestingInternal(layer, |
| 29 transform, | 29 transform, |
| 30 transform_origin, | 30 transform_origin, |
| 31 position, | 31 position, |
| 32 bounds, | 32 bounds, |
| 33 flatten_transform, | 33 flatten_transform, |
| 34 is_3d_sorted); | 34 is_3d_sorted, |
| 35 false); | |
| 35 } | 36 } |
| 36 | 37 |
| 37 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( | 38 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( |
| 38 LayerImpl* layer, | 39 LayerImpl* layer, |
| 39 const gfx::Transform& transform, | 40 const gfx::Transform& transform, |
| 40 const gfx::Point3F& transform_origin, | 41 const gfx::Point3F& transform_origin, |
| 41 const gfx::PointF& position, | 42 const gfx::PointF& position, |
| 42 const gfx::Size& bounds, | 43 const gfx::Size& bounds, |
| 43 bool flatten_transform, | 44 bool flatten_transform, |
| 44 bool is_3d_sorted) { | 45 bool is_3d_sorted, |
| 45 SetLayerPropertiesForTestingInternal<LayerImpl>(layer, | 46 bool create_render_surface) { |
| 46 transform, | 47 SetLayerPropertiesForTestingInternal(layer, |
| 47 transform_origin, | 48 transform, |
| 48 position, | 49 transform_origin, |
| 49 bounds, | 50 position, |
| 50 flatten_transform, | 51 bounds, |
| 51 is_3d_sorted); | 52 flatten_transform, |
| 53 is_3d_sorted, | |
| 54 create_render_surface); | |
| 52 layer->SetContentBounds(bounds); | 55 layer->SetContentBounds(bounds); |
| 53 } | 56 } |
| 54 | 57 |
| 58 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTestingInternal( | |
| 59 Layer* layer, | |
| 60 const gfx::Transform& transform, | |
| 61 const gfx::Point3F& transform_origin, | |
| 62 const gfx::PointF& position, | |
| 63 const gfx::Size& bounds, | |
| 64 bool flatten_transform, | |
| 65 bool is_3d_sorted, | |
| 66 bool create_render_surface) { | |
|
danakj
2014/09/03 19:30:33
this is always false, so just remove it?
awoloszyn
2014/09/09 15:31:36
Done.
| |
| 67 layer->SetTransform(transform); | |
| 68 layer->SetTransformOrigin(transform_origin); | |
| 69 layer->SetPosition(position); | |
| 70 layer->SetBounds(bounds); | |
| 71 layer->SetShouldFlattenTransform(flatten_transform); | |
| 72 layer->Set3dSortingContextId(is_3d_sorted ? 1 : 0); | |
| 73 if (create_render_surface) { | |
| 74 layer->CreateRenderSurface(); | |
| 75 } | |
| 76 } | |
| 77 | |
| 78 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTestingInternal( | |
| 79 LayerImpl* layer, | |
| 80 const gfx::Transform& transform, | |
| 81 const gfx::Point3F& transform_origin, | |
| 82 const gfx::PointF& position, | |
| 83 const gfx::Size& bounds, | |
| 84 bool flatten_transform, | |
| 85 bool is_3d_sorted, | |
| 86 bool create_render_surface) { | |
| 87 layer->SetTransform(transform); | |
| 88 layer->SetTransformOrigin(transform_origin); | |
| 89 layer->SetPosition(position); | |
| 90 layer->SetBounds(bounds); | |
| 91 layer->SetShouldFlattenTransform(flatten_transform); | |
| 92 layer->Set3dSortingContextId(is_3d_sorted ? 1 : 0); | |
| 93 if (create_render_surface) { | |
| 94 layer->SetHasRenderSurface(true); | |
| 95 } | |
| 96 } | |
| 97 | |
| 55 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( | 98 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( |
| 56 Layer* root_layer, | 99 Layer* root_layer, |
| 57 float device_scale_factor, | 100 float device_scale_factor, |
| 58 float page_scale_factor, | 101 float page_scale_factor, |
| 59 Layer* page_scale_application_layer, | 102 Layer* page_scale_application_layer, |
| 60 bool can_use_lcd_text) { | 103 bool can_use_lcd_text) { |
| 61 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f)); | 104 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f)); |
| 62 gfx::Transform identity_matrix; | 105 gfx::Transform identity_matrix; |
| 63 gfx::Size device_viewport_size = | 106 gfx::Size device_viewport_size = |
| 64 gfx::Size(root_layer->bounds().width() * device_scale_factor, | 107 gfx::Size(root_layer->bounds().width() * device_scale_factor, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 inputs.can_adjust_raster_scales = true; | 147 inputs.can_adjust_raster_scales = true; |
| 105 | 148 |
| 106 ++render_surface_layer_list_count_; | 149 ++render_surface_layer_list_count_; |
| 107 inputs.current_render_surface_layer_list_id = | 150 inputs.current_render_surface_layer_list_id = |
| 108 render_surface_layer_list_count_; | 151 render_surface_layer_list_count_; |
| 109 | 152 |
| 110 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 153 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 111 } | 154 } |
| 112 | 155 |
| 113 } // namespace cc | 156 } // namespace cc |
| OLD | NEW |