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

Side by Side Diff: cc/quads/render_pass_unittest.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding compositor pixel tests, clang-format Created 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/quads/render_pass.h" 5 #include "cc/quads/render_pass.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/base/scoped_ptr_vector.h" 8 #include "cc/base/scoped_ptr_vector.h"
9 #include "cc/output/copy_output_request.h" 9 #include "cc/output/copy_output_request.h"
10 #include "cc/quads/checkerboard_draw_quad.h" 10 #include "cc/quads/checkerboard_draw_quad.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 44 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
45 pass->SetAll(id, 45 pass->SetAll(id,
46 output_rect, 46 output_rect,
47 damage_rect, 47 damage_rect,
48 transform_to_root, 48 transform_to_root,
49 has_transparent_background); 49 has_transparent_background);
50 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); 50 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest());
51 51
52 // Stick a quad in the pass, this should not get copied. 52 // Stick a quad in the pass, this should not get copied.
53 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create(); 53 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create();
54 shared_state->SetAll( 54 shared_state->SetAll(gfx::Transform(),
55 gfx::Transform(), gfx::Size(), gfx::Rect(), gfx::Rect(), false, 1); 55 gfx::Size(),
56 gfx::Rect(),
57 gfx::Rect(),
58 false,
59 1,
60 SkXfermode::kSrcOver_Mode);
56 pass->AppendSharedQuadState(shared_state.Pass()); 61 pass->AppendSharedQuadState(shared_state.Pass());
57 62
58 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad = 63 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad =
59 CheckerboardDrawQuad::Create(); 64 CheckerboardDrawQuad::Create();
60 checkerboard_quad->SetNew( 65 checkerboard_quad->SetNew(
61 pass->shared_quad_state_list.back(), gfx::Rect(), SkColor()); 66 pass->shared_quad_state_list.back(), gfx::Rect(), SkColor());
62 pass->quad_list.push_back(checkerboard_quad.PassAs<DrawQuad>()); 67 pass->quad_list.push_back(checkerboard_quad.PassAs<DrawQuad>());
63 68
64 RenderPass::Id new_id(63, 4); 69 RenderPass::Id new_id(63, 4);
65 70
(...skipping 24 matching lines...) Expand all
90 95
91 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 96 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
92 pass->SetAll(id, 97 pass->SetAll(id,
93 output_rect, 98 output_rect,
94 damage_rect, 99 damage_rect,
95 transform_to_root, 100 transform_to_root,
96 has_transparent_background); 101 has_transparent_background);
97 102
98 // Two quads using one shared state. 103 // Two quads using one shared state.
99 scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create(); 104 scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create();
100 shared_state1->SetAll( 105 shared_state1->SetAll(gfx::Transform(),
101 gfx::Transform(), gfx::Size(1, 1), gfx::Rect(), gfx::Rect(), false, 1); 106 gfx::Size(1, 1),
107 gfx::Rect(),
108 gfx::Rect(),
109 false,
110 1,
111 SkXfermode::kSrcOver_Mode);
102 pass->AppendSharedQuadState(shared_state1.Pass()); 112 pass->AppendSharedQuadState(shared_state1.Pass());
103 113
104 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 = 114 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 =
105 CheckerboardDrawQuad::Create(); 115 CheckerboardDrawQuad::Create();
106 checkerboard_quad1->SetNew( 116 checkerboard_quad1->SetNew(
107 pass->shared_quad_state_list.back(), gfx::Rect(1, 1, 1, 1), SkColor()); 117 pass->shared_quad_state_list.back(), gfx::Rect(1, 1, 1, 1), SkColor());
108 pass->quad_list.push_back(checkerboard_quad1.PassAs<DrawQuad>()); 118 pass->quad_list.push_back(checkerboard_quad1.PassAs<DrawQuad>());
109 119
110 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 = 120 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 =
111 CheckerboardDrawQuad::Create(); 121 CheckerboardDrawQuad::Create();
112 checkerboard_quad2->SetNew( 122 checkerboard_quad2->SetNew(
113 pass->shared_quad_state_list.back(), gfx::Rect(2, 2, 2, 2), SkColor()); 123 pass->shared_quad_state_list.back(), gfx::Rect(2, 2, 2, 2), SkColor());
114 pass->quad_list.push_back(checkerboard_quad2.PassAs<DrawQuad>()); 124 pass->quad_list.push_back(checkerboard_quad2.PassAs<DrawQuad>());
115 125
116 // And two quads using another shared state. 126 // And two quads using another shared state.
117 scoped_ptr<SharedQuadState> shared_state2 = SharedQuadState::Create(); 127 scoped_ptr<SharedQuadState> shared_state2 = SharedQuadState::Create();
118 shared_state2->SetAll( 128 shared_state2->SetAll(gfx::Transform(),
119 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 129 gfx::Size(2, 2),
130 gfx::Rect(),
131 gfx::Rect(),
132 false,
133 1,
134 SkXfermode::kSrcOver_Mode);
120 pass->AppendSharedQuadState(shared_state2.Pass()); 135 pass->AppendSharedQuadState(shared_state2.Pass());
121 136
122 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad3 = 137 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad3 =
123 CheckerboardDrawQuad::Create(); 138 CheckerboardDrawQuad::Create();
124 checkerboard_quad3->SetNew( 139 checkerboard_quad3->SetNew(
125 pass->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor()); 140 pass->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor());
126 pass->quad_list.push_back(checkerboard_quad3.PassAs<DrawQuad>()); 141 pass->quad_list.push_back(checkerboard_quad3.PassAs<DrawQuad>());
127 142
128 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad4 = 143 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad4 =
129 CheckerboardDrawQuad::Create(); 144 CheckerboardDrawQuad::Create();
(...skipping 10 matching lines...) Expand all
140 bool contrib_has_transparent_background = true; 155 bool contrib_has_transparent_background = true;
141 156
142 scoped_ptr<TestRenderPass> contrib = TestRenderPass::Create(); 157 scoped_ptr<TestRenderPass> contrib = TestRenderPass::Create();
143 contrib->SetAll(contrib_id, 158 contrib->SetAll(contrib_id,
144 contrib_output_rect, 159 contrib_output_rect,
145 contrib_damage_rect, 160 contrib_damage_rect,
146 contrib_transform_to_root, 161 contrib_transform_to_root,
147 contrib_has_transparent_background); 162 contrib_has_transparent_background);
148 163
149 scoped_ptr<SharedQuadState> contrib_shared_state = SharedQuadState::Create(); 164 scoped_ptr<SharedQuadState> contrib_shared_state = SharedQuadState::Create();
150 contrib_shared_state->SetAll( 165 contrib_shared_state->SetAll(gfx::Transform(),
151 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 166 gfx::Size(2, 2),
167 gfx::Rect(),
168 gfx::Rect(),
169 false,
170 1,
171 SkXfermode::kSrcOver_Mode);
152 contrib->AppendSharedQuadState(contrib_shared_state.Pass()); 172 contrib->AppendSharedQuadState(contrib_shared_state.Pass());
153 173
154 scoped_ptr<CheckerboardDrawQuad> contrib_quad = 174 scoped_ptr<CheckerboardDrawQuad> contrib_quad =
155 CheckerboardDrawQuad::Create(); 175 CheckerboardDrawQuad::Create();
156 contrib_quad->SetNew( 176 contrib_quad->SetNew(
157 contrib->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor()); 177 contrib->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor());
158 contrib->quad_list.push_back(contrib_quad.PassAs<DrawQuad>()); 178 contrib->quad_list.push_back(contrib_quad.PassAs<DrawQuad>());
159 179
160 // And a RenderPassDrawQuad for the contributing pass. 180 // And a RenderPassDrawQuad for the contributing pass.
161 scoped_ptr<RenderPassDrawQuad> pass_quad = RenderPassDrawQuad::Create(); 181 scoped_ptr<RenderPassDrawQuad> pass_quad = RenderPassDrawQuad::Create();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 copy->quad_list[i]->rect.ToString()); 218 copy->quad_list[i]->rect.ToString());
199 EXPECT_EQ( 219 EXPECT_EQ(
200 pass->quad_list[i]->shared_quad_state->content_bounds.ToString(), 220 pass->quad_list[i]->shared_quad_state->content_bounds.ToString(),
201 copy->quad_list[i]->shared_quad_state->content_bounds.ToString()); 221 copy->quad_list[i]->shared_quad_state->content_bounds.ToString());
202 } 222 }
203 } 223 }
204 } 224 }
205 225
206 } // namespace 226 } // namespace
207 } // namespace cc 227 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698