Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 684543006: cc: Toggle LCD text at raster time instead of record time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcdraster: bettertestsyay Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 4483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4494 host->SetRootLayer(layer); 4494 host->SetRootLayer(layer);
4495 PicturePile* pile = layer->GetPicturePileForTesting(); 4495 PicturePile* pile = layer->GetPicturePileForTesting();
4496 4496
4497 host_impl_.SetViewportSize(layer_bounds); 4497 host_impl_.SetViewportSize(layer_bounds);
4498 4498
4499 int frame_number = 0; 4499 int frame_number = 0;
4500 4500
4501 client.set_fill_with_nonsolid_color(!test_for_solid); 4501 client.set_fill_with_nonsolid_color(!test_for_solid);
4502 4502
4503 Region invalidation(layer_rect); 4503 Region invalidation(layer_rect);
4504 pile->UpdateAndExpandInvalidation(&client, &invalidation, SK_ColorWHITE, 4504 pile->UpdateAndExpandInvalidation(
4505 false, false, layer_bounds, layer_rect, 4505 &client, &invalidation, SK_ColorWHITE, false, false, false, layer_bounds,
4506 frame_number++, Picture::RECORD_NORMALLY); 4506 layer_rect, frame_number++, Picture::RECORD_NORMALLY);
4507 4507
4508 scoped_refptr<PicturePileImpl> pending_pile = 4508 scoped_refptr<PicturePileImpl> pending_pile =
4509 PicturePileImpl::CreateFromOther(pile); 4509 PicturePileImpl::CreateFromOther(pile);
4510 4510
4511 SetupPendingTree(pending_pile); 4511 SetupPendingTree(pending_pile);
4512 ActivateTree(); 4512 ActivateTree();
4513 4513
4514 active_layer_->set_fixed_tile_size(tile_size); 4514 active_layer_->set_fixed_tile_size(tile_size);
4515 host_impl_.active_tree()->UpdateDrawProperties(); 4515 host_impl_.active_tree()->UpdateDrawProperties();
4516 if (test_for_solid) { 4516 if (test_for_solid) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 host->SetRootLayer(layer); 4561 host->SetRootLayer(layer);
4562 PicturePile* pile = layer->GetPicturePileForTesting(); 4562 PicturePile* pile = layer->GetPicturePileForTesting();
4563 4563
4564 host_impl_.SetViewportSize(layer_bounds); 4564 host_impl_.SetViewportSize(layer_bounds);
4565 4565
4566 int frame_number = 0; 4566 int frame_number = 0;
4567 4567
4568 client.set_fill_with_nonsolid_color(true); 4568 client.set_fill_with_nonsolid_color(true);
4569 4569
4570 Region invalidation1(layer_rect); 4570 Region invalidation1(layer_rect);
4571 pile->UpdateAndExpandInvalidation(&client, &invalidation1, SK_ColorWHITE, 4571 pile->UpdateAndExpandInvalidation(
4572 false, false, layer_bounds, layer_rect, 4572 &client, &invalidation1, SK_ColorWHITE, false, false, false, layer_bounds,
4573 frame_number++, Picture::RECORD_NORMALLY); 4573 layer_rect, frame_number++, Picture::RECORD_NORMALLY);
4574 4574
4575 scoped_refptr<PicturePileImpl> pending_pile1 = 4575 scoped_refptr<PicturePileImpl> pending_pile1 =
4576 PicturePileImpl::CreateFromOther(pile); 4576 PicturePileImpl::CreateFromOther(pile);
4577 4577
4578 SetupPendingTree(pending_pile1); 4578 SetupPendingTree(pending_pile1);
4579 ActivateTree(); 4579 ActivateTree();
4580 host_impl_.active_tree()->UpdateDrawProperties(); 4580 host_impl_.active_tree()->UpdateDrawProperties();
4581 4581
4582 // We've started with a solid layer that contains some tilings. 4582 // We've started with a solid layer that contains some tilings.
4583 ASSERT_TRUE(active_layer_->tilings()); 4583 ASSERT_TRUE(active_layer_->tilings());
4584 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); 4584 EXPECT_NE(0u, active_layer_->tilings()->num_tilings());
4585 4585
4586 client.set_fill_with_nonsolid_color(false); 4586 client.set_fill_with_nonsolid_color(false);
4587 4587
4588 Region invalidation2(layer_rect); 4588 Region invalidation2(layer_rect);
4589 pile->UpdateAndExpandInvalidation(&client, &invalidation2, SK_ColorWHITE, 4589 pile->UpdateAndExpandInvalidation(
4590 false, false, layer_bounds, layer_rect, 4590 &client, &invalidation2, SK_ColorWHITE, false, false, false, layer_bounds,
4591 frame_number++, Picture::RECORD_NORMALLY); 4591 layer_rect, frame_number++, Picture::RECORD_NORMALLY);
4592 4592
4593 scoped_refptr<PicturePileImpl> pending_pile2 = 4593 scoped_refptr<PicturePileImpl> pending_pile2 =
4594 PicturePileImpl::CreateFromOther(pile); 4594 PicturePileImpl::CreateFromOther(pile);
4595 4595
4596 SetupPendingTree(pending_pile2); 4596 SetupPendingTree(pending_pile2);
4597 ActivateTree(); 4597 ActivateTree();
4598 4598
4599 // We've switched to a solid color, so we should end up with no tilings. 4599 // We've switched to a solid color, so we should end up with no tilings.
4600 ASSERT_TRUE(active_layer_->tilings()); 4600 ASSERT_TRUE(active_layer_->tilings());
4601 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 4601 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4720 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4720 result = layer->CalculateTileSize(gfx::Size(447, 400));
4721 EXPECT_EQ(result.width(), 448); 4721 EXPECT_EQ(result.width(), 448);
4722 EXPECT_EQ(result.height(), 448); 4722 EXPECT_EQ(result.height(), 448);
4723 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4723 result = layer->CalculateTileSize(gfx::Size(500, 499));
4724 EXPECT_EQ(result.width(), 512); 4724 EXPECT_EQ(result.width(), 512);
4725 EXPECT_EQ(result.height(), 500 + 2); 4725 EXPECT_EQ(result.height(), 500 + 2);
4726 } 4726 }
4727 4727
4728 } // namespace 4728 } // namespace
4729 } // namespace cc 4729 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698