26 NestedGM(
bool doAA,
bool flipped) : fDoAA(doAA), fFlipped(flipped) {
34 name.append(
"_flipY");
56 b->addRect(rect, dir);
65 b->addOval(rect, dir);
88 for (
int y = 0;
y < kImageHeight;
y += 10) {
89 for (
int x = 0;
x < kImageWidth;
x += 10) {
94 p.setColor(rand.
nextU() | 0xFF000000);
100 for (
int outerShape = 0; outerShape <
kShapeCount; ++outerShape) {
101 for (
int innerShape = 0; innerShape <
kShapeCount; ++innerShape) {
102 for (
size_t innerRect = 0; innerRect < std::size(innerRects); ++innerRect) {
111 canvas->
scale(1.0f, -1.0f);
117 canvas->
drawPath(builder.detach(), shapePaint);
131 inline static constexpr int kImageWidth = 269;
132 inline static constexpr int kImageHeight = 134;
137 using INHERITED =
GM;
142DEF_GM(
return new NestedGM(
true,
false); )
143DEF_GM(
return new NestedGM(
false,
false); )
144DEF_GM(
return new NestedGM(
true,
true); )
145DEF_GM(
return new NestedGM(
false,
true); )
150 auto drawEllipses = [&]() {
161 canvas->scale(16.f / 24.f, 16.f / 24.f);
165 paint.setAntiAlias(
true);
170 canvas->translate(10.f, 0.f);
172 canvas->translate(10.f, 0.f);
179 canvas->translate(0.5f, 16.f);
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorBLACK
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
void setColor(SkColor color)
void setAntiAlias(bool aa)
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
NestedGM(bool doAA, bool flipped)
static void AddShape(SkPathBuilder *b, const SkRect &rect, Shapes shape, SkPathDirection dir)
SkString getName() const override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)