| OLD | NEW |
| 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_resource_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) |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 SkXfermode::Mode const kBlendModes[] = { | 15 SkXfermode::Mode const kBlendModes[] = { |
| 16 SkXfermode::kSrcOver_Mode, SkXfermode::kScreen_Mode, | 16 SkXfermode::kSrcOver_Mode, SkXfermode::kScreen_Mode, |
| 17 SkXfermode::kOverlay_Mode, SkXfermode::kDarken_Mode, | 17 SkXfermode::kOverlay_Mode, SkXfermode::kDarken_Mode, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 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 const uint32 kForceShaders = 1 << 3; |
| 56 | 56 |
| 57 class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { | 57 class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest { |
| 58 public: | 58 public: |
| 59 LayerTreeHostBlendingPixelTest() | 59 LayerTreeHostBlendingPixelTest() |
| 60 : force_antialiasing_(false), force_blending_with_shaders_(false) { | 60 : force_antialiasing_(false), force_blending_with_shaders_(false) { |
| 61 pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true)); | 61 pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void InitializeSettings(LayerTreeSettings* settings) override { | 64 void InitializeSettings(LayerTreeSettings* settings) override { |
| 65 settings->renderer_settings.force_antialiasing = force_antialiasing_; | 65 settings->renderer_settings.force_antialiasing = force_antialiasing_; |
| 66 settings->renderer_settings.force_blending_with_shaders = | 66 settings->renderer_settings.force_blending_with_shaders = |
| 67 force_blending_with_shaders_; | 67 force_blending_with_shaders_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 void RunBlendingWithRootPixelTestType(PixelTestType type) { | 71 void RunBlendingWithRootPixelTestType(PixelResourceTestCase type) { |
| 72 const int kLaneWidth = 2; | 72 const int kLaneWidth = 2; |
| 73 const int kLaneHeight = kLaneWidth; | 73 const int kLaneHeight = kLaneWidth; |
| 74 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth; | 74 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth; |
| 75 const int kRootHeight = 2 * kLaneWidth + kLaneHeight; | 75 const int kRootHeight = 2 * kLaneWidth + kLaneHeight; |
| 76 InitializeFromTestCase(type); |
| 76 | 77 |
| 77 scoped_refptr<SolidColorLayer> background = | 78 scoped_refptr<SolidColorLayer> background = |
| 78 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSOrange); | 79 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSOrange); |
| 79 | 80 |
| 80 // Orange child layers will blend with the green background | 81 // Orange child layers will blend with the green background |
| 81 for (int i = 0; i < kBlendModesCount; ++i) { | 82 for (int i = 0; i < kBlendModesCount; ++i) { |
| 82 gfx::Rect child_rect( | 83 gfx::Rect child_rect( |
| 83 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight); | 84 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight); |
| 84 scoped_refptr<SolidColorLayer> green_lane = | 85 scoped_refptr<SolidColorLayer> green_lane = |
| 85 CreateSolidColorLayer(child_rect, kCSSGreen); | 86 CreateSolidColorLayer(child_rect, kCSSGreen); |
| 86 background->AddChild(green_lane); | 87 background->AddChild(green_lane); |
| 87 green_lane->SetBlendMode(kBlendModes[i]); | 88 green_lane->SetBlendMode(kBlendModes[i]); |
| 88 } | 89 } |
| 89 | 90 |
| 90 RunPixelTest(type, | 91 RunPixelResourceTest( |
| 91 background, | 92 background, |
| 92 base::FilePath(FILE_PATH_LITERAL("blending_with_root.png"))); | 93 base::FilePath(FILE_PATH_LITERAL("blending_with_root.png"))); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void RunBlendingWithTransparentPixelTestType(PixelTestType type) { | 96 void RunBlendingWithTransparentPixelTestType(PixelResourceTestCase type) { |
| 96 const int kLaneWidth = 2; | 97 const int kLaneWidth = 2; |
| 97 const int kLaneHeight = 3 * kLaneWidth; | 98 const int kLaneHeight = 3 * kLaneWidth; |
| 98 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth; | 99 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth; |
| 99 const int kRootHeight = 2 * kLaneWidth + kLaneHeight; | 100 const int kRootHeight = 2 * kLaneWidth + kLaneHeight; |
| 101 InitializeFromTestCase(type); |
| 100 | 102 |
| 101 scoped_refptr<SolidColorLayer> root = | 103 scoped_refptr<SolidColorLayer> root = |
| 102 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSBrown); | 104 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSBrown); |
| 103 | 105 |
| 104 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( | 106 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
| 105 gfx::Rect(0, kLaneWidth * 2, kRootWidth, kLaneWidth), kCSSOrange); | 107 gfx::Rect(0, kLaneWidth * 2, kRootWidth, kLaneWidth), kCSSOrange); |
| 106 | 108 |
| 107 root->AddChild(background); | 109 root->AddChild(background); |
| 108 background->SetIsRootForIsolatedGroup(true); | 110 background->SetIsRootForIsolatedGroup(true); |
| 109 | 111 |
| 110 // Orange child layers will blend with the green background | 112 // Orange child layers will blend with the green background |
| 111 for (int i = 0; i < kBlendModesCount; ++i) { | 113 for (int i = 0; i < kBlendModesCount; ++i) { |
| 112 gfx::Rect child_rect( | 114 gfx::Rect child_rect( |
| 113 (i + 1) * kLaneWidth, -kLaneWidth, kLaneWidth, kLaneHeight); | 115 (i + 1) * kLaneWidth, -kLaneWidth, kLaneWidth, kLaneHeight); |
| 114 scoped_refptr<SolidColorLayer> green_lane = | 116 scoped_refptr<SolidColorLayer> green_lane = |
| 115 CreateSolidColorLayer(child_rect, kCSSGreen); | 117 CreateSolidColorLayer(child_rect, kCSSGreen); |
| 116 background->AddChild(green_lane); | 118 background->AddChild(green_lane); |
| 117 green_lane->SetBlendMode(kBlendModes[i]); | 119 green_lane->SetBlendMode(kBlendModes[i]); |
| 118 } | 120 } |
| 119 | 121 |
| 120 RunPixelTest(type, | 122 RunPixelResourceTest( |
| 121 root, | 123 root, base::FilePath(FILE_PATH_LITERAL("blending_transparent.png"))); |
| 122 base::FilePath(FILE_PATH_LITERAL("blending_transparent.png"))); | |
| 123 } | 124 } |
| 124 | 125 |
| 125 scoped_refptr<Layer> CreateColorfulBackdropLayer(int width, int height) { | 126 scoped_refptr<Layer> CreateColorfulBackdropLayer(int width, int height) { |
| 126 // Draw the backdrop with horizontal lanes. | 127 // Draw the backdrop with horizontal lanes. |
| 127 const int kLaneWidth = width; | 128 const int kLaneWidth = width; |
| 128 const int kLaneHeight = height / kCSSTestColorsCount; | 129 const int kLaneHeight = height / kCSSTestColorsCount; |
| 129 SkBitmap backing_store; | 130 SkBitmap backing_store; |
| 130 backing_store.allocN32Pixels(width, height); | 131 backing_store.allocN32Pixels(width, height); |
| 131 SkCanvas canvas(backing_store); | 132 SkCanvas canvas(backing_store); |
| 132 canvas.clear(SK_ColorTRANSPARENT); | 133 canvas.clear(SK_ColorTRANSPARENT); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 lane->SetForceRenderSurface(true); | 212 lane->SetForceRenderSurface(true); |
| 212 if (flags & kUseMasks) | 213 if (flags & kUseMasks) |
| 213 SetupMaskLayer(lane); | 214 SetupMaskLayer(lane); |
| 214 if (flags & kUseColorMatrix) { | 215 if (flags & kUseColorMatrix) { |
| 215 SetupColorMatrix(lane); | 216 SetupColorMatrix(lane); |
| 216 } | 217 } |
| 217 background->AddChild(lane); | 218 background->AddChild(lane); |
| 218 } | 219 } |
| 219 } | 220 } |
| 220 | 221 |
| 221 void RunBlendingWithRenderPass(PixelTestType type, | 222 void RunBlendingWithRenderPass(PixelResourceTestCase type, |
| 222 const base::FilePath::CharType* expected_path, | 223 const base::FilePath::CharType* expected_path, |
| 223 RenderPassOptions flags) { | 224 RenderPassOptions flags) { |
| 224 const int kLaneWidth = 8; | 225 const int kLaneWidth = 8; |
| 225 const int kLaneHeight = kLaneWidth * kCSSTestColorsCount; | 226 const int kLaneHeight = kLaneWidth * kCSSTestColorsCount; |
| 226 const int kRootSize = kLaneHeight; | 227 const int kRootSize = kLaneHeight; |
| 228 InitializeFromTestCase(type); |
| 227 | 229 |
| 228 scoped_refptr<SolidColorLayer> root = | 230 scoped_refptr<SolidColorLayer> root = |
| 229 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), SK_ColorWHITE); | 231 CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), SK_ColorWHITE); |
| 230 scoped_refptr<Layer> background = | 232 scoped_refptr<Layer> background = |
| 231 CreateColorfulBackdropLayer(kRootSize, kRootSize); | 233 CreateColorfulBackdropLayer(kRootSize, kRootSize); |
| 232 | 234 |
| 233 background->SetIsRootForIsolatedGroup(true); | 235 background->SetIsRootForIsolatedGroup(true); |
| 234 root->AddChild(background); | 236 root->AddChild(background); |
| 235 | 237 |
| 236 CreateBlendingColorLayers(kLaneWidth, kLaneHeight, background.get(), flags); | 238 CreateBlendingColorLayers(kLaneWidth, kLaneHeight, background.get(), flags); |
| 237 | 239 |
| 238 this->impl_side_painting_ = false; | 240 this->impl_side_painting_ = false; |
| 239 this->force_antialiasing_ = (flags & kUseAntialiasing); | 241 this->force_antialiasing_ = (flags & kUseAntialiasing); |
| 240 this->force_blending_with_shaders_ = (flags & kForceShaders); | 242 this->force_blending_with_shaders_ = (flags & kForceShaders); |
| 241 | 243 |
| 242 if ((flags & kUseAntialiasing) && (type == PIXEL_TEST_GL)) { | 244 if ((flags & kUseAntialiasing) && (test_type_ == PIXEL_TEST_GL)) { |
| 243 // Anti aliasing causes differences up to 8 pixels at the edges. | 245 // Anti aliasing causes differences up to 8 pixels at the edges. |
| 244 int large_error_allowed = 8; | 246 int large_error_allowed = 8; |
| 245 // Blending results might differ with one pixel. | 247 // Blending results might differ with one pixel. |
| 246 int small_error_allowed = 1; | 248 int small_error_allowed = 1; |
| 247 // Most of the errors are one pixel errors. | 249 // Most of the errors are one pixel errors. |
| 248 float percentage_pixels_small_error = 13.1f; | 250 float percentage_pixels_small_error = 13.1f; |
| 249 // Because of anti-aliasing, around 10% of pixels (at the edges) have | 251 // Because of anti-aliasing, around 10% of pixels (at the edges) have |
| 250 // bigger errors (from small_error_allowed + 1 to large_error_allowed). | 252 // bigger errors (from small_error_allowed + 1 to large_error_allowed). |
| 251 float percentage_pixels_error = 22.5f; | 253 float percentage_pixels_error = 22.5f; |
| 252 // The average error is still close to 1. | 254 // The average error is still close to 1. |
| 253 float average_error_allowed_in_bad_pixels = 1.4f; | 255 float average_error_allowed_in_bad_pixels = 1.4f; |
| 254 | 256 |
| 255 pixel_comparator_.reset( | 257 pixel_comparator_.reset( |
| 256 new FuzzyPixelComparator(false, // discard_alpha | 258 new FuzzyPixelComparator(false, // discard_alpha |
| 257 percentage_pixels_error, | 259 percentage_pixels_error, |
| 258 percentage_pixels_small_error, | 260 percentage_pixels_small_error, |
| 259 average_error_allowed_in_bad_pixels, | 261 average_error_allowed_in_bad_pixels, |
| 260 large_error_allowed, | 262 large_error_allowed, |
| 261 small_error_allowed)); | 263 small_error_allowed)); |
| 262 } | 264 } |
| 263 | 265 |
| 264 RunPixelTest(type, root, base::FilePath(expected_path)); | 266 RunPixelResourceTest(root, base::FilePath(expected_path)); |
| 265 } | 267 } |
| 266 | 268 |
| 267 bool force_antialiasing_; | 269 bool force_antialiasing_; |
| 268 bool force_blending_with_shaders_; | 270 bool force_blending_with_shaders_; |
| 269 }; | 271 }; |
| 270 | 272 |
| 271 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_GL) { | 273 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_GL) { |
| 272 RunBlendingWithRootPixelTestType(PIXEL_TEST_GL); | 274 RunBlendingWithRootPixelTestType(GL_ASYNC_UPLOAD_2D_DRAW); |
| 273 } | 275 } |
| 274 | 276 |
| 275 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_Software) { | 277 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_Software) { |
| 276 RunBlendingWithRootPixelTestType(PIXEL_TEST_SOFTWARE); | 278 RunBlendingWithRootPixelTestType(SOFTWARE); |
| 277 } | 279 } |
| 278 | 280 |
| 279 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithBackgroundFilter) { | 281 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithBackgroundFilter) { |
| 280 const int kLaneWidth = 2; | 282 const int kLaneWidth = 2; |
| 281 const int kLaneHeight = kLaneWidth; | 283 const int kLaneHeight = kLaneWidth; |
| 282 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth; | 284 const int kRootWidth = (kBlendModesCount + 2) * kLaneWidth; |
| 283 const int kRootHeight = 2 * kLaneWidth + kLaneHeight; | 285 const int kRootHeight = 2 * kLaneWidth + kLaneHeight; |
| 286 InitializeFromTestCase(GL_ASYNC_UPLOAD_2D_DRAW); |
| 284 | 287 |
| 285 scoped_refptr<SolidColorLayer> background = | 288 scoped_refptr<SolidColorLayer> background = |
| 286 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSOrange); | 289 CreateSolidColorLayer(gfx::Rect(kRootWidth, kRootHeight), kCSSOrange); |
| 287 | 290 |
| 288 // Orange child layers have a background filter set and they will blend with | 291 // Orange child layers have a background filter set and they will blend with |
| 289 // the green background | 292 // the green background |
| 290 for (int i = 0; i < kBlendModesCount; ++i) { | 293 for (int i = 0; i < kBlendModesCount; ++i) { |
| 291 gfx::Rect child_rect( | 294 gfx::Rect child_rect( |
| 292 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight); | 295 (i + 1) * kLaneWidth, kLaneWidth, kLaneWidth, kLaneHeight); |
| 293 scoped_refptr<SolidColorLayer> green_lane = | 296 scoped_refptr<SolidColorLayer> green_lane = |
| 294 CreateSolidColorLayer(child_rect, kCSSGreen); | 297 CreateSolidColorLayer(child_rect, kCSSGreen); |
| 295 background->AddChild(green_lane); | 298 background->AddChild(green_lane); |
| 296 | 299 |
| 297 FilterOperations filters; | 300 FilterOperations filters; |
| 298 filters.Append(FilterOperation::CreateGrayscaleFilter(.75)); | 301 filters.Append(FilterOperation::CreateGrayscaleFilter(.75)); |
| 299 green_lane->SetBackgroundFilters(filters); | 302 green_lane->SetBackgroundFilters(filters); |
| 300 green_lane->SetBlendMode(kBlendModes[i]); | 303 green_lane->SetBlendMode(kBlendModes[i]); |
| 301 } | 304 } |
| 302 | 305 |
| 303 RunPixelTest(PIXEL_TEST_GL, | 306 RunPixelResourceTest( |
| 304 background, | 307 background, base::FilePath(FILE_PATH_LITERAL("blending_and_filter.png"))); |
| 305 base::FilePath(FILE_PATH_LITERAL("blending_and_filter.png"))); | |
| 306 } | 308 } |
| 307 | 309 |
| 308 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithTransparent_GL) { | 310 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithTransparent_GL) { |
| 309 RunBlendingWithTransparentPixelTestType(PIXEL_TEST_GL); | 311 RunBlendingWithTransparentPixelTestType(GL_ASYNC_UPLOAD_2D_DRAW); |
| 310 } | 312 } |
| 311 | 313 |
| 312 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithTransparent_Software) { | 314 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithTransparent_Software) { |
| 313 RunBlendingWithTransparentPixelTestType(PIXEL_TEST_SOFTWARE); | 315 RunBlendingWithTransparentPixelTestType(SOFTWARE); |
| 314 } | 316 } |
| 315 | 317 |
| 316 // Tests for render passes | 318 // Tests for render passes |
| 317 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPass_GL) { | 319 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPass_GL) { |
| 318 RunBlendingWithRenderPass( | 320 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 319 PIXEL_TEST_GL, FILE_PATH_LITERAL("blending_render_pass.png"), 0); | 321 FILE_PATH_LITERAL("blending_render_pass.png"), 0); |
| 320 } | 322 } |
| 321 | 323 |
| 322 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPass_Software) { | 324 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPass_Software) { |
| 323 RunBlendingWithRenderPass( | 325 RunBlendingWithRenderPass(SOFTWARE, |
| 324 PIXEL_TEST_SOFTWARE, FILE_PATH_LITERAL("blending_render_pass.png"), 0); | 326 FILE_PATH_LITERAL("blending_render_pass.png"), 0); |
| 325 } | 327 } |
| 326 | 328 |
| 327 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassAA_GL) { | 329 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassAA_GL) { |
| 328 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 330 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 329 FILE_PATH_LITERAL("blending_render_pass.png"), | 331 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 330 kUseAntialiasing); | 332 kUseAntialiasing); |
| 331 } | 333 } |
| 332 | 334 |
| 333 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassAA_Software) { | 335 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassAA_Software) { |
| 334 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 336 RunBlendingWithRenderPass(SOFTWARE, |
| 335 FILE_PATH_LITERAL("blending_render_pass.png"), | 337 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 336 kUseAntialiasing); | 338 kUseAntialiasing); |
| 337 } | 339 } |
| 338 | 340 |
| 339 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMask_GL) { | 341 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMask_GL) { |
| 340 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 342 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 341 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 343 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 342 kUseMasks); | 344 kUseMasks); |
| 343 } | 345 } |
| 344 | 346 |
| 345 TEST_F(LayerTreeHostBlendingPixelTest, | 347 TEST_F(LayerTreeHostBlendingPixelTest, |
| 346 BlendingWithRenderPassWithMask_Software) { | 348 BlendingWithRenderPassWithMask_Software) { |
| 347 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 349 RunBlendingWithRenderPass( |
| 348 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 350 SOFTWARE, FILE_PATH_LITERAL("blending_render_pass_mask.png"), kUseMasks); |
| 349 kUseMasks); | |
| 350 } | 351 } |
| 351 | 352 |
| 352 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMaskAA_GL) { | 353 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMaskAA_GL) { |
| 353 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 354 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 354 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 355 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 355 kUseMasks | kUseAntialiasing); | 356 kUseMasks | kUseAntialiasing); |
| 356 } | 357 } |
| 357 | 358 |
| 358 TEST_F(LayerTreeHostBlendingPixelTest, | 359 TEST_F(LayerTreeHostBlendingPixelTest, |
| 359 BlendingWithRenderPassWithMaskAA_Software) { | 360 BlendingWithRenderPassWithMaskAA_Software) { |
| 360 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 361 RunBlendingWithRenderPass(SOFTWARE, |
| 361 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 362 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 362 kUseMasks | kUseAntialiasing); | 363 kUseMasks | kUseAntialiasing); |
| 363 } | 364 } |
| 364 | 365 |
| 365 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrix_GL) { | 366 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrix_GL) { |
| 366 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 367 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 367 FILE_PATH_LITERAL("blending_render_pass.png"), | 368 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 368 kUseColorMatrix); | 369 kUseColorMatrix); |
| 369 } | 370 } |
| 370 | 371 |
| 371 TEST_F(LayerTreeHostBlendingPixelTest, | 372 TEST_F(LayerTreeHostBlendingPixelTest, |
| 372 BlendingWithRenderPassColorMatrix_Software) { | 373 BlendingWithRenderPassColorMatrix_Software) { |
| 373 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 374 RunBlendingWithRenderPass( |
| 374 FILE_PATH_LITERAL("blending_render_pass.png"), | 375 SOFTWARE, FILE_PATH_LITERAL("blending_render_pass.png"), kUseColorMatrix); |
| 375 kUseColorMatrix); | |
| 376 } | 376 } |
| 377 | 377 |
| 378 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrixAA_GL) { | 378 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrixAA_GL) { |
| 379 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 379 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 380 FILE_PATH_LITERAL("blending_render_pass.png"), | 380 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 381 kUseAntialiasing | kUseColorMatrix); | 381 kUseAntialiasing | kUseColorMatrix); |
| 382 } | 382 } |
| 383 | 383 |
| 384 TEST_F(LayerTreeHostBlendingPixelTest, | 384 TEST_F(LayerTreeHostBlendingPixelTest, |
| 385 BlendingWithRenderPassColorMatrixAA_Software) { | 385 BlendingWithRenderPassColorMatrixAA_Software) { |
| 386 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 386 RunBlendingWithRenderPass(SOFTWARE, |
| 387 FILE_PATH_LITERAL("blending_render_pass.png"), | 387 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 388 kUseAntialiasing | kUseColorMatrix); | 388 kUseAntialiasing | kUseColorMatrix); |
| 389 } | 389 } |
| 390 | 390 |
| 391 TEST_F(LayerTreeHostBlendingPixelTest, | 391 TEST_F(LayerTreeHostBlendingPixelTest, |
| 392 BlendingWithRenderPassWithMaskColorMatrix_GL) { | 392 BlendingWithRenderPassWithMaskColorMatrix_GL) { |
| 393 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 393 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 394 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 394 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 395 kUseMasks | kUseColorMatrix); | 395 kUseMasks | kUseColorMatrix); |
| 396 } | 396 } |
| 397 | 397 |
| 398 TEST_F(LayerTreeHostBlendingPixelTest, | 398 TEST_F(LayerTreeHostBlendingPixelTest, |
| 399 BlendingWithRenderPassWithMaskColorMatrix_Software) { | 399 BlendingWithRenderPassWithMaskColorMatrix_Software) { |
| 400 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 400 RunBlendingWithRenderPass(SOFTWARE, |
| 401 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 401 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 402 kUseMasks | kUseColorMatrix); | 402 kUseMasks | kUseColorMatrix); |
| 403 } | 403 } |
| 404 | 404 |
| 405 TEST_F(LayerTreeHostBlendingPixelTest, | 405 TEST_F(LayerTreeHostBlendingPixelTest, |
| 406 BlendingWithRenderPassWithMaskColorMatrixAA_GL) { | 406 BlendingWithRenderPassWithMaskColorMatrixAA_GL) { |
| 407 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 407 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 408 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 408 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 409 kUseMasks | kUseAntialiasing | kUseColorMatrix); | 409 kUseMasks | kUseAntialiasing | kUseColorMatrix); |
| 410 } | 410 } |
| 411 | 411 |
| 412 TEST_F(LayerTreeHostBlendingPixelTest, | 412 TEST_F(LayerTreeHostBlendingPixelTest, |
| 413 BlendingWithRenderPassWithMaskColorMatrixAA_Software) { | 413 BlendingWithRenderPassWithMaskColorMatrixAA_Software) { |
| 414 RunBlendingWithRenderPass(PIXEL_TEST_SOFTWARE, | 414 RunBlendingWithRenderPass(SOFTWARE, |
| 415 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 415 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 416 kUseMasks | kUseAntialiasing | kUseColorMatrix); | 416 kUseMasks | kUseAntialiasing | kUseColorMatrix); |
| 417 } | 417 } |
| 418 | 418 |
| 419 // Tests for render passes forcing shaders for all the blend modes. | 419 // Tests for render passes forcing shaders for all the blend modes. |
| 420 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShaders_GL) { | 420 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShaders_GL) { |
| 421 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 421 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 422 FILE_PATH_LITERAL("blending_render_pass.png"), | 422 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 423 kForceShaders); | 423 kForceShaders); |
| 424 } | 424 } |
| 425 | 425 |
| 426 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShadersAA_GL) { | 426 TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShadersAA_GL) { |
| 427 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 427 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 428 FILE_PATH_LITERAL("blending_render_pass.png"), | 428 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 429 kUseAntialiasing | kForceShaders); | 429 kUseAntialiasing | kForceShaders); |
| 430 } | 430 } |
| 431 | 431 |
| 432 TEST_F(LayerTreeHostBlendingPixelTest, | 432 TEST_F(LayerTreeHostBlendingPixelTest, |
| 433 BlendingWithRenderPassShadersWithMask_GL) { | 433 BlendingWithRenderPassShadersWithMask_GL) { |
| 434 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 434 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 435 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 435 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 436 kUseMasks | kForceShaders); | 436 kUseMasks | kForceShaders); |
| 437 } | 437 } |
| 438 | 438 |
| 439 TEST_F(LayerTreeHostBlendingPixelTest, | 439 TEST_F(LayerTreeHostBlendingPixelTest, |
| 440 BlendingWithRenderPassShadersWithMaskAA_GL) { | 440 BlendingWithRenderPassShadersWithMaskAA_GL) { |
| 441 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 441 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 442 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 442 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 443 kUseMasks | kUseAntialiasing | kForceShaders); | 443 kUseMasks | kUseAntialiasing | kForceShaders); |
| 444 } | 444 } |
| 445 | 445 |
| 446 TEST_F(LayerTreeHostBlendingPixelTest, | 446 TEST_F(LayerTreeHostBlendingPixelTest, |
| 447 BlendingWithRenderPassShadersColorMatrix_GL) { | 447 BlendingWithRenderPassShadersColorMatrix_GL) { |
| 448 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 448 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 449 FILE_PATH_LITERAL("blending_render_pass.png"), | 449 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 450 kUseColorMatrix | kForceShaders); | 450 kUseColorMatrix | kForceShaders); |
| 451 } | 451 } |
| 452 | 452 |
| 453 TEST_F(LayerTreeHostBlendingPixelTest, | 453 TEST_F(LayerTreeHostBlendingPixelTest, |
| 454 BlendingWithRenderPassShadersColorMatrixAA_GL) { | 454 BlendingWithRenderPassShadersColorMatrixAA_GL) { |
| 455 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 455 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 456 FILE_PATH_LITERAL("blending_render_pass.png"), | 456 FILE_PATH_LITERAL("blending_render_pass.png"), |
| 457 kUseAntialiasing | kUseColorMatrix | kForceShaders); | 457 kUseAntialiasing | kUseColorMatrix | kForceShaders); |
| 458 } | 458 } |
| 459 | 459 |
| 460 TEST_F(LayerTreeHostBlendingPixelTest, | 460 TEST_F(LayerTreeHostBlendingPixelTest, |
| 461 BlendingWithRenderPassShadersWithMaskColorMatrix_GL) { | 461 BlendingWithRenderPassShadersWithMaskColorMatrix_GL) { |
| 462 RunBlendingWithRenderPass(PIXEL_TEST_GL, | 462 RunBlendingWithRenderPass(GL_ASYNC_UPLOAD_2D_DRAW, |
| 463 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 463 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 464 kUseMasks | kUseColorMatrix | kForceShaders); | 464 kUseMasks | kUseColorMatrix | kForceShaders); |
| 465 } | 465 } |
| 466 | 466 |
| 467 TEST_F(LayerTreeHostBlendingPixelTest, | 467 TEST_F(LayerTreeHostBlendingPixelTest, |
| 468 BlendingWithRenderPassShadersWithMaskColorMatrixAA_GL) { | 468 BlendingWithRenderPassShadersWithMaskColorMatrixAA_GL) { |
| 469 RunBlendingWithRenderPass( | 469 RunBlendingWithRenderPass( |
| 470 PIXEL_TEST_GL, FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 470 GL_ASYNC_UPLOAD_2D_DRAW, |
| 471 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
| 471 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders); | 472 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders); |
| 472 } | 473 } |
| 473 | 474 |
| 474 } // namespace | 475 } // namespace |
| 475 } // namespace cc | 476 } // namespace cc |
| 476 | 477 |
| 477 #endif // OS_ANDROID | 478 #endif // OS_ANDROID |
| OLD | NEW |