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

Unified Diff: cc/layers/tiled_layer_unittest.cc

Issue 590313004: Revert of Fix bad scaling in TiledLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/tiled_layer.cc ('k') | cc/resources/bitmap_content_layer_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/tiled_layer_unittest.cc
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 4a6f5f6157fa4cdf68b1d2d901c1cec6d280880e..beeb878137e2c3abeed294a41cc38169d9a04610 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -287,27 +287,6 @@
// not painted.
EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0));
EXPECT_FALSE(layer_impl->HasResourceIdForTileAt(0, 1));
-}
-
-TEST_F(TiledLayerTest, Scale) {
- layer_tree_host_->SetDeviceScaleFactor(1.5);
-
- scoped_refptr<FakeTiledLayer> layer =
- make_scoped_refptr(new FakeTiledLayer(resource_manager_.get()));
- scoped_ptr<FakeTiledLayerImpl> layer_impl =
- make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1));
- RenderSurfaceLayerList render_surface_layer_list;
-
- layer_tree_host_->root_layer()->AddChild(layer);
-
- layer->SetBounds(gfx::Size(100, 200));
- CalcDrawProps(&render_surface_layer_list);
-
- // Change the width so that it doesn't divide cleanly by the scale.
- layer->SetBounds(gfx::Size(101, 200));
- UpdateAndPush(layer, layer_impl);
-
- EXPECT_EQ(1.5, layer->fake_layer_updater()->last_contents_width_scale());
}
TEST_F(TiledLayerTest, PushOccludedDirtyTiles) {
@@ -893,13 +872,11 @@
layer_tree_host_->root_layer()->AddChild(layer);
gfx::Rect layer_bounds(0, 0, 300, 200);
- gfx::Rect content_bounds(0, 0, 150, 250);
+ gfx::Rect content_bounds(0, 0, 200, 250);
layer->SetBounds(layer_bounds.size());
layer->SetContentBounds(content_bounds.size());
layer->draw_properties().visible_content_rect = content_bounds;
- layer->draw_properties().contents_scale_x = .5f;
- layer->draw_properties().contents_scale_y = 1.25f;
// On first update, the update_rect includes all tiles, even beyond the
// boundaries of the layer.
@@ -910,9 +887,7 @@
resource_manager_->PrioritizeTextures();
layer->SavePaintProperties();
layer->Update(queue_.get(), NULL);
-
- // Update rect is 200x300 (tile size of 100x100). Scaled this gives 400x240.
- EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 400, 240), layer->update_rect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->update_rect());
UpdateTextures();
// After the tiles are updated once, another invalidate only needs to update
@@ -933,7 +908,7 @@
resource_manager_->PrioritizeTextures();
layer->SavePaintProperties();
layer->Update(queue_.get(), NULL);
- EXPECT_FLOAT_RECT_EQ(gfx::RectF(60, 80, 20, 8), layer->update_rect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->update_rect());
}
TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) {
@@ -1717,11 +1692,7 @@
layer->InvalidateContentRect(content_rect);
layer->Update(queue_.get(), NULL);
- // Rounding leads to an extra pixel.
- gfx::Rect expanded_layer_rect(layer_rect);
- expanded_layer_rect.set_height(32);
- EXPECT_RECT_EQ(expanded_layer_rect,
- layer->tracking_layer_painter()->PaintedRect());
+ EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
}
TEST_F(TiledLayerTest,
@@ -1756,11 +1727,7 @@
layer->SetNeedsDisplayRect(layer_rect);
layer->Update(queue_.get(), NULL);
- // Rounding leads to an extra pixel.
- gfx::Rect expanded_layer_rect(layer_rect);
- expanded_layer_rect.set_height(32);
- EXPECT_RECT_EQ(expanded_layer_rect,
- layer->tracking_layer_painter()->PaintedRect());
+ EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
}
} // namespace
« no previous file with comments | « cc/layers/tiled_layer.cc ('k') | cc/resources/bitmap_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698