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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 659683002: Include mask texture size in RenderPassDrawQuad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_mask_draw_quad_test
Patch Set: No ToEnclosedRect Created 6 years, 2 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/layers/render_surface_impl.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 9716aa91030bf3cf3bfb5094b7c9b7808c9703cc..67cca8b3a4b7907a2d80508b316a936f8db4e4e4 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1200,7 +1200,11 @@ TEST_F(PictureLayerImplTest, HugeMasksDontGetTiles) {
// Mask layers have a tiling with a single tile in it.
EXPECT_EQ(1u, active_layer_->HighResTiling()->AllTilesForTesting().size());
// The mask resource exists.
- EXPECT_NE(0u, active_layer_->ContentsResourceId());
+ ResourceProvider::ResourceId mask_resource_id;
+ gfx::Size mask_texture_size;
+ active_layer_->GetContentsResourceId(&mask_resource_id, &mask_texture_size);
+ EXPECT_NE(0u, mask_resource_id);
+ EXPECT_EQ(mask_texture_size, active_layer_->bounds());
// Resize larger than the max texture size.
int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size;
@@ -1223,7 +1227,41 @@ TEST_F(PictureLayerImplTest, HugeMasksDontGetTiles) {
// Mask layers have a tiling, but there should be no tiles in it.
EXPECT_EQ(0u, active_layer_->HighResTiling()->AllTilesForTesting().size());
// The mask resource is empty.
- EXPECT_EQ(0u, active_layer_->ContentsResourceId());
+ active_layer_->GetContentsResourceId(&mask_resource_id, &mask_texture_size);
+ EXPECT_EQ(0u, mask_resource_id);
+}
+
+TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
+ gfx::Size tile_size(100, 100);
+
+ scoped_refptr<FakePicturePileImpl> valid_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(1000, 1000));
+ valid_pile->set_is_mask(true);
+ SetupPendingTree(valid_pile);
+
+ float ideal_contents_scale = 1.3f;
+ SetupDrawPropertiesAndUpdateTiles(
+ pending_layer_, ideal_contents_scale, 1.f, 1.f, 1.f, false);
+ EXPECT_EQ(ideal_contents_scale,
+ pending_layer_->HighResTiling()->contents_scale());
+ EXPECT_EQ(1u, pending_layer_->num_tilings());
+
+ pending_layer_->HighResTiling()->CreateAllTilesForTesting();
+ host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
+ pending_layer_->HighResTiling()->AllTilesForTesting());
+
+ ActivateTree();
+
+ // Mask layers have a tiling with a single tile in it.
+ EXPECT_EQ(1u, active_layer_->HighResTiling()->AllTilesForTesting().size());
+ // The mask resource exists.
+ ResourceProvider::ResourceId mask_resource_id;
+ gfx::Size mask_texture_size;
+ active_layer_->GetContentsResourceId(&mask_resource_id, &mask_texture_size);
+ EXPECT_NE(0u, mask_resource_id);
+ gfx::Size expected_mask_texture_size = gfx::ToCeiledSize(
+ gfx::ScaleSize(active_layer_->bounds(), ideal_contents_scale));
+ EXPECT_EQ(mask_texture_size, expected_mask_texture_size);
}
TEST_F(PictureLayerImplTest, ReleaseResources) {
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/render_surface_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698