| 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_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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 background->SetIsRootForIsolatedGroup(true); | 226 background->SetIsRootForIsolatedGroup(true); |
| 227 root->AddChild(background); | 227 root->AddChild(background); |
| 228 | 228 |
| 229 CreateBlendingColorLayers(kRootSize, kRootSize, background.get(), flags); | 229 CreateBlendingColorLayers(kRootSize, kRootSize, background.get(), flags); |
| 230 | 230 |
| 231 this->impl_side_painting_ = false; | 231 this->impl_side_painting_ = false; |
| 232 this->force_antialiasing_ = (flags & kUseAntialiasing); | 232 this->force_antialiasing_ = (flags & kUseAntialiasing); |
| 233 | 233 |
| 234 if ((flags & kUseAntialiasing) && (type == PIXEL_TEST_GL)) { | 234 if ((flags & kUseAntialiasing) && (type == PIXEL_TEST_GL)) { |
| 235 // Anti aliasing causes differences up to 7 pixels at the edges. | 235 // Anti aliasing causes differences up to 7 pixels at the edges. |
| 236 int large_error_allowed = 7; | 236 // Several pixels have 9 units difference on the alpha channel. |
| 237 int large_error_allowed = (flags & kUseMasks) ? 7 : 9; |
| 237 // Blending results might differ with one pixel. | 238 // Blending results might differ with one pixel. |
| 238 int small_error_allowed = 1; | 239 int small_error_allowed = 1; |
| 239 // Most of the errors are one pixel errors. | 240 // Most of the errors are one pixel errors. |
| 240 float percentage_pixels_small_error = 12.5f; | 241 float percentage_pixels_small_error = (flags & kUseMasks) ? 7.7f : 12.1f; |
| 241 // Because of anti-aliasing, around 3% of pixels (at the edges) have | 242 // Because of anti-aliasing, around 3% of pixels (at the edges) have |
| 242 // bigger errors (from small_error_allowed + 1 to large_error_allowed). | 243 // bigger errors (from small_error_allowed + 1 to large_error_allowed). |
| 243 float percentage_pixels_error = 15.0f; | 244 float percentage_pixels_error = (flags & kUseMasks) ? 12.4f : 15.f; |
| 244 // The average error is still close to 1. | 245 // The average error is still close to 1. |
| 245 float average_error_allowed_in_bad_pixels = 1.3f; | 246 float average_error_allowed_in_bad_pixels = |
| 247 (flags & kUseMasks) ? 1.3f : 1.f; |
| 246 | 248 |
| 247 // The sepia filter generates more small errors, but the number of large | 249 // The sepia filter generates more small errors, but the number of large |
| 248 // errors remains around 3%. | 250 // errors remains around 3%. |
| 249 if (flags & kUseColorMatrix) { | 251 if (flags & kUseColorMatrix) { |
| 250 percentage_pixels_small_error = 26.f; | 252 percentage_pixels_small_error = (flags & kUseMasks) ? 14.0f : 26.f; |
| 251 percentage_pixels_error = 29.f; | 253 percentage_pixels_error = (flags & kUseMasks) ? 18.5f : 29.f; |
| 254 average_error_allowed_in_bad_pixels = (flags & kUseMasks) ? 0.9f : 0.7f; |
| 252 } | 255 } |
| 253 | 256 |
| 254 // Anti-aliased pixels in combination with non-separable blend modes and | |
| 255 // a white background produces several black pixels (6 for these tests). | |
| 256 // Having a mask will hide the black pixels. | |
| 257 // TODO(rosca): fix this issue for non-separable blend modes. | |
| 258 if (!(flags & kUseMasks)) | |
| 259 large_error_allowed = 255; | |
| 260 | |
| 261 pixel_comparator_.reset( | 257 pixel_comparator_.reset( |
| 262 new FuzzyPixelComparator(false, // discard_alpha | 258 new FuzzyPixelComparator(false, // discard_alpha |
| 263 percentage_pixels_error, | 259 percentage_pixels_error, |
| 264 percentage_pixels_small_error, | 260 percentage_pixels_small_error, |
| 265 average_error_allowed_in_bad_pixels, | 261 average_error_allowed_in_bad_pixels, |
| 266 large_error_allowed, | 262 large_error_allowed, |
| 267 small_error_allowed)); | 263 small_error_allowed)); |
| 268 } else if ((flags & kUseColorMatrix) && (type == PIXEL_TEST_GL)) { | 264 } else if ((flags & kUseColorMatrix) && (type == PIXEL_TEST_GL)) { |
| 269 float percentage_pixels_error = 100.f; | 265 float percentage_pixels_error = 100.f; |
| 270 float percentage_pixels_small_error = 0.f; | 266 float percentage_pixels_small_error = 0.f; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 RunBlendingWithRenderPass( | 430 RunBlendingWithRenderPass( |
| 435 PIXEL_TEST_SOFTWARE, | 431 PIXEL_TEST_SOFTWARE, |
| 436 FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), | 432 FILE_PATH_LITERAL("blending_render_pass_mask_cm.png"), |
| 437 kUseMasks | kUseAntialiasing | kUseColorMatrix); | 433 kUseMasks | kUseAntialiasing | kUseColorMatrix); |
| 438 } | 434 } |
| 439 | 435 |
| 440 } // namespace | 436 } // namespace |
| 441 } // namespace cc | 437 } // namespace cc |
| 442 | 438 |
| 443 #endif // OS_ANDROID | 439 #endif // OS_ANDROID |
| OLD | NEW |