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

Unified Diff: cc/trees/layer_tree_host_pixeltest_filters.cc

Issue 1952303002: cc: fix nullptr deref in software renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing test file Created 4 years, 7 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/white.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 a89cae83d1db80a8b9696d999eb793c4322f2916..bfa8f81d312a4fe7c9c5a1980c838ce31f57d703 100644
--- a/cc/trees/layer_tree_host_pixeltest_filters.cc
+++ b/cc/trees/layer_tree_host_pixeltest_filters.cc
@@ -251,6 +251,37 @@ TEST_F(LayerTreeHostNullFilterPixelTest, Software) {
RunPixelTestType(PIXEL_TEST_SOFTWARE);
}
+class LayerTreeHostCroppedFilterPixelTest
+ : public LayerTreeHostFiltersPixelTest {
+ void InitializeSettings(LayerTreeSettings* settings) override {}
+
+ protected:
+ void RunPixelTestType(PixelTestType test_type) {
+ scoped_refptr<SolidColorLayer> foreground =
+ CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorGREEN);
+
+ // Check that a filter with a zero-height crop rect crops out its
+ // result completely.
+ FilterOperations filters;
+ SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(0, 0, 100, 0));
+ sk_sp<SkImageFilter> offset(
+ SkOffsetImageFilter::Make(0, 0, nullptr, &cropRect));
+ filters.Append(FilterOperation::CreateReferenceFilter(offset));
+ foreground->SetFilters(filters);
+
+ RunPixelTest(test_type, foreground,
+ base::FilePath(FILE_PATH_LITERAL("white.png")));
+ }
+};
+
+TEST_F(LayerTreeHostCroppedFilterPixelTest, GL) {
+ RunPixelTestType(PIXEL_TEST_GL);
+}
+
+TEST_F(LayerTreeHostCroppedFilterPixelTest, Software) {
+ RunPixelTestType(PIXEL_TEST_SOFTWARE);
+}
+
class ImageFilterClippedPixelTest : public LayerTreeHostFiltersPixelTest {
protected:
void RunPixelTestType(PixelTestType test_type) {
« no previous file with comments | « cc/test/data/white.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698