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

Unified Diff: cc/trees/layer_tree_host_pixeltest_masks.cc

Issue 1960543002: Optimize render passes with single quads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix context menus Created 4 years, 6 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
Index: cc/trees/layer_tree_host_pixeltest_masks.cc
diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc
index a6380781470288179aefc0b7fad02666a45ad2e1..9ca88ff0e376c05915d2b97ed56f04b1c7319c7a 100644
--- a/cc/trees/layer_tree_host_pixeltest_masks.cc
+++ b/cc/trees/layer_tree_host_pixeltest_masks.cc
@@ -13,6 +13,7 @@
#include "cc/playback/drawing_display_item.h"
#include "cc/test/layer_tree_pixel_resource_test.h"
#include "cc/test/pixel_comparator.h"
+#include "cc/test/solid_color_content_layer_client.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkSurface.h"
@@ -178,6 +179,41 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplica) {
background, base::FilePath(FILE_PATH_LITERAL("mask_with_replica.png")));
}
+// Test collapsing of render passes containing a single tile quad and
+// drawing them directly with masks and replicas.
+TEST_P(LayerTreeHostMasksPixelTest, ContentLayerMaskWithReplica) {
+ scoped_refptr<SolidColorLayer> background =
+ CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE);
+
+ gfx::Size mask_bounds(50, 50);
+ MaskContentLayerClient client(mask_bounds);
+ scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client);
+ mask->SetBounds(mask_bounds);
+ mask->SetIsDrawable(true);
+ mask->SetIsMask(true);
+
+ // Use a border to defeat solid color detection to force a tile quad.
+ SolidColorContentLayerClient green_client(kCSSGreen, mask_bounds, 1,
+ SK_ColorBLACK);
+ scoped_refptr<PictureLayer> green = PictureLayer::Create(&green_client);
+ green->SetBounds(mask_bounds);
+ green->SetIsDrawable(true);
+ background->AddChild(green);
+ green->SetMaskLayer(mask.get());
+
+ gfx::Transform replica_transform;
+ replica_transform.Rotate(-90.0);
+
+ scoped_refptr<Layer> replica = Layer::Create();
+ replica->SetTransformOrigin(gfx::Point3F(25.f, 25.f, 0.f));
+ replica->SetPosition(gfx::PointF(50.f, 50.f));
+ replica->SetTransform(replica_transform);
+ green->SetReplicaLayer(replica.get());
+
+ RunPixelResourceTest(
+ background, base::FilePath(FILE_PATH_LITERAL("mask_with_replica.png")));
+}
+
TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) {
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
gfx::Rect(100, 100), SK_ColorWHITE);

Powered by Google App Engine
This is Rietveld 408576698