Index: gm/gradients.cpp |
diff --git a/gm/gradients.cpp b/gm/gradients.cpp |
index 2c7036d3b968189a1fb74157430acbf5dc5e6940..02217c9d6587c8644f51b1c6a94a17cd885e149f 100644 |
--- a/gm/gradients.cpp |
+++ b/gm/gradients.cpp |
@@ -460,4 +460,34 @@ private: |
}; |
DEF_GM( return new RadialGradient3GM; ) |
+class RadialGradient4GM : public GM { |
+ SkAutoTUnref<SkShader> fShader; |
+ |
+protected: |
+ SkString onShortName() override { return SkString("radial_gradient4"); } |
+ |
+ SkISize onISize() override { return SkISize::Make(500, 500); } |
+ |
+ void onOnceBeforeDraw() override { |
+ const SkPoint center = { 250, 250 }; |
+ const SkScalar kRadius = 250; |
+ const SkColor colors[] = { SK_ColorRED, SK_ColorRED, SK_ColorWHITE, SK_ColorWHITE, |
+ SK_ColorRED }; |
+ const SkScalar pos[] = { 0, .4f, .4f, .8f, .8f, 1 }; |
+ fShader.reset(SkGradientShader::CreateRadial(center, kRadius, colors, pos, |
+ SK_ARRAY_COUNT(gColors), SkShader::kClamp_TileMode)); |
+ } |
+ |
+ void onDraw(SkCanvas* canvas) override { |
+ SkPaint paint; |
+ paint.setAntiAlias(true); |
+ paint.setShader(fShader); |
+ canvas->drawRect(SkRect::MakeWH(500, 500), paint); |
+ } |
+ |
+private: |
+ typedef GM INHERITED; |
+}; |
+DEF_GM( return new RadialGradient4GM; ) |
+ |
} |