blob: 8835fa59c4ef24d959a0e2747ba96e3e0147fa77 [file] [log] [blame]
Mike Kleinfd35c742017-05-15 15:55:54 -04001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -04009#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"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050017#include "include/effects/SkGradientShader.h"
Mike Kleinfd35c742017-05-15 15:55:54 -040018
19// All we're looking for here is that we see a smooth gradient.
20DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200) {
Mike Klein1b258182019-03-13 15:49:23 -050021 SkPoint center = {1000, 1000};
Mike Kleinfd35c742017-05-15 15:55:54 -040022 SkScalar radius = 40;
Mike Klein1b258182019-03-13 15:49:23 -050023 SkColor colors[] = {SK_ColorBLACK, SK_ColorGREEN};
Mike Kleinfd35c742017-05-15 15:55:54 -040024
25 SkPaint p;
26 p.setShader(SkGradientShader::MakeRadial(center, radius,
27 colors, nullptr, SK_ARRAY_COUNT(colors),
Mike Reedfae8fce2019-04-03 10:27:45 -040028 SkTileMode::kRepeat));
Mike Kleinfd35c742017-05-15 15:55:54 -040029 canvas->drawPaint(p);
30}