28#include <initializer_list>
41 paint->setPathEffect(compose);
45 paint->setStrokeWidth(0);
49 paint->setStrokeWidth(0);
54 paint->setStrokeWidth(12);
59 SkScalar inter[] = { 20, 10, 10, 10 };
60 paint->setStrokeWidth(12);
65constexpr int gXY[] = {
664, 0, 0, -4, 8, -4, 12, 0, 8, 4, 0, 4
72 return path.makeTransform(m);
78 for (
unsigned i = 2; i < std::size(
gXY); i += 2) {
94 paint->setPathEffect(
nullptr);
125 paint.setAntiAlias(
true);
137 for (
size_t i = 0; i < std::size(
gPE); i++) {
145 SkRect r = { 0, 0, 250, 120 };
151 for (
size_t i = 0; i < std::size(
gPE2); i++) {
158 for (
size_t i = 0; i < std::size(
gPE); i++) {
160 p.setAntiAlias(
true);
169 using INHERITED =
GM;
172DEF_GM(
return new PathEffectGM; )
188 StrokeLineInflated(
float strokeWidth,
float pxInflate)
189 : fRadius(
strokeWidth / 2.f), fPxInflate(pxInflate) {}
191 bool onNeedsCTM() const final {
return true; }
202 if (!ctm.invert(&invCtm)) {
219 dst->moveTo(pts[0] + n);
220 dst->lineTo(pts[1] + n);
221 dst->lineTo(pts[1] - n);
222 dst->lineTo(pts[0] - n);
239 const float fPxInflate;
255 return dctx ==
nullptr ? DrawResult::kOk : DrawResult::kSkip;
260 const float pxInflate = 0.5f;
264 path.moveTo(100, 100);
265 path.lineTo(200, 200);
269 paint.setAntiAlias(
true);
271 paint.setPathEffect(pathEffect);
275 canvas->
scale(2.5, 0.5f);
281 paint.setPathEffect(
nullptr);
288 canvas->
scale(2.5, 0.5f);
294 using INHERITED =
GM;
static const int strokeWidth
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
constexpr SkColor SK_ColorBLUE
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
constexpr SkColor SK_ColorGREEN
#define SK_FLATTENABLE_HOOKS(type)
sk_sp< T > sk_ref_sp(T *obj)
SkISize getISize() override
DrawResult onGpuSetup(SkCanvas *canvas, SkString *, GraphiteTestContext *) override
SkString getName() const override
void onDraw(SkCanvas *canvas) override
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
void drawIRect(const SkIRect &rect, const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
static sk_sp< SkPathEffect > Make(SkScalar radius)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkPathEffect > Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist=0)
virtual void flatten(SkWriteBuffer &) const
void mapVector(SkScalar dx, SkScalar dy, SkVector *result) const
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
static sk_sp< SkPathEffect > Make(const SkPath &path, SkScalar advance, SkScalar phase, Style)
static sk_sp< SkPathEffect > Make(const SkMatrix &matrix, const SkPath &path)
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & addRect(const SkRect &, SkPathDirection, unsigned startIndex)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & addOval(const SkRect &, SkPathDirection, unsigned startIndex)
SkPathBuilder & offset(SkScalar dx, SkScalar dy)
virtual bool onNeedsCTM() const
virtual bool computeFastBounds(SkRect *bounds) const =0
virtual bool onFilterPath(SkPath *, const SkPath &, SkStrokeRec *, const SkRect *, const SkMatrix &) const =0
static sk_sp< SkPathEffect > MakeCompose(sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
GM(SkColor backgroundColor=SK_ColorWHITE)
void onDraw(SkCanvas *canvas) override
SkString getName() const override
SkISize getISize() override
void(* PE_Proc)(SkPaint *)
static void hair_pe(SkPaint *paint)
static void compose_pe(SkPaint *paint)
static void one_d_pe(SkPaint *paint)
static void dash_pe(SkPaint *paint)
static void hair2_pe(SkPaint *paint)
static sk_sp< SkPathEffect > MakeTileEffect()
static void fill_pe(SkPaint *paint)
static void tile_pe(SkPaint *paint)
static void discrete_pe(SkPaint *paint)
static void stroke_pe(SkPaint *paint)
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
bool setLength(float length)
SkRect makeInset(float dx, float dy) const