Index: cc/trees/layer_tree_host_pixeltest_filters.cc |
diff --git a/cc/trees/layer_tree_host_pixeltest_filters.cc b/cc/trees/layer_tree_host_pixeltest_filters.cc |
index 40fa2c3e454b16d18a0ff7686a2a0f10115a6a26..dc8cc4a9a0db89a8038e10d8cf59ca4208f322b2 100644 |
--- a/cc/trees/layer_tree_host_pixeltest_filters.cc |
+++ b/cc/trees/layer_tree_host_pixeltest_filters.cc |
@@ -136,8 +136,8 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOffAxis) { |
blur->SetBackgroundFilters(filters); |
#if defined(OS_WIN) |
- // Windows has 153 pixels off by at most 2: crbug.com/225027 |
- float percentage_pixels_large_error = 0.3825f; // 153px / (200*200) |
+ // Windows has 116 pixels off by at most 2: crbug.com/225027 |
+ float percentage_pixels_large_error = 0.3f; // 116px / (200*200), rounded up |
float percentage_pixels_small_error = 0.0f; |
float average_error_allowed_in_bad_pixels = 1.f; |
int large_error_allowed = 2; |
@@ -277,6 +277,63 @@ TEST_F(ImageFilterClippedPixelTest, ImageFilterClipped_Software) { |
RunPixelTestType(PIXEL_TEST_SOFTWARE); |
} |
+TEST_F(LayerTreeHostFiltersPixelTest, ImageFilterScaled_GL) { |
+ scoped_refptr<SolidColorLayer> background = |
+ CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE); |
+ |
+ gfx::Rect rect(50, 50, 100, 100); |
+ |
+ static const int kInset = 3; |
+ for (int i = 0; !rect.IsEmpty(); ++i) { |
+ scoped_refptr<SolidColorLayer> layer = |
+ CreateSolidColorLayer(rect, (i & 1) ? SK_ColorWHITE : SK_ColorRED); |
+ |
+ gfx::Transform transform; |
+ transform.Translate(rect.width() / 2.0, rect.height() / 2.0); |
+ transform.RotateAboutZAxis(30.0); |
+ transform.Translate(-rect.width() / 2.0, -rect.height() / 2.0); |
+ layer->SetTransform(transform); |
+ |
+ background->AddChild(layer); |
+ |
+ rect.Inset(kInset, kInset); |
+ } |
+ |
+ scoped_refptr<SolidColorLayer> filter = |
+ CreateSolidColorLayer(gfx::Rect(100, 0, 100, 200), SK_ColorTRANSPARENT); |
+ |
+ background->AddChild(filter); |
+ |
+ // Apply a scale to |background| so that we can see any scaling artifacts that |
+ // may appear. |
+ gfx::Transform background_transform; |
+ static float scale = 1.1f; |
+ background_transform.Scale(scale, scale); |
+ background->SetTransform(background_transform); |
+ |
+ FilterOperations filters; |
+ filters.Append(FilterOperation::CreateGrayscaleFilter(1.0f)); |
+ filter->SetBackgroundFilters(filters); |
+ |
+#if defined(OS_WIN) |
+ // Windows has 153 pixels off by at most 2: crbug.com/225027 |
+ float percentage_pixels_large_error = 0.3825f; // 153px / (200*200) |
+ float percentage_pixels_small_error = 0.0f; |
+ float average_error_allowed_in_bad_pixels = 1.f; |
+ int large_error_allowed = 2; |
+ int small_error_allowed = 0; |
+ pixel_comparator_.reset(new FuzzyPixelComparator( |
+ true, // discard_alpha |
+ percentage_pixels_large_error, percentage_pixels_small_error, |
+ average_error_allowed_in_bad_pixels, large_error_allowed, |
+ small_error_allowed)); |
+#endif |
+ |
+ // TODO(hendrikw): Enable test in software as well: crbug.com/432157 |
+ RunPixelTest(PIXEL_TEST_GL, background, |
+ base::FilePath(FILE_PATH_LITERAL("filter_on_scaled_layer.png"))); |
+} |
+ |
} // namespace |
} // namespace cc |