| 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/draw_property_utils.h" | 10 #include "cc/trees/draw_property_utils.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 gfx::Transform identity_matrix; | 146 gfx::Transform identity_matrix; |
| 147 gfx::Size device_viewport_size = | 147 gfx::Size device_viewport_size = |
| 148 gfx::Size(root_layer->bounds().width() * device_scale_factor, | 148 gfx::Size(root_layer->bounds().width() * device_scale_factor, |
| 149 root_layer->bounds().height() * device_scale_factor); | 149 root_layer->bounds().height() * device_scale_factor); |
| 150 | 150 |
| 151 render_surface_layer_list_impl_.reset(new LayerImplList); | 151 render_surface_layer_list_impl_.reset(new LayerImplList); |
| 152 | 152 |
| 153 // We are probably not testing what is intended if the root_layer bounds are | 153 // We are probably not testing what is intended if the root_layer bounds are |
| 154 // empty. | 154 // empty. |
| 155 DCHECK(!root_layer->bounds().IsEmpty()); | 155 DCHECK(!root_layer->bounds().IsEmpty()); |
| 156 root_layer->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 156 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 157 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 157 root_layer, device_viewport_size, render_surface_layer_list_impl_.get()); | 158 root_layer, device_viewport_size, render_surface_layer_list_impl_.get(), |
| 159 root_layer->layer_tree_impl()->current_render_surface_list_id()); |
| 158 inputs.device_scale_factor = device_scale_factor; | 160 inputs.device_scale_factor = device_scale_factor; |
| 159 inputs.page_scale_factor = page_scale_factor; | 161 inputs.page_scale_factor = page_scale_factor; |
| 160 inputs.page_scale_layer = page_scale_layer; | 162 inputs.page_scale_layer = page_scale_layer; |
| 161 inputs.can_use_lcd_text = can_use_lcd_text; | 163 inputs.can_use_lcd_text = can_use_lcd_text; |
| 162 inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text; | 164 inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text; |
| 163 inputs.can_adjust_raster_scales = true; | 165 inputs.can_adjust_raster_scales = true; |
| 164 | 166 |
| 165 ++render_surface_layer_list_count_; | 167 render_surface_layer_list_count_ = |
| 166 inputs.current_render_surface_layer_list_id = | 168 inputs.current_render_surface_layer_list_id; |
| 167 render_surface_layer_list_count_; | |
| 168 | 169 |
| 169 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 170 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void LayerTreeHostCommonTestBase:: | 173 void LayerTreeHostCommonTestBase:: |
| 173 ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( | 174 ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( |
| 174 LayerImpl* root_layer) { | 175 LayerImpl* root_layer) { |
| 175 gfx::Transform identity_matrix; | 176 gfx::Transform identity_matrix; |
| 176 gfx::Size device_viewport_size = | 177 gfx::Size device_viewport_size = |
| 177 gfx::Size(root_layer->bounds().width(), root_layer->bounds().height()); | 178 gfx::Size(root_layer->bounds().width(), root_layer->bounds().height()); |
| 178 render_surface_layer_list_impl_.reset(new LayerImplList); | 179 render_surface_layer_list_impl_.reset(new LayerImplList); |
| 179 | 180 |
| 180 DCHECK(!root_layer->bounds().IsEmpty()); | 181 DCHECK(!root_layer->bounds().IsEmpty()); |
| 182 root_layer->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 181 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 183 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 182 root_layer, device_viewport_size, render_surface_layer_list_impl_.get()); | 184 root_layer, device_viewport_size, render_surface_layer_list_impl_.get(), |
| 185 root_layer->layer_tree_impl()->current_render_surface_list_id()); |
| 183 inputs.can_adjust_raster_scales = true; | 186 inputs.can_adjust_raster_scales = true; |
| 184 inputs.can_render_to_separate_surface = false; | 187 inputs.can_render_to_separate_surface = false; |
| 185 | 188 |
| 186 ++render_surface_layer_list_count_; | 189 render_surface_layer_list_count_ = |
| 187 inputs.current_render_surface_layer_list_id = | 190 inputs.current_render_surface_layer_list_id; |
| 188 render_surface_layer_list_count_; | |
| 189 | 191 |
| 190 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 192 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 191 } | 193 } |
| 192 | 194 |
| 193 bool LayerTreeHostCommonTestBase::UpdateLayerListContains(int id) const { | 195 bool LayerTreeHostCommonTestBase::UpdateLayerListContains(int id) const { |
| 194 for (size_t i = 0; i < update_layer_list_.size(); ++i) { | 196 for (size_t i = 0; i < update_layer_list_.size(); ++i) { |
| 195 if (update_layer_list_[i]->id() == id) | 197 if (update_layer_list_[i]->id() == id) |
| 196 return true; | 198 return true; |
| 197 } | 199 } |
| 198 return false; | 200 return false; |
| 199 } | 201 } |
| 200 | 202 |
| 201 LayerTreeHostCommonTest::LayerTreeHostCommonTest() | 203 LayerTreeHostCommonTest::LayerTreeHostCommonTest() |
| 202 : LayerTreeHostCommonTestBase(LayerTreeSettings()) { | 204 : LayerTreeHostCommonTestBase(LayerTreeSettings()) { |
| 203 } | 205 } |
| 204 | 206 |
| 205 LayerTreeHostCommonTest::LayerTreeHostCommonTest( | 207 LayerTreeHostCommonTest::LayerTreeHostCommonTest( |
| 206 const LayerTreeSettings& settings) | 208 const LayerTreeSettings& settings) |
| 207 : LayerTreeHostCommonTestBase(settings) { | 209 : LayerTreeHostCommonTestBase(settings) { |
| 208 } | 210 } |
| 209 | 211 |
| 210 } // namespace cc | 212 } // namespace cc |
| OLD | NEW |