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

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_masks.cc

Issue 2058013003: Revert of Optimize render passes with single quads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert "Optimize render passes with single quads" 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "cc/layers/content_layer_client.h" 8 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_image_layer.h" 9 #include "cc/layers/picture_image_layer.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
11 #include "cc/layers/solid_color_layer.h" 11 #include "cc/layers/solid_color_layer.h"
12 #include "cc/playback/display_item_list_settings.h" 12 #include "cc/playback/display_item_list_settings.h"
13 #include "cc/playback/drawing_display_item.h" 13 #include "cc/playback/drawing_display_item.h"
14 #include "cc/test/layer_tree_pixel_resource_test.h" 14 #include "cc/test/layer_tree_pixel_resource_test.h"
15 #include "cc/test/pixel_comparator.h" 15 #include "cc/test/pixel_comparator.h"
16 #include "cc/test/solid_color_content_layer_client.h"
17 #include "third_party/skia/include/core/SkImage.h" 16 #include "third_party/skia/include/core/SkImage.h"
18 #include "third_party/skia/include/core/SkPictureRecorder.h" 17 #include "third_party/skia/include/core/SkPictureRecorder.h"
19 #include "third_party/skia/include/core/SkSurface.h" 18 #include "third_party/skia/include/core/SkSurface.h"
20 19
21 #if !defined(OS_ANDROID) 20 #if !defined(OS_ANDROID)
22 21
23 namespace cc { 22 namespace cc {
24 namespace { 23 namespace {
25 24
26 typedef ParameterizedPixelResourceTest LayerTreeHostMasksPixelTest; 25 typedef ParameterizedPixelResourceTest LayerTreeHostMasksPixelTest;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 scoped_refptr<Layer> replica = Layer::Create(); 171 scoped_refptr<Layer> replica = Layer::Create();
173 replica->SetTransformOrigin(gfx::Point3F(25.f, 25.f, 0.f)); 172 replica->SetTransformOrigin(gfx::Point3F(25.f, 25.f, 0.f));
174 replica->SetPosition(gfx::PointF(50.f, 50.f)); 173 replica->SetPosition(gfx::PointF(50.f, 50.f));
175 replica->SetTransform(replica_transform); 174 replica->SetTransform(replica_transform);
176 green->SetReplicaLayer(replica.get()); 175 green->SetReplicaLayer(replica.get());
177 176
178 RunPixelResourceTest( 177 RunPixelResourceTest(
179 background, base::FilePath(FILE_PATH_LITERAL("mask_with_replica.png"))); 178 background, base::FilePath(FILE_PATH_LITERAL("mask_with_replica.png")));
180 } 179 }
181 180
182 // Test collapsing of render passes containing a single tile quad and
183 // drawing them directly with masks and replicas.
184 TEST_P(LayerTreeHostMasksPixelTest, ContentLayerMaskWithReplica) {
185 scoped_refptr<SolidColorLayer> background =
186 CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE);
187
188 gfx::Size mask_bounds(50, 50);
189 MaskContentLayerClient client(mask_bounds);
190 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client);
191 mask->SetBounds(mask_bounds);
192 mask->SetIsDrawable(true);
193 mask->SetIsMask(true);
194
195 // Use a border to defeat solid color detection to force a tile quad.
196 SolidColorContentLayerClient green_client(kCSSGreen, mask_bounds, 1,
197 SK_ColorBLACK);
198 scoped_refptr<PictureLayer> green = PictureLayer::Create(&green_client);
199 green->SetBounds(mask_bounds);
200 green->SetIsDrawable(true);
201 background->AddChild(green);
202 green->SetMaskLayer(mask.get());
203
204 gfx::Transform replica_transform;
205 replica_transform.Rotate(-90.0);
206
207 scoped_refptr<Layer> replica = Layer::Create();
208 replica->SetTransformOrigin(gfx::Point3F(25.f, 25.f, 0.f));
209 replica->SetPosition(gfx::PointF(50.f, 50.f));
210 replica->SetTransform(replica_transform);
211 green->SetReplicaLayer(replica.get());
212
213 RunPixelResourceTest(
214 background, base::FilePath(FILE_PATH_LITERAL("mask_with_replica.png")));
215 }
216
217 TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) { 181 TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) {
218 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( 182 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
219 gfx::Rect(100, 100), SK_ColorWHITE); 183 gfx::Rect(100, 100), SK_ColorWHITE);
220 184
221 gfx::Size mask_bounds(50, 50); 185 gfx::Size mask_bounds(50, 50);
222 MaskContentLayerClient client(mask_bounds); 186 MaskContentLayerClient client(mask_bounds);
223 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); 187 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client);
224 mask->SetBounds(mask_bounds); 188 mask->SetBounds(mask_bounds);
225 mask->SetIsDrawable(true); 189 mask->SetIsDrawable(true);
226 mask->SetIsMask(true); 190 mask->SetIsMask(true);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 482
519 RunPixelResourceTest(background, 483 RunPixelResourceTest(background,
520 base::FilePath( 484 base::FilePath(
521 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); 485 FILE_PATH_LITERAL("mask_of_layer_with_blend.png")));
522 } 486 }
523 487
524 } // namespace 488 } // namespace
525 } // namespace cc 489 } // namespace cc
526 490
527 #endif // !defined(OS_ANDROID) 491 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_filters.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698