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

Unified Diff: cc/trees/layer_tree_host_pixeltest_filters.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dc8cc4a9a0db89a8038e10d8cf59ca4208f322b2..bf8e3e2123867ac34c7684c5b1f6898cfd78909b 100644
--- a/cc/trees/layer_tree_host_pixeltest_filters.cc
+++ b/cc/trees/layer_tree_host_pixeltest_filters.cc
@@ -283,7 +283,7 @@ TEST_F(LayerTreeHostFiltersPixelTest, ImageFilterScaled_GL) {
gfx::Rect rect(50, 50, 100, 100);
- static const int kInset = 3;
+ const int kInset = 3;
for (int i = 0; !rect.IsEmpty(); ++i) {
scoped_refptr<SolidColorLayer> layer =
CreateSolidColorLayer(rect, (i & 1) ? SK_ColorWHITE : SK_ColorRED);
@@ -334,6 +334,67 @@ TEST_F(LayerTreeHostFiltersPixelTest, ImageFilterScaled_GL) {
base::FilePath(FILE_PATH_LITERAL("filter_on_scaled_layer.png")));
}
+class ImageScaledRenderSurface : public LayerTreeHostFiltersPixelTest {
+ protected:
+ void RunPixelTestType(PixelTestType test_type, base::FilePath image_name) {
+ // A filter will cause a render surface to be used. Here we force the
+ // render surface on, and scale the result to make sure that we rasterize at
+ // the correct resolution.
+ scoped_refptr<SolidColorLayer> background =
+ CreateSolidColorLayer(gfx::Rect(300, 300), SK_ColorBLUE);
+
+ scoped_refptr<SolidColorLayer> render_surface_layer =
+ CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE);
+
+ gfx::Rect rect(50, 50, 100, 100);
+
+ scoped_refptr<SolidColorLayer> child =
+ CreateSolidColorLayer(rect, 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);
+ child->SetTransform(transform);
+
+ render_surface_layer->AddChild(child);
+
+ gfx::Transform render_surface_transform;
+ render_surface_transform.Scale(1.5f, 1.5f);
+ render_surface_layer->SetTransform(render_surface_transform);
+ render_surface_layer->SetForceRenderSurface(true);
+
+ background->AddChild(render_surface_layer);
+
+ // Software has some huge differences in the AA'd pixels on the different
+ // trybots. See crbug.com/452198.
+ float percentage_pixels_large_error = 0.686f;
+ float percentage_pixels_small_error = 0.0f;
+ float average_error_allowed_in_bad_pixels = 16.f;
+ int large_error_allowed = 17;
+ 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));
+
+ RunPixelTest(test_type, background, image_name);
+ }
+};
+
+TEST_F(ImageScaledRenderSurface, ImageRenderSurfaceScaled_GL) {
+ RunPixelTestType(
+ PIXEL_TEST_GL,
+ base::FilePath(FILE_PATH_LITERAL("scaled_render_surface_layer_gl.png")));
+}
+
+TEST_F(ImageScaledRenderSurface, ImageRenderSurfaceScaled_Software) {
+ RunPixelTestType(
+ PIXEL_TEST_SOFTWARE,
+ base::FilePath(FILE_PATH_LITERAL("scaled_render_surface_layer_sw.png")));
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698