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

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

Issue 15004009: cc: Fix readback from non-root layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/pixel_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "build/build_config.h"
6 #include "cc/test/layer_tree_pixel_test.h"
7
8 #if !defined(OS_ANDROID)
9
10 namespace cc {
11 namespace {
12
13 class LayerTreeHostReadbackPixelTest : public LayerTreePixelTest {};
14
15 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer) {
16 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
17 gfx::Rect(200, 200), SK_ColorWHITE);
18
19 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer(
20 gfx::Rect(200, 200), SK_ColorGREEN);
21 background->AddChild(green);
22
23 RunPixelTest(background,
24 base::FilePath(FILE_PATH_LITERAL(
25 "green.png")));
26 }
27
28 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayerWithChild) {
29 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
30 gfx::Rect(200, 200), SK_ColorWHITE);
31
32 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer(
33 gfx::Rect(200, 200), SK_ColorGREEN);
34 background->AddChild(green);
35
36 scoped_refptr<SolidColorLayer> blue = CreateSolidColorLayer(
37 gfx::Rect(150, 150, 50, 50), SK_ColorBLUE);
38 green->AddChild(blue);
39
40 RunPixelTest(background,
41 base::FilePath(FILE_PATH_LITERAL(
42 "green_with_blue_corner.png")));
43 }
44
45 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer) {
46 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
47 gfx::Rect(200, 200), SK_ColorWHITE);
48
49 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer(
50 gfx::Rect(200, 200), SK_ColorGREEN);
51 background->AddChild(green);
52
53 RunPixelTestWithReadbackTarget(background,
54 green.get(),
55 base::FilePath(FILE_PATH_LITERAL(
56 "green.png")));
57 }
58
59 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayer) {
60 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
61 gfx::Rect(200, 200), SK_ColorWHITE);
62
63 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer(
64 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN);
65 background->AddChild(green);
66
67 RunPixelTestWithReadbackTarget(background,
68 green.get(),
69 base::FilePath(FILE_PATH_LITERAL(
70 "green_small.png")));
71 }
72
73 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayerWithChild) {
74 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
75 gfx::Rect(200, 200), SK_ColorWHITE);
76
77 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer(
78 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN);
79 background->AddChild(green);
80
81 scoped_refptr<SolidColorLayer> blue = CreateSolidColorLayer(
82 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE);
83 green->AddChild(blue);
84
85 RunPixelTestWithReadbackTarget(background,
86 green.get(),
87 base::FilePath(FILE_PATH_LITERAL(
88 "green_small_with_blue_corner.png")));
89 }
90
91 } // namespace
92 } // namespace cc
93
94 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « cc/test/pixel_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698