1 /*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm/gm.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkColor.h"
11 #include "include/core/SkPaint.h"
12 #include "include/core/SkPoint.h"
13 #include "include/core/SkScalar.h"
14 #include "include/core/SkShader.h"
15 #include "include/core/SkTileMode.h"
16 #include "include/core/SkTypes.h"
17 #include "include/effects/SkGradientShader.h"
18
19 // All we're looking for here is that we see a smooth gradient.
DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200)20 DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200) {
21 SkPoint center = {1000, 1000};
22 SkScalar radius = 40;
23 SkColor colors[] = {SK_ColorBLACK, SK_ColorGREEN};
24
25 SkPaint p;
26 p.setShader(SkGradientShader::MakeRadial(center, radius,
27 colors, nullptr, SK_ARRAY_COUNT(colors),
28 SkTileMode::kRepeat));
29 canvas->drawPaint(p);
30 }
31