Chromium Code Reviews| Index: cc/trees/layer_tree_host_pixeltest_blending.cc |
| diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc |
| index 7a492a1d5bfde2cc2e11afa89d82057645b60256..7c0354dbef7ddf84e1cd47e732a339bc8a474af2 100644 |
| --- a/cc/trees/layer_tree_host_pixeltest_blending.cc |
| +++ b/cc/trees/layer_tree_host_pixeltest_blending.cc |
| @@ -5,6 +5,7 @@ |
| #include "cc/layers/solid_color_layer.h" |
| #include "cc/layers/texture_layer.h" |
| #include "cc/test/layer_tree_pixel_test.h" |
| +#include "cc/test/pixel_test.h" |
| #if !defined(OS_ANDROID) |
| @@ -23,6 +24,13 @@ SkXfermode::Mode const kBlendModes[] = { |
| const int kBlendModesCount = arraysize(kBlendModes); |
| +// All pixels can be off by one, but any more than that is an error. |
| +class FuzzyPixelOffByOneComparator : public FuzzyPixelComparator { |
|
enne (OOO)
2014/09/05 17:49:08
I feel like this is duplicated elsewhere. Can you
rosca
2014/09/05 20:52:27
Done.
|
| + public: |
| + explicit FuzzyPixelOffByOneComparator(bool discard_alpha) |
| + : FuzzyPixelComparator(discard_alpha, 100.f, 0.f, 1.f, 1, 0) {} |
| +}; |
| + |
| class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
| protected: |
| void RunBlendingWithRootPixelTestType(PixelTestType type) { |
| @@ -43,6 +51,9 @@ class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
| green_lane->SetBlendMode(kBlendModes[i]); |
| } |
| + if (type == SOFTWARE_WITH_BITMAP) |
|
enne (OOO)
2014/09/05 17:49:08
I'd be ok with making all the blending tests use a
rosca
2014/09/05 20:52:28
Done.
|
| + pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true)); |
| + |
| RunPixelTest(type, |
| background, |
| base::FilePath(FILE_PATH_LITERAL("blending_with_root.png"))); |
| @@ -72,6 +83,9 @@ class LayerTreeHostBlendingPixelTest : public LayerTreePixelTest { |
| green_lane->SetBlendMode(kBlendModes[i]); |
| } |
| + if (type == SOFTWARE_WITH_BITMAP) |
| + pixel_comparator_.reset(new FuzzyPixelOffByOneComparator(true)); |
| + |
| RunPixelTest(type, |
| root, |
| base::FilePath(FILE_PATH_LITERAL("blending_transparent.png"))); |
| @@ -82,6 +96,10 @@ TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_GL) { |
| RunBlendingWithRootPixelTestType(GL_WITH_BITMAP); |
| } |
| +TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRoot_Software) { |
| + RunBlendingWithRootPixelTestType(SOFTWARE_WITH_BITMAP); |
| +} |
| + |
| TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithBackgroundFilter) { |
| const int kLaneWidth = 15; |
| const int kLaneHeight = kBlendModesCount * kLaneWidth; |
| @@ -114,6 +132,10 @@ TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithTransparent_GL) { |
| RunBlendingWithTransparentPixelTestType(GL_WITH_BITMAP); |
| } |
| +TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithTransparent_Software) { |
| + RunBlendingWithTransparentPixelTestType(SOFTWARE_WITH_BITMAP); |
| +} |
| + |
| } // namespace |
| } // namespace cc |