44 for (
int i = 0; i < 8; ++i) {
47 this->drawVertRects(canvas, white);
50 this->drawVertRects(canvas, green);
54 canvas->
translate(80.0f, i*40.0f + i*0.125f);
55 this->drawHorizRects(canvas, white);
58 this->drawHorizRects(canvas, green);
64 this->drawSquares(canvas, white);
67 this->drawSquares(canvas, green);
74 constexpr SkRect vertRects[] = {
79 { 21, 1, 21.25f, 21 },
80 { 25, 1, 25.125f, 21 },
84 static constexpr SkVector radii[4] = {{1/32.f, 2/32.f}, {3/32.f, 1/32.f}, {2/32.f, 3/32.f},
87 for (
size_t j = 0; j < std::size(vertRects); ++j) {
98 constexpr SkRect horizRects[] = {
101 { 1, 13, 21, 14.0f },
102 { 1, 17, 21, 17.5f },
103 { 1, 21, 21, 21.25f },
104 { 1, 25, 21, 25.125f },
109 for (
size_t j = 0; j < std::size(horizRects); ++j) {
120 constexpr SkRect squares[] = {
121 { 1, 1, 5.0f, 5.0f },
122 { 8, 8, 10.0f, 10.0f },
123 { 13, 13, 14.0f, 14.0f },
124 { 17, 17, 17.5f, 17.5f },
125 { 21, 21, 21.25f, 21.25f },
126 { 25, 25, 25.125f, 25.125f },
127 { 29, 29, 29.0f, 29.0f }
131 for (
size_t j = 0; j < std::size(squares); ++j) {
143 using INHERITED =
GM;
148DEF_GM(
return new ThinRectsGM(
false); )
149DEF_GM(
return new ThinRectsGM(
true); )
156 errorMsg->printf(
"makeSurface not supported");
163 p.setAntiAlias(
true);
165 zoomedCanvas->save();
168 zoomedCanvas->restore();
172 auto img = zoomed->makeImageSnapshot();
static void round(SkPoint *p)
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
sk_sp< SkSurface > makeSurface(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
SkImageInfo imageInfo() const
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kFill_Style
set to fill geometry
void setRectRadii(const SkRect &rect, const SkVector radii[4])
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
void setNinePatch(const SkRect &rect, SkScalar leftRad, SkScalar topRad, SkScalar rightRad, SkScalar bottomRad)
GM(SkColor backgroundColor=SK_ColorWHITE)
void onDraw(SkCanvas *canvas) override
SkISize getISize() override
SkString getName() const override
#define DEF_SIMPLE_GM_CAN_FAIL(NAME, CANVAS, ERR_MSG, W, H)
static constexpr SkISize Make(int32_t w, int32_t h)
SkImageInfo makeWH(int newWidth, int newHeight) const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)