| 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/SkGradient.h" |
| 18 |
|
| 19 |
// All we're looking for here is that we see a smooth gradient. |
| 20 |
DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200) { |
| 21 |
SkPoint center = {1000, 1000}; |
| 22 |
SkScalar radius = 40; |
| 23 |
SkColor4f colors[] = {SkColors::kBlack, SkColors::kGreen}; |
| 24 |
|
| 25 |
SkPaint p; |
| 26 |
p.setShader(SkShaders::RadialGradient(center, radius, {{colors, {}, SkTileMode::kRepeat}, {}})); |
| 27 |
canvas->drawPaint(p); |
| 28 |
} |