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

Unified Diff: tests/GradientTest.cpp

Issue 2234663002: Prevent degenerate linear gradient instantiation (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: add a regression test Created 4 years, 4 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 | « src/effects/gradients/SkGradientShader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GradientTest.cpp
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index 7add42d875b93804539f78a42977b081ce9ce2af..3ed2f518cc78fe61212f8befbf131ec6f040d967 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -253,6 +253,22 @@ static void test_clamping_overflow(skiatest::Reporter*) {
// Passes if we don't trigger asserts.
}
+// http://crbug.com/636194
+static void text_degenerate_linear(skiatest::Reporter*) {
+ SkPaint p;
+ const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN };
+ const SkPoint pts[] = {
+ SkPoint::Make(-46058024627067344430605278824628224.0f, 0),
+ SkPoint::Make(SK_ScalarMax, 0)
+ };
+
+ p.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode));
+ sk_sp<SkSurface> surface(SkSurface::MakeRasterN32Premul(50, 50));
+ surface->getCanvas()->drawPaint(p);
+
+ // Passes if we don't trigger asserts.
+}
+
DEF_TEST(Gradient, reporter) {
TestGradientShaders(reporter);
TestConstantGradient(reporter);
@@ -261,4 +277,5 @@ DEF_TEST(Gradient, reporter) {
test_linear_fuzz(reporter);
test_two_point_conical_zero_radius(reporter);
test_clamping_overflow(reporter);
+ text_degenerate_linear(reporter);
}
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698