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