OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "cc/layers/append_quads_data.h" | 12 #include "cc/layers/append_quads_data.h" |
13 #include "cc/layers/picture_layer.h" | 13 #include "cc/layers/picture_layer.h" |
14 #include "cc/test/fake_content_layer_client.h" | 14 #include "cc/test/fake_content_layer_client.h" |
15 #include "cc/test/fake_impl_proxy.h" | 15 #include "cc/test/fake_impl_proxy.h" |
16 #include "cc/test/fake_layer_tree_host_impl.h" | 16 #include "cc/test/fake_layer_tree_host_impl.h" |
17 #include "cc/test/fake_output_surface.h" | 17 #include "cc/test/fake_output_surface.h" |
18 #include "cc/test/fake_picture_layer_impl.h" | 18 #include "cc/test/fake_picture_layer_impl.h" |
19 #include "cc/test/fake_picture_pile_impl.h" | 19 #include "cc/test/fake_picture_pile_impl.h" |
20 #include "cc/test/geometry_test_utils.h" | 20 #include "cc/test/geometry_test_utils.h" |
21 #include "cc/test/impl_side_painting_settings.h" | 21 #include "cc/test/impl_side_painting_settings.h" |
22 #include "cc/test/layer_test_common.h" | 22 #include "cc/test/layer_test_common.h" |
23 #include "cc/test/mock_quad_culler.h" | 23 #include "cc/test/mock_quad_culler.h" |
24 #include "cc/test/test_shared_bitmap_manager.h" | 24 #include "cc/test/test_shared_bitmap_manager.h" |
25 #include "cc/test/test_web_graphics_context_3d.h" | 25 #include "cc/test/test_web_graphics_context_3d.h" |
26 #include "cc/trees/layer_tree_impl.h" | 26 #include "cc/trees/layer_tree_impl.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 #include "ui/gfx/rect_conversions.h" | 28 #include "ui/gfx/rect_conversions.h" |
29 #include "ui/gfx/size_conversions.h" | |
29 | 30 |
30 namespace cc { | 31 namespace cc { |
31 namespace { | 32 namespace { |
32 | 33 |
33 class MockCanvas : public SkCanvas { | 34 class MockCanvas : public SkCanvas { |
34 public: | 35 public: |
35 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {} | 36 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {} |
36 | 37 |
37 virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE { | 38 virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE { |
38 // Capture calls before SkCanvas quickReject() kicks in. | 39 // Capture calls before SkCanvas quickReject() kicks in. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); | 134 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); |
134 pending_layer->SetDrawsContent(true); | 135 pending_layer->SetDrawsContent(true); |
135 pending_layer->SetAnchorPoint(gfx::PointF()); | 136 pending_layer->SetAnchorPoint(gfx::PointF()); |
136 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); | 137 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); |
137 | 138 |
138 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 139 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
139 host_impl_.pending_tree()->LayerById(id_)); | 140 host_impl_.pending_tree()->LayerById(id_)); |
140 pending_layer_->DoPostCommitInitializationIfNeeded(); | 141 pending_layer_->DoPostCommitInitializationIfNeeded(); |
141 } | 142 } |
142 | 143 |
144 void SetupDrawPropertiesAndManageTilings( | |
145 FakePictureLayerImpl* layer, | |
146 float ideal_contents_scale, | |
147 float device_scale_factor, | |
148 float page_scale_factor, | |
149 float maximum_animation_contents_scale, | |
150 bool animating_transform_to_screen) { | |
151 layer->draw_properties().ideal_contents_scale = ideal_contents_scale; | |
152 layer->draw_properties().device_scale_factor = device_scale_factor; | |
153 layer->draw_properties().page_scale_factor = page_scale_factor; | |
154 layer->draw_properties().maximum_animation_contents_scale = | |
155 maximum_animation_contents_scale; | |
156 layer->draw_properties().screen_space_transform_is_animating = | |
157 animating_transform_to_screen; | |
158 layer->ScaleAndManageTilings(animating_transform_to_screen, | |
danakj
2014/06/02 11:22:11
Similar question, wondering why this can't call Up
| |
159 maximum_animation_contents_scale); | |
160 } | |
143 static void VerifyAllTilesExistAndHavePile( | 161 static void VerifyAllTilesExistAndHavePile( |
144 const PictureLayerTiling* tiling, | 162 const PictureLayerTiling* tiling, |
145 PicturePileImpl* pile) { | 163 PicturePileImpl* pile) { |
146 for (PictureLayerTiling::CoverageIterator iter( | 164 for (PictureLayerTiling::CoverageIterator iter( |
147 tiling, tiling->contents_scale(), tiling->TilingRect()); | 165 tiling, tiling->contents_scale(), tiling->TilingRect()); |
148 iter; | 166 iter; |
149 ++iter) { | 167 ++iter) { |
150 EXPECT_TRUE(*iter); | 168 EXPECT_TRUE(*iter); |
151 EXPECT_EQ(pile, iter->picture_pile()); | 169 EXPECT_EQ(pile, iter->picture_pile()); |
152 } | 170 } |
153 } | 171 } |
154 | 172 |
155 void SetContentsScaleOnBothLayers(float contents_scale, | 173 void SetContentsScaleOnBothLayers(float contents_scale, |
156 float device_scale_factor, | 174 float device_scale_factor, |
157 float page_scale_factor, | 175 float page_scale_factor, |
158 float maximum_animation_contents_scale, | 176 float maximum_animation_contents_scale, |
159 bool animating_transform) { | 177 bool animating_transform) { |
160 float result_scale_x, result_scale_y; | 178 SetupDrawPropertiesAndManageTilings(pending_layer_, |
161 gfx::Size result_bounds; | 179 contents_scale, |
162 pending_layer_->CalculateContentsScale(contents_scale, | 180 device_scale_factor, |
163 device_scale_factor, | 181 page_scale_factor, |
164 page_scale_factor, | 182 maximum_animation_contents_scale, |
165 maximum_animation_contents_scale, | 183 animating_transform); |
166 animating_transform, | 184 |
167 &result_scale_x, | 185 SetupDrawPropertiesAndManageTilings(active_layer_, |
168 &result_scale_y, | 186 contents_scale, |
169 &result_bounds); | 187 device_scale_factor, |
170 active_layer_->CalculateContentsScale(contents_scale, | 188 page_scale_factor, |
171 device_scale_factor, | 189 maximum_animation_contents_scale, |
172 page_scale_factor, | 190 animating_transform); |
173 maximum_animation_contents_scale, | |
174 animating_transform, | |
175 &result_scale_x, | |
176 &result_scale_y, | |
177 &result_bounds); | |
178 } | 191 } |
179 | 192 |
180 void ResetTilingsAndRasterScales() { | 193 void ResetTilingsAndRasterScales() { |
181 pending_layer_->ReleaseResources(); | 194 pending_layer_->ReleaseResources(); |
182 active_layer_->ReleaseResources(); | 195 active_layer_->ReleaseResources(); |
183 } | 196 } |
184 | 197 |
185 void AssertAllTilesRequired(PictureLayerTiling* tiling) { | 198 void AssertAllTilesRequired(PictureLayerTiling* tiling) { |
186 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 199 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
187 for (size_t i = 0; i < tiles.size(); ++i) | 200 for (size_t i = 0; i < tiles.size(); ++i) |
(...skipping 16 matching lines...) Expand all Loading... | |
204 settings.default_tile_size.width() * 7 / 2, | 217 settings.default_tile_size.width() * 7 / 2, |
205 settings.default_tile_size.height() * 7 / 2); | 218 settings.default_tile_size.height() * 7 / 2); |
206 | 219 |
207 scoped_refptr<FakePicturePileImpl> pending_pile = | 220 scoped_refptr<FakePicturePileImpl> pending_pile = |
208 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); | 221 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); |
209 scoped_refptr<FakePicturePileImpl> active_pile = | 222 scoped_refptr<FakePicturePileImpl> active_pile = |
210 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); | 223 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); |
211 | 224 |
212 SetupTrees(pending_pile, active_pile); | 225 SetupTrees(pending_pile, active_pile); |
213 | 226 |
214 float result_scale_x, result_scale_y; | 227 SetupDrawPropertiesAndManageTilings( |
215 gfx::Size result_bounds; | 228 active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
216 active_layer_->CalculateContentsScale(1.f, | |
217 1.f, | |
218 1.f, | |
219 1.f, | |
220 false, | |
221 &result_scale_x, | |
222 &result_scale_y, | |
223 &result_bounds); | |
224 | 229 |
225 // Add 1x1 rects at the centers of each tile, then re-record pile contents | 230 // Add 1x1 rects at the centers of each tile, then re-record pile contents |
226 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 231 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
227 std::vector<Tile*> tiles = | 232 std::vector<Tile*> tiles = |
228 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 233 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
229 EXPECT_EQ(16u, tiles.size()); | 234 EXPECT_EQ(16u, tiles.size()); |
230 std::vector<SkRect> rects; | 235 std::vector<SkRect> rects; |
231 std::vector<Tile*>::const_iterator tile_iter; | 236 std::vector<Tile*>::const_iterator tile_iter; |
232 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { | 237 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { |
233 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint(); | 238 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 scoped_refptr<FakePicturePileImpl> active_pile = | 313 scoped_refptr<FakePicturePileImpl> active_pile = |
309 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 314 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
310 | 315 |
311 SetupTrees(pending_pile, active_pile); | 316 SetupTrees(pending_pile, active_pile); |
312 | 317 |
313 std::vector<TileManager::PairedPictureLayer> paired_layers; | 318 std::vector<TileManager::PairedPictureLayer> paired_layers; |
314 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 319 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
315 EXPECT_EQ(0u, paired_layers.size()); | 320 EXPECT_EQ(0u, paired_layers.size()); |
316 | 321 |
317 // Update tile priorities will force the layer to register itself. | 322 // Update tile priorities will force the layer to register itself. |
318 float dummy_contents_scale_x; | 323 SetupDrawPropertiesAndManageTilings(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
319 float dummy_contents_scale_y; | |
320 gfx::Size dummy_content_bounds; | |
321 active_layer_->CalculateContentsScale(1.f, | |
322 1.f, | |
323 1.f, | |
324 1.f, | |
325 false, | |
326 &dummy_contents_scale_x, | |
327 &dummy_contents_scale_y, | |
328 &dummy_content_bounds); | |
329 active_layer_->UpdateTilePriorities(); | 324 active_layer_->UpdateTilePriorities(); |
330 host_impl_.pending_tree()->UpdateDrawProperties(); | 325 host_impl_.pending_tree()->UpdateDrawProperties(); |
331 pending_layer_->CalculateContentsScale(1.f, | 326 |
332 1.f, | 327 SetupDrawPropertiesAndManageTilings( |
333 1.f, | 328 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
334 1.f, | |
335 false, | |
336 &dummy_contents_scale_x, | |
337 &dummy_contents_scale_y, | |
338 &dummy_content_bounds); | |
339 pending_layer_->UpdateTilePriorities(); | 329 pending_layer_->UpdateTilePriorities(); |
340 | 330 |
341 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 331 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
342 EXPECT_EQ(1u, paired_layers.size()); | 332 EXPECT_EQ(1u, paired_layers.size()); |
343 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); | 333 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); |
344 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); | 334 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); |
345 | 335 |
346 // Destroy and recreate tile manager. | 336 // Destroy and recreate tile manager. |
347 host_impl_.DidLoseOutputSurface(); | 337 host_impl_.DidLoseOutputSurface(); |
348 scoped_ptr<TestWebGraphicsContext3D> context = | 338 scoped_ptr<TestWebGraphicsContext3D> context = |
349 TestWebGraphicsContext3D::Create(); | 339 TestWebGraphicsContext3D::Create(); |
350 host_impl_.InitializeRenderer( | 340 host_impl_.InitializeRenderer( |
351 FakeOutputSurface::Create3d(context.Pass()).PassAs<OutputSurface>()); | 341 FakeOutputSurface::Create3d(context.Pass()).PassAs<OutputSurface>()); |
352 | 342 |
353 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 343 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
354 EXPECT_EQ(0u, paired_layers.size()); | 344 EXPECT_EQ(0u, paired_layers.size()); |
355 | 345 |
356 active_layer_->CalculateContentsScale(1.f, | 346 SetupDrawPropertiesAndManageTilings(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
357 1.f, | |
358 1.f, | |
359 1.f, | |
360 false, | |
361 &dummy_contents_scale_x, | |
362 &dummy_contents_scale_y, | |
363 &dummy_content_bounds); | |
364 active_layer_->UpdateTilePriorities(); | 347 active_layer_->UpdateTilePriorities(); |
365 host_impl_.pending_tree()->UpdateDrawProperties(); | 348 host_impl_.pending_tree()->UpdateDrawProperties(); |
366 pending_layer_->CalculateContentsScale(1.f, | 349 |
367 1.f, | 350 SetupDrawPropertiesAndManageTilings( |
368 1.f, | 351 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
369 1.f, | |
370 false, | |
371 &dummy_contents_scale_x, | |
372 &dummy_contents_scale_y, | |
373 &dummy_content_bounds); | |
374 pending_layer_->UpdateTilePriorities(); | 352 pending_layer_->UpdateTilePriorities(); |
375 | 353 |
376 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 354 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
377 EXPECT_EQ(1u, paired_layers.size()); | 355 EXPECT_EQ(1u, paired_layers.size()); |
378 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); | 356 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); |
379 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); | 357 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); |
380 } | 358 } |
381 | 359 |
382 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { | 360 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { |
383 base::TimeTicks time_ticks; | 361 base::TimeTicks time_ticks; |
384 host_impl_.SetCurrentFrameTimeTicks(time_ticks); | 362 host_impl_.SetCurrentFrameTimeTicks(time_ticks); |
385 | 363 |
386 gfx::Size tile_size(100, 100); | 364 gfx::Size tile_size(100, 100); |
387 gfx::Size layer_bounds(400, 400); | 365 gfx::Size layer_bounds(400, 400); |
388 | 366 |
389 scoped_refptr<FakePicturePileImpl> pending_pile = | 367 scoped_refptr<FakePicturePileImpl> pending_pile = |
390 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 368 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
391 scoped_refptr<FakePicturePileImpl> active_pile = | 369 scoped_refptr<FakePicturePileImpl> active_pile = |
392 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 370 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
393 | 371 |
394 SetupTrees(pending_pile, active_pile); | 372 SetupTrees(pending_pile, active_pile); |
395 | 373 |
396 Region invalidation; | 374 Region invalidation; |
397 AddDefaultTilingsWithInvalidation(invalidation); | 375 AddDefaultTilingsWithInvalidation(invalidation); |
398 float dummy_contents_scale_x; | 376 SetupDrawPropertiesAndManageTilings(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
399 float dummy_contents_scale_y; | |
400 gfx::Size dummy_content_bounds; | |
401 active_layer_->CalculateContentsScale(1.f, | |
402 1.f, | |
403 1.f, | |
404 1.f, | |
405 false, | |
406 &dummy_contents_scale_x, | |
407 &dummy_contents_scale_y, | |
408 &dummy_content_bounds); | |
409 | 377 |
410 // UpdateTilePriorities with valid viewport. Should update tile viewport. | 378 // UpdateTilePriorities with valid viewport. Should update tile viewport. |
411 bool valid_for_tile_management = true; | 379 bool valid_for_tile_management = true; |
412 gfx::Rect viewport = gfx::Rect(layer_bounds); | 380 gfx::Rect viewport = gfx::Rect(layer_bounds); |
413 gfx::Transform transform; | 381 gfx::Transform transform; |
414 host_impl_.SetExternalDrawConstraints( | 382 host_impl_.SetExternalDrawConstraints( |
415 transform, viewport, viewport, valid_for_tile_management); | 383 transform, viewport, viewport, valid_for_tile_management); |
416 active_layer_->draw_properties().visible_content_rect = viewport; | 384 active_layer_->draw_properties().visible_content_rect = viewport; |
417 active_layer_->draw_properties().screen_space_transform = transform; | 385 active_layer_->draw_properties().screen_space_transform = transform; |
418 active_layer_->UpdateTilePriorities(); | 386 active_layer_->UpdateTilePriorities(); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
655 | 623 |
656 TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) { | 624 TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) { |
657 gfx::Size tile_size(400, 400); | 625 gfx::Size tile_size(400, 400); |
658 gfx::Size layer_bounds(1300, 1900); | 626 gfx::Size layer_bounds(1300, 1900); |
659 | 627 |
660 scoped_refptr<FakePicturePileImpl> pending_pile = | 628 scoped_refptr<FakePicturePileImpl> pending_pile = |
661 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 629 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
662 scoped_refptr<FakePicturePileImpl> active_pile = | 630 scoped_refptr<FakePicturePileImpl> active_pile = |
663 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 631 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
664 | 632 |
665 float result_scale_x, result_scale_y; | |
666 gfx::Size result_bounds; | |
667 | |
668 SetupTrees(pending_pile, active_pile); | 633 SetupTrees(pending_pile, active_pile); |
669 | 634 |
670 pending_layer_->CalculateContentsScale(1.f, | 635 SetupDrawPropertiesAndManageTilings( |
671 1.f, | 636 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
672 1.f, | |
673 1.f, | |
674 false, | |
675 &result_scale_x, | |
676 &result_scale_y, | |
677 &result_bounds); | |
678 | 637 |
679 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 638 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
680 } | 639 } |
681 | 640 |
682 TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) { | 641 TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) { |
683 gfx::Size tile_size(400, 400); | 642 gfx::Size tile_size(400, 400); |
684 gfx::Size layer_bounds(1300, 1900); | 643 gfx::Size layer_bounds(1300, 1900); |
685 | 644 |
686 scoped_refptr<FakePicturePileImpl> pending_pile = | 645 scoped_refptr<FakePicturePileImpl> pending_pile = |
687 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 646 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
688 scoped_refptr<FakePicturePileImpl> active_pile = | 647 scoped_refptr<FakePicturePileImpl> active_pile = |
689 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 648 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
690 | 649 |
691 float result_scale_x, result_scale_y; | |
692 gfx::Size result_bounds; | |
693 | |
694 SetupTrees(pending_pile, active_pile); | 650 SetupTrees(pending_pile, active_pile); |
695 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 651 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
696 | 652 |
697 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 653 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
698 EXPECT_LT(low_res_factor, 1.f); | 654 EXPECT_LT(low_res_factor, 1.f); |
699 | 655 |
700 pending_layer_->CalculateContentsScale(6.f, // ideal contents scale | 656 SetupDrawPropertiesAndManageTilings(pending_layer_, |
701 3.f, // device scale | 657 6.f, // ideal contents scale |
702 2.f, // page scale | 658 3.f, // device scale |
703 1.f, // maximum animation scale | 659 2.f, // page scale |
704 false, | 660 1.f, // maximum animation scale |
705 &result_scale_x, | 661 false); |
706 &result_scale_y, | |
707 &result_bounds); | |
708 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 662 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
709 EXPECT_FLOAT_EQ(6.f, | 663 EXPECT_FLOAT_EQ(6.f, |
710 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 664 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
711 EXPECT_FLOAT_EQ(6.f * low_res_factor, | 665 EXPECT_FLOAT_EQ(6.f * low_res_factor, |
712 pending_layer_->tilings()->tiling_at(1)->contents_scale()); | 666 pending_layer_->tilings()->tiling_at(1)->contents_scale()); |
713 | 667 |
714 // If we change the page scale factor, then we should get new tilings. | 668 // If we change the page scale factor, then we should get new tilings. |
715 pending_layer_->CalculateContentsScale(6.6f, // ideal contents scale | 669 SetupDrawPropertiesAndManageTilings(pending_layer_, |
716 3.f, // device scale | 670 6.6f, // ideal contents scale |
717 2.2f, // page scale | 671 3.f, // device scale |
718 1.f, // maximum animation scale | 672 2.2f, // page scale |
719 false, | 673 1.f, // maximum animation scale |
720 &result_scale_x, | 674 false); |
721 &result_scale_y, | |
722 &result_bounds); | |
723 ASSERT_EQ(4u, pending_layer_->tilings()->num_tilings()); | 675 ASSERT_EQ(4u, pending_layer_->tilings()->num_tilings()); |
724 EXPECT_FLOAT_EQ(6.6f, | 676 EXPECT_FLOAT_EQ(6.6f, |
725 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 677 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
726 EXPECT_FLOAT_EQ(6.6f * low_res_factor, | 678 EXPECT_FLOAT_EQ(6.6f * low_res_factor, |
727 pending_layer_->tilings()->tiling_at(2)->contents_scale()); | 679 pending_layer_->tilings()->tiling_at(2)->contents_scale()); |
728 | 680 |
729 // If we change the device scale factor, then we should get new tilings. | 681 // If we change the device scale factor, then we should get new tilings. |
730 pending_layer_->CalculateContentsScale(7.26f, // ideal contents scale | 682 SetupDrawPropertiesAndManageTilings(pending_layer_, |
731 3.3f, // device scale | 683 7.26f, // ideal contents scale |
732 2.2f, // page scale | 684 3.3f, // device scale |
733 1.f, // maximum animation scale | 685 2.2f, // page scale |
734 false, | 686 1.f, // maximum animation scale |
735 &result_scale_x, | 687 false); |
736 &result_scale_y, | |
737 &result_bounds); | |
738 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings()); | 688 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings()); |
739 EXPECT_FLOAT_EQ(7.26f, | 689 EXPECT_FLOAT_EQ(7.26f, |
740 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 690 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
741 EXPECT_FLOAT_EQ(7.26f * low_res_factor, | 691 EXPECT_FLOAT_EQ(7.26f * low_res_factor, |
742 pending_layer_->tilings()->tiling_at(3)->contents_scale()); | 692 pending_layer_->tilings()->tiling_at(3)->contents_scale()); |
743 | 693 |
744 // If we change the device scale factor, but end up at the same total scale | 694 // If we change the device scale factor, but end up at the same total scale |
745 // factor somehow, then we don't get new tilings. | 695 // factor somehow, then we don't get new tilings. |
746 pending_layer_->CalculateContentsScale(7.26f, // ideal contents scale | 696 SetupDrawPropertiesAndManageTilings(pending_layer_, |
747 2.2f, // device scale | 697 7.26f, // ideal contents scale |
748 3.3f, // page scale | 698 2.2f, // device scale |
749 1.f, // maximum animation scale | 699 3.3f, // page scale |
750 false, | 700 1.f, // maximum animation scale |
751 &result_scale_x, | 701 false); |
752 &result_scale_y, | |
753 &result_bounds); | |
754 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings()); | 702 ASSERT_EQ(6u, pending_layer_->tilings()->num_tilings()); |
755 EXPECT_FLOAT_EQ(7.26f, | 703 EXPECT_FLOAT_EQ(7.26f, |
756 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 704 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
757 EXPECT_FLOAT_EQ(7.26f * low_res_factor, | 705 EXPECT_FLOAT_EQ(7.26f * low_res_factor, |
758 pending_layer_->tilings()->tiling_at(3)->contents_scale()); | 706 pending_layer_->tilings()->tiling_at(3)->contents_scale()); |
759 } | 707 } |
760 | 708 |
761 TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { | 709 TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { |
762 // This test makes sure that if a layer can have tilings, then a commit makes | 710 // This test makes sure that if a layer can have tilings, then a commit makes |
763 // it not able to have tilings (empty size), and then a future commit that | 711 // it not able to have tilings (empty size), and then a future commit that |
764 // makes it valid again should be able to create tilings. | 712 // makes it valid again should be able to create tilings. |
765 gfx::Size tile_size(400, 400); | 713 gfx::Size tile_size(400, 400); |
766 gfx::Size layer_bounds(1300, 1900); | 714 gfx::Size layer_bounds(1300, 1900); |
767 | 715 |
768 scoped_refptr<FakePicturePileImpl> empty_pile = | 716 scoped_refptr<FakePicturePileImpl> empty_pile = |
769 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 717 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
770 scoped_refptr<FakePicturePileImpl> valid_pile = | 718 scoped_refptr<FakePicturePileImpl> valid_pile = |
771 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 719 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
772 | 720 |
773 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 721 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
774 EXPECT_LT(low_res_factor, 1.f); | 722 EXPECT_LT(low_res_factor, 1.f); |
775 | 723 |
776 float high_res_scale = 1.3f; | 724 float high_res_scale = 1.3f; |
777 float low_res_scale = high_res_scale * low_res_factor; | 725 float low_res_scale = high_res_scale * low_res_factor; |
778 float device_scale = 1.7f; | 726 float device_scale = 1.7f; |
779 float page_scale = 3.2f; | 727 float page_scale = 3.2f; |
780 float maximum_animation_scale = 1.f; | 728 float maximum_animation_scale = 1.f; |
781 float result_scale_x, result_scale_y; | |
782 gfx::Size result_bounds; | |
783 | 729 |
784 SetupPendingTree(valid_pile); | 730 SetupPendingTree(valid_pile); |
785 pending_layer_->CalculateContentsScale(high_res_scale, | 731 SetupDrawPropertiesAndManageTilings(pending_layer_, |
786 device_scale, | 732 high_res_scale, |
787 page_scale, | 733 device_scale, |
788 maximum_animation_scale, | 734 page_scale, |
789 false, | 735 maximum_animation_scale, |
790 &result_scale_x, | 736 false); |
791 &result_scale_y, | |
792 &result_bounds); | |
793 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 737 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
794 EXPECT_FLOAT_EQ(high_res_scale, | 738 EXPECT_FLOAT_EQ(high_res_scale, |
795 pending_layer_->HighResTiling()->contents_scale()); | 739 pending_layer_->HighResTiling()->contents_scale()); |
796 EXPECT_FLOAT_EQ(low_res_scale, | 740 EXPECT_FLOAT_EQ(low_res_scale, |
797 pending_layer_->LowResTiling()->contents_scale()); | 741 pending_layer_->LowResTiling()->contents_scale()); |
798 | 742 |
799 ActivateTree(); | 743 ActivateTree(); |
800 SetupPendingTree(empty_pile); | 744 SetupPendingTree(empty_pile); |
801 pending_layer_->CalculateContentsScale(high_res_scale, | 745 SetupDrawPropertiesAndManageTilings(pending_layer_, |
802 device_scale, | 746 high_res_scale, |
803 page_scale, | 747 device_scale, |
804 maximum_animation_scale, | 748 page_scale, |
805 false, | 749 maximum_animation_scale, |
806 &result_scale_x, | 750 false); |
807 &result_scale_y, | |
808 &result_bounds); | |
809 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 751 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
810 ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 752 ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
811 | 753 |
812 ActivateTree(); | 754 ActivateTree(); |
813 active_layer_->CalculateContentsScale(high_res_scale, | 755 SetupDrawPropertiesAndManageTilings(active_layer_, |
814 device_scale, | 756 high_res_scale, |
815 page_scale, | 757 device_scale, |
816 maximum_animation_scale, | 758 page_scale, |
817 false, | 759 maximum_animation_scale, |
818 &result_scale_x, | 760 false); |
819 &result_scale_y, | |
820 &result_bounds); | |
821 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); | 761 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); |
822 | 762 |
823 SetupPendingTree(valid_pile); | 763 SetupPendingTree(valid_pile); |
824 pending_layer_->CalculateContentsScale(high_res_scale, | 764 SetupDrawPropertiesAndManageTilings(pending_layer_, |
825 device_scale, | 765 high_res_scale, |
826 page_scale, | 766 device_scale, |
827 maximum_animation_scale, | 767 page_scale, |
828 false, | 768 maximum_animation_scale, |
829 &result_scale_x, | 769 false); |
830 &result_scale_y, | |
831 &result_bounds); | |
832 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 770 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
833 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); | 771 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); |
834 EXPECT_FLOAT_EQ(high_res_scale, | 772 EXPECT_FLOAT_EQ(high_res_scale, |
835 pending_layer_->HighResTiling()->contents_scale()); | 773 pending_layer_->HighResTiling()->contents_scale()); |
836 EXPECT_FLOAT_EQ(low_res_scale, | 774 EXPECT_FLOAT_EQ(low_res_scale, |
837 pending_layer_->LowResTiling()->contents_scale()); | 775 pending_layer_->LowResTiling()->contents_scale()); |
838 } | 776 } |
839 | 777 |
840 TEST_F(PictureLayerImplTest, ZoomOutCrash) { | 778 TEST_F(PictureLayerImplTest, ZoomOutCrash) { |
841 gfx::Size tile_size(400, 400); | 779 gfx::Size tile_size(400, 400); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
955 | 893 |
956 TEST_F(PictureLayerImplTest, CleanUpTilings) { | 894 TEST_F(PictureLayerImplTest, CleanUpTilings) { |
957 gfx::Size tile_size(400, 400); | 895 gfx::Size tile_size(400, 400); |
958 gfx::Size layer_bounds(1300, 1900); | 896 gfx::Size layer_bounds(1300, 1900); |
959 | 897 |
960 scoped_refptr<FakePicturePileImpl> pending_pile = | 898 scoped_refptr<FakePicturePileImpl> pending_pile = |
961 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 899 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
962 scoped_refptr<FakePicturePileImpl> active_pile = | 900 scoped_refptr<FakePicturePileImpl> active_pile = |
963 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 901 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
964 | 902 |
965 float result_scale_x, result_scale_y; | |
966 gfx::Size result_bounds; | |
967 std::vector<PictureLayerTiling*> used_tilings; | 903 std::vector<PictureLayerTiling*> used_tilings; |
968 | 904 |
969 SetupTrees(pending_pile, active_pile); | 905 SetupTrees(pending_pile, active_pile); |
970 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 906 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
971 | 907 |
972 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 908 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
973 EXPECT_LT(low_res_factor, 1.f); | 909 EXPECT_LT(low_res_factor, 1.f); |
974 | 910 |
975 float device_scale = 1.7f; | 911 float device_scale = 1.7f; |
976 float page_scale = 3.2f; | 912 float page_scale = 3.2f; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1030 // Now move the ideal scale to 1.0. Our target stays 1.2. | 966 // Now move the ideal scale to 1.0. Our target stays 1.2. |
1031 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false); | 967 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false); |
1032 | 968 |
1033 // All the tilings are between are target and the ideal, so they are not | 969 // All the tilings are between are target and the ideal, so they are not |
1034 // removed. | 970 // removed. |
1035 used_tilings.clear(); | 971 used_tilings.clear(); |
1036 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 972 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
1037 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); | 973 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); |
1038 | 974 |
1039 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. | 975 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. |
1040 active_layer_->CalculateContentsScale(1.1f, | 976 SetupDrawPropertiesAndManageTilings( |
1041 device_scale, | 977 active_layer_, 1.1f, device_scale, page_scale, 1.f, false); |
1042 page_scale, | |
1043 1.f, | |
1044 false, | |
1045 &result_scale_x, | |
1046 &result_scale_y, | |
1047 &result_bounds); | |
1048 | 978 |
1049 // Because the pending layer's ideal scale is still 1.0, our tilings fall | 979 // Because the pending layer's ideal scale is still 1.0, our tilings fall |
1050 // in the range [1.0,1.2] and are kept. | 980 // in the range [1.0,1.2] and are kept. |
1051 used_tilings.clear(); | 981 used_tilings.clear(); |
1052 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 982 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
1053 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); | 983 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); |
1054 | 984 |
1055 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays | 985 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays |
1056 // 1.2 still. | 986 // 1.2 still. |
1057 pending_layer_->CalculateContentsScale(1.1f, | 987 SetupDrawPropertiesAndManageTilings( |
1058 device_scale, | 988 pending_layer_, 1.1f, device_scale, page_scale, 1.f, false); |
1059 page_scale, | |
1060 1.f, | |
1061 false, | |
1062 &result_scale_x, | |
1063 &result_scale_y, | |
1064 &result_bounds); | |
1065 | 989 |
1066 // Our 1.0 tiling now falls outside the range between our ideal scale and our | 990 // Our 1.0 tiling now falls outside the range between our ideal scale and our |
1067 // target raster scale. But it is in our used tilings set, so nothing is | 991 // target raster scale. But it is in our used tilings set, so nothing is |
1068 // deleted. | 992 // deleted. |
1069 used_tilings.clear(); | 993 used_tilings.clear(); |
1070 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); | 994 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
1071 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 995 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
1072 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); | 996 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); |
1073 | 997 |
1074 // If we remove it from our used tilings set, it is outside the range to keep | 998 // If we remove it from our used tilings set, it is outside the range to keep |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 | 1132 |
1209 TEST_F(PictureLayerImplTest, ReleaseResources) { | 1133 TEST_F(PictureLayerImplTest, ReleaseResources) { |
1210 gfx::Size tile_size(400, 400); | 1134 gfx::Size tile_size(400, 400); |
1211 gfx::Size layer_bounds(1300, 1900); | 1135 gfx::Size layer_bounds(1300, 1900); |
1212 | 1136 |
1213 scoped_refptr<FakePicturePileImpl> pending_pile = | 1137 scoped_refptr<FakePicturePileImpl> pending_pile = |
1214 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1138 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1215 scoped_refptr<FakePicturePileImpl> active_pile = | 1139 scoped_refptr<FakePicturePileImpl> active_pile = |
1216 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1140 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1217 | 1141 |
1218 float result_scale_x, result_scale_y; | |
1219 gfx::Size result_bounds; | |
1220 | |
1221 SetupTrees(pending_pile, active_pile); | 1142 SetupTrees(pending_pile, active_pile); |
1222 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 1143 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
1223 | 1144 |
1224 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale | 1145 SetupDrawPropertiesAndManageTilings(pending_layer_, |
1225 2.7f, // device scale | 1146 1.3f, // ideal contents scale |
1226 3.2f, // page scale | 1147 2.7f, // device scale |
1227 1.f, // maximum animation scale | 1148 3.2f, // page scale |
1228 false, | 1149 1.f, // maximum animation scale |
1229 &result_scale_x, | 1150 false); |
1230 &result_scale_y, | |
1231 &result_bounds); | |
1232 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 1151 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
1233 | 1152 |
1234 // All tilings should be removed when losing output surface. | 1153 // All tilings should be removed when losing output surface. |
1235 active_layer_->ReleaseResources(); | 1154 active_layer_->ReleaseResources(); |
1236 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 1155 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
1237 pending_layer_->ReleaseResources(); | 1156 pending_layer_->ReleaseResources(); |
1238 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 1157 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
1239 | 1158 |
1240 // This should create new tilings. | 1159 // This should create new tilings. |
1241 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale | 1160 SetupDrawPropertiesAndManageTilings(pending_layer_, |
1242 2.7f, // device scale | 1161 1.3f, // ideal contents scale |
1243 3.2f, // page scale | 1162 2.7f, // device scale |
1244 1.f, // maximum animation scale | 1163 3.2f, // page scale |
1245 false, | 1164 1.f, // maximum animation scale |
1246 &result_scale_x, | 1165 false); |
1247 &result_scale_y, | |
1248 &result_bounds); | |
1249 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 1166 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
1250 } | 1167 } |
1251 | 1168 |
1252 TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) { | 1169 TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) { |
1253 // The default max tile size is larger than 400x400. | 1170 // The default max tile size is larger than 400x400. |
1254 gfx::Size tile_size(400, 400); | 1171 gfx::Size tile_size(400, 400); |
1255 gfx::Size layer_bounds(5000, 5000); | 1172 gfx::Size layer_bounds(5000, 5000); |
1256 | 1173 |
1257 scoped_refptr<FakePicturePileImpl> pending_pile = | 1174 scoped_refptr<FakePicturePileImpl> pending_pile = |
1258 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1175 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1259 scoped_refptr<FakePicturePileImpl> active_pile = | 1176 scoped_refptr<FakePicturePileImpl> active_pile = |
1260 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1177 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1261 | 1178 |
1262 float result_scale_x, result_scale_y; | |
1263 gfx::Size result_bounds; | |
1264 | |
1265 SetupTrees(pending_pile, active_pile); | 1179 SetupTrees(pending_pile, active_pile); |
1266 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 1180 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
1267 | 1181 |
1268 pending_layer_->CalculateContentsScale(1.f, | 1182 SetupDrawPropertiesAndManageTilings( |
1269 1.f, | 1183 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
1270 1.f, | |
1271 1.f, | |
1272 false, | |
1273 &result_scale_x, | |
1274 &result_scale_y, | |
1275 &result_bounds); | |
1276 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 1184 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
1277 | 1185 |
1278 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 1186 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
1279 | 1187 |
1280 // The default value. | 1188 // The default value. |
1281 EXPECT_EQ(gfx::Size(256, 256).ToString(), | 1189 EXPECT_EQ(gfx::Size(256, 256).ToString(), |
1282 host_impl_.settings().default_tile_size.ToString()); | 1190 host_impl_.settings().default_tile_size.ToString()); |
1283 | 1191 |
1284 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; | 1192 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; |
1285 EXPECT_EQ(gfx::Size(256, 256).ToString(), | 1193 EXPECT_EQ(gfx::Size(256, 256).ToString(), |
1286 tile->content_rect().size().ToString()); | 1194 tile->content_rect().size().ToString()); |
1287 | 1195 |
1288 pending_layer_->ReleaseResources(); | 1196 pending_layer_->ReleaseResources(); |
1289 | 1197 |
1290 // Change the max texture size on the output surface context. | 1198 // Change the max texture size on the output surface context. |
1291 scoped_ptr<TestWebGraphicsContext3D> context = | 1199 scoped_ptr<TestWebGraphicsContext3D> context = |
1292 TestWebGraphicsContext3D::Create(); | 1200 TestWebGraphicsContext3D::Create(); |
1293 context->set_max_texture_size(140); | 1201 context->set_max_texture_size(140); |
1294 host_impl_.DidLoseOutputSurface(); | 1202 host_impl_.DidLoseOutputSurface(); |
1295 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( | 1203 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( |
1296 context.Pass()).PassAs<OutputSurface>()); | 1204 context.Pass()).PassAs<OutputSurface>()); |
1297 | 1205 |
1298 pending_layer_->CalculateContentsScale(1.f, | 1206 SetupDrawPropertiesAndManageTilings( |
1299 1.f, | 1207 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
1300 1.f, | |
1301 1.f, | |
1302 false, | |
1303 &result_scale_x, | |
1304 &result_scale_y, | |
1305 &result_bounds); | |
1306 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 1208 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
1307 | 1209 |
1308 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 1210 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
1309 | 1211 |
1310 // Verify the tiles are not larger than the context's max texture size. | 1212 // Verify the tiles are not larger than the context's max texture size. |
1311 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; | 1213 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; |
1312 EXPECT_GE(140, tile->content_rect().width()); | 1214 EXPECT_GE(140, tile->content_rect().width()); |
1313 EXPECT_GE(140, tile->content_rect().height()); | 1215 EXPECT_GE(140, tile->content_rect().height()); |
1314 } | 1216 } |
1315 | 1217 |
1316 TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) { | 1218 TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) { |
1317 // The default max tile size is larger than 400x400. | 1219 // The default max tile size is larger than 400x400. |
1318 gfx::Size tile_size(400, 400); | 1220 gfx::Size tile_size(400, 400); |
1319 gfx::Size layer_bounds(500, 500); | 1221 gfx::Size layer_bounds(500, 500); |
1320 | 1222 |
1321 scoped_refptr<FakePicturePileImpl> pending_pile = | 1223 scoped_refptr<FakePicturePileImpl> pending_pile = |
1322 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1224 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1323 scoped_refptr<FakePicturePileImpl> active_pile = | 1225 scoped_refptr<FakePicturePileImpl> active_pile = |
1324 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1226 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1325 | 1227 |
1326 float result_scale_x, result_scale_y; | |
1327 gfx::Size result_bounds; | |
1328 | |
1329 SetupTrees(pending_pile, active_pile); | 1228 SetupTrees(pending_pile, active_pile); |
1330 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 1229 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
1331 | 1230 |
1332 pending_layer_->CalculateContentsScale(1.f, | 1231 SetupDrawPropertiesAndManageTilings( |
1333 1.f, | 1232 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
1334 1.f, | |
1335 1.f, | |
1336 false, | |
1337 &result_scale_x, | |
1338 &result_scale_y, | |
1339 &result_bounds); | |
1340 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); | 1233 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); |
1341 | 1234 |
1342 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 1235 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
1343 | 1236 |
1344 // The default value. The layer is smaller than this. | 1237 // The default value. The layer is smaller than this. |
1345 EXPECT_EQ(gfx::Size(512, 512).ToString(), | 1238 EXPECT_EQ(gfx::Size(512, 512).ToString(), |
1346 host_impl_.settings().max_untiled_layer_size.ToString()); | 1239 host_impl_.settings().max_untiled_layer_size.ToString()); |
1347 | 1240 |
1348 // There should be a single tile since the layer is small. | 1241 // There should be a single tile since the layer is small. |
1349 PictureLayerTiling* high_res_tiling = pending_layer_->tilings()->tiling_at(0); | 1242 PictureLayerTiling* high_res_tiling = pending_layer_->tilings()->tiling_at(0); |
1350 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size()); | 1243 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size()); |
1351 | 1244 |
1352 pending_layer_->ReleaseResources(); | 1245 pending_layer_->ReleaseResources(); |
1353 | 1246 |
1354 // Change the max texture size on the output surface context. | 1247 // Change the max texture size on the output surface context. |
1355 scoped_ptr<TestWebGraphicsContext3D> context = | 1248 scoped_ptr<TestWebGraphicsContext3D> context = |
1356 TestWebGraphicsContext3D::Create(); | 1249 TestWebGraphicsContext3D::Create(); |
1357 context->set_max_texture_size(140); | 1250 context->set_max_texture_size(140); |
1358 host_impl_.DidLoseOutputSurface(); | 1251 host_impl_.DidLoseOutputSurface(); |
1359 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( | 1252 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d( |
1360 context.Pass()).PassAs<OutputSurface>()); | 1253 context.Pass()).PassAs<OutputSurface>()); |
1361 | 1254 |
1362 pending_layer_->CalculateContentsScale(1.f, | 1255 SetupDrawPropertiesAndManageTilings( |
1363 1.f, | 1256 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
1364 1.f, | |
1365 1.f, | |
1366 false, | |
1367 &result_scale_x, | |
1368 &result_scale_y, | |
1369 &result_bounds); | |
1370 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); | 1257 ASSERT_LE(1u, pending_layer_->tilings()->num_tilings()); |
1371 | 1258 |
1372 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 1259 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
1373 | 1260 |
1374 // There should be more than one tile since the max texture size won't cover | 1261 // There should be more than one tile since the max texture size won't cover |
1375 // the layer. | 1262 // the layer. |
1376 high_res_tiling = pending_layer_->tilings()->tiling_at(0); | 1263 high_res_tiling = pending_layer_->tilings()->tiling_at(0); |
1377 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); | 1264 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); |
1378 | 1265 |
1379 // Verify the tiles are not larger than the context's max texture size. | 1266 // Verify the tiles are not larger than the context's max texture size. |
1380 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; | 1267 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; |
1381 EXPECT_GE(140, tile->content_rect().width()); | 1268 EXPECT_GE(140, tile->content_rect().width()); |
1382 EXPECT_GE(140, tile->content_rect().height()); | 1269 EXPECT_GE(140, tile->content_rect().height()); |
1383 } | 1270 } |
1384 | 1271 |
1385 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { | 1272 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { |
1386 MockQuadCuller quad_culler; | 1273 MockQuadCuller quad_culler; |
1387 | 1274 |
1388 gfx::Size tile_size(400, 400); | 1275 gfx::Size tile_size(400, 400); |
1389 gfx::Size layer_bounds(1300, 1900); | 1276 gfx::Size layer_bounds(1300, 1900); |
1390 | 1277 |
1391 scoped_refptr<FakePicturePileImpl> pending_pile = | 1278 scoped_refptr<FakePicturePileImpl> pending_pile = |
1392 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1279 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1393 scoped_refptr<FakePicturePileImpl> active_pile = | 1280 scoped_refptr<FakePicturePileImpl> active_pile = |
1394 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1281 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1395 | 1282 |
1396 SetupTrees(pending_pile, active_pile); | 1283 SetupTrees(pending_pile, active_pile); |
1397 | 1284 |
1398 active_layer_->SetContentBounds(layer_bounds); | |
1399 active_layer_->draw_properties().visible_content_rect = | 1285 active_layer_->draw_properties().visible_content_rect = |
1400 gfx::Rect(layer_bounds); | 1286 gfx::Rect(layer_bounds); |
1401 | 1287 |
1402 gfx::Rect layer_invalidation(150, 200, 30, 180); | 1288 gfx::Rect layer_invalidation(150, 200, 30, 180); |
1403 Region invalidation(layer_invalidation); | 1289 Region invalidation(layer_invalidation); |
1404 AddDefaultTilingsWithInvalidation(invalidation); | 1290 AddDefaultTilingsWithInvalidation(invalidation); |
1405 | 1291 |
1406 AppendQuadsData data; | 1292 AppendQuadsData data; |
1407 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); | 1293 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); |
1408 active_layer_->AppendQuads(&quad_culler, &data); | 1294 active_layer_->AppendQuads(&quad_culler, &data); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1753 host_impl_.SetUseGpuRasterization(false); | 1639 host_impl_.SetUseGpuRasterization(false); |
1754 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 1640 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
1755 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 1641 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
1756 } | 1642 } |
1757 | 1643 |
1758 TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) { | 1644 TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) { |
1759 SetupDefaultTrees(gfx::Size(10, 10)); | 1645 SetupDefaultTrees(gfx::Size(10, 10)); |
1760 host_impl_.active_tree()->UpdateDrawProperties(); | 1646 host_impl_.active_tree()->UpdateDrawProperties(); |
1761 EXPECT_FALSE(host_impl_.active_tree()->needs_update_draw_properties()); | 1647 EXPECT_FALSE(host_impl_.active_tree()->needs_update_draw_properties()); |
1762 | 1648 |
1763 float result_scale_x; | 1649 SetupDrawPropertiesAndManageTilings( |
1764 float result_scale_y; | 1650 active_layer_, 0.5f, 0.5f, 0.5f, 0.5f, false); |
1765 gfx::Size result_bounds; | |
1766 active_layer_->CalculateContentsScale(0.5f, | |
1767 0.5f, | |
1768 0.5f, | |
1769 0.5f, | |
1770 false, | |
1771 &result_scale_x, | |
1772 &result_scale_y, | |
1773 &result_bounds); | |
1774 active_layer_->tilings()->RemoveAllTilings(); | 1651 active_layer_->tilings()->RemoveAllTilings(); |
1775 PictureLayerTiling* tiling = active_layer_->tilings()->AddTiling(0.5f); | 1652 PictureLayerTiling* tiling = active_layer_->tilings()->AddTiling(0.5f); |
1776 active_layer_->tilings()->AddTiling(1.5f); | 1653 active_layer_->tilings()->AddTiling(1.5f); |
1777 active_layer_->tilings()->AddTiling(0.25f); | 1654 active_layer_->tilings()->AddTiling(0.25f); |
1778 tiling->set_resolution(HIGH_RESOLUTION); | 1655 tiling->set_resolution(HIGH_RESOLUTION); |
1779 | 1656 |
1780 // Sanity checks. | 1657 // Sanity checks. |
1781 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); | 1658 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); |
1782 ASSERT_EQ(tiling, active_layer_->tilings()->TilingAtScale(0.5f)); | 1659 ASSERT_EQ(tiling, active_layer_->tilings()->TilingAtScale(0.5f)); |
1783 | 1660 |
(...skipping 22 matching lines...) Expand all Loading... | |
1806 pending_layer_->tilings()->TilingAtScale(1.0f)->resolution()); | 1683 pending_layer_->tilings()->TilingAtScale(1.0f)->resolution()); |
1807 ASSERT_TRUE(pending_layer_->tilings()->TilingAtScale(1.5f)); | 1684 ASSERT_TRUE(pending_layer_->tilings()->TilingAtScale(1.5f)); |
1808 EXPECT_EQ(NON_IDEAL_RESOLUTION, | 1685 EXPECT_EQ(NON_IDEAL_RESOLUTION, |
1809 pending_layer_->tilings()->TilingAtScale(1.5f)->resolution()); | 1686 pending_layer_->tilings()->TilingAtScale(1.5f)->resolution()); |
1810 } | 1687 } |
1811 | 1688 |
1812 TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) { | 1689 TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) { |
1813 gfx::Size default_tile_size(host_impl_.settings().default_tile_size); | 1690 gfx::Size default_tile_size(host_impl_.settings().default_tile_size); |
1814 gfx::Size layer_bounds(default_tile_size.width() * 4, | 1691 gfx::Size layer_bounds(default_tile_size.width() * 4, |
1815 default_tile_size.height() * 4); | 1692 default_tile_size.height() * 4); |
1816 float result_scale_x, result_scale_y; | |
1817 gfx::Size result_bounds; | |
1818 | 1693 |
1819 SetupDefaultTrees(layer_bounds); | 1694 SetupDefaultTrees(layer_bounds); |
1820 EXPECT_FALSE(host_impl_.use_gpu_rasterization()); | 1695 EXPECT_FALSE(host_impl_.use_gpu_rasterization()); |
1821 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 1696 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
1822 pending_layer_->CalculateContentsScale(1.f, | 1697 SetupDrawPropertiesAndManageTilings( |
1823 1.f, | 1698 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
1824 1.f, | |
1825 1.f, | |
1826 false, | |
1827 &result_scale_x, | |
1828 &result_scale_y, | |
1829 &result_bounds); | |
1830 // Should have a low-res and a high-res tiling. | 1699 // Should have a low-res and a high-res tiling. |
1831 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 1700 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
1832 | 1701 |
1833 ResetTilingsAndRasterScales(); | 1702 ResetTilingsAndRasterScales(); |
1834 | 1703 |
1835 host_impl_.SetUseGpuRasterization(true); | 1704 host_impl_.SetUseGpuRasterization(true); |
1836 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); | 1705 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); |
1837 pending_layer_->CalculateContentsScale(1.f, | 1706 SetupDrawPropertiesAndManageTilings( |
1838 1.f, | 1707 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
1839 1.f, | 1708 |
1840 1.f, | |
1841 false, | |
1842 &result_scale_x, | |
1843 &result_scale_y, | |
1844 &result_bounds); | |
1845 // Should only have the high-res tiling. | 1709 // Should only have the high-res tiling. |
1846 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 1710 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
1847 } | 1711 } |
1848 | 1712 |
1849 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { | 1713 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { |
1850 // Set up layers with tilings. | 1714 // Set up layers with tilings. |
1851 SetupDefaultTrees(gfx::Size(10, 10)); | 1715 SetupDefaultTrees(gfx::Size(10, 10)); |
1852 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, false); | 1716 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, false); |
1853 pending_layer_->PushPropertiesTo(active_layer_); | 1717 pending_layer_->PushPropertiesTo(active_layer_); |
1854 EXPECT_TRUE(pending_layer_->DrawsContent()); | 1718 EXPECT_TRUE(pending_layer_->DrawsContent()); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2460 | 2324 |
2461 TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { | 2325 TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { |
2462 gfx::Size tile_size(400, 400); | 2326 gfx::Size tile_size(400, 400); |
2463 gfx::Size layer_bounds(1300, 1900); | 2327 gfx::Size layer_bounds(1300, 1900); |
2464 | 2328 |
2465 scoped_refptr<FakePicturePileImpl> pending_pile = | 2329 scoped_refptr<FakePicturePileImpl> pending_pile = |
2466 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2330 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2467 scoped_refptr<FakePicturePileImpl> active_pile = | 2331 scoped_refptr<FakePicturePileImpl> active_pile = |
2468 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2332 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2469 | 2333 |
2470 float result_scale_x, result_scale_y; | |
2471 gfx::Size result_bounds; | |
2472 | |
2473 SetupTrees(pending_pile, active_pile); | 2334 SetupTrees(pending_pile, active_pile); |
2474 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 2335 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
2475 | 2336 |
2476 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 2337 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
2477 EXPECT_LT(low_res_factor, 1.f); | 2338 EXPECT_LT(low_res_factor, 1.f); |
2478 | 2339 |
2479 pending_layer_->CalculateContentsScale(6.f, // ideal contents scale | 2340 SetupDrawPropertiesAndManageTilings(pending_layer_, |
2480 3.f, // device scale | 2341 6.f, // ideal contents scale |
2481 2.f, // page scale | 2342 3.f, // device scale |
2482 1.f, // maximum animation scale | 2343 2.f, // page scale |
2483 false, | 2344 1.f, // maximum animation scale |
2484 &result_scale_x, | 2345 false); |
2485 &result_scale_y, | |
2486 &result_bounds); | |
2487 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 2346 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
2488 EXPECT_FLOAT_EQ(6.f, | 2347 EXPECT_FLOAT_EQ(6.f, |
2489 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 2348 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
2490 | 2349 |
2491 // If we change the page scale factor, then we should get new tilings. | 2350 // If we change the page scale factor, then we should get new tilings. |
2492 pending_layer_->CalculateContentsScale(6.6f, // ideal contents scale | 2351 SetupDrawPropertiesAndManageTilings(pending_layer_, |
2493 3.f, // device scale | 2352 6.6f, // ideal contents scale |
2494 2.2f, // page scale | 2353 3.f, // device scale |
2495 1.f, // maximum animation scale | 2354 2.2f, // page scale |
2496 false, | 2355 1.f, // maximum animation scale |
2497 &result_scale_x, | 2356 false); |
2498 &result_scale_y, | |
2499 &result_bounds); | |
2500 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 2357 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
2501 EXPECT_FLOAT_EQ(6.6f, | 2358 EXPECT_FLOAT_EQ(6.6f, |
2502 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 2359 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
2503 | 2360 |
2504 // If we change the device scale factor, then we should get new tilings. | 2361 // If we change the device scale factor, then we should get new tilings. |
2505 pending_layer_->CalculateContentsScale(7.26f, // ideal contents scale | 2362 SetupDrawPropertiesAndManageTilings(pending_layer_, |
2506 3.3f, // device scale | 2363 7.26f, // ideal contents scale |
2507 2.2f, // page scale | 2364 3.3f, // device scale |
2508 1.f, // maximum animation scale | 2365 2.2f, // page scale |
2509 false, | 2366 1.f, // maximum animation scale |
2510 &result_scale_x, | 2367 false); |
2511 &result_scale_y, | |
2512 &result_bounds); | |
2513 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); | 2368 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); |
2514 EXPECT_FLOAT_EQ(7.26f, | 2369 EXPECT_FLOAT_EQ(7.26f, |
2515 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 2370 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
2516 | 2371 |
2517 // If we change the device scale factor, but end up at the same total scale | 2372 // If we change the device scale factor, but end up at the same total scale |
2518 // factor somehow, then we don't get new tilings. | 2373 // factor somehow, then we don't get new tilings. |
2519 pending_layer_->CalculateContentsScale(7.26f, // ideal contents scale | 2374 SetupDrawPropertiesAndManageTilings(pending_layer_, |
2520 2.2f, // device scale | 2375 7.26f, // ideal contents scale |
2521 3.3f, // page scale | 2376 2.2f, // device scale |
2522 1.f, // maximum animation scale | 2377 3.3f, // page scale |
2523 false, | 2378 1.f, // maximum animation scale |
2524 &result_scale_x, | 2379 false); |
2525 &result_scale_y, | |
2526 &result_bounds); | |
2527 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); | 2380 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); |
2528 EXPECT_FLOAT_EQ(7.26f, | 2381 EXPECT_FLOAT_EQ(7.26f, |
2529 pending_layer_->tilings()->tiling_at(0)->contents_scale()); | 2382 pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
2530 } | 2383 } |
2531 | 2384 |
2532 TEST_F(NoLowResPictureLayerImplTest, MarkRequiredNullTiles) { | 2385 TEST_F(NoLowResPictureLayerImplTest, MarkRequiredNullTiles) { |
2533 gfx::Size tile_size(100, 100); | 2386 gfx::Size tile_size(100, 100); |
2534 gfx::Size layer_bounds(1000, 1000); | 2387 gfx::Size layer_bounds(1000, 1000); |
2535 | 2388 |
2536 scoped_refptr<FakePicturePileImpl> pending_pile = | 2389 scoped_refptr<FakePicturePileImpl> pending_pile = |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2611 scoped_refptr<FakePicturePileImpl> active_pile = | 2464 scoped_refptr<FakePicturePileImpl> active_pile = |
2612 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2465 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2613 | 2466 |
2614 SetupTrees(pending_pile, active_pile); | 2467 SetupTrees(pending_pile, active_pile); |
2615 | 2468 |
2616 std::vector<TileManager::PairedPictureLayer> paired_layers; | 2469 std::vector<TileManager::PairedPictureLayer> paired_layers; |
2617 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 2470 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
2618 EXPECT_EQ(0u, paired_layers.size()); | 2471 EXPECT_EQ(0u, paired_layers.size()); |
2619 | 2472 |
2620 // Update tile priorities will force the layer to register itself. | 2473 // Update tile priorities will force the layer to register itself. |
2621 float dummy_contents_scale_x; | 2474 SetupDrawPropertiesAndManageTilings(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
2622 float dummy_contents_scale_y; | |
2623 gfx::Size dummy_content_bounds; | |
2624 active_layer_->CalculateContentsScale(1.f, | |
2625 1.f, | |
2626 1.f, | |
2627 1.f, | |
2628 false, | |
2629 &dummy_contents_scale_x, | |
2630 &dummy_contents_scale_y, | |
2631 &dummy_content_bounds); | |
2632 active_layer_->UpdateTilePriorities(); | 2475 active_layer_->UpdateTilePriorities(); |
2633 host_impl_.pending_tree()->UpdateDrawProperties(); | 2476 host_impl_.pending_tree()->UpdateDrawProperties(); |
2634 pending_layer_->CalculateContentsScale(1.f, | 2477 SetupDrawPropertiesAndManageTilings( |
2635 1.f, | 2478 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
2636 1.f, | |
2637 1.f, | |
2638 false, | |
2639 &dummy_contents_scale_x, | |
2640 &dummy_contents_scale_y, | |
2641 &dummy_content_bounds); | |
2642 pending_layer_->UpdateTilePriorities(); | 2479 pending_layer_->UpdateTilePriorities(); |
2643 | 2480 |
2644 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 2481 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
2645 EXPECT_EQ(1u, paired_layers.size()); | 2482 EXPECT_EQ(1u, paired_layers.size()); |
2646 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); | 2483 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); |
2647 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); | 2484 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); |
2648 | 2485 |
2649 // Destroy and recreate tile manager. | 2486 // Destroy and recreate tile manager. |
2650 host_impl_.DidLoseOutputSurface(); | 2487 host_impl_.DidLoseOutputSurface(); |
2651 scoped_ptr<TestWebGraphicsContext3D> context = | 2488 scoped_ptr<TestWebGraphicsContext3D> context = |
2652 TestWebGraphicsContext3D::Create(); | 2489 TestWebGraphicsContext3D::Create(); |
2653 host_impl_.InitializeRenderer( | 2490 host_impl_.InitializeRenderer( |
2654 FakeOutputSurface::Create3d(context.Pass()).PassAs<OutputSurface>()); | 2491 FakeOutputSurface::Create3d(context.Pass()).PassAs<OutputSurface>()); |
2655 | 2492 |
2656 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 2493 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
2657 EXPECT_EQ(0u, paired_layers.size()); | 2494 EXPECT_EQ(0u, paired_layers.size()); |
2658 | 2495 |
2659 active_layer_->CalculateContentsScale(1.f, | 2496 SetupDrawPropertiesAndManageTilings(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
2660 1.f, | |
2661 1.f, | |
2662 1.f, | |
2663 false, | |
2664 &dummy_contents_scale_x, | |
2665 &dummy_contents_scale_y, | |
2666 &dummy_content_bounds); | |
2667 active_layer_->UpdateTilePriorities(); | 2497 active_layer_->UpdateTilePriorities(); |
2668 host_impl_.pending_tree()->UpdateDrawProperties(); | 2498 host_impl_.pending_tree()->UpdateDrawProperties(); |
2669 pending_layer_->CalculateContentsScale(1.f, | 2499 SetupDrawPropertiesAndManageTilings( |
2670 1.f, | 2500 pending_layer_, 1.f, 1.f, 1.f, 1.f, false); |
2671 1.f, | |
2672 1.f, | |
2673 false, | |
2674 &dummy_contents_scale_x, | |
2675 &dummy_contents_scale_y, | |
2676 &dummy_content_bounds); | |
2677 pending_layer_->UpdateTilePriorities(); | 2501 pending_layer_->UpdateTilePriorities(); |
2678 | 2502 |
2679 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); | 2503 host_impl_.tile_manager()->GetPairedPictureLayers(&paired_layers); |
2680 EXPECT_EQ(1u, paired_layers.size()); | 2504 EXPECT_EQ(1u, paired_layers.size()); |
2681 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); | 2505 EXPECT_EQ(active_layer_, paired_layers[0].active_layer); |
2682 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); | 2506 EXPECT_EQ(pending_layer_, paired_layers[0].pending_layer); |
2683 } | 2507 } |
2684 | 2508 |
2685 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { | 2509 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { |
2686 base::TimeTicks time_ticks; | 2510 base::TimeTicks time_ticks; |
2687 host_impl_.SetCurrentFrameTimeTicks(time_ticks); | 2511 host_impl_.SetCurrentFrameTimeTicks(time_ticks); |
2688 | 2512 |
2689 gfx::Size tile_size(100, 100); | 2513 gfx::Size tile_size(100, 100); |
2690 gfx::Size layer_bounds(400, 400); | 2514 gfx::Size layer_bounds(400, 400); |
2691 | 2515 |
2692 scoped_refptr<FakePicturePileImpl> pending_pile = | 2516 scoped_refptr<FakePicturePileImpl> pending_pile = |
2693 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2517 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2694 scoped_refptr<FakePicturePileImpl> active_pile = | 2518 scoped_refptr<FakePicturePileImpl> active_pile = |
2695 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2519 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2696 | 2520 |
2697 SetupTrees(pending_pile, active_pile); | 2521 SetupTrees(pending_pile, active_pile); |
2698 | 2522 |
2699 Region invalidation; | 2523 Region invalidation; |
2700 AddDefaultTilingsWithInvalidation(invalidation); | 2524 AddDefaultTilingsWithInvalidation(invalidation); |
2701 float dummy_contents_scale_x; | 2525 SetupDrawPropertiesAndManageTilings(active_layer_, 1.f, 1.f, 1.f, 1.f, false); |
2702 float dummy_contents_scale_y; | |
2703 gfx::Size dummy_content_bounds; | |
2704 active_layer_->CalculateContentsScale(1.f, | |
2705 1.f, | |
2706 1.f, | |
2707 1.f, | |
2708 false, | |
2709 &dummy_contents_scale_x, | |
2710 &dummy_contents_scale_y, | |
2711 &dummy_content_bounds); | |
2712 | 2526 |
2713 // UpdateTilePriorities with valid viewport. Should update tile viewport. | 2527 // UpdateTilePriorities with valid viewport. Should update tile viewport. |
2714 bool valid_for_tile_management = true; | 2528 bool valid_for_tile_management = true; |
2715 gfx::Rect viewport = gfx::Rect(layer_bounds); | 2529 gfx::Rect viewport = gfx::Rect(layer_bounds); |
2716 gfx::Transform transform; | 2530 gfx::Transform transform; |
2717 host_impl_.SetExternalDrawConstraints( | 2531 host_impl_.SetExternalDrawConstraints( |
2718 transform, viewport, viewport, valid_for_tile_management); | 2532 transform, viewport, viewport, valid_for_tile_management); |
2719 active_layer_->draw_properties().visible_content_rect = viewport; | 2533 active_layer_->draw_properties().visible_content_rect = viewport; |
2720 active_layer_->draw_properties().screen_space_transform = transform; | 2534 active_layer_->draw_properties().screen_space_transform = transform; |
2721 active_layer_->UpdateTilePriorities(); | 2535 active_layer_->UpdateTilePriorities(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2800 | 2614 |
2801 TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { | 2615 TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { |
2802 gfx::Size tile_size(400, 400); | 2616 gfx::Size tile_size(400, 400); |
2803 gfx::Size layer_bounds(1300, 1900); | 2617 gfx::Size layer_bounds(1300, 1900); |
2804 | 2618 |
2805 scoped_refptr<FakePicturePileImpl> pending_pile = | 2619 scoped_refptr<FakePicturePileImpl> pending_pile = |
2806 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2620 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2807 scoped_refptr<FakePicturePileImpl> active_pile = | 2621 scoped_refptr<FakePicturePileImpl> active_pile = |
2808 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2622 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2809 | 2623 |
2810 float result_scale_x, result_scale_y; | |
2811 gfx::Size result_bounds; | |
2812 std::vector<PictureLayerTiling*> used_tilings; | 2624 std::vector<PictureLayerTiling*> used_tilings; |
2813 | 2625 |
2814 SetupTrees(pending_pile, active_pile); | 2626 SetupTrees(pending_pile, active_pile); |
2815 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 2627 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
2816 | 2628 |
2817 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 2629 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
2818 EXPECT_LT(low_res_factor, 1.f); | 2630 EXPECT_LT(low_res_factor, 1.f); |
2819 | 2631 |
2820 float device_scale = 1.7f; | 2632 float device_scale = 1.7f; |
2821 float page_scale = 3.2f; | 2633 float page_scale = 3.2f; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2870 // Now move the ideal scale to 1.0. Our target stays 1.2. | 2682 // Now move the ideal scale to 1.0. Our target stays 1.2. |
2871 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false); | 2683 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, false); |
2872 | 2684 |
2873 // All the tilings are between are target and the ideal, so they are not | 2685 // All the tilings are between are target and the ideal, so they are not |
2874 // removed. | 2686 // removed. |
2875 used_tilings.clear(); | 2687 used_tilings.clear(); |
2876 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 2688 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
2877 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 2689 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
2878 | 2690 |
2879 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. | 2691 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. |
2880 active_layer_->CalculateContentsScale(1.1f, | 2692 SetupDrawPropertiesAndManageTilings( |
2881 device_scale, | 2693 active_layer_, 1.1f, device_scale, page_scale, 1.f, false); |
2882 page_scale, | |
2883 1.f, | |
2884 false, | |
2885 &result_scale_x, | |
2886 &result_scale_y, | |
2887 &result_bounds); | |
2888 | 2694 |
2889 // Because the pending layer's ideal scale is still 1.0, our tilings fall | 2695 // Because the pending layer's ideal scale is still 1.0, our tilings fall |
2890 // in the range [1.0,1.2] and are kept. | 2696 // in the range [1.0,1.2] and are kept. |
2891 used_tilings.clear(); | 2697 used_tilings.clear(); |
2892 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 2698 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
2893 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 2699 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
2894 | 2700 |
2895 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays | 2701 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays |
2896 // 1.2 still. | 2702 // 1.2 still. |
2897 pending_layer_->CalculateContentsScale(1.1f, | 2703 SetupDrawPropertiesAndManageTilings( |
2898 device_scale, | 2704 pending_layer_, 1.1f, device_scale, page_scale, 1.f, false); |
2899 page_scale, | |
2900 1.f, | |
2901 false, | |
2902 &result_scale_x, | |
2903 &result_scale_y, | |
2904 &result_bounds); | |
2905 | 2705 |
2906 // Our 1.0 tiling now falls outside the range between our ideal scale and our | 2706 // Our 1.0 tiling now falls outside the range between our ideal scale and our |
2907 // target raster scale. But it is in our used tilings set, so nothing is | 2707 // target raster scale. But it is in our used tilings set, so nothing is |
2908 // deleted. | 2708 // deleted. |
2909 used_tilings.clear(); | 2709 used_tilings.clear(); |
2910 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); | 2710 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); |
2911 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 2711 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
2912 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); | 2712 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); |
2913 | 2713 |
2914 // If we remove it from our used tilings set, it is outside the range to keep | 2714 // If we remove it from our used tilings set, it is outside the range to keep |
2915 // so it is deleted. | 2715 // so it is deleted. |
2916 used_tilings.clear(); | 2716 used_tilings.clear(); |
2917 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 2717 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
2918 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); | 2718 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); |
2919 } | 2719 } |
2920 | 2720 |
2921 TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) { | 2721 TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) { |
2922 gfx::Size tile_size(400, 400); | 2722 gfx::Size tile_size(400, 400); |
2923 gfx::Size layer_bounds(1300, 1900); | 2723 gfx::Size layer_bounds(1300, 1900); |
2924 | 2724 |
2925 scoped_refptr<FakePicturePileImpl> pending_pile = | 2725 scoped_refptr<FakePicturePileImpl> pending_pile = |
2926 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2726 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2927 scoped_refptr<FakePicturePileImpl> active_pile = | 2727 scoped_refptr<FakePicturePileImpl> active_pile = |
2928 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2728 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
2929 | 2729 |
2930 float result_scale_x, result_scale_y; | |
2931 gfx::Size result_bounds; | |
2932 | |
2933 SetupTrees(pending_pile, active_pile); | 2730 SetupTrees(pending_pile, active_pile); |
2934 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 2731 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
2935 | 2732 |
2936 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale | 2733 SetupDrawPropertiesAndManageTilings(pending_layer_, |
2937 2.7f, // device scale | 2734 1.3f, // ideal contents scale |
2938 3.2f, // page scale | 2735 2.7f, // device scale |
2939 1.f, // maximum animation scale | 2736 3.2f, // page scale |
2940 false, | 2737 1.f, // maximum animation scale |
2941 &result_scale_x, | 2738 false); |
2942 &result_scale_y, | |
2943 &result_bounds); | |
2944 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 2739 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
2945 | 2740 |
2946 // All tilings should be removed when losing output surface. | 2741 // All tilings should be removed when losing output surface. |
2947 active_layer_->ReleaseResources(); | 2742 active_layer_->ReleaseResources(); |
2948 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 2743 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
2949 pending_layer_->ReleaseResources(); | 2744 pending_layer_->ReleaseResources(); |
2950 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 2745 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
2951 | 2746 |
2952 // This should create new tilings. | 2747 // This should create new tilings. |
2953 pending_layer_->CalculateContentsScale(1.3f, // ideal contents scale | 2748 SetupDrawPropertiesAndManageTilings(pending_layer_, |
2954 2.7f, // device scale | 2749 1.3f, // ideal contents scale |
2955 3.2f, // page scale | 2750 2.7f, // device scale |
2956 1.f, // maximum animation scale | 2751 3.2f, // page scale |
2957 false, | 2752 1.f, // maximum animation scale |
2958 &result_scale_x, | 2753 false); |
2959 &result_scale_y, | |
2960 &result_bounds); | |
2961 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 2754 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
2962 } | 2755 } |
2963 | 2756 |
2757 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { | |
2758 MockQuadCuller quad_culler; | |
2759 | |
2760 gfx::Size tile_size(400, 400); | |
2761 gfx::Size layer_bounds(1000, 2000); | |
2762 | |
2763 scoped_refptr<FakePicturePileImpl> pending_pile = | |
2764 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | |
2765 scoped_refptr<FakePicturePileImpl> active_pile = | |
2766 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | |
2767 | |
2768 SetupTrees(pending_pile, active_pile); | |
2769 | |
2770 SetupDrawPropertiesAndManageTilings( | |
2771 pending_layer_, 2.5f, 1.f, 1.f, 1.f, false); | |
2772 host_impl_.pending_tree()->UpdateDrawProperties(); | |
2773 | |
2774 active_layer_->draw_properties().visible_content_rect = | |
2775 gfx::Rect(layer_bounds); | |
2776 host_impl_.active_tree()->UpdateDrawProperties(); | |
2777 | |
2778 float max_contents_scale = active_layer_->MaximumTilingContentScale(); | |
2779 gfx::Transform scaled_draw_transform = active_layer_->draw_transform(); | |
2780 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, | |
2781 SK_MScalar1 / max_contents_scale); | |
2782 | |
2783 AppendQuadsData data; | |
2784 active_layer_->AppendQuads(&quad_culler, &data); | |
2785 | |
2786 // SharedQuadState should have be of size 1, as we are doing AppenQuad once. | |
2787 EXPECT_EQ(1u, quad_culler.shared_quad_state_list().size()); | |
2788 // The content_to_target_transform should be scaled by the | |
2789 // MaximumTilingContentScale on the layer. | |
2790 EXPECT_EQ(scaled_draw_transform.ToString(), | |
2791 quad_culler.shared_quad_state_list()[0] | |
2792 ->content_to_target_transform.ToString()); | |
2793 // The content_bounds should be scaled by the | |
2794 // MaximumTilingContentScale on the layer. | |
2795 EXPECT_EQ(gfx::Size(2500u, 5000u).ToString(), | |
2796 quad_culler.shared_quad_state_list()[0]->content_bounds.ToString()); | |
2797 // The visible_content_rect should be scaled by the | |
2798 // MaximumTilingContentScale on the layer. | |
2799 EXPECT_EQ( | |
2800 gfx::Rect(0u, 0u, 2500u, 5000u).ToString(), | |
2801 quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString()); | |
2802 } | |
2803 | |
2964 } // namespace | 2804 } // namespace |
2965 } // namespace cc | 2805 } // namespace cc |
OLD | NEW |