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

Unified Diff: gm/gradients.cpp

Issue 1269723002: add radial gradient hard stop test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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; )
+
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698