| 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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 flatten_transform, | 52 flatten_transform, |
| 53 is_3d_sorted); | 53 is_3d_sorted); |
| 54 layer->SetContentBounds(bounds); | 54 layer->SetContentBounds(bounds); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( | 57 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( |
| 58 Layer* root_layer, | 58 Layer* root_layer, |
| 59 float device_scale_factor, | 59 float device_scale_factor, |
| 60 float page_scale_factor, | 60 float page_scale_factor, |
| 61 Layer* page_scale_application_layer, | 61 Layer* page_scale_application_layer, |
| 62 bool can_use_lcd_text, | 62 bool can_use_lcd_text) { |
| 63 bool layers_always_allowed_lcd_text) { | |
| 64 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f)); | 63 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f)); |
| 65 gfx::Transform identity_matrix; | 64 gfx::Transform identity_matrix; |
| 66 gfx::Size device_viewport_size = | 65 gfx::Size device_viewport_size = |
| 67 gfx::Size(root_layer->bounds().width() * device_scale_factor, | 66 gfx::Size(root_layer->bounds().width() * device_scale_factor, |
| 68 root_layer->bounds().height() * device_scale_factor); | 67 root_layer->bounds().height() * device_scale_factor); |
| 69 | 68 |
| 70 render_surface_layer_list_.reset(new RenderSurfaceLayerList); | 69 render_surface_layer_list_.reset(new RenderSurfaceLayerList); |
| 71 | 70 |
| 72 // We are probably not testing what is intended if the root_layer bounds are | 71 // We are probably not testing what is intended if the root_layer bounds are |
| 73 // empty. | 72 // empty. |
| 74 DCHECK(!root_layer->bounds().IsEmpty()); | 73 DCHECK(!root_layer->bounds().IsEmpty()); |
| 75 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 74 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 76 root_layer, device_viewport_size, render_surface_layer_list_.get()); | 75 root_layer, device_viewport_size, render_surface_layer_list_.get()); |
| 77 inputs.device_scale_factor = device_scale_factor; | 76 inputs.device_scale_factor = device_scale_factor; |
| 78 inputs.page_scale_factor = page_scale_factor; | 77 inputs.page_scale_factor = page_scale_factor; |
| 79 inputs.page_scale_application_layer = page_scale_application_layer; | 78 inputs.page_scale_application_layer = page_scale_application_layer; |
| 80 inputs.can_use_lcd_text = can_use_lcd_text; | 79 inputs.can_use_lcd_text = can_use_lcd_text; |
| 81 inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text; | |
| 82 inputs.can_adjust_raster_scales = true; | 80 inputs.can_adjust_raster_scales = true; |
| 83 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 81 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 84 } | 82 } |
| 85 | 83 |
| 86 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( | 84 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( |
| 87 LayerImpl* root_layer, | 85 LayerImpl* root_layer, |
| 88 float device_scale_factor, | 86 float device_scale_factor, |
| 89 float page_scale_factor, | 87 float page_scale_factor, |
| 90 LayerImpl* page_scale_application_layer, | 88 LayerImpl* page_scale_application_layer, |
| 91 bool can_use_lcd_text, | 89 bool can_use_lcd_text) { |
| 92 bool layers_always_allowed_lcd_text) { | |
| 93 gfx::Transform identity_matrix; | 90 gfx::Transform identity_matrix; |
| 94 gfx::Size device_viewport_size = | 91 gfx::Size device_viewport_size = |
| 95 gfx::Size(root_layer->bounds().width() * device_scale_factor, | 92 gfx::Size(root_layer->bounds().width() * device_scale_factor, |
| 96 root_layer->bounds().height() * device_scale_factor); | 93 root_layer->bounds().height() * device_scale_factor); |
| 97 | 94 |
| 98 render_surface_layer_list_impl_.reset(new LayerImplList); | 95 render_surface_layer_list_impl_.reset(new LayerImplList); |
| 99 | 96 |
| 100 // We are probably not testing what is intended if the root_layer bounds are | 97 // We are probably not testing what is intended if the root_layer bounds are |
| 101 // empty. | 98 // empty. |
| 102 DCHECK(!root_layer->bounds().IsEmpty()); | 99 DCHECK(!root_layer->bounds().IsEmpty()); |
| 103 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 100 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 104 root_layer, device_viewport_size, render_surface_layer_list_impl_.get()); | 101 root_layer, device_viewport_size, render_surface_layer_list_impl_.get()); |
| 105 inputs.device_scale_factor = device_scale_factor; | 102 inputs.device_scale_factor = device_scale_factor; |
| 106 inputs.page_scale_factor = page_scale_factor; | 103 inputs.page_scale_factor = page_scale_factor; |
| 107 inputs.page_scale_application_layer = page_scale_application_layer; | 104 inputs.page_scale_application_layer = page_scale_application_layer; |
| 108 inputs.can_use_lcd_text = can_use_lcd_text; | 105 inputs.can_use_lcd_text = can_use_lcd_text; |
| 109 inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text; | |
| 110 inputs.can_adjust_raster_scales = true; | 106 inputs.can_adjust_raster_scales = true; |
| 111 | 107 |
| 112 ++render_surface_layer_list_count_; | 108 ++render_surface_layer_list_count_; |
| 113 inputs.current_render_surface_layer_list_id = | 109 inputs.current_render_surface_layer_list_id = |
| 114 render_surface_layer_list_count_; | 110 render_surface_layer_list_count_; |
| 115 | 111 |
| 116 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 112 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 117 } | 113 } |
| 118 | 114 |
| 119 scoped_ptr<FakeLayerTreeHost> | 115 scoped_ptr<FakeLayerTreeHost> |
| 120 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() { | 116 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() { |
| 121 return FakeLayerTreeHost::Create(&client_); | 117 return FakeLayerTreeHost::Create(&client_); |
| 122 } | 118 } |
| 123 | 119 |
| 124 } // namespace cc | 120 } // namespace cc |
| OLD | NEW |