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

Unified Diff: cc/trees/layer_tree_host_pixeltest_filters.cc

Issue 1670763002: cc: fix for huge filtered render surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 4 years, 10 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/test/data/filter_with_giant_crop_rect.png ('k') | no next file » | 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 cee0cbb5a8afa07fbce5634155d47bcec165b66c..eecb6d423f8a2fca1b82865f735e1a2e5dedc8b3 100644
--- a/cc/trees/layer_tree_host_pixeltest_filters.cc
+++ b/cc/trees/layer_tree_host_pixeltest_filters.cc
@@ -587,6 +587,69 @@ TEST_F(EnlargedTextureWithCropOffsetFilter, Software) {
base::FilePath(FILE_PATH_LITERAL("enlarged_texture_on_crop_offset.png")));
}
+class FilterWithGiantCropRectPixelTest : public LayerTreeHostFiltersPixelTest {
+ protected:
+ scoped_refptr<SolidColorLayer> BuildFilterWithGiantCropRect(
+ bool masks_to_bounds) {
+ scoped_refptr<SolidColorLayer> background =
+ CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE);
+ scoped_refptr<SolidColorLayer> filter_layer =
+ CreateSolidColorLayer(gfx::Rect(50, 50, 100, 100), SK_ColorRED);
+
+ // This matrix swaps the red and green channels, and has a slight
+ // translation in the alpha component, so that it affects transparent
+ // pixels.
+ SkScalar matrix[20] = {
+ 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 20.0f,
+ };
+
+ skia::RefPtr<SkColorFilter> color_filter(
+ skia::AdoptRef(SkColorFilter::CreateMatrixFilterRowMajor255(matrix)));
+
+ FilterOperations filters;
+ SkImageFilter::CropRect cropRect(
+ SkRect::MakeXYWH(-40000, -40000, 80000, 80000));
+ skia::RefPtr<SkImageFilter> filter(
+ skia::AdoptRef(SkColorFilterImageFilter::Create(color_filter.get(),
+ nullptr, &cropRect)));
+ filters.Append(FilterOperation::CreateReferenceFilter(filter));
+ filter_layer->SetFilters(filters);
+ background->SetMasksToBounds(masks_to_bounds);
+ background->AddChild(filter_layer);
+
+ return background;
+ }
+};
+
+class FilterWithGiantCropRect : public FilterWithGiantCropRectPixelTest {
+ protected:
+ void RunPixelTestType(PixelTestType test_type, base::FilePath image_name) {
+ scoped_refptr<SolidColorLayer> tree = BuildFilterWithGiantCropRect(true);
+ RunPixelTest(test_type, tree, image_name);
+ }
+};
+
+TEST_F(FilterWithGiantCropRect, GL) {
+ RunPixelTestType(
+ PIXEL_TEST_GL,
+ base::FilePath(FILE_PATH_LITERAL("filter_with_giant_crop_rect.png")));
+}
+
+class FilterWithGiantCropRectNoClip : public FilterWithGiantCropRectPixelTest {
+ protected:
+ void RunPixelTestType(PixelTestType test_type, base::FilePath image_name) {
+ scoped_refptr<SolidColorLayer> tree = BuildFilterWithGiantCropRect(false);
+ RunPixelTest(test_type, tree, image_name);
+ }
+};
+
+TEST_F(FilterWithGiantCropRectNoClip, GL) {
+ RunPixelTestType(
+ PIXEL_TEST_GL,
+ base::FilePath(FILE_PATH_LITERAL("filter_with_giant_crop_rect.png")));
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/test/data/filter_with_giant_crop_rect.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698