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

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

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 "cc/layers/image_layer.h" 5 #include "cc/layers/image_layer.h"
6 #include "cc/layers/solid_color_layer.h" 6 #include "cc/layers/solid_color_layer.h"
7 #include "cc/test/layer_tree_pixel_test.h" 7 #include "cc/test/layer_tree_pixel_test.h"
8 #include "cc/test/pixel_comparator.h" 8 #include "cc/test/pixel_comparator.h"
9 9
10 #if !defined(OS_ANDROID) 10 #if !defined(OS_ANDROID)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 0x00000000 // transparent 45 0x00000000 // transparent
46 }; 46 };
47 47
48 const int kBlendModesCount = arraysize(kBlendModes); 48 const int kBlendModesCount = arraysize(kBlendModes);
49 const int kCSSTestColorsCount = arraysize(kCSSTestColors); 49 const int kCSSTestColorsCount = arraysize(kCSSTestColors);
50 50
51 using RenderPassOptions = uint32; 51 using RenderPassOptions = uint32;
52 const uint32 kUseMasks = 1 << 0; 52 const uint32 kUseMasks = 1 << 0;
53 const uint32 kUseAntialiasing = 1 << 1; 53 const uint32 kUseAntialiasing = 1 << 1;
54 const uint32 kUseColorMatrix = 1 << 2; 54 const uint32 kUseColorMatrix = 1 << 2;
55 const uint32 kForceShaders = 1 << 3;
55 56
56 class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { 57 class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest {
57 public: 58 public:
58 LayerTreeHostBlendingPixelTest() { 59 LayerTreeHostBlendingPixelTest()
60 : force_antialiasing_(false), force_blending_with_shaders_(false) {
59 pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true)); 61 pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true));
60 } 62 }
61 63
62 virtual void InitializeSettings(LayerTreeSettings* settings) override { 64 virtual void InitializeSettings(LayerTreeSettings* settings) override {
63 settings->force_antialiasing = force_antialiasing_; 65 settings->force_antialiasing = force_antialiasing_;
66 settings->force_blending_with_shaders = force_blending_with_shaders_;
64 } 67 }
65 68
66 protected: 69 protected:
67 void RunBlendingWithRootPixelTestType(PixelTestType type) { 70 void RunBlendingWithRootPixelTestType(PixelTestType type) {
68 const int kLaneWidth = 15; 71 const int kLaneWidth = 2;
69 const int kLaneHeight = kBlendModesCount * kLaneWidth; 72 const int kLaneHeight = kLaneWidth;
70 const int kRootSize = (kBlendModesCount + 2) * kLaneWidth; 73 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth;
74 const int kRootHeight = 2 * kLaneWidth + kLaneHeight;
71 75
72 scoped_refptr<SolidColorLayer> background = 76 scoped_refptr<SolidColorLayer> background =
73 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), kCSSOrange); 77 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSOrange);
74 78
75 // Orange child layers will blend with the green background 79 // Orange child layers will blend with the green background
76 for (int i = 0; i < kBlendModesCount; ++i) { 80 for (int i = 0; i < kBlendModesCount; ++i) {
77 gfx::Rect child_rect( 81 gfx::Rect child_rect(
78 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight); 82 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight);
79 scoped_refptr<SolidColorLayer> green_lane = 83 scoped_refptr<SolidColorLayer> green_lane =
80 CreateSolidColorLayer(child_rect, kCSSGreen); 84 CreateSolidColorLayer(child_rect, kCSSGreen);
81 background->AddChild(green_lane); 85 background->AddChild(green_lane);
82 green_lane->SetBlendMode(kBlendModes[i]); 86 green_lane->SetBlendMode(kBlendModes[i]);
83 } 87 }
84 88
85 RunPixelTest(type, 89 RunPixelTest(type,
86 background, 90 background,
87 base::FilePath(FILE_PATH_LITERAL("blending_with_root.png"))); 91 base::FilePath(FILE_PATH_LITERAL("blending_with_root.png")));
88 } 92 }
89 93
90 void RunBlendingWithTransparentPixelTestType(PixelTestType type) { 94 void RunBlendingWithTransparentPixelTestType(PixelTestType type) {
91 const int kLaneWidth = 15; 95 const int kLaneWidth = 2;
92 const int kLaneHeight = kBlendModesCount * kLaneWidth; 96 const int kLaneHeight = 3 * kLaneWidth;
93 const int kRootSize = (kBlendModesCount + 2) * kLaneWidth; 97 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth;
98 const int kRootHeight = 2 * kLaneWidth + kLaneHeight;
94 99
95 scoped_refptr<SolidColorLayer> root = 100 scoped_refptr<SolidColorLayer> root =
96 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), kCSSBrown); 101 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSBrown);
97 102
98 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( 103 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
99 gfx::Rect(0, kLaneWidth * 2, kRootSize, kLaneWidth), kCSSOrange); 104 gfx::Rect(0, kLaneWidth * 2, kRootWidth, kLaneWidth), kCSSOrange);
100 105
101 root->AddChild(background); 106 root->AddChild(background);
102 background->SetIsRootForIsolatedGroup(true); 107 background->SetIsRootForIsolatedGroup(true);
103 108
104 // Orange child layers will blend with the green background 109 // Orange child layers will blend with the green background
105 for (int i = 0; i < kBlendModesCount; ++i) { 110 for (int i = 0; i < kBlendModesCount; ++i) {
106 gfx::Rect child_rect( 111 gfx::Rect child_rect(
107 (i + 1) * kLaneWidth, -kLaneWidth, kLaneWidth, kLaneHeight); 112 (i + 1) * kLaneWidth, -kLaneWidth, kLaneWidth, kLaneHeight);
108 scoped_refptr<SolidColorLayer> green_lane = 113 scoped_refptr<SolidColorLayer> green_lane =
109 CreateSolidColorLayer(child_rect, kCSSGreen); 114 CreateSolidColorLayer(child_rect, kCSSGreen);
(...skipping 21 matching lines...) Expand all
131 SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint); 136 SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint);
132 } 137 }
133 scoped_refptr<ImageLayer> layer = ImageLayer::Create(); 138 scoped_refptr<ImageLayer> layer = ImageLayer::Create();
134 layer->SetIsDrawable(true); 139 layer->SetIsDrawable(true);
135 layer->SetBounds(gfx::Size(width, height)); 140 layer->SetBounds(gfx::Size(width, height));
136 layer->SetBitmap(backing_store); 141 layer->SetBitmap(backing_store);
137 return layer; 142 return layer;
138 } 143 }
139 144
140 void SetupMaskLayer(scoped_refptr<Layer> layer) { 145 void SetupMaskLayer(scoped_refptr<Layer> layer) {
141 const int kMaskOffset = 5; 146 const int kMaskOffset = 2;
142 gfx::Size bounds = layer->bounds(); 147 gfx::Size bounds = layer->bounds();
143 scoped_refptr<ImageLayer> mask = ImageLayer::Create(); 148 scoped_refptr<ImageLayer> mask = ImageLayer::Create();
144 mask->SetIsDrawable(true); 149 mask->SetIsDrawable(true);
145 mask->SetIsMask(true); 150 mask->SetIsMask(true);
146 mask->SetBounds(bounds); 151 mask->SetBounds(bounds);
147 152
148 SkBitmap bitmap; 153 SkBitmap bitmap;
149 bitmap.allocN32Pixels(bounds.width(), bounds.height()); 154 bitmap.allocN32Pixels(bounds.width(), bounds.height());
150 SkCanvas canvas(bitmap); 155 SkCanvas canvas(bitmap);
151 SkPaint paint; 156 SkPaint paint;
152 paint.setColor(SK_ColorWHITE); 157 paint.setColor(SK_ColorWHITE);
153 canvas.clear(SK_ColorTRANSPARENT); 158 canvas.clear(SK_ColorTRANSPARENT);
154 canvas.drawRect(SkRect::MakeXYWH(kMaskOffset, 159 canvas.drawRect(SkRect::MakeXYWH(kMaskOffset,
155 kMaskOffset, 160 kMaskOffset,
156 bounds.width() - kMaskOffset * 2, 161 bounds.width() - kMaskOffset * 2,
157 bounds.height() - kMaskOffset * 2), 162 bounds.height() - kMaskOffset * 2),
158 paint); 163 paint);
159 mask->SetBitmap(bitmap); 164 mask->SetBitmap(bitmap);
160 layer->SetMaskLayer(mask.get()); 165 layer->SetMaskLayer(mask.get());
161 } 166 }
162 167
163 void SetupColorMatrix(scoped_refptr<Layer> layer) { 168 void SetupColorMatrix(scoped_refptr<Layer> layer) {
164 FilterOperations filter_operations; 169 FilterOperations filter_operations;
165 filter_operations.Append(FilterOperation::CreateSepiaFilter(1.f)); 170 filter_operations.Append(FilterOperation::CreateSepiaFilter(.001f));
166 layer->SetFilters(filter_operations); 171 layer->SetFilters(filter_operations);
167 } 172 }
168 173
169 void CreateBlendingColorLayers(int width, 174 void CreateBlendingColorLayers(int lane_width,
170 int height, 175 int lane_height,
171 scoped_refptr<Layer> background, 176 scoped_refptr<Layer> background,
172 RenderPassOptions flags) { 177 RenderPassOptions flags) {
173 const int kLanesCount = kBlendModesCount + 4; 178 const int kLanesCount = kBlendModesCount + 4;
174 int lane_width = width / kLanesCount;
175 const SkColor kMiscOpaqueColor = 0xffc86464; 179 const SkColor kMiscOpaqueColor = 0xffc86464;
176 const SkColor kMiscTransparentColor = 0x80c86464; 180 const SkColor kMiscTransparentColor = 0x80c86464;
177 const SkXfermode::Mode kCoeffBlendMode = SkXfermode::kScreen_Mode; 181 const SkXfermode::Mode kCoeffBlendMode = SkXfermode::kScreen_Mode;
178 const SkXfermode::Mode kShaderBlendMode = SkXfermode::kColorBurn_Mode; 182 const SkXfermode::Mode kShaderBlendMode = SkXfermode::kColorBurn_Mode;
179 // add vertical lanes with each of the blend modes 183 // add vertical lanes with each of the blend modes
180 for (int i = 0; i < kLanesCount; ++i) { 184 for (int i = 0; i < kLanesCount; ++i) {
181 gfx::Rect child_rect(i * lane_width, 0, lane_width, height); 185 gfx::Rect child_rect(i * lane_width, 0, lane_width, lane_height);
182 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; 186 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
183 float opacity = 1.f; 187 float opacity = 1.f;
184 SkColor color = kMiscOpaqueColor; 188 SkColor color = kMiscOpaqueColor;
185 189
186 if (i < kBlendModesCount) { 190 if (i < kBlendModesCount) {
187 blend_mode = kBlendModes[i]; 191 blend_mode = kBlendModes[i];
188 } else if (i == kBlendModesCount) { 192 } else if (i == kBlendModesCount) {
189 blend_mode = kCoeffBlendMode; 193 blend_mode = kCoeffBlendMode;
190 opacity = 0.5f; 194 opacity = 0.5f;
191 } else if (i == kBlendModesCount + 1) { 195 } else if (i == kBlendModesCount + 1) {
(...skipping 17 matching lines...) Expand all
209 if (flags & kUseColorMatrix) { 213 if (flags & kUseColorMatrix) {
210 SetupColorMatrix(lane); 214 SetupColorMatrix(lane);
211 } 215 }
212 background->AddChild(lane); 216 background->AddChild(lane);
213 } 217 }
214 } 218 }
215 219
216 void RunBlendingWithRenderPass(PixelTestType type, 220 void RunBlendingWithRenderPass(PixelTestType type,
217 const base::FilePath::CharType* expected_path, 221 const base::FilePath::CharType* expected_path,
218 RenderPassOptions flags) { 222 RenderPassOptions flags) {
219 const int kRootSize = 400; 223 const int kLaneWidth = 8;
224 const int kLaneHeight = kLaneWidth * kCSSTestColorsCount;
225 const int kRootSize = kLaneHeight;
220 226
221 scoped_refptr<SolidColorLayer> root = 227 scoped_refptr<SolidColorLayer> root =
222 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), SK_ColorWHITE); 228 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), SK_ColorWHITE);
223 scoped_refptr<Layer> background = 229 scoped_refptr<Layer> background =
224 CreateColorfulBackdropLayer(kRootSize, kRootSize); 230 CreateColorfulBackdropLayer(kRootSize, kRootSize);
225 231
226 background->SetIsRootForIsolatedGroup(true); 232 background->SetIsRootForIsolatedGroup(true);
227 root->AddChild(background); 233 root->AddChild(background);
228 234
229 CreateBlendingColorLayers(kRootSize, kRootSize, background.get(), flags); 235 CreateBlendingColorLayers(kLaneWidth, kLaneHeight, background.get(), flags);
230 236
231 this->impl_side_painting_ = false; 237 this->impl_side_painting_ = false;
232 this->force_antialiasing_ = (flags & kUseAntialiasing); 238 this->force_antialiasing_ = (flags & kUseAntialiasing);
239 this->force_blending_with_shaders_ = (flags & kForceShaders);
233 240
234 if ((flags & kUseAntialiasing) && (type == PIXEL_TEST_GL)) { 241 if ((flags & kUseAntialiasing) && (type == PIXEL_TEST_GL)) {
235 // Anti aliasing causes differences up to 7 pixels at the edges. 242 // Anti aliasing causes differences up to 8 pixels at the edges.
236 // Several pixels have 9 units difference on the alpha channel. 243 int large_error_allowed = 8;
237 int large_error_allowed = (flags & kUseMasks) ? 7 : 9;
238 // Blending results might differ with one pixel. 244 // Blending results might differ with one pixel.
239 int small_error_allowed = 1; 245 int small_error_allowed = 1;
240 // Most of the errors are one pixel errors. 246 // Most of the errors are one pixel errors.
241 float percentage_pixels_small_error = (flags & kUseMasks) ? 7.7f : 12.1f; 247 float percentage_pixels_small_error = 13.1f;
242 // Because of anti-aliasing, around 3% of pixels (at the edges) have 248 // Because of anti-aliasing, around 10% of pixels (at the edges) have
243 // bigger errors (from small_error_allowed + 1 to large_error_allowed). 249 // bigger errors (from small_error_allowed + 1 to large_error_allowed).
244 float percentage_pixels_error = (flags & kUseMasks) ? 12.4f : 15.f; 250 float percentage_pixels_error = 22.5f;
245 // The average error is still close to 1. 251 // The average error is still close to 1.
246 float average_error_allowed_in_bad_pixels = 252 float average_error_allowed_in_bad_pixels = 1.4f;
247 (flags & kUseMasks) ? 1.3f : 1.f;
248
249 // The sepia filter generates more small errors, but the number of large
250 // errors remains around 3%.
251 if (flags & kUseColorMatrix) {
252 percentage_pixels_small_error = (flags & kUseMasks) ? 14.0f : 26.f;
253 percentage_pixels_error = (flags & kUseMasks) ? 18.5f : 29.f;
254 average_error_allowed_in_bad_pixels = (flags & kUseMasks) ? 0.9f : 0.7f;
255 }
256 253
257 pixel_comparator_.reset( 254 pixel_comparator_.reset(
258 new FuzzyPixelComparator(false, // discard_alpha 255 new FuzzyPixelComparator(false, // discard_alpha
259 percentage_pixels_error, 256 percentage_pixels_error,
260 percentage_pixels_small_error,
261 average_error_allowed_in_bad_pixels,
262 large_error_allowed,
263 small_error_allowed));
264 } else if ((flags & kUseColorMatrix) && (type == PIXEL_TEST_GL)) {
265 float percentage_pixels_error = 100.f;
266 float percentage_pixels_small_error = 0.f;
267 float average_error_allowed_in_bad_pixels = 1.f;
268 int large_error_allowed = 2;
269 int small_error_allowed = 0;
270 pixel_comparator_.reset(
271 new FuzzyPixelComparator(false, // discard_alpha
272 percentage_pixels_error,
273 percentage_pixels_small_error, 257 percentage_pixels_small_error,
274 average_error_allowed_in_bad_pixels, 258 average_error_allowed_in_bad_pixels,
275 large_error_allowed, 259 large_error_allowed,
276 small_error_allowed)); 260 small_error_allowed));
277 } 261 }
278 262
279 RunPixelTest(type, root, base::FilePath(expected_path)); 263 RunPixelTest(type, root, base::FilePath(expected_path));
280 } 264 }
281 265
282 bool force_antialiasing_ = false; 266 bool force_antialiasing_;
267 bool force_blending_with_shaders_;
283 }; 268 };
284 269
285 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_GL) { 270 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_GL) {
286 RunBlendingWithRootPixelTestType(PIXEL_TEST_GL); 271 RunBlendingWithRootPixelTestType(PIXEL_TEST_GL);
287 } 272 }
288 273
289 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_Software) { 274 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_Software) {
290 RunBlendingWithRootPixelTestType(PIXEL_TEST_SOFTWARE); 275 RunBlendingWithRootPixelTestType(PIXEL_TEST_SOFTWARE);
291 } 276 }
292 277
293 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithBackgroundFilter) { 278 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithBackgroundFilter) {
294 const int kLaneWidth = 15; 279 const int kLaneWidth = 2;
295 const int kLaneHeight = kBlendModesCount * kLaneWidth; 280 const int kLaneHeight = kLaneWidth;
296 const int kRootSize = (kBlendModesCount + 2) * kLaneWidth; 281 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth;
282 const int kRootHeight = 2 * kLaneWidth + kLaneHeight;
297 283
298 scoped_refptr<SolidColorLayer> background = 284 scoped_refptr<SolidColorLayer> background =
299 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), kCSSOrange); 285 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSOrange);
300 286
301 // Orange child layers have a background filter set and they will blend with 287 // Orange child layers have a background filter set and they will blend with
302 // the green background 288 // the green background
303 for (int i = 0; i < kBlendModesCount; ++i) { 289 for (int i = 0; i < kBlendModesCount; ++i) {
304 gfx::Rect child_rect( 290 gfx::Rect child_rect(
305 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight); 291 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight);
306 scoped_refptr<SolidColorLayer> green_lane = 292 scoped_refptr<SolidColorLayer> green_lane =
307 CreateSolidColorLayer(child_rect, kCSSGreen); 293 CreateSolidColorLayer(child_rect, kCSSGreen);
308 background->AddChild(green_lane); 294 background->AddChild(green_lane);
309 295
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 356
371 TEST_F(LayerTreeHostBlendingPixelTest, 357 TEST_F(LayerTreeHostBlendingPixelTest,
372 BlendingWithRenderPassWithMaskAA_Software) { 358 BlendingWithRenderPassWithMaskAA_Software) {
373 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, 359 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE,
374 FILE_PATH_LITERAL("blending_render_pass_mask.png"), 360 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
375 kUseMasks | kUseAntialiasing); 361 kUseMasks | kUseAntialiasing);
376 } 362 }
377 363
378 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrix_GL) { 364 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrix_GL) {
379 RunBlendingWithRenderPass(PIXEL_TEST_GL, 365 RunBlendingWithRenderPass(PIXEL_TEST_GL,
380 FILE_PATH_LITERAL("blending_render_pass_cm.png"), 366 FILE_PATH_LITERAL("blending_render_pass.png"),
381 kUseColorMatrix); 367 kUseColorMatrix);
382 } 368 }
383 369
384 TEST_F(LayerTreeHostBlendingPixelTest, 370 TEST_F(LayerTreeHostBlendingPixelTest,
385 BlendingWithRenderPassColorMatrix_Software) { 371 BlendingWithRenderPassColorMatrix_Software) {
386 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, 372 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE,
387 FILE_PATH_LITERAL("blending_render_pass_cm.png"), 373 FILE_PATH_LITERAL("blending_render_pass.png"),
388 kUseColorMatrix); 374 kUseColorMatrix);
389 } 375 }
390 376
391 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrixAA_GL) { 377 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrixAA_GL) {
392 RunBlendingWithRenderPass(PIXEL_TEST_GL, 378 RunBlendingWithRenderPass(PIXEL_TEST_GL,
393 FILE_PATH_LITERAL("blending_render_pass_cm.png"), 379 FILE_PATH_LITERAL("blending_render_pass.png"),
394 kUseAntialiasing | kUseColorMatrix); 380 kUseAntialiasing | kUseColorMatrix);
395 } 381 }
396 382
397 TEST_F(LayerTreeHostBlendingPixelTest, 383 TEST_F(LayerTreeHostBlendingPixelTest,
398 BlendingWithRenderPassColorMatrixAA_Software) { 384 BlendingWithRenderPassColorMatrixAA_Software) {
399 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, 385 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE,
400 FILE_PATH_LITERAL("blending_render_pass_cm.png"), 386 FILE_PATH_LITERAL("blending_render_pass.png"),
401 kUseAntialiasing | kUseColorMatrix); 387 kUseAntialiasing | kUseColorMatrix);
402 } 388 }
403 389
404 TEST_F(LayerTreeHostBlendingPixelTest, 390 TEST_F(LayerTreeHostBlendingPixelTest,
405 BlendingWithRenderPassWithMaskColorMatrix_GL) { 391 BlendingWithRenderPassWithMaskColorMatrix_GL) {
406 RunBlendingWithRenderPass( 392 RunBlendingWithRenderPass(PIXEL_TEST_GL,
407 PIXEL_TEST_GL, 393 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
408 FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), 394 kUseMasks | kUseColorMatrix);
409 kUseMasks | kUseColorMatrix);
410 } 395 }
411 396
412 TEST_F(LayerTreeHostBlendingPixelTest, 397 TEST_F(LayerTreeHostBlendingPixelTest,
413 BlendingWithRenderPassWithMaskColorMatrix_Software) { 398 BlendingWithRenderPassWithMaskColorMatrix_Software) {
414 RunBlendingWithRenderPass( 399 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE,
415 PIXEL_TEST_SOFTWARE, 400 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
416 FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), 401 kUseMasks | kUseColorMatrix);
417 kUseMasks | kUseColorMatrix);
418 } 402 }
419 403
420 TEST_F(LayerTreeHostBlendingPixelTest, 404 TEST_F(LayerTreeHostBlendingPixelTest,
421 BlendingWithRenderPassWithMaskColorMatrixAA_GL) { 405 BlendingWithRenderPassWithMaskColorMatrixAA_GL) {
422 RunBlendingWithRenderPass( 406 RunBlendingWithRenderPass(PIXEL_TEST_GL,
423 PIXEL_TEST_GL, 407 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
424 FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), 408 kUseMasks | kUseAntialiasing | kUseColorMatrix);
425 kUseMasks | kUseAntialiasing | kUseColorMatrix);
426 } 409 }
427 410
428 TEST_F(LayerTreeHostBlendingPixelTest, 411 TEST_F(LayerTreeHostBlendingPixelTest,
429 BlendingWithRenderPassWithMaskColorMatrixAA_Software) { 412 BlendingWithRenderPassWithMaskColorMatrixAA_Software) {
413 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE,
414 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
415 kUseMasks | kUseAntialiasing | kUseColorMatrix);
416 }
417
418 // Tests for render passes forcing shaders for all the blend modes.
419 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShaders_GL) {
420 RunBlendingWithRenderPass(PIXEL_TEST_GL,
421 FILE_PATH_LITERAL("blending_render_pass.png"),
422 kForceShaders);
423 }
424
425 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShadersAA_GL) {
426 RunBlendingWithRenderPass(PIXEL_TEST_GL,
427 FILE_PATH_LITERAL("blending_render_pass.png"),
428 kUseAntialiasing | kForceShaders);
429 }
430
431 TEST_F(LayerTreeHostBlendingPixelTest,
432 BlendingWithRenderPassShadersWithMask_GL) {
433 RunBlendingWithRenderPass(PIXEL_TEST_GL,
434 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
435 kUseMasks | kForceShaders);
436 }
437
438 TEST_F(LayerTreeHostBlendingPixelTest,
439 BlendingWithRenderPassShadersWithMaskAA_GL) {
440 RunBlendingWithRenderPass(PIXEL_TEST_GL,
441 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
442 kUseMasks | kUseAntialiasing | kForceShaders);
443 }
444
445 TEST_F(LayerTreeHostBlendingPixelTest,
446 BlendingWithRenderPassShadersColorMatrix_GL) {
447 RunBlendingWithRenderPass(PIXEL_TEST_GL,
448 FILE_PATH_LITERAL("blending_render_pass.png"),
449 kUseColorMatrix | kForceShaders);
450 }
451
452 TEST_F(LayerTreeHostBlendingPixelTest,
453 BlendingWithRenderPassShadersColorMatrixAA_GL) {
454 RunBlendingWithRenderPass(PIXEL_TEST_GL,
455 FILE_PATH_LITERAL("blending_render_pass.png"),
456 kUseAntialiasing | kUseColorMatrix | kForceShaders);
457 }
458
459 TEST_F(LayerTreeHostBlendingPixelTest,
460 BlendingWithRenderPassShadersWithMaskColorMatrix_GL) {
461 RunBlendingWithRenderPass(PIXEL_TEST_GL,
462 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
463 kUseMasks | kUseColorMatrix | kForceShaders);
464 }
465
466 TEST_F(LayerTreeHostBlendingPixelTest,
467 BlendingWithRenderPassShadersWithMaskColorMatrixAA_GL) {
430 RunBlendingWithRenderPass( 468 RunBlendingWithRenderPass(
431 PIXEL_TEST_SOFTWARE, 469 PIXEL_TEST_GL, FILE_PATH_LITERAL("blending_render_pass_mask.png"),
432 FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), 470 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders);
433 kUseMasks | kUseAntialiasing | kUseColorMatrix);
434 } 471 }
435 472
436 } // namespace 473 } // namespace
437 } // namespace cc 474 } // namespace cc
438 475
439 #endif // OS_ANDROID 476 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_pixeltest_filters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698