Index: gm/gradients.cpp |
diff --git a/gm/gradients.cpp b/gm/gradients.cpp |
index 45b6564a64e0ff71ba55af08acfbf047d70a32fe..8ae1dd7901e45cd6044ca2968b7b8cb8cba324c9 100644 |
--- a/gm/gradients.cpp |
+++ b/gm/gradients.cpp |
@@ -919,3 +919,20 @@ DEF_SIMPLE_GM(gradient_many_stops, canvas, 500, 500) { |
DEF_SIMPLE_GM(gradient_many_stops_4f, canvas, 500, 500) { |
draw_many_stops(canvas, SkLinearGradient::kForce4fContext_PrivateFlag); |
} |
+ |
+static void draw_subpixel_gradient(SkCanvas* canvas, uint32_t flags) { |
+ const SkPoint pts[] = { {50, 50}, {50.1f, 50.1f}}; |
+ SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
+ SkPaint p; |
+ p.setShader(SkGradientShader::MakeLinear( |
+ pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kRepeat_TileMode, flags, nullptr)); |
+ canvas->drawRect(SkRect::MakeXYWH(0, 0, 500, 500), p); |
+} |
+ |
+DEF_SIMPLE_GM(gradient_subpixel, canvas, 500, 500) { |
+ draw_subpixel_gradient(canvas, 0); |
+} |
+ |
+DEF_SIMPLE_GM(gradient_subpixel_4f, canvas, 500, 500) { |
+ draw_subpixel_gradient(canvas, SkLinearGradient::kForce4fContext_PrivateFlag); |
+} |