33#include <initializer_list>
104 for (
auto isAA : {
true,
false }) {
111 int saveCount = canvas->
save();
112 canvas->
concat(localMatrix);
136 name.append(
"_drawPoints");
182 m.preScale(3.0f, 3.0f);
208 m.setSkew(0.3f, 0.5f);
228 for (
int i = 0;
i < fPaints.
size(); ++
i) {
229 int saveCount = canvas->
save();
236 for (
int i = 0;
i < fMatrices.
size(); ++
i) {
237 int saveCount = canvas->
save();
238 draw_row(canvas, fPaints[0], fMatrices[
i], fUseDrawPath);
249 const bool fUseDrawPath;
251 using INHERITED =
GM;
256DEF_GM(
return new StrokedLinesGM(
true);)
257DEF_GM(
return new StrokedLinesGM(
false);)
266 constexpr SkPoint kPts[] {{kRect.fLeft, kRect.fTop}, {kRect.fRight, kRect.fBottom}};
273 paint.setAntiAlias(
true);
276 paint.setShader(std::move(shader));
278 paint.setStrokeCap(cap);
287 paint.setStrokeWidth(0);
288 paint.setShader(
nullptr);
292 paint.setStrokeWidth(3);
307 constexpr float kLengths[] = {
314 auto drawLine = [&](
float x0,
float y0,
float x1,
float y1) {
319 for (
size_t j = 0; j <
std::size(kLengths); ++j) {
320 float l = kLengths[j];
322 drawLine(0.f, 0.f, l, l);
323 drawLine(l, l, 0.f, 0.f);
324 drawLine(l/2, 0, l/2, l);
325 drawLine(0, l/2, l, l/2);
static const int points[]
@ kOuter_SkBlurStyle
nothing inside, fuzzy outside
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
#define SkScalarSin(radians)
#define SkScalarCos(radians)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
uint32_t * getAddr32(int x, int y) const
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void restoreToCount(int saveCount)
void drawPath(const SkPath &path, const SkPaint &paint)
void concat(const SkMatrix &matrix)
@ kPoints_PointMode
draw each point separately
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
static const SkMatrix & I()
@ kButt_Cap
no stroke extension
void setStyle(Style style)
void setAntiAlias(bool aa)
void setStrokeCap(Cap cap)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
int getPoints(SkPoint points[], int max) const
static SkPath Line(const SkPoint a, const SkPoint b)
GM(SkColor backgroundColor=SK_ColorWHITE)
StrokedLinesGM(bool useDrawPath)
void onDraw(SkCanvas *canvas) override
SkString getName() const override
SkISize getISize() override
void onOnceBeforeDraw() override
static float max(float r, float g, float b)
PODArray< SkColor > colors
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr SkPoint kPts[kPtsCount]
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
DEF_SIMPLE_GM(hugebitmapshader, canvas, 100, 100)
static constexpr float kStrokeWidth
static void draw_path(SkCanvas *canvas, const SkRect &r, const SkPaint &p)
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
static const SkPaint::Cap kCaps[]
static void draw_row(SkCanvas *canvas, const SkPaint &paint, const SkMatrix &localMatrix, bool useDrawPath)
static void draw_fins(SkCanvas *canvas, const SkPoint &offset, float angle, const SkPaint &paint, bool useDrawPath)
static void draw_line(SkCanvas *canvas, const SkPoint &p0, const SkPoint &p1, const SkPaint &paint, bool useDrawPath)
constexpr int kNumColumns
constexpr SkScalar kStrokeWidth
static void draw_snowflake(SkCanvas *canvas, const SkPaint &paint, bool useDrawPath)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)