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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2629233002: cc: Remove separate x/y raster scales. (Closed)
Patch Set: Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index a00ae19f54a5e177328db9fe12eae615b91f1eeb..4c4f88391284a6b2a64d852127b0d7529f9fc7bc 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -202,7 +202,7 @@ class PictureLayerImplTest : public TestLayerTreeHostBase {
auto prioritized_tiles =
tiling->UpdateAndGetAllPrioritizedTilesForTesting();
for (PictureLayerTiling::CoverageIterator iter(
- tiling, tiling->contents_scale_key(),
+ tiling, tiling->contents_scale(),
gfx::Rect(tiling->tiling_size()));
iter; ++iter) {
EXPECT_TRUE(*iter);
@@ -334,7 +334,7 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
EXPECT_EQ(
tiling->GetCurrentVisibleRectForTesting(),
gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space,
- tiling->contents_scale_key()));
+ tiling->contents_scale()));
}
// Update tiles with viewport for tile priority as (200, 200, 100, 100) in
@@ -370,7 +370,7 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
EXPECT_EQ(
tiling->GetCurrentVisibleRectForTesting(),
gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space,
- tiling->contents_scale_key()));
+ tiling->contents_scale()));
}
}
@@ -446,12 +446,12 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
EXPECT_GT(tilings->num_tilings(), 0u);
for (size_t i = 0; i < tilings->num_tilings(); ++i) {
const PictureLayerTiling* tiling = tilings->tiling_at(i);
- gfx::Rect content_invalidation = gfx::ScaleToEnclosingRect(
- layer_invalidation, tiling->contents_scale_key());
+ gfx::Rect content_invalidation =
+ gfx::ScaleToEnclosingRect(layer_invalidation, tiling->contents_scale());
auto prioritized_tiles =
tiling->UpdateAndGetAllPrioritizedTilesForTesting();
for (PictureLayerTiling::CoverageIterator iter(
- tiling, tiling->contents_scale_key(),
+ tiling, tiling->contents_scale(),
gfx::Rect(tiling->tiling_size()));
iter; ++iter) {
// We don't always have a tile, but when we do it's because it was
@@ -475,7 +475,7 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
auto prioritized_tiles =
tiling->UpdateAndGetAllPrioritizedTilesForTesting();
for (PictureLayerTiling::CoverageIterator iter(
- tiling, tiling->contents_scale_key(),
+ tiling, tiling->contents_scale(),
gfx::Rect(tiling->tiling_size()));
iter; ++iter) {
EXPECT_TRUE(*iter);
@@ -529,11 +529,10 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 6.f * low_res_factor,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(6.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
// If we change the page scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(active_layer(),
@@ -544,11 +543,10 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(4u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.6f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 6.6f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.6f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(6.6f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// If we change the device scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(active_layer(),
@@ -559,11 +557,10 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(6u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 7.26f * low_res_factor,
- active_layer()->tilings()->tiling_at(3)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(7.26f * low_res_factor,
+ active_layer()->tilings()->tiling_at(3)->contents_scale());
// If we change the device scale factor, but end up at the same total scale
// factor somehow, then we don't get new tilings.
@@ -575,11 +572,10 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(6u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 7.26f * low_res_factor,
- active_layer()->tilings()->tiling_at(3)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(7.26f * low_res_factor,
+ active_layer()->tilings()->tiling_at(3)->contents_scale());
}
TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
@@ -602,8 +598,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the page scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(pending_layer(),
@@ -614,8 +610,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.6f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.6f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the device scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(pending_layer(),
@@ -626,8 +622,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the device scale factor, but end up at the same total scale
// factor somehow, then we don't get new tilings.
@@ -639,8 +635,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
}
TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
@@ -707,7 +703,7 @@ TEST_F(PictureLayerImplTest, ZoomOutCrash) {
ResetTilingsAndRasterScales();
EXPECT_EQ(0u, active_layer()->tilings()->num_tilings());
SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, 1.0f, 0.f, false);
- EXPECT_EQ(32.f, active_layer()->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(32.f, active_layer()->HighResTiling()->contents_scale());
host_impl()->PinchGestureBegin();
SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false);
SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false);
@@ -725,8 +721,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, 0.f, false);
EXPECT_EQ(active_layer()->num_tilings(), 2u);
EXPECT_EQ(pending_layer()->num_tilings(), 1u);
- EXPECT_EQ(active_layer()->tilings()->tiling_at(0)->contents_scale_key(), 2.f);
- EXPECT_EQ(active_layer()->tilings()->tiling_at(1)->contents_scale_key(),
+ EXPECT_EQ(active_layer()->tilings()->tiling_at(0)->contents_scale(), 2.f);
+ EXPECT_EQ(active_layer()->tilings()->tiling_at(1)->contents_scale(),
2.f * low_res_factor);
// One of the tilings has to be a low resolution one.
EXPECT_EQ(LOW_RESOLUTION,
@@ -742,13 +738,12 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
// the scale (2/kMaxScaleRatioDuringPinch).
SetContentsScaleOnBothLayers(1.8f, 1.0f, 1.8f, 1.0f, 0.f, false);
EXPECT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 2.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.0f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 2.0f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(2.0f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.0f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(2.0f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// Since we're pinching, we shouldn't create a low resolution tiling.
EXPECT_FALSE(
active_layer()->tilings()->FindTilingWithResolution(LOW_RESOLUTION));
@@ -768,8 +763,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
// kMaxScaleRatioDuringPinch, this will create a new tiling at 4.0.
SetContentsScaleOnBothLayers(3.8f, 1.0f, 3.8f, 1.f, 0.f, false);
EXPECT_EQ(4u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 4.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(4.0f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
// Although one of the tilings matches the low resolution scale, it still
// shouldn't be marked as low resolution since we're pinching.
auto* low_res_tiling =
@@ -787,8 +782,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
// (checked above).
SetContentsScaleOnBothLayers(4.0f, 1.0f, 4.0f, 1.f, 0.f, false);
EXPECT_EQ(4u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 4.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(4.0f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
// Now that we stopped pinching, the low resolution tiling that existed should
// now be marked as low resolution.
low_res_tiling =
@@ -807,10 +802,10 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
// Set up the high and low res tilings before pinch zoom.
SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, 0.f, false);
EXPECT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 0.24f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 0.0625f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(0.24f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(0.0625f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
// Ensure UpdateTiles won't remove any tilings.
active_layer()->MarkAllTilingsUsed();
@@ -822,12 +817,12 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
// the scale (1/kMaxScaleRatioDuringPinch).
SetContentsScaleOnBothLayers(0.2f, 1.0f, 0.2f, 1.0f, 0.f, false);
EXPECT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 0.24f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 0.12f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 0.0625, active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(0.24f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(0.12f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(0.0625,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// Ensure UpdateTiles won't remove any tilings.
active_layer()->MarkAllTilingsUsed();
@@ -846,8 +841,8 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
// is a power of 2 times 0.24.
SetContentsScaleOnBothLayers(1.f, 1.0f, 1.f, 1.0f, 0.f, false);
EXPECT_EQ(4u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.92f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.92f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
}
TEST_F(PictureLayerImplTest, CleanUpTilings) {
@@ -864,11 +859,10 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
SetupDefaultTrees(layer_bounds);
active_layer()->SetHasWillChangeTransformHint(true);
EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
// Ensure UpdateTiles won't remove any tilings. Note this is unrelated to
// |used_tilings| variable, and it's here only to ensure that active_layer()
@@ -879,11 +873,10 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.clear();
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
host_impl()->PinchGestureBegin();
@@ -892,21 +885,19 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
page_scale = 1.5f;
SetContentsScaleOnBothLayers(scale, 1.f, page_scale, 1.f, 0.f, false);
EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
// The tilings are still our target scale, so they aren't removed.
used_tilings.clear();
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
host_impl()->PinchGestureEnd();
@@ -915,16 +906,14 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
page_scale = 1.2f;
SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, 0.f, false);
ASSERT_EQ(4u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer()->tilings()->tiling_at(3)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(3)->contents_scale());
// Ensure UpdateTiles won't remove any tilings.
active_layer()->MarkAllTilingsUsed();
@@ -935,16 +924,14 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.push_back(active_layer()->tilings()->tiling_at(3));
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(4u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f * low_res_factor,
- active_layer()->tilings()->tiling_at(3)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f * low_res_factor,
+ active_layer()->tilings()->tiling_at(3)->contents_scale());
// Now move the ideal scale to 0.5. Our target stays 1.2.
SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, 0.f, false);
@@ -954,13 +941,12 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.clear();
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// Now move the ideal scale to 1.0. Our target stays 1.2.
SetContentsScaleOnBothLayers(1.f, 1.f, page_scale, 1.f, 0.f, false);
@@ -970,13 +956,12 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.clear();
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2.
SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.1f, 1.f, page_scale, 1.f,
@@ -987,13 +972,12 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.clear();
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// Move the ideal scale on the pending layer to 1.1 as well. Our target stays
// 1.2 still.
@@ -1007,24 +991,22 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
used_tilings.push_back(active_layer()->tilings()->tiling_at(1));
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2f * low_res_factor,
- active_layer()->tilings()->tiling_at(2)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2f * low_res_factor,
+ active_layer()->tilings()->tiling_at(2)->contents_scale());
// If we remove it from our used tilings set, it is outside the range to keep
// so it is deleted.
used_tilings.clear();
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings);
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_FLOAT_EQ(
- 1.2 * low_res_factor,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.2f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_FLOAT_EQ(1.2 * low_res_factor,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
}
TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
@@ -1049,7 +1031,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
EXPECT_BOTH_EQ(num_tilings(), 1u);
// Stop animating, low res gets created.
@@ -1057,9 +1039,8 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f);
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(),
- low_res_factor);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), low_res_factor);
EXPECT_EQ(active_layer()->num_tilings(), 2u);
EXPECT_EQ(pending_layer()->num_tilings(), 1u);
@@ -1076,7 +1057,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
EXPECT_FALSE(active_layer()->LowResTiling());
EXPECT_FALSE(pending_layer()->LowResTiling());
EXPECT_EQ(3u, active_layer()->num_tilings());
@@ -1087,8 +1068,8 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f);
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(),
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(),
2.f * low_res_factor);
EXPECT_EQ(4u, active_layer()->num_tilings());
EXPECT_EQ(1u, pending_layer()->num_tilings());
@@ -1116,7 +1097,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
EXPECT_BOTH_EQ(num_tilings(), 1u);
ResetTilingsAndRasterScales();
@@ -1126,7 +1107,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
EXPECT_BOTH_EQ(num_tilings(), 1u);
// TODO(danakj): Remove these when raster scale doesn't get fixed?
@@ -1138,8 +1119,8 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale);
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(),
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(),
contents_scale * low_res_factor);
EXPECT_FALSE(pending_layer()->LowResTiling());
EXPECT_EQ(active_layer()->num_tilings(), 2u);
@@ -1166,7 +1147,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
SetupDrawPropertiesAndUpdateTiles(
mask_raw, contents_scale, device_scale, page_scale,
maximum_animation_scale, starting_animation_scale, animating_transform);
- EXPECT_EQ(mask_raw->HighResTiling()->contents_scale_key(), contents_scale);
+ EXPECT_EQ(mask_raw->HighResTiling()->contents_scale(), contents_scale);
EXPECT_EQ(mask_raw->num_tilings(), 1u);
}
@@ -1195,7 +1176,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
FakePictureLayerImpl* pending_mask = static_cast<FakePictureLayerImpl*>(
pending_layer()->test_properties()->mask_layer);
- EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale());
EXPECT_EQ(1u, pending_mask->num_tilings());
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting(
@@ -1241,7 +1222,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
// The mask tiling gets scaled down.
- EXPECT_LT(pending_mask->HighResTiling()->contents_scale_key(), 1.f);
+ EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f);
EXPECT_EQ(1u, pending_mask->num_tilings());
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting(
@@ -1325,7 +1306,7 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
pending_layer()->test_properties()->mask_layer);
// Masks are scaled, and do not have a low res tiling.
- EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale());
EXPECT_EQ(1u, pending_mask->num_tilings());
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting(
@@ -1660,7 +1641,7 @@ TEST_F(NoLowResPictureLayerImplTest,
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
ASSERT_EQ(1u, pending_layer()->num_tilings());
- ASSERT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key());
+ ASSERT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale());
// Set external viewport for tile priority.
gfx::Transform transform;
@@ -1858,7 +1839,7 @@ TEST_F(PictureLayerImplTest,
// One ideal tile exists, this will get used when drawing.
std::vector<Tile*> ideal_tiles;
- EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale());
ideal_tiles.push_back(active_layer()->HighResTiling()->TileAt(0, 0));
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting(
ideal_tiles);
@@ -1870,13 +1851,13 @@ TEST_F(PictureLayerImplTest,
SetupDrawPropertiesAndUpdateTiles(active_layer(), 2.f, 1.f, 1.f, 1.f, 0.f,
false);
- EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale());
EXPECT_EQ(1.f, active_layer()->raster_contents_scale());
EXPECT_EQ(2.f, active_layer()->ideal_contents_scale());
// Both tilings still exist.
- EXPECT_EQ(2.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_EQ(1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_EQ(2.f, active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_EQ(1.f, active_layer()->tilings()->tiling_at(1)->contents_scale());
// All high res tiles have resources.
std::vector<Tile*> high_tiles =
@@ -2450,7 +2431,7 @@ TEST_F(PictureLayerImplTest, FirstTilingDuringPinch) {
SetupDefaultTrees(gfx::Size(10, 10));
// We start with a tiling at scale 1.
- EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale());
// When we page scale up by 2.3, we get a new tiling that is a power of 2, in
// this case 4.
@@ -2458,14 +2439,14 @@ TEST_F(PictureLayerImplTest, FirstTilingDuringPinch) {
float high_res_scale = 2.3f;
SetContentsScaleOnBothLayers(high_res_scale, 1.f, high_res_scale, 1.f, 0.f,
false);
- EXPECT_EQ(4.f, pending_layer()->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(4.f, pending_layer()->HighResTiling()->contents_scale());
}
TEST_F(PictureLayerImplTest, PinchingTooSmall) {
SetupDefaultTrees(gfx::Size(10, 10));
// We start with a tiling at scale 1.
- EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key());
+ EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale());
host_impl()->PinchGestureBegin();
float high_res_scale = 0.0001f;
@@ -2474,7 +2455,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmall) {
SetContentsScaleOnBothLayers(high_res_scale, 1.f, high_res_scale, 1.f, 0.f,
false);
EXPECT_FLOAT_EQ(pending_layer()->MinimumContentsScale(),
- pending_layer()->HighResTiling()->contents_scale_key());
+ pending_layer()->HighResTiling()->contents_scale());
}
TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) {
@@ -2487,7 +2468,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) {
ASSERT_GE(pending_layer()->num_tilings(), 0u);
EXPECT_FLOAT_EQ(contents_scale,
- pending_layer()->HighResTiling()->contents_scale_key());
+ pending_layer()->HighResTiling()->contents_scale());
host_impl()->PinchGestureBegin();
@@ -2499,7 +2480,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) {
1.f, 0.f, false);
ASSERT_GE(pending_layer()->num_tilings(), 0u);
EXPECT_FLOAT_EQ(pending_layer()->MinimumContentsScale(),
- pending_layer()->HighResTiling()->contents_scale_key());
+ pending_layer()->HighResTiling()->contents_scale());
}
TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) {
@@ -2516,13 +2497,13 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) {
float starting_animation_scale = 1.f;
bool animating_transform = true;
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
// Maximum animation scale is greater than starting animation scale
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
animating_transform = false;
@@ -2530,7 +2511,7 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
// Starting animation scale greater than maximum animation scale
// Bounds at starting scale within the viewport
@@ -2540,14 +2521,14 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 5.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 5.f);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
// Starting Animation scale greater than maximum animation scale
// Bounds at starting scale outisde the viewport
@@ -2557,7 +2538,7 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
}
TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
@@ -2574,7 +2555,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
float starting_animation_scale = 0.f;
bool animating_transform = false;
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
// Starting an animation should cause tiling resolution to get set to the
// maximum animation scale factor.
@@ -2585,7 +2566,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
// Further changes to scale during the animation should not cause a new
// high-res tiling to get created.
@@ -2595,7 +2576,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2603,7 +2584,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 4.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
// When animating with an unknown maximum animation scale factor, a new
// high-res tiling should be created at a source scale of 1.
@@ -2614,8 +2595,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(),
- page_scale * device_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale);
// Further changes to scale during the animation should not cause a new
// high-res tiling to get created.
@@ -2624,8 +2604,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(),
- page_scale * device_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2634,7 +2613,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 4.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
// When animating with a maxmium animation scale factor that is so large
// that the layer grows larger than the viewport at this scale, a new
@@ -2647,8 +2626,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(),
- page_scale * device_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2657,7 +2635,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 11.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
// When animating with a maxmium animation scale factor that is so large
// that the layer grows larger than the viewport at this scale, and where
@@ -2670,8 +2648,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(),
- device_scale * page_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2680,7 +2657,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 12.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 12.f);
// When animating toward a smaller scale, but that is still so large that the
// layer grows larger than the viewport at this scale, a new high-res tiling
@@ -2692,8 +2669,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(),
- device_scale * page_scale);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale);
// Once we stop animating, a new high-res tiling should be created.
animating_transform = false;
@@ -2702,7 +2678,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 11.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
}
TEST_F(PictureLayerImplTest, TilingSetRasterQueue) {
@@ -2967,19 +2943,18 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) {
EXPECT_FALSE(tile->required_for_activation());
- while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) >
+ while (std::abs(tile->contents_scale() - expected_scales[scale_index]) >
std::numeric_limits<float>::epsilon()) {
++scale_index;
ASSERT_LT(scale_index, arraysize(expected_scales));
}
- EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]);
+ EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]);
unique_tiles.insert(tile);
if (tile->required_for_activation() ==
last_tile.tile()->required_for_activation() &&
- std::abs(tile->contents_scale_key() -
- last_tile.tile()->contents_scale_key()) <
+ std::abs(tile->contents_scale() - last_tile.tile()->contents_scale()) <
std::numeric_limits<float>::epsilon()) {
if (priority.distance_to_visible <=
last_tile.priority().distance_to_visible)
@@ -3015,13 +2990,13 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) {
scale_index = 0;
}
- while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) >
+ while (std::abs(tile->contents_scale() - expected_scales[scale_index]) >
std::numeric_limits<float>::epsilon()) {
++scale_index;
ASSERT_LT(scale_index, arraysize(expected_scales));
}
- EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]);
+ EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]);
unique_tiles.insert(tile);
queue->Pop();
}
@@ -3096,7 +3071,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
// Changing the source scale without being in an animation will cause
// the layer to change scale.
@@ -3105,14 +3080,14 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
contents_scale = 0.5f;
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
// However, if the layer has a will-change property, then the raster scale
// will get fixed at the last value.
@@ -3124,7 +3099,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
// Further changes to the source scale will no longer be reflected in the
// contents scale.
@@ -3133,7 +3108,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
// Disabling the will-change hint will once again make the raster scale update
// with the ideal scale.
@@ -3145,7 +3120,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
}
TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
@@ -3228,8 +3203,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the page scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(active_layer(),
@@ -3240,8 +3215,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.6f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.6f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the device scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(active_layer(),
@@ -3252,8 +3227,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the device scale factor, but end up at the same total scale
// factor somehow, then we don't get new tilings.
@@ -3265,8 +3240,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
0.f, // starting animation scale
false);
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
}
TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
@@ -3286,8 +3261,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the page scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(pending_layer(),
@@ -3298,8 +3273,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 6.6f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(6.6f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the device scale factor, then we should get new tilings.
SetupDrawPropertiesAndUpdateTiles(pending_layer(),
@@ -3310,8 +3285,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
// If we change the device scale factor, but end up at the same total scale
// factor somehow, then we don't get new tilings.
@@ -3323,8 +3298,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
0.f, // starting animation scale
false);
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_FLOAT_EQ(7.26f,
+ pending_layer()->tilings()->tiling_at(0)->contents_scale());
}
TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfNotChanged) {
@@ -3434,8 +3409,8 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
page_scale /= 4.f;
SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, 0.f, false);
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings());
- EXPECT_FLOAT_EQ(
- 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ EXPECT_FLOAT_EQ(1.f,
+ active_layer()->tilings()->tiling_at(1)->contents_scale());
// Ensure UpdateTiles won't remove any tilings.
active_layer()->MarkAllTilingsUsed();
@@ -3656,8 +3631,8 @@ class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest {
EXPECT_TRUE(tile_priority_bin < last_tile_priority_bin ||
tile->required_for_activation() ||
- tile->contents_scale_key() !=
- last_tile.tile()->contents_scale_key())
+ tile->contents_scale() !=
+ last_tile.tile()->contents_scale())
<< "line: " << source_line;
}
}
@@ -3935,8 +3910,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) {
for (size_t j = 0; j < tiles.size(); ++j) {
if (prioritized_tiles[tiles[j]].is_occluded()) {
gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
- tiles[j]->content_rect(), 1.f / tiles[j]->raster_scales().width(),
- 1.f / tiles[j]->raster_scales().height());
+ tiles[j]->content_rect(), 1.f / tiles[j]->contents_scale());
EXPECT_GE(scaled_content_rect.x(), occluding_layer_position.x());
occluded_tile_count++;
}
@@ -4000,8 +3974,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
const Tile* tile = *iter;
gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
- tile->content_rect(), 1.f / tile->raster_scales().width(),
- 1.f / tile->raster_scales().height());
+ tile->content_rect(), 1.f / tile->contents_scale());
// Tiles are occluded on the active tree iff they lie beneath the
// occluding layer.
EXPECT_EQ(prioritized_tiles[tile].is_occluded(),
@@ -4037,8 +4010,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
active_layer()->GetPendingOrActiveTwinTiling(tiling)->TileAt(
iter.i(), iter.j());
gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
- tile->content_rect(), 1.f / tile->raster_scales().height(),
- 1.f / tile->raster_scales().width());
+ tile->content_rect(), 1.f / tile->contents_scale());
if (scaled_content_rect.Intersects(invalidation_rect)) {
// Tiles inside the invalidation rect exist on both trees.
@@ -4146,7 +4118,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
}
EXPECT_EQ(expected_occluded_tile_count_on_pending[i],
occluded_tile_count_on_pending)
- << tiling->contents_scale_key();
+ << tiling->contents_scale();
}
// Verify number of occluded tiles on the active layer for each tiling.
@@ -4736,7 +4708,7 @@ TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) {
float page_scale = 2.f;
SetContentsScaleOnBothLayers(page_scale, 1.0f, page_scale, 1.0f, 0.f, false);
EXPECT_BOTH_EQ(num_tilings(), 1u);
- EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale_key(), page_scale);
+ EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), page_scale);
host_impl()->PinchGestureBegin();
@@ -4745,8 +4717,7 @@ TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) {
float zoomed = page_scale / low_res_factor;
SetContentsScaleOnBothLayers(zoomed, 1.0f, zoomed, 1.0f, 0.f, false);
EXPECT_EQ(1u, pending_layer()->num_tilings());
- EXPECT_EQ(zoomed,
- pending_layer()->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_EQ(zoomed, pending_layer()->tilings()->tiling_at(0)->contents_scale());
}
TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
@@ -4764,9 +4735,8 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
page_scale, 1.0f, 0.f, false);
EXPECT_EQ(2u, active_layer()->tilings()->num_tilings());
EXPECT_EQ(page_scale,
- active_layer()->tilings()->tiling_at(0)->contents_scale_key());
- EXPECT_EQ(low_res,
- active_layer()->tilings()->tiling_at(1)->contents_scale_key());
+ active_layer()->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_EQ(low_res, active_layer()->tilings()->tiling_at(1)->contents_scale());
// Grab a current low res tile.
PictureLayerTiling* old_low_res_tiling =
@@ -4791,9 +4761,9 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
EXPECT_EQ(3u, active_layer()->num_tilings());
PictureLayerTilingSet* tilings = active_layer()->tilings();
- EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale_key());
- EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale_key());
- EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale_key());
+ EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale());
+ EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale());
+ EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale());
EXPECT_EQ(NON_IDEAL_RESOLUTION, tilings->tiling_at(0)->resolution());
EXPECT_EQ(HIGH_RESOLUTION, tilings->tiling_at(1)->resolution());
@@ -4864,8 +4834,7 @@ TEST_F(PictureLayerImplTest, CompositedImageIgnoreIdealContentsScale) {
pending_layer_ptr, suggested_ideal_contents_scale, device_scale_factor,
page_scale_factor, animation_contents_scale, animation_contents_scale,
animating_transform_to_screen);
- EXPECT_EQ(1.f,
- pending_layer_ptr->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_EQ(1.f, pending_layer_ptr->tilings()->tiling_at(0)->contents_scale());
// Push to active layer.
host_impl()->ActivateSyncTree();
@@ -4876,7 +4845,7 @@ TEST_F(PictureLayerImplTest, CompositedImageIgnoreIdealContentsScale) {
active_layer, suggested_ideal_contents_scale, device_scale_factor,
page_scale_factor, animation_contents_scale, animation_contents_scale,
animating_transform_to_screen);
- EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale_key());
+ EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale());
active_layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
// Create resources for the tiles.
@@ -4932,7 +4901,7 @@ TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) {
EXPECT_FLOAT_EQ(expected_contents_scale,
pending_layer_ptr->picture_layer_tiling_set()
->FindTilingWithResolution(HIGH_RESOLUTION)
- ->contents_scale_key())
+ ->contents_scale())
<< "ideal_contents_scale: " << ideal_contents_scale;
}
@@ -4954,7 +4923,7 @@ TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) {
EXPECT_FLOAT_EQ(expected_contents_scale,
pending_layer_ptr->picture_layer_tiling_set()
->FindTilingWithResolution(HIGH_RESOLUTION)
- ->contents_scale_key())
+ ->contents_scale())
<< "ideal_contents_scale: " << ideal_contents_scale;
}
}
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698