2017-05-16 16:03:15 +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 14:59:30 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkColor.h"
|
|
|
|
#include "include/core/SkPaint.h"
|
|
|
|
#include "include/core/SkPicture.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkPictureRecorder.h"
|
2019-05-01 14:59:30 +00:00
|
|
|
#include "include/core/SkRefCnt.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-16 16:03:15 +00:00
|
|
|
|
|
|
|
DEF_SIMPLE_GM(bug6643, canvas, 200, 200) {
|
|
|
|
SkColor colors[] = { SK_ColorTRANSPARENT, SK_ColorGREEN, SK_ColorTRANSPARENT };
|
|
|
|
|
|
|
|
SkPaint p;
|
|
|
|
p.setAntiAlias(true);
|
|
|
|
p.setShader(SkGradientShader::MakeSweep(100, 100, colors, nullptr, SK_ARRAY_COUNT(colors),
|
|
|
|
SkGradientShader::kInterpolateColorsInPremul_Flag,
|
|
|
|
nullptr));
|
|
|
|
|
|
|
|
SkPictureRecorder recorder;
|
|
|
|
recorder.beginRecording(200, 200)->drawPaint(p);
|
|
|
|
|
2019-04-03 14:27:45 +00:00
|
|
|
p.setShader(recorder.finishRecordingAsPicture()->makeShader(
|
|
|
|
SkTileMode::kRepeat, SkTileMode::kRepeat));
|
2017-05-16 16:03:15 +00:00
|
|
|
canvas->drawColor(SK_ColorWHITE);
|
|
|
|
canvas->drawPaint(p);
|
|
|
|
}
|