Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
bug6643.cpp
Go to the documentation of this file.
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"
19
20DEF_SIMPLE_GM(bug6643, canvas, 200, 200) {
22
23 SkPaint p;
24 p.setAntiAlias(true);
25 p.setShader(SkGradientShader::MakeSweep(100, 100, colors, nullptr, std::size(colors),
27 nullptr));
28
29 SkPictureRecorder recorder;
30 recorder.beginRecording(200, 200)->drawPaint(p);
31
32 p.setShader(recorder.finishRecordingAsPicture()->makeShader(
34 SkFilterMode::kNearest, nullptr, nullptr));
35 canvas->drawColor(SK_ColorWHITE);
36 canvas->drawPaint(p);
37}
uint32_t SkColor
Definition SkColor.h:37
constexpr SkColor SK_ColorTRANSPARENT
Definition SkColor.h:99
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
void drawPaint(const SkPaint &paint)
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50