blob: 42debb581b3911b9bcbdb6015579b5ce182be920 [file] [log] [blame]
Mike Klein7e68bc92017-05-16 12:03:15 -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 Wagner6a34f3a2019-05-01 10:59:30 -04009#include "include/core/SkCanvas.h"
10#include "include/core/SkColor.h"
11#include "include/core/SkPaint.h"
12#include "include/core/SkPicture.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "include/core/SkPictureRecorder.h"
Ben Wagner6a34f3a2019-05-01 10:59:30 -040014#include "include/core/SkRefCnt.h"
15#include "include/core/SkShader.h"
16#include "include/core/SkTileMode.h"
17#include "include/core/SkTypes.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050018#include "include/effects/SkGradientShader.h"
Mike Klein7e68bc92017-05-16 12:03:15 -040019
20DEF_SIMPLE_GM(bug6643, canvas, 200, 200) {
21 SkColor colors[] = { SK_ColorTRANSPARENT, SK_ColorGREEN, SK_ColorTRANSPARENT };
22
23 SkPaint p;
24 p.setAntiAlias(true);
25 p.setShader(SkGradientShader::MakeSweep(100, 100, colors, nullptr, SK_ARRAY_COUNT(colors),
26 SkGradientShader::kInterpolateColorsInPremul_Flag,
27 nullptr));
28
29 SkPictureRecorder recorder;
30 recorder.beginRecording(200, 200)->drawPaint(p);
31
Mike Reedfae8fce2019-04-03 10:27:45 -040032 p.setShader(recorder.finishRecordingAsPicture()->makeShader(
33 SkTileMode::kRepeat, SkTileMode::kRepeat));
Mike Klein7e68bc92017-05-16 12:03:15 -040034 canvas->drawColor(SK_ColorWHITE);
35 canvas->drawPaint(p);
36}