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 86039dfb672ff6c0a3e9b29c31d58e298738fc39..81a5f704516137458b6129c6033c85edaea8b3d1 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -191,7 +191,7 @@ class PictureLayerImplTest : public TestLayerTreeHostBase { |
auto prioritized_tiles = |
tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
for (PictureLayerTiling::CoverageIterator iter( |
- tiling, tiling->contents_scale(), |
+ tiling, tiling->contents_scale_key(), |
gfx::Rect(tiling->tiling_size())); |
iter; ++iter) { |
EXPECT_TRUE(*iter); |
@@ -323,7 +323,7 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { |
EXPECT_EQ( |
tiling->GetCurrentVisibleRectForTesting(), |
gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
- tiling->contents_scale())); |
+ tiling->contents_scale_key())); |
} |
// Update tiles with viewport for tile priority as (200, 200, 100, 100) in |
@@ -359,7 +359,7 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { |
EXPECT_EQ( |
tiling->GetCurrentVisibleRectForTesting(), |
gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
- tiling->contents_scale())); |
+ tiling->contents_scale_key())); |
} |
} |
@@ -417,7 +417,8 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
Region()); |
ActivateTree(); |
// Add a unique tiling on the active tree. |
- PictureLayerTiling* tiling = active_layer()->AddTiling(3.f); |
+ PictureLayerTiling* tiling = |
+ active_layer()->AddTiling(ScaleTranslate2d(3.f, gfx::Vector2dF())); |
tiling->set_resolution(HIGH_RESOLUTION); |
tiling->CreateAllTilesForTesting(); |
@@ -435,12 +436,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()); |
+ gfx::Rect content_invalidation = gfx::ScaleToEnclosingRect( |
+ layer_invalidation, tiling->contents_scale_key()); |
auto prioritized_tiles = |
tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
for (PictureLayerTiling::CoverageIterator iter( |
- tiling, tiling->contents_scale(), |
+ tiling, tiling->contents_scale_key(), |
gfx::Rect(tiling->tiling_size())); |
iter; ++iter) { |
// We don't always have a tile, but when we do it's because it was |
@@ -464,7 +465,7 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
auto prioritized_tiles = |
tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
for (PictureLayerTiling::CoverageIterator iter( |
- tiling, tiling->contents_scale(), |
+ tiling, tiling->contents_scale_key(), |
gfx::Rect(tiling->tiling_size())); |
iter; ++iter) { |
EXPECT_TRUE(*iter); |
@@ -518,10 +519,11 @@ 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()); |
- EXPECT_FLOAT_EQ(6.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -532,10 +534,11 @@ 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()); |
- EXPECT_FLOAT_EQ(6.6f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ 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()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -546,10 +549,11 @@ 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()); |
- EXPECT_FLOAT_EQ(7.26f * low_res_factor, |
- active_layer()->tilings()->tiling_at(3)->contents_scale()); |
+ 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()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -561,10 +565,11 @@ 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()); |
- EXPECT_FLOAT_EQ(7.26f * low_res_factor, |
- active_layer()->tilings()->tiling_at(3)->contents_scale()); |
+ 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()); |
} |
TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
@@ -587,8 +592,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()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -599,8 +604,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()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -611,8 +616,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()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -624,8 +629,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()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { |
@@ -692,7 +697,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()); |
+ EXPECT_EQ(32.f, active_layer()->HighResTiling()->contents_scale_key()); |
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); |
@@ -717,7 +722,7 @@ TEST_F(PictureLayerImplTest, ScaledBoundsOverflowInt) { |
static_cast<float>(std::numeric_limits<int>::max())); |
SetContentsScaleOnBothLayers(scale, 1.0f, scale, 1.0f, 0.f, false); |
- float adjusted_scale = active_layer()->HighResTiling()->contents_scale(); |
+ float adjusted_scale = active_layer()->HighResTiling()->contents_scale_key(); |
EXPECT_LT(adjusted_scale, scale); |
// PopulateSharedQuadState CHECKs for overflows. |
@@ -740,8 +745,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(), 2.f); |
- EXPECT_EQ(active_layer()->tilings()->tiling_at(1)->contents_scale(), |
+ EXPECT_EQ(active_layer()->tilings()->tiling_at(0)->contents_scale_key(), 2.f); |
+ EXPECT_EQ(active_layer()->tilings()->tiling_at(1)->contents_scale_key(), |
2.f * low_res_factor); |
// One of the tilings has to be a low resolution one. |
EXPECT_EQ(LOW_RESOLUTION, |
@@ -757,12 +762,13 @@ 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()); |
- 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()); |
+ 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()); |
// Since we're pinching, we shouldn't create a low resolution tiling. |
EXPECT_FALSE( |
active_layer()->tilings()->FindTilingWithResolution(LOW_RESOLUTION)); |
@@ -782,8 +788,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()); |
+ EXPECT_FLOAT_EQ( |
+ 4.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// 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 = |
@@ -801,8 +807,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()); |
+ EXPECT_FLOAT_EQ( |
+ 4.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// Now that we stopped pinching, the low resolution tiling that existed should |
// now be marked as low resolution. |
low_res_tiling = |
@@ -821,10 +827,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()); |
- EXPECT_FLOAT_EQ(0.0625f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -836,12 +842,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()); |
- 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()); |
+ 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()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -860,8 +866,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()); |
+ EXPECT_FLOAT_EQ( |
+ 1.92f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, CleanUpTilings) { |
@@ -878,10 +884,11 @@ 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()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
// 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() |
@@ -892,10 +899,11 @@ 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()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
host_impl()->PinchGestureBegin(); |
@@ -904,19 +912,21 @@ 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()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
// 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()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
host_impl()->PinchGestureEnd(); |
@@ -925,14 +935,16 @@ 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()); |
- 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()); |
+ 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()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -943,14 +955,16 @@ 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()); |
- 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()); |
+ 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()); |
// 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); |
@@ -960,12 +974,13 @@ 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()); |
- 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.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()); |
// 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); |
@@ -975,12 +990,13 @@ 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()); |
- 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.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()); |
// 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, |
@@ -991,12 +1007,13 @@ 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()); |
- 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.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()); |
// Move the ideal scale on the pending layer to 1.1 as well. Our target stays |
// 1.2 still. |
@@ -1010,22 +1027,24 @@ 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()); |
- 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.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()); |
// 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()); |
- EXPECT_FLOAT_EQ(1.2 * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
} |
TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
@@ -1050,7 +1069,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(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
// Stop animating, low res gets created. |
@@ -1058,8 +1077,9 @@ 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(), 1.f); |
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), low_res_factor); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f); |
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(), |
+ low_res_factor); |
EXPECT_EQ(active_layer()->num_tilings(), 2u); |
EXPECT_EQ(pending_layer()->num_tilings(), 1u); |
@@ -1076,7 +1096,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(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
EXPECT_FALSE(active_layer()->LowResTiling()); |
EXPECT_FALSE(pending_layer()->LowResTiling()); |
EXPECT_EQ(3u, active_layer()->num_tilings()); |
@@ -1087,8 +1107,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(), 2.f); |
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(), |
2.f * low_res_factor); |
EXPECT_EQ(4u, active_layer()->num_tilings()); |
EXPECT_EQ(1u, pending_layer()->num_tilings()); |
@@ -1116,7 +1136,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(), contents_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
ResetTilingsAndRasterScales(); |
@@ -1126,7 +1146,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(), contents_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
// TODO(danakj): Remove these when raster scale doesn't get fixed? |
@@ -1138,8 +1158,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(), contents_scale); |
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale); |
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(), |
contents_scale * low_res_factor); |
EXPECT_FALSE(pending_layer()->LowResTiling()); |
EXPECT_EQ(active_layer()->num_tilings(), 2u); |
@@ -1166,7 +1186,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(), contents_scale); |
+ EXPECT_EQ(mask_raw->HighResTiling()->contents_scale_key(), contents_scale); |
EXPECT_EQ(mask_raw->num_tilings(), 1u); |
} |
@@ -1195,7 +1215,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()); |
+ EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale_key()); |
EXPECT_EQ(1u, pending_mask->num_tilings()); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
@@ -1241,7 +1261,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(), 1.f); |
+ EXPECT_LT(pending_mask->HighResTiling()->contents_scale_key(), 1.f); |
EXPECT_EQ(1u, pending_mask->num_tilings()); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
@@ -1325,7 +1345,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()); |
+ EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale_key()); |
EXPECT_EQ(1u, pending_mask->num_tilings()); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
@@ -1660,7 +1680,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()); |
+ ASSERT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key()); |
// Set external viewport for tile priority. |
gfx::Transform transform; |
@@ -1858,7 +1878,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()); |
+ EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale_key()); |
ideal_tiles.push_back(active_layer()->HighResTiling()->TileAt(0, 0)); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
ideal_tiles); |
@@ -1870,13 +1890,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()); |
+ EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale_key()); |
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()); |
- EXPECT_EQ(1.f, active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ 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()); |
// All high res tiles have resources. |
std::vector<Tile*> high_tiles = |
@@ -2450,7 +2470,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()); |
+ EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key()); |
// 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 +2478,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()); |
+ EXPECT_EQ(4.f, pending_layer()->HighResTiling()->contents_scale_key()); |
} |
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()); |
+ EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key()); |
host_impl()->PinchGestureBegin(); |
float high_res_scale = 0.0001f; |
@@ -2474,7 +2494,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()); |
+ pending_layer()->HighResTiling()->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) { |
@@ -2487,7 +2507,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) { |
ASSERT_GE(pending_layer()->num_tilings(), 0u); |
EXPECT_FLOAT_EQ(contents_scale, |
- pending_layer()->HighResTiling()->contents_scale()); |
+ pending_layer()->HighResTiling()->contents_scale_key()); |
host_impl()->PinchGestureBegin(); |
@@ -2499,7 +2519,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()); |
+ pending_layer()->HighResTiling()->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
@@ -2516,13 +2536,13 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
float starting_animation_scale = 1.f; |
bool animating_transform = true; |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
animating_transform = false; |
@@ -2530,7 +2550,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(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
// Starting animation scale greater than maximum animation scale |
// Bounds at starting scale within the viewport |
@@ -2540,14 +2560,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(), 5.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
// Starting Animation scale greater than maximum animation scale |
// Bounds at starting scale outisde the viewport |
@@ -2557,7 +2577,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(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
} |
TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
@@ -2574,7 +2594,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
float starting_animation_scale = 0.f; |
bool animating_transform = false; |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f); |
// Starting an animation should cause tiling resolution to get set to the |
// maximum animation scale factor. |
@@ -2585,7 +2605,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(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
// Further changes to scale during the animation should not cause a new |
// high-res tiling to get created. |
@@ -2595,7 +2615,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(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2603,7 +2623,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(), 4.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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,7 +2634,8 @@ 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(), page_scale * device_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ page_scale * device_scale); |
// Further changes to scale during the animation should not cause a new |
// high-res tiling to get created. |
@@ -2623,7 +2644,8 @@ 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(), page_scale * device_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ page_scale * device_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2632,7 +2654,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(), 4.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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 |
@@ -2645,7 +2667,8 @@ 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(), page_scale * device_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ page_scale * device_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2654,7 +2677,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(), 11.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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 |
@@ -2667,7 +2690,8 @@ 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(), device_scale * page_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ device_scale * page_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2676,7 +2700,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(), 12.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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 |
@@ -2688,7 +2712,8 @@ 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(), device_scale * page_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ device_scale * page_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2697,7 +2722,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(), 11.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 11.f); |
} |
TEST_F(PictureLayerImplTest, TilingSetRasterQueue) { |
@@ -2962,18 +2987,19 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { |
EXPECT_FALSE(tile->required_for_activation()); |
- while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > |
+ while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) > |
std::numeric_limits<float>::epsilon()) { |
++scale_index; |
ASSERT_LT(scale_index, arraysize(expected_scales)); |
} |
- EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); |
+ EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]); |
unique_tiles.insert(tile); |
if (tile->required_for_activation() == |
last_tile.tile()->required_for_activation() && |
- std::abs(tile->contents_scale() - last_tile.tile()->contents_scale()) < |
+ std::abs(tile->contents_scale_key() - |
+ last_tile.tile()->contents_scale_key()) < |
std::numeric_limits<float>::epsilon()) { |
if (priority.distance_to_visible <= |
last_tile.priority().distance_to_visible) |
@@ -3009,13 +3035,13 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { |
scale_index = 0; |
} |
- while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > |
+ while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) > |
std::numeric_limits<float>::epsilon()) { |
++scale_index; |
ASSERT_LT(scale_index, arraysize(expected_scales)); |
} |
- EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); |
+ EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]); |
unique_tiles.insert(tile); |
queue->Pop(); |
} |
@@ -3090,7 +3116,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(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
// Changing the source scale without being in an animation will cause |
// the layer to change scale. |
@@ -3099,14 +3125,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(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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(), 0.5f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f); |
// However, if the layer has a will-change property, then the raster scale |
// will get fixed at the last value. |
@@ -3118,7 +3144,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(), 0.5f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f); |
// Further changes to the source scale will no longer be reflected in the |
// contents scale. |
@@ -3127,7 +3153,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(), 0.5f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f); |
// Disabling the will-change hint will once again make the raster scale update |
// with the ideal scale. |
@@ -3139,7 +3165,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(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
} |
TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
@@ -3222,8 +3248,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()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -3234,8 +3260,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()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -3246,8 +3272,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()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -3259,8 +3285,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()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
@@ -3280,8 +3306,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()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -3292,8 +3318,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()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -3304,8 +3330,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()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -3317,8 +3343,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()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfNotChanged) { |
@@ -3428,8 +3454,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()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -3650,8 +3676,8 @@ class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest { |
EXPECT_TRUE(tile_priority_bin < last_tile_priority_bin || |
tile->required_for_activation() || |
- tile->contents_scale() != |
- last_tile.tile()->contents_scale()) |
+ tile->contents_scale_key() != |
+ last_tile.tile()->contents_scale_key()) |
<< "line: " << source_line; |
} |
} |
@@ -3904,11 +3930,21 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { |
pending_layer()->tilings()->RemoveAllTilings(); |
float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; |
- pending_layer()->AddTiling(low_res_factor)->set_resolution(LOW_RESOLUTION); |
- pending_layer()->AddTiling(0.3f)->set_resolution(HIGH_RESOLUTION); |
- pending_layer()->AddTiling(0.7f)->set_resolution(HIGH_RESOLUTION); |
- pending_layer()->AddTiling(1.0f)->set_resolution(HIGH_RESOLUTION); |
- pending_layer()->AddTiling(2.0f)->set_resolution(HIGH_RESOLUTION); |
+ pending_layer() |
+ ->AddTiling(ScaleTranslate2d(low_res_factor, gfx::Vector2dF())) |
+ ->set_resolution(LOW_RESOLUTION); |
+ pending_layer() |
+ ->AddTiling(ScaleTranslate2d(0.3f, gfx::Vector2dF())) |
+ ->set_resolution(HIGH_RESOLUTION); |
+ pending_layer() |
+ ->AddTiling(ScaleTranslate2d(0.7f, gfx::Vector2dF())) |
+ ->set_resolution(HIGH_RESOLUTION); |
+ pending_layer() |
+ ->AddTiling(ScaleTranslate2d(1.0f, gfx::Vector2dF())) |
+ ->set_resolution(HIGH_RESOLUTION); |
+ pending_layer() |
+ ->AddTiling(ScaleTranslate2d(2.0f, gfx::Vector2dF())) |
+ ->set_resolution(HIGH_RESOLUTION); |
RebuildPropertyTreesOnPendingTree(); |
host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
@@ -3929,7 +3965,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]->contents_scale()); |
+ tiles[j]->content_rect(), 1.f / tiles[j]->contents_scale_key()); |
EXPECT_GE(scaled_content_rect.x(), occluding_layer_position.x()); |
occluded_tile_count++; |
} |
@@ -3993,7 +4029,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) { |
const Tile* tile = *iter; |
gfx::Rect scaled_content_rect = ScaleToEnclosingRect( |
- tile->content_rect(), 1.f / tile->contents_scale()); |
+ tile->content_rect(), 1.f / tile->contents_scale_key()); |
// Tiles are occluded on the active tree iff they lie beneath the |
// occluding layer. |
EXPECT_EQ(prioritized_tiles[tile].is_occluded(), |
@@ -4029,7 +4065,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->contents_scale()); |
+ tile->content_rect(), 1.f / tile->contents_scale_key()); |
if (scaled_content_rect.Intersects(invalidation_rect)) { |
// Tiles inside the invalidation rect exist on both trees. |
@@ -4137,7 +4173,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
} |
EXPECT_EQ(expected_occluded_tile_count_on_pending[i], |
occluded_tile_count_on_pending) |
- << tiling->contents_scale(); |
+ << tiling->contents_scale_key(); |
} |
// Verify number of occluded tiles on the active layer for each tiling. |
@@ -4727,7 +4763,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(), page_scale); |
+ EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale_key(), page_scale); |
host_impl()->PinchGestureBegin(); |
@@ -4736,7 +4772,8 @@ 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()); |
+ EXPECT_EQ(zoomed, |
+ pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, HighResWasLowResCollision) { |
@@ -4754,8 +4791,9 @@ 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()); |
- EXPECT_EQ(low_res, active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_EQ(low_res, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// Grab a current low res tile. |
PictureLayerTiling* old_low_res_tiling = |
@@ -4780,9 +4818,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()); |
- EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale()); |
- EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale()); |
+ 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(NON_IDEAL_RESOLUTION, tilings->tiling_at(0)->resolution()); |
EXPECT_EQ(HIGH_RESOLUTION, tilings->tiling_at(1)->resolution()); |
@@ -4853,7 +4891,8 @@ 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()); |
+ EXPECT_EQ(1.f, |
+ pending_layer_ptr->tilings()->tiling_at(0)->contents_scale_key()); |
// Push to active layer. |
host_impl()->ActivateSyncTree(); |
@@ -4864,7 +4903,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()); |
+ EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale_key()); |
active_layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); |
// Create resources for the tiles. |
@@ -4920,7 +4959,7 @@ TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) { |
EXPECT_FLOAT_EQ(expected_contents_scale, |
pending_layer_ptr->picture_layer_tiling_set() |
->FindTilingWithResolution(HIGH_RESOLUTION) |
- ->contents_scale()) |
+ ->contents_scale_key()) |
<< "ideal_contents_scale: " << ideal_contents_scale; |
} |
@@ -4942,10 +4981,136 @@ TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) { |
EXPECT_FLOAT_EQ(expected_contents_scale, |
pending_layer_ptr->picture_layer_tiling_set() |
->FindTilingWithResolution(HIGH_RESOLUTION) |
- ->contents_scale()) |
+ ->contents_scale_key()) |
<< "ideal_contents_scale: " << ideal_contents_scale; |
} |
} |
+TEST_F(PictureLayerImplTest, ChangeRasterTranslationNukePendingLayerTiles) { |
+ gfx::Size layer_bounds(200, 200); |
+ gfx::Size tile_size(256, 256); |
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
+ pending_layer()->SetUseTransformedRasterization(true); |
+ |
+ // Start with scale & translation of * 2.25 + (0.25, 0.5). |
+ SetupDrawProperties(pending_layer(), 2.25f, 1.5f, 1.f, 2.25f, 2.25f, false); |
+ gfx::Transform translate1; |
+ translate1.Translate(0.25f, 0.5f); |
+ pending_layer()->draw_properties().screen_space_transform.ConcatTransform( |
+ translate1); |
+ pending_layer()->draw_properties().target_space_transform = |
+ pending_layer()->draw_properties().screen_space_transform; |
+ pending_layer()->UpdateTiles(); |
+ ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
+ { |
+ PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(0); |
+ EXPECT_EQ(ScaleTranslate2d(2.25f, gfx::Vector2dF(0.25f, 0.5f)), |
+ tiling->raster_transform()); |
+ EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); |
+ // Mark some arbitrary flags on the tiles for later checking. |
+ for (auto* tile : tiling->AllTilesForTesting()) |
+ tile->set_solid_color_analysis_performed(true); |
+ } |
+ |
+ // Change to scale & translation of * 2.25 + (0.75, 0.25). |
+ // Verifies there is a hysteresis that simple layer movement doesn't update |
+ // raster translation. |
+ SetupDrawProperties(pending_layer(), 2.25f, 1.5f, 1.f, 2.25f, 2.25f, false); |
+ gfx::Transform translate2; |
+ translate2.Translate(0.75f, 0.25f); |
+ pending_layer()->draw_properties().screen_space_transform.ConcatTransform( |
+ translate2); |
+ pending_layer()->draw_properties().target_space_transform = |
+ pending_layer()->draw_properties().screen_space_transform; |
+ pending_layer()->UpdateTiles(); |
+ ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
+ { |
+ PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(0); |
+ EXPECT_EQ(ScaleTranslate2d(2.25f, gfx::Vector2dF(0.25f, 0.5f)), |
+ tiling->raster_transform()); |
+ EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); |
+ for (auto* tile : tiling->AllTilesForTesting()) |
+ EXPECT_TRUE(tile->is_solid_color_analysis_performed()); |
+ } |
+ |
+ // Now change the device scale factor but keep the same total scale. |
+ // Verifies the old tiles get evicted due to slot conflict. |
+ SetupDrawProperties(pending_layer(), 2.25f, 1.0f, 1.f, 2.25f, 2.25f, false); |
+ pending_layer()->draw_properties().screen_space_transform.ConcatTransform( |
+ translate2); |
+ pending_layer()->draw_properties().target_space_transform = |
+ pending_layer()->draw_properties().screen_space_transform; |
+ pending_layer()->UpdateTiles(); |
+ ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
+ { |
+ PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(0); |
+ EXPECT_EQ(ScaleTranslate2d(2.25f, gfx::Vector2dF(0.75f, 0.25f)), |
+ tiling->raster_transform()); |
+ EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); |
+ for (auto* tile : tiling->AllTilesForTesting()) |
+ EXPECT_FALSE(tile->is_solid_color_analysis_performed()); |
+ } |
+} |
+ |
+TEST_F(PictureLayerImplTest, ChangeRasterTranslationNukeActiveLayerTiles) { |
+ gfx::Size layer_bounds(200, 200); |
+ gfx::Size tile_size(256, 256); |
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
+ active_layer()->SetUseTransformedRasterization(true); |
+ pending_layer()->SetUseTransformedRasterization(true); |
+ |
+ // Start with scale & translation of * 2.25 + (0.25, 0.5) on the active layer. |
+ SetupDrawProperties(active_layer(), 2.25f, 1.5f, 1.f, 2.25f, 2.25f, false); |
+ gfx::Transform translate1; |
+ translate1.Translate(0.25f, 0.5f); |
+ active_layer()->draw_properties().screen_space_transform.ConcatTransform( |
+ translate1); |
+ active_layer()->draw_properties().target_space_transform = |
+ active_layer()->draw_properties().screen_space_transform; |
+ active_layer()->UpdateTiles(); |
+ ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
+ { |
+ PictureLayerTiling* tiling = |
+ active_layer()->tilings()->FindTilingWithScaleKey(2.25f); |
+ EXPECT_EQ(ScaleTranslate2d(2.25f, gfx::Vector2dF(0.25f, 0.5f)), |
+ tiling->raster_transform()); |
+ EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); |
+ // Mark some arbitrary flags on the tiles for later checking. |
+ for (auto* tile : tiling->AllTilesForTesting()) |
+ tile->set_solid_color_analysis_performed(true); |
+ } |
+ |
+ // Create a pending layer with the same scale but different translation. |
+ SetupDrawProperties(pending_layer(), 2.25f, 1.5f, 1.f, 2.25f, 2.25f, false); |
+ gfx::Transform translate2; |
+ translate2.Translate(0.75f, 0.25f); |
+ pending_layer()->draw_properties().screen_space_transform.ConcatTransform( |
+ translate2); |
+ pending_layer()->draw_properties().target_space_transform = |
+ pending_layer()->draw_properties().screen_space_transform; |
+ pending_layer()->UpdateTiles(); |
+ ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
+ { |
+ PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(0); |
+ EXPECT_EQ(ScaleTranslate2d(2.25f, gfx::Vector2dF(0.75f, 0.25f)), |
+ tiling->raster_transform()); |
+ EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); |
+ } |
+ |
+ // Now push to the active layer. |
+ // Verifies the active tiles get evicted due to slot conflict. |
+ host_impl()->ActivateSyncTree(); |
+ ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
+ { |
+ PictureLayerTiling* tiling = |
+ active_layer()->tilings()->FindTilingWithScaleKey(2.25f); |
+ EXPECT_EQ(ScaleTranslate2d(2.25f, gfx::Vector2dF(0.75f, 0.25f)), |
+ tiling->raster_transform()); |
+ EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); |
+ for (auto* tile : tiling->AllTilesForTesting()) |
+ EXPECT_FALSE(tile->is_solid_color_analysis_performed()); |
+ } |
+} |
+ |
} // namespace |
} // namespace cc |