2017-05-15 19:55:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "gm/gm.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkColor.h"
|
|
|
|
#include "include/core/SkPaint.h"
|
|
|
|
#include "include/core/SkPoint.h"
|
|
|
|
#include "include/core/SkScalar.h"
|
|
|
|
#include "include/core/SkShader.h"
|
|
|
|
#include "include/core/SkTileMode.h"
|
|
|
|
#include "include/core/SkTypes.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/effects/SkGradientShader.h"
|
2017-05-15 19:55:54 +00:00
|
|
|
|
|
|
|
// All we're looking for here is that we see a smooth gradient.
|
|
|
|
DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200) {
|
2019-03-13 20:49:23 +00:00
|
|
|
SkPoint center = {1000, 1000};
|
2017-05-15 19:55:54 +00:00
|
|
|
SkScalar radius = 40;
|
2019-03-13 20:49:23 +00:00
|
|
|
SkColor colors[] = {SK_ColorBLACK, SK_ColorGREEN};
|
2017-05-15 19:55:54 +00:00
|
|
|
|
|
|
|
SkPaint p;
|
|
|
|
p.setShader(SkGradientShader::MakeRadial(center, radius,
|
|
|
|
colors, nullptr, SK_ARRAY_COUNT(colors),
|
2019-04-03 14:27:45 +00:00
|
|
|
SkTileMode::kRepeat));
|
2017-05-15 19:55:54 +00:00
|
|
|
canvas->drawPaint(p);
|
|
|
|
}
|