blob: 2904901ed9a6579583d6ef2b07d42325dc2186f8 [file] [log] [blame] [edit]
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPicture.h"
#include "include/core/SkPictureRecorder.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkShader.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradient.h"
DEF_SIMPLE_GM(bug6643, canvas, 200, 200) {
const SkColor4f colors[] = {
SkColors::kTransparent, SkColors::kGreen, SkColors::kTransparent
};
SkPaint p;
p.setAntiAlias(true);
p.setShader(SkShaders::SweepGradient({100, 100},
{{colors, {}, SkTileMode::kClamp},
{SkGradient::Interpolation::InPremul::kYes}}));
SkPictureRecorder recorder;
recorder.beginRecording(200, 200)->drawPaint(p);
p.setShader(recorder.finishRecordingAsPicture()->makeShader(
SkTileMode::kRepeat, SkTileMode::kRepeat,
SkFilterMode::kNearest, nullptr, nullptr));
canvas->drawColor(SK_ColorWHITE);
canvas->drawPaint(p);
}