Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
complexclip.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
13#include "include/core/SkFont.h"
18#include "include/core/SkRect.h"
20#include "include/core/SkSize.h"
25#include "tools/DecodeUtils.h"
26#include "tools/Resources.h"
27#include "tools/ToolUtils.h"
29
30#include <string.h>
31
32namespace skiagm {
33
37
38class ComplexClipGM : public GM {
39public:
40 ComplexClipGM(bool aaclip, bool saveLayer, bool invertDraw)
41 : fDoAAClip(aaclip)
42 , fDoSaveLayer(saveLayer)
43 , fInvertDraw(invertDraw) {
44 this->setBGColor(0xFFDEDFDE);
45 }
46
47protected:
48 SkString getName() const override {
49 SkString str;
50 str.printf("complexclip_%s%s%s",
51 fDoAAClip ? "aa" : "bw",
52 fDoSaveLayer ? "_layer" : "",
53 fInvertDraw ? "_invert" : "");
54 return str;
55 }
56
57 SkISize getISize() override { return SkISize::Make(388, 780); }
58
59 void onDraw(SkCanvas* canvas) override {
60 SkPath path = SkPathBuilder()
61 .moveTo(0, 50)
62 .quadTo(0, 0, 50, 0)
63 .lineTo(175, 0)
64 .quadTo(200, 0, 200, 25)
65 .lineTo(200, 150)
66 .quadTo(200, 200, 150, 200)
67 .lineTo(0, 200)
68 .close()
69 .moveTo(50, 50)
70 .lineTo(150, 50)
71 .lineTo(150, 125)
72 .quadTo(150, 150, 125, 150)
73 .lineTo(50, 150)
74 .close()
75 .detach();
76 if (fInvertDraw) {
77 path.setFillType(SkPathFillType::kInverseEvenOdd);
78 } else {
79 path.setFillType(SkPathFillType::kEvenOdd);
80 }
81 SkPaint pathPaint;
82 pathPaint.setAntiAlias(true);
83 pathPaint.setColor(gPathColor);
84
85 SkPath clipA = SkPath::Polygon({{10, 20}, {165, 22}, {70, 105}, {165, 177}, {-5, 180}}, true);
86
87 SkPath clipB = SkPath::Polygon({{40, 10}, {190, 15}, {195, 190}, {40, 185}, {155, 100}}, true);
88
90
91 constexpr struct {
92 SkClipOp fOp;
93 const char* fName;
94 } gOps[] = { //extra spaces in names for measureText
95 {SkClipOp::kIntersect, "Isect "},
96 {SkClipOp::kDifference, "Diff " },
97 };
98
99 canvas->translate(20, 20);
100 canvas->scale(3 * SK_Scalar1 / 4, 3 * SK_Scalar1 / 4);
101
102 if (fDoSaveLayer) {
103 // We want the layer to appear symmetric relative to actual
104 // device boundaries so we need to "undo" the effect of the
105 // scale and translate
106 SkRect bounds = SkRect::MakeLTRB(
107 4.0f/3.0f * -20,
108 4.0f/3.0f * -20,
109 4.0f/3.0f * (this->getISize().fWidth - 20),
110 4.0f/3.0f * (this->getISize().fHeight - 20));
111
112 bounds.inset(100, 100);
113 SkPaint boundPaint;
114 boundPaint.setColor(SK_ColorRED);
116 canvas->drawRect(bounds, boundPaint);
117 canvas->clipRect(bounds);
118 canvas->saveLayer(&bounds, nullptr);
119 }
120
121 for (int invBits = 0; invBits < 4; ++invBits) {
122 canvas->save();
123 for (size_t op = 0; op < std::size(gOps); ++op) {
124 this->drawHairlines(canvas, path, clipA, clipB);
125
126 bool doInvA = SkToBool(invBits & 1);
127 bool doInvB = SkToBool(invBits & 2);
128 canvas->save();
129 // set clip
132 clipB.setFillType(doInvB ? SkPathFillType::kInverseEvenOdd :
134 canvas->clipPath(clipA, fDoAAClip);
135 canvas->clipPath(clipB, gOps[op].fOp, fDoAAClip);
136
137 // In the inverse case we need to prevent the draw from covering the whole
138 // canvas.
139 if (fInvertDraw) {
140 SkRect rectClip = clipA.getBounds();
141 rectClip.join(path.getBounds());
142 rectClip.join(path.getBounds());
143 rectClip.outset(5, 5);
144 canvas->clipRect(rectClip);
145 }
146
147 // draw path clipped
148 canvas->drawPath(path, pathPaint);
149 canvas->restore();
150
151
153 SkScalar txtX = 45;
154 paint.setColor(gClipAColor);
155 const char* aTxt = doInvA ? "InvA " : "A ";
156 canvas->drawSimpleText(aTxt, strlen(aTxt), SkTextEncoding::kUTF8, txtX, 220, font, paint);
157 txtX += font.measureText(aTxt, strlen(aTxt), SkTextEncoding::kUTF8);
158 paint.setColor(SK_ColorBLACK);
159 canvas->drawSimpleText(gOps[op].fName, strlen(gOps[op].fName), SkTextEncoding::kUTF8, txtX, 220,
160 font, paint);
161 txtX += font.measureText(gOps[op].fName, strlen(gOps[op].fName), SkTextEncoding::kUTF8);
162 paint.setColor(gClipBColor);
163 const char* bTxt = doInvB ? "InvB " : "B ";
164 canvas->drawSimpleText(bTxt, strlen(bTxt), SkTextEncoding::kUTF8, txtX, 220, font, paint);
165
166 canvas->translate(250,0);
167 }
168 canvas->restore();
169 canvas->translate(0, 250);
170 }
171
172 if (fDoSaveLayer) {
173 canvas->restore();
174 }
175 }
176private:
177 void drawHairlines(SkCanvas* canvas, const SkPath& path,
178 const SkPath& clipA, const SkPath& clipB) {
180 paint.setAntiAlias(true);
182 const SkAlpha fade = 0x33;
183
184 // draw path in hairline
185 paint.setColor(gPathColor); paint.setAlpha(fade);
186 canvas->drawPath(path, paint);
187
188 // draw clips in hair line
189 paint.setColor(gClipAColor); paint.setAlpha(fade);
190 canvas->drawPath(clipA, paint);
191 paint.setColor(gClipBColor); paint.setAlpha(fade);
192 canvas->drawPath(clipB, paint);
193 }
194
195 bool fDoAAClip;
196 bool fDoSaveLayer;
197 bool fInvertDraw;
198
199 using INHERITED = GM;
200};
201
202//////////////////////////////////////////////////////////////////////////////
203
204DEF_GM(return new ComplexClipGM(false, false, false);)
205DEF_GM(return new ComplexClipGM(false, false, true);)
206DEF_GM(return new ComplexClipGM(false, true, false);)
207DEF_GM(return new ComplexClipGM(false, true, true);)
208DEF_GM(return new ComplexClipGM(true, false, false);)
209DEF_GM(return new ComplexClipGM(true, false, true);)
210DEF_GM(return new ComplexClipGM(true, true, false);)
211DEF_GM(return new ComplexClipGM(true, true, true);)
212} // namespace skiagm
213
214DEF_SIMPLE_GM(clip_shader, canvas, 840, 650) {
215 auto img = ToolUtils::GetResourceAsImage("images/yellow_rose.png");
216 auto sh = img->makeShader(SkSamplingOptions());
217
218 SkRect r = SkRect::MakeIWH(img->width(), img->height());
219 SkPaint p;
220
221 canvas->translate(10, 10);
222 canvas->drawImage(img, 0, 0);
223
224 canvas->save();
225 canvas->translate(img->width() + 10, 0);
226 canvas->clipShader(sh, SkClipOp::kIntersect);
227 p.setColor(SK_ColorRED);
228 canvas->drawRect(r, p);
229 canvas->restore();
230
231 canvas->save();
232 canvas->translate(0, img->height() + 10);
234 p.setColor(SK_ColorGREEN);
235 canvas->drawRect(r, p);
236 canvas->restore();
237
238 canvas->save();
239 canvas->translate(img->width() + 10, img->height() + 10);
240 canvas->clipShader(sh, SkClipOp::kIntersect);
241 canvas->save();
242 SkMatrix lm = SkMatrix::Scale(1.0f/5, 1.0f/5);
243 canvas->clipShader(img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
244 SkSamplingOptions(), lm));
245 canvas->drawImage(img, 0, 0);
246
247 canvas->restore();
248 canvas->restore();
249}
250
251DEF_SIMPLE_GM(clip_shader_layer, canvas, 430, 320) {
252 auto img = ToolUtils::GetResourceAsImage("images/yellow_rose.png");
253 auto sh = img->makeShader(SkSamplingOptions());
254
255 SkRect r = SkRect::MakeIWH(img->width(), img->height());
256
257 canvas->translate(10, 10);
258 // now add the cool clip
259 canvas->clipRect(r);
260 canvas->clipShader(sh);
261 // now draw a layer with the same image, and watch it get restored w/ the clip
262 canvas->saveLayer(&r, nullptr);
263 canvas->drawColor(0xFFFF0000);
264 canvas->restore();
265}
266
267DEF_SIMPLE_GM(clip_shader_nested, canvas, 256, 256) {
268 float w = 64.f;
269 float h = 64.f;
270
271 const SkColor gradColors[] = {SK_ColorBLACK, SkColorSetARGB(128, 128, 128, 128)};
272 auto s = SkGradientShader::MakeRadial({0.5f * w, 0.5f * h}, 0.1f * w, gradColors, nullptr,
273 2, SkTileMode::kRepeat, 0, nullptr);
274
275 SkPaint p;
276
277 // A large black rect affected by two gradient clips
278 canvas->save();
279 canvas->clipShader(s);
280 canvas->scale(2.f, 2.f);
281 canvas->clipShader(s);
282 canvas->drawRect(SkRect::MakeWH(w, h), p);
283 canvas->restore();
284
285 canvas->translate(0.f, 2.f * h);
286
287 // A small red rect, with no clipping
288 canvas->save();
289 p.setColor(SK_ColorRED);
290 canvas->drawRect(SkRect::MakeWH(w, h), p);
291 canvas->restore();
292}
293
294namespace {
295
296// Where is canvas->concat(persp) called relative to the clipShader calls.
297enum ConcatPerspective {
298 kConcatBeforeClips,
299 kConcatAfterClips,
300 kConcatBetweenClips
301};
302// Order in which clipShader(image) and clipShader(gradient) are specified; only meaningful
303// when CanvasPerspective is kConcatBetweenClips.
304enum ClipOrder {
305 kClipImageFirst,
306 kClipGradientFirst,
307
308 kDoesntMatter = kClipImageFirst
309};
310// Which shaders have perspective applied as a local matrix.
311enum LocalMatrix {
312 kNoLocalMat,
313 kImageWithLocalMat,
314 kGradientWithLocalMat,
315 kBothWithLocalMat
316};
317struct Config {
318 ConcatPerspective fConcat;
319 ClipOrder fOrder;
320 LocalMatrix fLM;
321};
322
323static void draw_banner(SkCanvas* canvas, Config config) {
324 SkString banner;
325 banner.append("Persp: ");
326
327 if (config.fConcat == kConcatBeforeClips || config.fLM == kBothWithLocalMat) {
328 banner.append("Both Clips");
329 } else {
330 SkASSERT((config.fConcat == kConcatBetweenClips && config.fLM == kNoLocalMat) ||
331 (config.fConcat == kConcatAfterClips && (config.fLM == kImageWithLocalMat ||
332 config.fLM == kGradientWithLocalMat)));
333 if ((config.fConcat == kConcatBetweenClips && config.fOrder == kClipImageFirst) ||
334 config.fLM == kGradientWithLocalMat) {
335 banner.append("Gradient");
336 } else {
337 SkASSERT(config.fOrder == kClipGradientFirst || config.fLM == kImageWithLocalMat);
338 banner.append("Image");
339 }
340 }
341 if (config.fLM != kNoLocalMat) {
342 banner.append(" (w/ LM, should equal top row)");
343 }
344
346 canvas->drawString(banner.c_str(), 20.f, -30.f, kFont, SkPaint());
347};
348
349} // namespace
350
351DEF_SIMPLE_GM(clip_shader_persp, canvas, 1370, 1030) {
352 // Each draw has a clipShader(image-shader), a clipShader(gradient-shader), a concat(persp-mat),
353 // and each shader may or may not be wrapped with a perspective local matrix.
354
355 // Pairs of configs that should match in appearance where first config doesn't use a local
356 // matrix (top row of GM) and the second does (bottom row of GM).
357 Config matches[][2] = {
358 // Everything has perspective
359 {{kConcatBeforeClips, kDoesntMatter, kNoLocalMat},
360 {kConcatAfterClips, kDoesntMatter, kBothWithLocalMat}},
361 // Image shader has perspective
362 {{kConcatBetweenClips, kClipGradientFirst, kNoLocalMat},
363 {kConcatAfterClips, kDoesntMatter, kImageWithLocalMat}},
364 // Gradient shader has perspective
365 {{kConcatBetweenClips, kClipImageFirst, kNoLocalMat},
366 {kConcatAfterClips, kDoesntMatter, kGradientWithLocalMat}}
367 };
368
369 // The image that is drawn
370 auto img = ToolUtils::GetResourceAsImage("images/yellow_rose.png");
371 // Scale factor always applied to the image shader so that it tiles
372 SkMatrix scale = SkMatrix::Scale(1.f / 4.f, 1.f / 4.f);
373 // The perspective matrix applied wherever needed
374 SkPoint src[4];
375 SkRect::Make(img->dimensions()).toQuad(src);
376 SkPoint dst[4] = {{0, 80.f},
377 {img->width() + 28.f, -100.f},
378 {img->width() - 28.f, img->height() + 100.f},
379 {0.f, img->height() - 80.f}};
380 SkMatrix persp;
381 SkAssertResult(persp.setPolyToPoly(src, dst, 4));
382
383 SkMatrix perspScale = SkMatrix::Concat(persp, scale);
384
385 auto drawConfig = [&](Config config) {
386 canvas->save();
387
388 draw_banner(canvas, config);
389
390 // Make clipShaders (possibly with local matrices)
391 bool gradLM = config.fLM == kGradientWithLocalMat || config.fLM == kBothWithLocalMat;
392 const SkColor gradColors[] = {SK_ColorBLACK, SkColorSetARGB(128, 128, 128, 128)};
393 auto gradShader = SkGradientShader::MakeRadial({0.5f * img->width(), 0.5f * img->height()},
394 0.1f * img->width(), gradColors, nullptr, 2,
396 gradLM ? &persp : nullptr);
397 bool imageLM = config.fLM == kImageWithLocalMat || config.fLM == kBothWithLocalMat;
398 auto imgShader = img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
399 SkSamplingOptions(), imageLM ? perspScale : scale);
400
401 // Perspective before any clipShader
402 if (config.fConcat == kConcatBeforeClips) {
403 canvas->concat(persp);
404 }
405
406 // First clipshader
407 canvas->clipShader(config.fOrder == kClipImageFirst ? imgShader : gradShader);
408
409 // Perspective between clipShader
410 if (config.fConcat == kConcatBetweenClips) {
411 canvas->concat(persp);
412 }
413
414 // Second clipShader
415 canvas->clipShader(config.fOrder == kClipImageFirst ? gradShader : imgShader);
416
417 // Perspective after clipShader
418 if (config.fConcat == kConcatAfterClips) {
419 canvas->concat(persp);
420 }
421
422 // Actual draw and clip boundary are the same for all configs
423 canvas->clipIRect(img->bounds());
424 canvas->clear(SK_ColorBLACK);
425 canvas->drawImage(img, 0, 0);
426
427 canvas->restore();
428 };
429
430 SkIRect grid = persp.mapRect(SkRect::Make(img->dimensions())).roundOut();
431 grid.fLeft -= 20; // manual adjust to look nicer
432
433 canvas->translate(10.f, 10.f);
434
435 for (size_t i = 0; i < std::size(matches); ++i) {
436 canvas->save();
437 canvas->translate(-grid.fLeft, -grid.fTop);
438 drawConfig(matches[i][0]);
439 canvas->translate(0.f, grid.height());
440 drawConfig(matches[i][1]);
441 canvas->restore();
442
443 canvas->translate(grid.width(), 0.f);
444 }
445}
446
447DEF_SIMPLE_GM(clip_shader_difference, canvas, 512, 512) {
448 auto image = ToolUtils::GetResourceAsImage("images/yellow_rose.png");
449 canvas->clear(SK_ColorGRAY);
450
451 SkRect rect = SkRect::MakeWH(256, 256);
453 SkRect::MakeWH(64, 64));
455 SkSamplingOptions(), &local);
456
458 paint.setColor(SK_ColorRED);
459 paint.setAntiAlias(true);
460
461 // TL: A rectangle
462 {
463 canvas->save();
464 canvas->translate(0, 0);
465 canvas->clipShader(shader, SkClipOp::kDifference);
466 canvas->drawRect(rect, paint);
467 canvas->restore();
468 }
469 // TR: A round rectangle
470 {
471 canvas->save();
472 canvas->translate(256, 0);
473 canvas->clipShader(shader, SkClipOp::kDifference);
474 canvas->drawRRect(SkRRect::MakeRectXY(rect, 64.f, 64.f), paint);
475 canvas->restore();
476 }
477 // BL: A path
478 {
479 canvas->save();
480 canvas->translate(0, 256);
481 canvas->clipShader(shader, SkClipOp::kDifference);
482
483 SkPath path;
484 path.moveTo(0.f, 128.f);
485 path.lineTo(128.f, 256.f);
486 path.lineTo(256.f, 128.f);
487 path.lineTo(128.f, 0.f);
488
489 SkScalar d = 64.f * SK_ScalarSqrt2;
490 path.moveTo(128.f - d, 128.f - d);
491 path.lineTo(128.f - d, 128.f + d);
492 path.lineTo(128.f + d, 128.f + d);
493 path.lineTo(128.f + d, 128.f - d);
494 canvas->drawPath(path, paint);
495 canvas->restore();
496 }
497 // BR: Text
498 {
499 canvas->save();
500 canvas->translate(256, 256);
501 canvas->clipShader(shader, SkClipOp::kDifference);
503 for (int y = 0; y < 4; ++y) {
504 canvas->drawString("Hello", 32.f, y * 64.f, font, paint);
505 }
506 canvas->restore();
507 }
508}
#define SkAssertResult(cond)
Definition SkAssert.h:123
#define SkASSERT(cond)
Definition SkAssert.h:116
SkClipOp
Definition SkClipOp.h:13
uint32_t SkColor
Definition SkColor.h:37
uint8_t SkAlpha
Definition SkColor.h:26
constexpr SkColor SK_ColorGRAY
Definition SkColor.h:113
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition SkColor.h:49
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
@ kUTF8
uses bytes to represent UTF-8 or ASCII
#define SK_Scalar1
Definition SkScalar.h:18
#define SK_ScalarSqrt2
Definition SkScalar.h:20
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition SkCanvas.cpp:500
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void restore()
Definition SkCanvas.cpp:465
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void clipIRect(const SkIRect &irect, SkClipOp op=SkClipOp::kIntersect)
Definition SkCanvas.h:991
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition SkCanvas.h:1182
void clear(SkColor color)
Definition SkCanvas.h:1199
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
int save()
Definition SkCanvas.cpp:451
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
void concat(const SkMatrix &matrix)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition SkCanvas.h:1803
void clipShader(sk_sp< SkShader >, SkClipOp=SkClipOp::kIntersect)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
static sk_sp< SkShader > MakeRadial(const SkPoint &center, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
int width() const
Definition SkImage.h:285
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition SkImage.cpp:179
int height() const
Definition SkImage.h:291
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition SkMatrix.h:75
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
Definition SkMatrix.h:157
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
Definition SkMatrix.h:1775
bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
void setStyle(Style style)
Definition SkPaint.cpp:105
void setColor(SkColor color)
Definition SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
SkPathBuilder & close()
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & quadTo(SkPoint pt1, SkPoint pt2)
void setFillType(SkPathFillType ft)
Definition SkPath.h:235
const SkRect & getBounds() const
Definition SkPath.cpp:420
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition SkPath.cpp:3546
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition SkRRect.h:180
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:534
void append(const char text[])
Definition SkString.h:203
const char * c_str() const
Definition SkString.h:133
void onDraw(SkCanvas *canvas) override
SkISize getISize() override
SkString getName() const override
ComplexClipGM(bool aaclip, bool saveLayer, bool invertDraw)
void setBGColor(SkColor)
Definition gm.cpp:159
const Paint & paint
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
sk_sp< SkImage > image
Definition examples.cpp:29
float SkScalar
Definition extension.cpp:12
struct MyStruct s
#define DEF_GM(CODE)
Definition gm.h:40
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50
double y
sk_sp< SkTypeface > DefaultPortableTypeface()
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition DecodeUtils.h:25
constexpr SkColor gPathColor
const char * fName
constexpr SkColor gClipBColor
constexpr SkColor gClipAColor
SkScalar w
SkScalar h
const Scalar scale
constexpr int32_t height() const
Definition SkRect.h:165
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34
constexpr int32_t width() const
Definition SkRect.h:158
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20
static SkRect Make(const SkISize &size)
Definition SkRect.h:669
void toQuad(SkPoint quad[4]) const
Definition SkRect.cpp:50
static SkRect MakeIWH(int w, int h)
Definition SkRect.h:623
void outset(float dx, float dy)
Definition SkRect.h:1077
void join(const SkRect &r)
Definition SkRect.cpp:126
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646