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

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

Issue 1588093004: Compute if a layer is drawn without LayerTree hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 "build/build_config.h" 5 #include "build/build_config.h"
6 #include "cc/layers/solid_color_layer.h" 6 #include "cc/layers/solid_color_layer.h"
7 #include "cc/layers/texture_layer.h" 7 #include "cc/layers/texture_layer.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/output/copy_output_result.h" 9 #include "cc/output/copy_output_result.h"
10 #include "cc/test/fake_picture_layer.h" 10 #include "cc/test/fake_picture_layer.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 target.get(), 256 target.get(),
257 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); 257 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
258 } 258 }
259 259
260 TEST_P(LayerTreeHostReadbackPixelTest, ReadbackHiddenSubtree) { 260 TEST_P(LayerTreeHostReadbackPixelTest, ReadbackHiddenSubtree) {
261 scoped_refptr<SolidColorLayer> background = 261 scoped_refptr<SolidColorLayer> background =
262 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK); 262 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK);
263 263
264 scoped_refptr<SolidColorLayer> hidden_target = 264 scoped_refptr<SolidColorLayer> hidden_target =
265 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); 265 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN);
266 hidden_target->SetHideLayerAndSubtree(true); 266 // Set opacity to 0 to hide subtree.
267 hidden_target->SetOpacity(0.f);
267 background->AddChild(hidden_target); 268 background->AddChild(hidden_target);
268 269
269 scoped_refptr<SolidColorLayer> blue = 270 scoped_refptr<SolidColorLayer> blue =
270 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); 271 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE);
271 hidden_target->AddChild(blue); 272 hidden_target->AddChild(blue);
272 273
273 RunReadbackTestWithReadbackTarget( 274 RunReadbackTestWithReadbackTarget(
274 GetParam().pixel_test_type, GetParam().readback_type, background, 275 GetParam().pixel_test_type, GetParam().readback_type, background,
275 hidden_target.get(), 276 hidden_target.get(),
276 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); 277 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
277 } 278 }
278 279
279 TEST_P(LayerTreeHostReadbackPixelTest, 280 TEST_P(LayerTreeHostReadbackPixelTest,
280 HiddenSubtreeNotVisibleWhenDrawnForReadback) { 281 HiddenSubtreeNotVisibleWhenDrawnForReadback) {
281 scoped_refptr<SolidColorLayer> background = 282 scoped_refptr<SolidColorLayer> background =
282 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK); 283 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK);
283 284
284 scoped_refptr<SolidColorLayer> hidden_target = 285 scoped_refptr<SolidColorLayer> hidden_target =
285 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); 286 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN);
286 hidden_target->SetHideLayerAndSubtree(true); 287 // Set opacity to 0 to hide subtree.
288 hidden_target->SetOpacity(0.f);
287 background->AddChild(hidden_target); 289 background->AddChild(hidden_target);
288 290
289 scoped_refptr<SolidColorLayer> blue = 291 scoped_refptr<SolidColorLayer> blue =
290 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); 292 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE);
291 hidden_target->AddChild(blue); 293 hidden_target->AddChild(blue);
292 294
293 hidden_target->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 295 hidden_target->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
294 base::Bind(&IgnoreReadbackResult))); 296 base::Bind(&IgnoreReadbackResult)));
295 RunReadbackTest(GetParam().pixel_test_type, GetParam().readback_type, 297 RunReadbackTest(GetParam().pixel_test_type, GetParam().readback_type,
296 background, base::FilePath(FILE_PATH_LITERAL("black.png"))); 298 background, base::FilePath(FILE_PATH_LITERAL("black.png")));
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 READBACK_DEFAULT), 550 READBACK_DEFAULT),
549 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, 551 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL,
550 READBACK_DEFAULT), 552 READBACK_DEFAULT),
551 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, 553 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL,
552 READBACK_BITMAP))); 554 READBACK_BITMAP)));
553 555
554 } // namespace 556 } // namespace
555 } // namespace cc 557 } // namespace cc
556 558
557 #endif // OS_ANDROID 559 #endif // OS_ANDROID
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698