diff options
author | Cary Clark <caryclark@skia.org> | 2018-10-31 12:14:03 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-10-31 16:45:32 +0000 |
commit | 09d80c033724e5324f499423f1fe783d56197662 (patch) | |
tree | 8bcbbd2dfa661990af315de49c52b9ea699fed32 /docs/SkRegion_Reference.bmh | |
parent | 96ea3401828c2338b52ec7ee5f4580e8455594c0 (diff) | |
download | platform_external_skqp-09d80c033724e5324f499423f1fe783d56197662.tar.gz platform_external_skqp-09d80c033724e5324f499423f1fe783d56197662.tar.bz2 platform_external_skqp-09d80c033724e5324f499423f1fe783d56197662.zip |
docs with more pop
Replace a hunk of documentation in docs/*.bmh
with #Populate, which instructs bookmaker to
retrieve the documentation from include/core.
Check spelling for all documentation retrieved
from include/core against Skia declarations
and a list of words in spelling.txt.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=163491
Bug: skia:
Change-Id: If057c3a1336e312ad59c084a3a130f0276802496
Reviewed-on: https://skia-review.googlesource.com/c/163491
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'docs/SkRegion_Reference.bmh')
-rw-r--r-- | docs/SkRegion_Reference.bmh | 1412 |
1 files changed, 537 insertions, 875 deletions
diff --git a/docs/SkRegion_Reference.bmh b/docs/SkRegion_Reference.bmh index 6158cfad36..7e72f6ae2f 100644 --- a/docs/SkRegion_Reference.bmh +++ b/docs/SkRegion_Reference.bmh @@ -56,19 +56,16 @@ up Region. #Method Iterator() #Line # constructs Region iterator ## -Initializes Iterator with an empty Region. done() on Iterator returns true. -Call reset() to initialized Iterator at a later time. - -#Return empty Region ierator ## +#Populate #Example SkRegion::Iterator iter; - SkRegion region;
- region.setRect({1, 2, 3, 4});
- iter.reset(region);
- auto r = iter.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
-#StdOut
+ SkRegion region; + region.setRect({1, 2, 3, 4}); + iter.reset(region); + auto r = iter.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom); +#StdOut rect={1,2,3,4} ## ## @@ -81,18 +78,15 @@ rect={1,2,3,4} #Method Iterator(const SkRegion& region) #Line # constructs Region iterator ## -Sets Iterator to return elements of IRect array in region. -#Param region Region to iterate ## - -#Return Region iterator ## +#Populate #Example - SkRegion region;
- region.setRect({1, 2, 3, 4});
- SkRegion::Iterator iter(region);
- auto r = iter.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
-#StdOut
+ SkRegion region; + region.setRect({1, 2, 3, 4}); + SkRegion::Iterator iter(region); + auto r = iter.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom); +#StdOut rect={1,2,3,4} ## ## @@ -105,41 +99,37 @@ rect={1,2,3,4} #Method bool rewind() #Line # points Iterator to start ## - -Points Iterator to start of Region. -Returns true if Region was set; otherwise, returns false. - -#Return true if Region was set ## +#Populate #Example #Bug 8186 - auto debugster = [](const char* label, SkRegion::Iterator& iter, bool addRewind) -> void {
- if (addRewind) {
- bool success = iter.rewind();
- SkDebugf("%14s rewind success=%s\n", label, success ? "true" : "false");
- }
- auto r = iter.rect();
- SkDebugf("%14s rect={%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
- };
- SkRegion::Iterator iter;
- debugster("empty iter", iter, true);
- SkRegion region;
- iter.reset(region);
- debugster("empty region", iter, true);
- region.setRect({1, 2, 3, 4});
- iter.reset(region);
- debugster("after set rect", iter, false);
- debugster("after rewind", iter, true);
-#StdOut
+ auto debugster = [](const char* label, SkRegion::Iterator& iter, bool addRewind) -> void { + if (addRewind) { + bool success = iter.rewind(); + SkDebugf("%14s rewind success=%s\n", label, success ? "true" : "false"); + } + auto r = iter.rect(); + SkDebugf("%14s rect={%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); + }; + SkRegion::Iterator iter; + debugster("empty iter", iter, true); + SkRegion region; + iter.reset(region); + debugster("empty region", iter, true); + region.setRect({1, 2, 3, 4}); + iter.reset(region); + debugster("after set rect", iter, false); + debugster("after rewind", iter, true); +#StdOut #Volatile - empty iter rewind success=false
- empty iter rect={0,0,0,0}
- empty region rewind success=true
- empty region rect={0,0,0,0}
-after set rect rect={1,2,3,4}
- after rewind rewind success=true
- after rewind rect={1,2,3,4}
-##
+ empty iter rewind success=false + empty iter rect={0,0,0,0} + empty region rewind success=true + empty region rect={0,0,0,0} +after set rect rect={1,2,3,4} + after rewind rewind success=true + after rewind rect={1,2,3,4} +## ## #SeeAlso reset @@ -150,27 +140,24 @@ after set rect rect={1,2,3,4} #Method void reset(const SkRegion& region) #Line # sets Region to iterate ## - -Resets iterator, using the new Region. - -#Param region Region to iterate ## +#Populate #Example - auto debugster = [](const char* label, SkRegion::Iterator& iter) -> void {
- SkDebugf("%14s: done=%s\n", label, iter.done() ? "true" : "false");
- };
- SkRegion region;
- SkRegion::Iterator iter(region);
- debugster("empty region", iter);
- region.setRect({1, 2, 3, 4});
- debugster("after set rect", iter);
- iter.reset(region);
- debugster("after reset", iter);
-#StdOut
- empty region: done=true
-after set rect: done=true
- after reset: done=false
-##
+ auto debugster = [](const char* label, SkRegion::Iterator& iter) -> void { + SkDebugf("%14s: done=%s\n", label, iter.done() ? "true" : "false"); + }; + SkRegion region; + SkRegion::Iterator iter(region); + debugster("empty region", iter); + region.setRect({1, 2, 3, 4}); + debugster("after set rect", iter); + iter.reset(region); + debugster("after reset", iter); +#StdOut + empty region: done=true +after set rect: done=true + after reset: done=false +## ## #SeeAlso rewind @@ -181,20 +168,17 @@ after set rect: done=true #Method bool done() const #Line # returns if data parsing is complete ## - -Returns true if Iterator is pointing to final IRect in Region. - -#Return true if data parsing is complete ## +#Populate #Example - SkRegion region;
- SkRegion::Iterator iter(region);
- SkDebugf("done=%s\n", iter.done() ? "true" : "false");
- region.setRect({1, 2, 3, 4});
- iter.rewind();
- SkDebugf("done=%s\n", iter.done() ? "true" : "false");
+ SkRegion region; + SkRegion::Iterator iter(region); + SkDebugf("done=%s\n", iter.done() ? "true" : "false"); + region.setRect({1, 2, 3, 4}); + iter.rewind(); + SkDebugf("done=%s\n", iter.done() ? "true" : "false"); #StdOut -done=true
+done=true done=false ## ## @@ -207,21 +191,20 @@ done=false #Method void next() #Line # advances to next IRect ## - -Advances Iterator to next IRect in Region if it is not done. +#Populate #Example - SkRegion region;
- SkIRect rects[] = {{1, 2, 3, 4}, {5, 6, 7, 8}};
- region.setRects(rects, SK_ARRAY_COUNT(rects));
- SkRegion::Iterator iter(region);
- do {
- auto r2 = iter.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r2.fLeft, r2.fTop, r2.fRight, r2.fBottom);
- iter.next();
- } while (!iter.done());
+ SkRegion region; + SkIRect rects[] = {{1, 2, 3, 4}, {5, 6, 7, 8}}; + region.setRects(rects, SK_ARRAY_COUNT(rects)); + SkRegion::Iterator iter(region); + do { + auto r2 = iter.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r2.fLeft, r2.fTop, r2.fRight, r2.fBottom); + iter.next(); + } while (!iter.done()); #StdOut -rect={1,2,3,4}
+rect={1,2,3,4} rect={5,6,7,8} ## ## @@ -234,25 +217,21 @@ rect={5,6,7,8} #Method const SkIRect& rect() const #Line # returns part of Region as IRect ## - -Returns IRect element in Region. Does not return predictable results if Region -is empty. - -#Return part of Region as IRect ## +#Populate #Example #Bug 8186 - SkRegion region;
- SkRegion::Iterator iter(region);
- auto r1 = iter.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r1.fLeft, r1.fTop, r1.fRight, r1.fBottom);
- region.setRect({1, 2, 3, 4});
- iter.rewind();
- auto r2 = iter.rect();
+ SkRegion region; + SkRegion::Iterator iter(region); + auto r1 = iter.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r1.fLeft, r1.fTop, r1.fRight, r1.fBottom); + region.setRect({1, 2, 3, 4}); + iter.rewind(); + auto r2 = iter.rect(); SkDebugf("rect={%d,%d,%d,%d}\n", r2.fLeft, r2.fTop, r2.fRight, r2.fBottom); #StdOut #Volatile -rect={0,0,0,0}
+rect={0,0,0,0} rect={1,2,3,4} ## ## @@ -265,19 +244,16 @@ rect={1,2,3,4} #Method const SkRegion* rgn() const #Line # returns original Region ## - -Returns Region if set; otherwise, returns nullptr. - -#Return iterated Region ## +#Populate #Example - SkRegion region;
- SkIRect rects[] = {{1, 2, 3, 4}, {3, 4, 5, 6}};
- region.setRects(rects, SK_ARRAY_COUNT(rects));
- SkRegion::Iterator iter(region);
- auto r = iter.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
- auto b = iter.rgn()->getBounds();
+ SkRegion region; + SkIRect rects[] = {{1, 2, 3, 4}, {3, 4, 5, 6}}; + region.setRects(rects, SK_ARRAY_COUNT(rects)); + SkRegion::Iterator iter(region); + auto r = iter.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom); + auto b = iter.rgn()->getBounds(); SkDebugf("bounds={%d,%d,%d,%d}\n", b.fLeft, b.fTop, b.fRight, b.fBottom); ## @@ -309,21 +285,15 @@ up Region intersected with the specified clip rectangle. #Method Cliperator(const SkRegion& region, const SkIRect& clip) #Line # constructs Region iterator with clip ## - -Sets Cliperator to return elements of IRect array in Region within clip. - -#Param region Region to iterate ## -#Param clip bounds of iteration ## - -#Return Region iterator ## +#Populate #Example - SkRegion region;
- region.setRect({1, 2, 3, 4});
- SkRegion::Cliperator clipper(region, {0, 0, 2, 3});
- auto r = clipper.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
-#StdOut
+ SkRegion region; + region.setRect({1, 2, 3, 4}); + SkRegion::Cliperator clipper(region, {0, 0, 2, 3}); + auto r = clipper.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom); +#StdOut rect={1,2,2,3} ## ## @@ -336,22 +306,19 @@ rect={1,2,2,3} #Method bool done() #Line # returns if data parsing is complete ## - -Returns true if Cliperator is pointing to final IRect in Region. - -#Return true if data parsing is complete ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- SkRegion::Cliperator clipper(region, {0, 0, 5, 5});
+ auto debugster = [](const char* label, SkRegion& region) -> void { + SkRegion::Cliperator clipper(region, {0, 0, 5, 5}); SkDebugf("%14s done=%s\n", label, clipper.done() ? "true" : "false"); - };
- SkRegion region;
- debugster("empty region", region);
- region.setRect({1, 2, 3, 4});
- debugster("after add rect", region);
-#StdOut
- empty region done=true
+ }; + SkRegion region; + debugster("empty region", region); + region.setRect({1, 2, 3, 4}); + debugster("after add rect", region); +#StdOut + empty region done=true after add rect done=false ## ## @@ -364,21 +331,20 @@ after add rect done=false #Method void next() #Line # advances to next IRect within clip ## - -Advances iterator to next IRect in Region contained by clip. +#Populate #Example - SkRegion region;
- SkIRect rects[] = {{1, 2, 3, 4}, {5, 6, 7, 8}};
- region.setRects(rects, SK_ARRAY_COUNT(rects));
- SkRegion::Cliperator clipper(region, {0, 3, 8, 7});
- do {
- auto r2 = clipper.rect();
- SkDebugf("rect={%d,%d,%d,%d}\n", r2.fLeft, r2.fTop, r2.fRight, r2.fBottom);
- clipper.next();
+ SkRegion region; + SkIRect rects[] = {{1, 2, 3, 4}, {5, 6, 7, 8}}; + region.setRects(rects, SK_ARRAY_COUNT(rects)); + SkRegion::Cliperator clipper(region, {0, 3, 8, 7}); + do { + auto r2 = clipper.rect(); + SkDebugf("rect={%d,%d,%d,%d}\n", r2.fLeft, r2.fTop, r2.fRight, r2.fBottom); + clipper.next(); } while (!clipper.done()); #StdOut -rect={1,3,3,4}
+rect={1,3,3,4} rect={5,6,7,7} ## ## @@ -391,29 +357,24 @@ rect={5,6,7,7} #Method const SkIRect& rect() const #Line # returns part of Region as IRect intersected with clip ## - -Returns IRect element in Region, intersected with clip passed to Cliperator -constructor. Does not return predictable results if Region -is empty. - -#Return part of Region inside clip as IRect ## +#Populate #Example #Bug 8186 - auto debugster = [](const char* label, SkRegion& region) -> void {
- SkRegion::Cliperator clipper(region, {0, 0, 5, 3});
- auto r = clipper.rect();
- SkDebugf("%14s rect={%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + SkRegion::Cliperator clipper(region, {0, 0, 5, 3}); + auto r = clipper.rect(); + SkDebugf("%14s rect={%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); }; - SkRegion region;
- debugster("empty region", region);
- region.setRect({1, 2, 3, 4});
- debugster("after set rect", region);
-#StdOut
+ SkRegion region; + debugster("empty region", region); + region.setRect({1, 2, 3, 4}); + debugster("after set rect", region); +#StdOut #Volatile - empty region rect={1094713344,1065353216,0,-1}
-after set rect rect={1,2,3,3}
-##
+ empty region rect={1094713344,1065353216,0,-1} +after set rect rect={1,2,3,3} +## ## #SeeAlso next done @@ -441,24 +402,15 @@ Returns the line segment ends within Region that intersect a horizontal line. #Method Spanerator(const SkRegion& region, int y, int left, int right) #Line # constructs Region iterator on scan line ## - -Sets Spanerator to return line segments in Region on scan line. - - -#Param region Region to iterate ## -#Param y horizontal line to intersect ## -#Param left bounds of iteration ## -#Param right bounds of iteration ## - -#Return Region iterator ## +#Populate #Example - SkRegion region;
- region.setRect({1, 2, 3, 4});
- SkRegion::Spanerator spanner(region, 3, 2, 4);
- int left, right;
- bool result = spanner.next(&left, &right);
- SkDebugf("result=%s left=%d right=%d\n", result ? "true" : "false", left, right);
+ SkRegion region; + region.setRect({1, 2, 3, 4}); + SkRegion::Spanerator spanner(region, 3, 2, 4); + int left, right; + bool result = spanner.next(&left, &right); + SkDebugf("result=%s left=%d right=%d\n", result ? "true" : "false", left, right); ## #SeeAlso SkRegion Iterator Cliperator @@ -469,30 +421,23 @@ Sets Spanerator to return line segments in Region on scan line. #Method bool next(int* left, int* right) #Line # advances to next span on horizontal line ## - -Advances iterator to next span intersecting Region within line segment provided -in constructor. Returns true if interval was found. - -#Param left pointer to span start; may be nullptr ## -#Param right pointer to span end; may be nullptr ## - -#Return true if interval was found ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- SkRegion::Spanerator spanner(region, 3, 2, 4);
- int left, right;
- bool result = spanner.next(&left, &right);
- SkDebugf("%14s: result=%s", label, result ? "true" : "false");
- if (result) SkDebugf(" left=%d right=%d", left, right);
- SkDebugf("\n");
- };
- SkRegion region;
- debugster("empty region", region);
- region.setRect({1, 2, 3, 4});
+ auto debugster = [](const char* label, SkRegion& region) -> void { + SkRegion::Spanerator spanner(region, 3, 2, 4); + int left, right; + bool result = spanner.next(&left, &right); + SkDebugf("%14s: result=%s", label, result ? "true" : "false"); + if (result) SkDebugf(" left=%d right=%d", left, right); + SkDebugf("\n"); + }; + SkRegion region; + debugster("empty region", region); + region.setRect({1, 2, 3, 4}); debugster("after set rect", region); #StdOut - empty region: result=false
+ empty region: result=false after set rect: result=true left=2 right=3 ## ## @@ -508,11 +453,7 @@ after set rect: result=true left=2 right=3 #Method SkRegion() #In Constructors #Line # constructs with default values ## - -Constructs an empty Region. Region is set to empty bounds -at (0, 0) with zero width and height. - -#Return empty Region ## +#Populate #Example SkRegion region; @@ -532,23 +473,12 @@ region bounds: {0, 0, 0, 0} #Method SkRegion(const SkRegion& region) #In Constructors #Line # makes a shallow copy ## -Constructs a copy of an existing region. -Copy constructor makes two regions identical by value. Internally, region and -the returned result share pointer values. The underlying Rect array is -copied when modified. - -Creating a Region copy is very efficient and never allocates memory. -Regions are always copied by value from the interface; the underlying shared -pointers are not exposed. - -#Param region Region to copy by value ## - -#Return copy of Region ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); }; SkRegion region({1, 2, 3, 4}); SkRegion region2(region); @@ -559,10 +489,10 @@ pointers are not exposed. debugster("region bounds", region); debugster("region2 bounds", region2); #StdOut - region bounds: {1,2,3,4}
-region2 bounds: {1,2,3,4}
- after region set empty:
- region bounds: {0,0,0,0}
+ region bounds: {1,2,3,4} +region2 bounds: {1,2,3,4} + after region set empty: + region bounds: {0,0,0,0} region2 bounds: {1,2,3,4} ## ## @@ -576,11 +506,7 @@ region2 bounds: {1,2,3,4} #Method explicit SkRegion(const SkIRect& rect) #In Constructors #Line # constructs Region matching IRect ## -Constructs a rectangular Region matching the bounds of rect. - -#Param rect bounds of constructed Region ## - -#Return rectangular Region ## +#Populate #Example SkRegion region({1, 2, 3, 4}); @@ -598,20 +524,20 @@ Constructs a rectangular Region matching the bounds of rect. #Method ~SkRegion() #In Constructors #Line # decreases Reference_Count of owned objects ## -Releases ownership of any shared data and deletes data if Region is sole owner. +#Populate #Example #Description -delete calls Region Destructor, but copy of original in region2 is unaffected. +delete calls Region destructor, but copy of original in region2 is unaffected. ## SkRegion* region = new SkRegion({1, 2, 3, 4}); SkRegion region2(*region); delete region; - auto r = region2.getBounds();
- SkDebugf("region2 bounds: {%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
-#StdOut
-region2 bounds: {1,2,3,4}
-##
+ auto r = region2.getBounds(); + SkDebugf("region2 bounds: {%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom); +#StdOut +region2 bounds: {1,2,3,4} +## ## #SeeAlso SkRegion() SkRegion(const SkRegion& region) SkRegion(const SkIRect& rect) operator=(const SkRegion& region) @@ -623,32 +549,21 @@ region2 bounds: {1,2,3,4} #Method SkRegion& operator=(const SkRegion& region) #In Operators #Line # makes a shallow copy ## -Constructs a copy of an existing region. -Makes two regions identical by value. Internally, region and -the returned result share pointer values. The underlying Rect array is -copied when modified. - -Creating a Region copy is very efficient and never allocates memory. -Regions are always copied by value from the interface; the underlying shared -pointers are not exposed. - -#Param region Region to copy by value ## - -#Return Region to copy by value ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); }; SkRegion region1({1, 2, 3, 4}); SkRegion region2 = region1; debugster("region1 bounds", region1); debugster("region2 bounds", region2); -#StdOut
-region1 bounds: {1,2,3,4}
-region2 bounds: {1,2,3,4}
-##
+#StdOut +region1 bounds: {1,2,3,4} +region2 bounds: {1,2,3,4} +## ## #SeeAlso set swap SkRegion(const SkRegion& region) @@ -660,13 +575,7 @@ region2 bounds: {1,2,3,4} #Method bool operator==(const SkRegion& other)_const #In Operators #Line # compares Regions for equality ## - -Compares Region and other; returns true if they enclose exactly -the same area. - -#Param other Region to compare ## - -#Return true if Region pair are equivalent ## +#Populate #Example auto debugster = [](const char* prefix, const SkRegion& a, const SkRegion& b) -> void { @@ -680,8 +589,8 @@ the same area. one.setEmpty(); debugster("set empty", one, two); #StdOut -empty one == two
-set rect one != two
+empty one == two +set rect one != two set empty one == two ## ## @@ -695,12 +604,7 @@ set empty one == two #Method bool operator!=(const SkRegion& other)_const #In Operators #Line # compares Regions for inequality ## - -Compares Region and other; returns true if they do not enclose the same area. - -#Param other Region to compare ## - -#Return true if Region pair are not equivalent ## +#Populate #Example auto debugster = [](const char* prefix, const SkRegion& a, const SkRegion& b) -> void { @@ -715,8 +619,8 @@ Compares Region and other; returns true if they do not enclose the same area. two.op({1, 3, 3, 4}, SkRegion::kUnion_Op); debugster("union rect", one, two); #StdOut -empty one == two
-set rect one != two
+empty one == two +set rect one != two union rect one == two ## ## @@ -730,34 +634,22 @@ union rect one == two #Method bool set(const SkRegion& src) #In Constructors #Line # makes a shallow copy ## - -Sets Region to src, and returns true if src bounds is not empty. -This makes Region and src identical by value. Internally, -Region and src share pointer values. The underlying Rect array is -copied when modified. - -Creating a Region copy is very efficient and never allocates memory. -Regions are always copied by value from the interface; the underlying shared -pointers are not exposed. - -#Param src Region to copy ## - -#Return copy of src ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); }; SkRegion region1({1, 2, 3, 4}); SkRegion region2; region2.set(region1); debugster("region1 bounds", region1); debugster("region2 bounds", region2); -#StdOut
-region1 bounds: {1,2,3,4}
-region2 bounds: {1,2,3,4}
-##
+#StdOut +region1 bounds: {1,2,3,4} +region2 bounds: {1,2,3,4} +## ## #SeeAlso operator=(const SkRegion& region) swap SkRegion(const SkRegion& region) @@ -769,30 +661,22 @@ region2 bounds: {1,2,3,4} #Method void swap(SkRegion& other) #In Operators #Line # exchanges Region pair ## - -Exchanges IRect array of Region and other. swap() internally exchanges pointers, -so it is lightweight and does not allocate memory. - -swap() usage has largely been replaced by operator=(const SkRegion& region). -Paths do not copy their content on assignment until they are written to, -making assignment as efficient as swap(). - -#Param other operator=(const SkRegion& region) set ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); }; SkRegion region1({1, 2, 3, 4}); SkRegion region2; region1.swap(region2); debugster("region1 bounds", region1); debugster("region2 bounds", region2); -#StdOut
-region1 bounds: {0,0,0,0}
-region2 bounds: {1,2,3,4}
-##
+#StdOut +region1 bounds: {0,0,0,0} +region2 bounds: {1,2,3,4} +## ## #SeeAlso operator=(const SkRegion& region) set SkRegion(const SkRegion& region) @@ -804,17 +688,11 @@ region2 bounds: {1,2,3,4} #Method bool isEmpty() const #In Property #Line # returns if bounds has no width or height ## - -Returns true if Region is empty. -Empty Region has bounds width or height less than or equal to zero. -SkRegion() constructs empty Region; setEmpty -and setRect with dimensionless data make Region empty. - -#Return true if bounds has no width or height ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- SkDebugf("%14s: region is %s" "empty\n", label, region.isEmpty() ? "" : "not ");
+ auto debugster = [](const char* label, SkRegion& region) -> void { + SkDebugf("%14s: region is %s" "empty\n", label, region.isEmpty() ? "" : "not "); }; SkRegion region; debugster("initial", region); @@ -823,8 +701,8 @@ and setRect with dimensionless data make Region empty. region.setEmpty(); debugster("set empty", region); #StdOut - initial: region is empty
- set rect: region is not empty
+ initial: region is empty + set rect: region is not empty set empty: region is empty ## ## @@ -838,10 +716,7 @@ and setRect with dimensionless data make Region empty. #Method bool isRect() const #In Property #Line # returns if Region contains one IRect ## - -Returns true if Region is one IRect with positive dimensions. - -#Return true if Region contains one IRect ## +#Populate #Example auto debugster = [](const char* label, const SkRegion& region) -> void { @@ -854,8 +729,8 @@ Returns true if Region is one IRect with positive dimensions. region.setEmpty(); debugster("set empty", region); #StdOut -initial: region is not rect
-set rect: region is rect
+initial: region is not rect +set rect: region is rect set empty: region is not rect ## ## @@ -869,24 +744,21 @@ set empty: region is not rect #Method bool isComplex() const #In Property #Line # returns true if Region contains more than one IRect ## - -Returns true if Region is described by more than one rectangle. - -#Return true if Region contains more than one IRect ## +#Populate #Example - auto debugster = [](const char* label, const SkRegion& region) -> void {
- SkDebugf("%s: region is %s" "complex\n", label, region.isComplex() ? "" : "not ");
- };
- SkRegion region;
- debugster("initial", region);
- region.setRect({1, 2, 3, 4});
- debugster("set rect", region);
- region.op({2, 3, 4, 5}, SkRegion::kUnion_Op);
+ auto debugster = [](const char* label, const SkRegion& region) -> void { + SkDebugf("%s: region is %s" "complex\n", label, region.isComplex() ? "" : "not "); + }; + SkRegion region; + debugster("initial", region); + region.setRect({1, 2, 3, 4}); + debugster("set rect", region); + region.op({2, 3, 4, 5}, SkRegion::kUnion_Op); debugster("op rect", region); #StdOut -initial: region is not complex
-set rect: region is not complex
+initial: region is not complex +set rect: region is not complex op rect: region is complex ## ## @@ -900,20 +772,16 @@ op rect: region is complex #Method const SkIRect& getBounds() const #In Property #Line # returns maximum and minimum of IRect array ## - -Returns minimum and maximum axes values of IRect array. -Returns (0, 0, 0, 0) if Region is empty. - -#Return combined bounds of all IRect elements ## +#Populate #Example - SkRegion region({1, 2, 3, 4});
- region.op({2, 3, 4, 5}, SkRegion::kUnion_Op);
- auto r = region.getBounds();
- SkDebugf("bounds: {%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
-#StdOut
-bounds: {1,2,4,5}
-##
+ SkRegion region({1, 2, 3, 4}); + region.op({2, 3, 4, 5}, SkRegion::kUnion_Op); + auto r = region.getBounds(); + SkDebugf("bounds: {%d,%d,%d,%d}\n", r.fLeft, r.fTop, r.fRight, r.fBottom); +#StdOut +bounds: {1,2,4,5} +## ## #SeeAlso isEmpty isRect @@ -925,29 +793,21 @@ bounds: {1,2,4,5} #Method int computeRegionComplexity() const #In Property #Line # returns relative complexity ## - -Returns a value that increases with the number of -elements in Region. Returns zero if Region is empty. -Returns one if Region equals IRect; otherwise, returns -value greater than one indicating that Region is complex. - -Call to compare Regions for relative complexity. - -#Return relative complexity ## +#Populate #Example - auto debugster = [](const char* label, const SkRegion& region) -> void {
- SkDebugf("%s: region complexity %d\n", label, region.computeRegionComplexity());
- };
- SkRegion region;
- debugster("initial", region);
- region.setRect({1, 2, 3, 4});
- debugster("set rect", region);
- region.op({2, 3, 4, 5}, SkRegion::kUnion_Op);
+ auto debugster = [](const char* label, const SkRegion& region) -> void { + SkDebugf("%s: region complexity %d\n", label, region.computeRegionComplexity()); + }; + SkRegion region; + debugster("initial", region); + region.setRect({1, 2, 3, 4}); + debugster("set rect", region); + region.op({2, 3, 4, 5}, SkRegion::kUnion_Op); debugster("op rect", region); #StdOut -initial: region complexity 0
-set rect: region complexity 1
+initial: region complexity 0 +set rect: region complexity 1 op rect: region complexity 3 ## ## @@ -961,24 +821,17 @@ op rect: region complexity 3 #Method bool getBoundaryPath(SkPath* path) const #In Property #Line # appends Region outline to Path ## - -Appends outline of Region to path. -Returns true if Region is not empty; otherwise, returns false, and leaves path -unmodified. - -#Param path Path to append to ## - -#Return true if path changed ## +#Populate #Example #Height 100 - SkRegion region;
- region.setRect({10, 20, 90, 60});
- region.op({30, 40, 60, 80}, SkRegion::kXOR_Op);
- canvas->drawRegion(region, SkPaint());
- SkPath path;
- region.getBoundaryPath(&path);
- path.offset(100, 0);
+ SkRegion region; + region.setRect({10, 20, 90, 60}); + region.op({30, 40, 60, 80}, SkRegion::kXOR_Op); + canvas->drawRegion(region, SkPaint()); + SkPath path; + region.getBoundaryPath(&path); + path.offset(100, 0); canvas->drawPath(path, SkPaint()); ## @@ -991,16 +844,12 @@ unmodified. #Method bool setEmpty() #In Constructors #Line # constructs with default values ## - -Constructs an empty Region. Region is set to empty bounds -at (0, 0) with zero width and height. Always returns false. - -#Return false ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); }; SkRegion region({1, 2, 3, 4}); debugster("region bounds", region); @@ -1008,9 +857,9 @@ at (0, 0) with zero width and height. Always returns false. SkDebugf(" after region set empty:\n"); debugster("region bounds", region); #StdOut - region bounds: {1,2,3,4}
- after region set empty:
- region bounds: {0,0,0,0}
+ region bounds: {1,2,3,4} + after region set empty: + region bounds: {0,0,0,0} ## ## @@ -1023,13 +872,7 @@ at (0, 0) with zero width and height. Always returns false. #Method bool setRect(const SkIRect& rect) #In Constructors #Line # constructs Region matching IRect ## - -Constructs a rectangular Region matching the bounds of rect. -If rect is empty, constructs empty and returns false. - -#Param rect bounds of constructed Region ## - -#Return true if rect is not empty ## +#Populate #Example SkRegion region({1, 2, 3, 4}); @@ -1038,8 +881,8 @@ If rect is empty, constructs empty and returns false. SkDebugf("region is %s" "empty\n", region.isEmpty() ? "" : "not "); SkDebugf("setEmpty: %s\n", setEmpty ? "true" : "false"); #StdOut -region is not empty
-region is empty
+region is not empty +region is empty setEmpty: false ## ## @@ -1053,23 +896,13 @@ setEmpty: false #Method bool setRect(int32_t left, int32_t top, int32_t right, int32_t bottom) #In Constructors #Line # constructs Region matching bounds ## - -Constructs Region with bounds (left, top, right, bottom). -Returns true if left is less than right and top is less than bottom; otherwise, -constructs empty Region and returns false. - -#Param left edge of bounds on x-axis ## -#Param top edge of bounds on y-axis ## -#Param right edge of bounds on x-axis ## -#Param bottom edge of bounds on y-axis ## - -#Return rectangular Region ## +#Populate #Example - auto debugster = [](const char* label, bool success, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: success:%s {%d,%d,%d,%d}\n", label, success ? "true" : "false",
- r.fLeft, r.fTop, r.fRight, r.fBottom);
+ auto debugster = [](const char* label, bool success, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: success:%s {%d,%d,%d,%d}\n", label, success ? "true" : "false", + r.fLeft, r.fTop, r.fRight, r.fBottom); }; SkRegion region; bool success = region.setRect(1, 2, 3, 4); @@ -1077,7 +910,7 @@ constructs empty Region and returns false. success = region.setRect(3, 2, 1, 4); debugster("set to: 3,2,1,4", success, region); #StdOut -set to: 1,2,3,4: success:true {1,2,3,4}
+set to: 1,2,3,4: success:true {1,2,3,4} set to: 3,2,1,4: success:false {0,0,0,0} ## ## @@ -1091,28 +924,19 @@ set to: 3,2,1,4: success:false {0,0,0,0} #Method bool setRects(const SkIRect rects[], int count) #In Constructors #Line # sets IRect array ## - -Constructs Region as the union of IRect in rects array. If count is -zero, constructs empty Region. Returns false if constructed Region is empty. - -May be faster than repeated calls to op(). - -#Param rects array of IRects ## -#Param count array size ## - -#Return true if constructed Region is not empty ## +#Populate #Example #Height 70 - SkIRect rects[] = { {10, 10, 40, 40}, {20, 20, 50, 50}, {30, 30, 60, 60} };
- SkRegion region;
- region.setRects(rects, SK_ARRAY_COUNT(rects));
- canvas->drawRegion(region, SkPaint());
- region.setEmpty();
- for (auto add : rects) {
- region.op(add, SkRegion::kUnion_Op);
- }
- region.translate(100, 0);
+ SkIRect rects[] = { {10, 10, 40, 40}, {20, 20, 50, 50}, {30, 30, 60, 60} }; + SkRegion region; + region.setRects(rects, SK_ARRAY_COUNT(rects)); + canvas->drawRegion(region, SkPaint()); + region.setEmpty(); + for (auto add : rects) { + region.op(add, SkRegion::kUnion_Op); + } + region.translate(100, 0); canvas->drawRegion(region, SkPaint()); ## @@ -1125,39 +949,27 @@ May be faster than repeated calls to op(). #Method bool setRegion(const SkRegion& region) #In Constructors #Line # copies Region ## - -Constructs a copy of an existing region. -Makes two regions identical by value. Internally, region and -the returned result share pointer values. The underlying Rect array is -copied when modified. - -Creating a Region copy is very efficient and never allocates memory. -Regions are always copied by value from the interface; the underlying shared -pointers are not exposed. - -#Param region Region to copy by value ## - -#Return Region to copy by value ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- auto r = region.getBounds();
- SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
- };
- SkRegion region({1, 2, 3, 4});
- SkRegion region2;
- region2.setRegion(region);
- debugster("region bounds", region);
- debugster("region2 bounds", region2);
- region2.setEmpty();
- SkDebugf(" after region set empty:\n");
- debugster("region bounds", region);
+ auto debugster = [](const char* label, SkRegion& region) -> void { + auto r = region.getBounds(); + SkDebugf("%14s: {%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); + }; + SkRegion region({1, 2, 3, 4}); + SkRegion region2; + region2.setRegion(region); + debugster("region bounds", region); + debugster("region2 bounds", region2); + region2.setEmpty(); + SkDebugf(" after region set empty:\n"); + debugster("region bounds", region); debugster("region2 bounds", region2); #StdOut - region bounds: {1,2,3,4}
-region2 bounds: {1,2,3,4}
- after region set empty:
- region bounds: {1,2,3,4}
+ region bounds: {1,2,3,4} +region2 bounds: {1,2,3,4} + after region set empty: + region bounds: {1,2,3,4} region2 bounds: {0,0,0,0} ## ## @@ -1171,33 +983,23 @@ region2 bounds: {0,0,0,0} #Method bool setPath(const SkPath& path, const SkRegion& clip) #In Constructors #Line # constructs Region from clipped Path ## - -Constructs Region to match outline of path within clip. -Returns false if constructed Region is empty. - -Constructed Region draws the same pixels as path through clip when -Anti_Aliasing is disabled. - -#Param path Path providing outline ## -#Param clip Region containing path ## - -#Return true if constructed Region is not empty ## +#Populate #Example #Height 120 - SkPaint paint;
- paint.setTextSize(128);
- SkPath textPath;
- paint.getTextPath("Q", 1, 0, 110, &textPath);
- SkIRect clipRect = {20, 20, 100, 120};
- SkRegion clipRegion(clipRect);
- SkRegion region;
- region.setPath(textPath, clipRegion);
- canvas->drawRegion(region, SkPaint());
- clipRect.offset(100, 0);
- textPath.offset(100, 0);
- canvas->clipRect(SkRect::Make(clipRect), false);
- canvas->drawPath(textPath, SkPaint());
+ SkPaint paint; + paint.setTextSize(128); + SkPath textPath; + paint.getTextPath("Q", 1, 0, 110, &textPath); + SkIRect clipRect = {20, 20, 100, 120}; + SkRegion clipRegion(clipRect); + SkRegion region; + region.setPath(textPath, clipRegion); + canvas->drawRegion(region, SkPaint()); + clipRect.offset(100, 0); + textPath.offset(100, 0); + canvas->clipRect(SkRect::Make(clipRect), false); + canvas->drawPath(textPath, SkPaint()); ## #SeeAlso setRects op @@ -1209,26 +1011,20 @@ Anti_Aliasing is disabled. #Method bool intersects(const SkIRect& rect) const #In Intersection #Line # returns true if areas overlap ## - -Returns true if Region intersects rect. -Returns false if either rect or Region is empty, or do not intersect. - -#Param rect IRect to intersect ## - -#Return true if rect and Region have area in common ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath textPath;
- paint.getTextPath("W", 1, 20, 110, &textPath);
- SkRegion region;
- region.setPath(textPath, SkRegion({0, 0, 256, 256}));
- canvas->drawRegion(region, SkPaint());
- SkIRect iRect = SkIRect::MakeXYWH(frame * 160, 55, 10, 10);
- paint.setColor(region.intersects(iRect) ? SK_ColorBLUE : SK_ColorRED);
+ SkPaint paint; + paint.setTextSize(128); + SkPath textPath; + paint.getTextPath("W", 1, 20, 110, &textPath); + SkRegion region; + region.setPath(textPath, SkRegion({0, 0, 256, 256})); + canvas->drawRegion(region, SkPaint()); + SkIRect iRect = SkIRect::MakeXYWH(frame * 160, 55, 10, 10); + paint.setColor(region.intersects(iRect) ? SK_ColorBLUE : SK_ColorRED); canvas->drawRect(SkRect::Make(iRect), paint); ## @@ -1239,27 +1035,21 @@ Returns false if either rect or Region is empty, or do not intersect. # ------------------------------------------------------------------------------ #Method bool intersects(const SkRegion& other) const - -Returns true if Region intersects other. -Returns false if either other or Region is empty, or do not intersect. - -#Param other Region to intersect ## - -#Return true if other and Region have area in common ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath hPath, dotPath;
- paint.getTextPath("H", 1, 40, 110, &hPath);
- paint.getTextPath(",", 1, frame * 180, 95, &dotPath);
- SkRegion hRegion, dotRegion;
- hRegion.setPath(hPath, SkRegion({0, 0, 256, 256}));
- dotRegion.setPath(dotPath, SkRegion({0, 0, 256, 256}));
- canvas->drawRegion(hRegion, paint);
- paint.setColor(hRegion.intersects(dotRegion) ? SK_ColorBLUE : SK_ColorRED);
+ SkPaint paint; + paint.setTextSize(128); + SkPath hPath, dotPath; + paint.getTextPath("H", 1, 40, 110, &hPath); + paint.getTextPath(",", 1, frame * 180, 95, &dotPath); + SkRegion hRegion, dotRegion; + hRegion.setPath(hPath, SkRegion({0, 0, 256, 256})); + dotRegion.setPath(dotPath, SkRegion({0, 0, 256, 256})); + canvas->drawRegion(hRegion, paint); + paint.setColor(hRegion.intersects(dotRegion) ? SK_ColorBLUE : SK_ColorRED); canvas->drawRegion(dotRegion, paint); ## @@ -1272,30 +1062,23 @@ Returns false if either other or Region is empty, or do not intersect. #Method bool contains(int32_t x, int32_t y) const #In Intersection #Line # returns true if points are equal or inside ## - -Returns true if IPoint (x, y) is inside Region. -Returns false if Region is empty. - -#Param x test IPoint x-coordinate ## -#Param y test IPoint y-coordinate ## - -#Return true if (x, y) is inside Region ## +#Populate #Example #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- SkRegion xRegion;
- xRegion.setPath(xPath, SkRegion({0, 0, 256, 256}));
- canvas->drawRegion(xRegion, paint);
- for (int y = 0; y < 128; y += 8) {
- for (int x = 0; x < 128; x += 8) {
- paint.setColor(xRegion.contains(x, y) ? SK_ColorWHITE : SK_ColorRED);
- canvas->drawPoint(x, y, paint);
- }
- }
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + SkRegion xRegion; + xRegion.setPath(xPath, SkRegion({0, 0, 256, 256})); + canvas->drawRegion(xRegion, paint); + for (int y = 0; y < 128; y += 8) { + for (int x = 0; x < 128; x += 8) { + paint.setColor(xRegion.contains(x, y) ? SK_ColorWHITE : SK_ColorRED); + canvas->drawPoint(x, y, paint); + } + } ## #SeeAlso intersects SkRect::contains @@ -1305,31 +1088,25 @@ Returns false if Region is empty. # ------------------------------------------------------------------------------ #Method bool contains(const SkIRect& other) const - -Returns true if other is completely inside Region. -Returns false if Region or other is empty. - -#Param other IRect to contain ## - -#Return true if other is inside Region ## +#Populate #Example #Height 128 #Duration 4 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- SkRegion xRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- xRegion.setPath(xPath, SkRegion(drawBounds));
- xRegion.op(drawBounds, SkRegion::kReverseDifference_Op);
- canvas->drawRegion(xRegion, paint);
- SkIRect test = SkIRect::MakeXYWH(frame* 128, 64, 5, 5);
- if (xRegion.contains(test)) {
- paint.setColor(SK_ColorYELLOW);
- canvas->drawRect(SkRect::Make(test), paint);
- }
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + SkRegion xRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + xRegion.setPath(xPath, SkRegion(drawBounds)); + xRegion.op(drawBounds, SkRegion::kReverseDifference_Op); + canvas->drawRegion(xRegion, paint); + SkIRect test = SkIRect::MakeXYWH(frame* 128, 64, 5, 5); + if (xRegion.contains(test)) { + paint.setColor(SK_ColorYELLOW); + canvas->drawRect(SkRect::Make(test), paint); + } ## #SeeAlso intersects SkRect::contains @@ -1339,31 +1116,25 @@ Returns false if Region or other is empty. # ------------------------------------------------------------------------------ #Method bool contains(const SkRegion& other) const - -Returns true if other is completely inside Region. -Returns false if Region or other is empty. - -#Param other Region to contain ## - -#Return true if other is inside Region ## +#Populate #Example #Height 128 #Duration 4 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath, testPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- paint.getTextPath("`", 1, frame * 150 - 40, 150, &testPath);
- SkRegion xRegion, testRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- xRegion.setPath(xPath, SkRegion(drawBounds));
- testRegion.setPath(testPath, SkRegion(drawBounds));
- xRegion.op(drawBounds, SkRegion::kReverseDifference_Op);
- canvas->drawRegion(xRegion, paint);
- if (xRegion.contains(testRegion)) {
- paint.setColor(SK_ColorYELLOW);
- canvas->drawRegion(testRegion, paint);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath, testPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + paint.getTextPath("`", 1, frame * 150 - 40, 150, &testPath); + SkRegion xRegion, testRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + xRegion.setPath(xPath, SkRegion(drawBounds)); + testRegion.setPath(testPath, SkRegion(drawBounds)); + xRegion.op(drawBounds, SkRegion::kReverseDifference_Op); + canvas->drawRegion(xRegion, paint); + if (xRegion.contains(testRegion)) { + paint.setColor(SK_ColorYELLOW); + canvas->drawRegion(testRegion, paint); } ## @@ -1376,25 +1147,19 @@ Returns false if Region or other is empty. #Method bool quickContains(const SkIRect& r) const #In Intersection #Line # returns true quickly if points are equal or inside ## - -Returns true if Region is a single rectangle and contains r. -May return false even though Region contains r. - -#Param r IRect to contain ## - -#Return true quickly if r points are equal or inside ## +#Populate #Example - SkRegion region({1, 2, 3, 4});
- SkIRect test = {2, 2, 3, 3};
- SkDebugf("quickContains 1: %s\n", region.quickContains(test) ? "true" : "false");
- region.op({1, 4, 3, 6}, SkRegion::kUnion_Op);
- SkDebugf("quickContains 2: %s\n", region.quickContains(test) ? "true" : "false");
- region.op({1, 7, 3, 8}, SkRegion::kUnion_Op);
+ SkRegion region({1, 2, 3, 4}); + SkIRect test = {2, 2, 3, 3}; + SkDebugf("quickContains 1: %s\n", region.quickContains(test) ? "true" : "false"); + region.op({1, 4, 3, 6}, SkRegion::kUnion_Op); + SkDebugf("quickContains 2: %s\n", region.quickContains(test) ? "true" : "false"); + region.op({1, 7, 3, 8}, SkRegion::kUnion_Op); SkDebugf("quickContains 3: %s\n", region.quickContains(test) ? "true" : "false"); #StdOut -quickContains 1: true
-quickContains 2: true
+quickContains 1: true +quickContains 2: true quickContains 3: false ## ## @@ -1407,32 +1172,21 @@ quickContains 3: false #Method bool quickContains(int32_t left, int32_t top, int32_t right, int32_t bottom) const - -Returns true if Region is a single rectangle and contains IRect -(left, top, right, bottom). -Returns false if Region is empty or IRect (left, top, right, bottom) is empty. -May return false even though Region contains (left, top, right, bottom). - -#Param left edge of bounds on x-axis ## -#Param top edge of bounds on y-axis ## -#Param right edge of bounds on x-axis ## -#Param bottom edge of bounds on y-axis ## - -#Return true quickly if IRect are equal or inside ## +#Populate #Example - auto debugster = [](const char* label, SkRegion& region) -> void {
- SkDebugf("%s: %s\n", label, region.quickContains(2, 2, 3, 3) ? "true" : "false");
+ auto debugster = [](const char* label, SkRegion& region) -> void { + SkDebugf("%s: %s\n", label, region.quickContains(2, 2, 3, 3) ? "true" : "false"); }; - SkRegion region({1, 2, 3, 4});
- debugster("quickContains 1", region);
- region.op({1, 4, 3, 6}, SkRegion::kUnion_Op);
- debugster("quickContains 2", region);
- region.op({1, 7, 3, 8}, SkRegion::kUnion_Op);
- debugster("quickContains 3", region);
+ SkRegion region({1, 2, 3, 4}); + debugster("quickContains 1", region); + region.op({1, 4, 3, 6}, SkRegion::kUnion_Op); + debugster("quickContains 2", region); + region.op({1, 7, 3, 8}, SkRegion::kUnion_Op); + debugster("quickContains 3", region); #StdOut -quickContains 1: true
-quickContains 2: true
+quickContains 1: true +quickContains 2: true quickContains 3: false ## ## @@ -1446,26 +1200,19 @@ quickContains 3: false #Method bool quickReject(const SkIRect& rect) const #In Intersection #Line # returns true quickly if points are outside ## - -Returns true if Region does not intersect rect. -Returns true if rect is empty or Region is empty. -May return false even though Region does not intersect rect. - -#Param rect IRect to intersect ## - -#Return true if rect does not intersect ## +#Populate #Example - SkRegion region({1, 2, 3, 4});
- SkIRect test = {4, 2, 5, 3};
- SkDebugf("quickReject 1: %s\n", region.quickReject(test) ? "true" : "false");
- region.op({1, 4, 3, 6}, SkRegion::kUnion_Op);
- SkDebugf("quickReject 2: %s\n", region.quickReject(test) ? "true" : "false");
- region.op({4, 7, 5, 8}, SkRegion::kUnion_Op);
+ SkRegion region({1, 2, 3, 4}); + SkIRect test = {4, 2, 5, 3}; + SkDebugf("quickReject 1: %s\n", region.quickReject(test) ? "true" : "false"); + region.op({1, 4, 3, 6}, SkRegion::kUnion_Op); + SkDebugf("quickReject 2: %s\n", region.quickReject(test) ? "true" : "false"); + region.op({4, 7, 5, 8}, SkRegion::kUnion_Op); SkDebugf("quickReject 3: %s\n", region.quickReject(test) ? "true" : "false"); #StdOut -quickReject 1: true
-quickReject 2: true
+quickReject 1: true +quickReject 2: true quickReject 3: false ## ## @@ -1477,28 +1224,21 @@ quickReject 3: false # ------------------------------------------------------------------------------ #Method bool quickReject(const SkRegion& rgn) const - -Returns true if Region does not intersect rgn. -Returns true if rgn is empty or Region is empty. -May return false even though Region does not intersect rgn. - -#Param rgn Region to intersect ## - -#Return true if rgn does not intersect ## +#Populate #Example - SkRegion region({1, 2, 3, 4});
- SkRegion test;
- SkIRect rects[] = {{4, 2, 5, 3}, {7, 2, 8, 3}};
- test.setRects(rects, SK_ARRAY_COUNT(rects));
- SkDebugf("quickReject 1: %s\n", region.quickReject(test) ? "true" : "false");
- region.op({1, 4, 3, 6}, SkRegion::kUnion_Op);
- SkDebugf("quickReject 2: %s\n", region.quickReject(test) ? "true" : "false");
- region.op({4, 7, 5, 8}, SkRegion::kUnion_Op);
+ SkRegion region({1, 2, 3, 4}); + SkRegion test; + SkIRect rects[] = {{4, 2, 5, 3}, {7, 2, 8, 3}}; + test.setRects(rects, SK_ARRAY_COUNT(rects)); + SkDebugf("quickReject 1: %s\n", region.quickReject(test) ? "true" : "false"); + region.op({1, 4, 3, 6}, SkRegion::kUnion_Op); + SkDebugf("quickReject 2: %s\n", region.quickReject(test) ? "true" : "false"); + region.op({4, 7, 5, 8}, SkRegion::kUnion_Op); SkDebugf("quickReject 3: %s\n", region.quickReject(test) ? "true" : "false"); #StdOut -quickReject 1: true
-quickReject 2: true
+quickReject 1: true +quickReject 2: true quickReject 3: false ## ## @@ -1512,22 +1252,18 @@ quickReject 3: false #Method void translate(int dx, int dy) #In Transform #Line # translates IPoints in Region ## - -Offsets Region by IVector (dx, dy). Has no effect if Region is empty. - -#Param dx x-axis offset ## -#Param dy y-axis offset ## +#Populate #Example #Height 90 - SkRegion test;
- SkIRect rects[] = {{40, 20, 50, 30}, {70, 40, 80, 50}, { 60, 10, 70, 20}};
- test.setRects(rects, SK_ARRAY_COUNT(rects));
- SkPaint paint;
- for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN, SK_ColorMAGENTA } ) {
- paint.setColor(color);
- canvas->drawRegion(test, paint);
- test.translate(10, 10);
+ SkRegion test; + SkIRect rects[] = {{40, 20, 50, 30}, {70, 40, 80, 50}, { 60, 10, 70, 20}}; + test.setRects(rects, SK_ARRAY_COUNT(rects)); + SkPaint paint; + for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN, SK_ColorMAGENTA } ) { + paint.setColor(color); + canvas->drawRegion(test, paint); + test.translate(10, 10); } ## @@ -1538,28 +1274,21 @@ Offsets Region by IVector (dx, dy). Has no effect if Region is empty. # ------------------------------------------------------------------------------ #Method void translate(int dx, int dy, SkRegion* dst) const - -Offsets Region by IVector (dx, dy), writing result to dst. Region may be passed -as dst parameter, translating Region in place. Has no effect if dst is nullptr. -If Region is empty, sets dst to empty. - -#Param dx x-axis offset ## -#Param dy y-axis offset ## -#Param dst translated result ## +#Populate #Example - SkRegion test;
- SkIRect rects[] = {{40, 20, 50, 30}, {70, 40, 80, 50}, { 60, 10, 70, 20}};
- test.setRects(rects, SK_ARRAY_COUNT(rects));
- SkPaint paint;
- for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN, SK_ColorMAGENTA } ) {
- paint.setColor(color);
- canvas->drawRegion(test, paint);
- SkRegion second;
- test.translate(10, test.getBounds().fBottom, &second);
- test.op(second, SkRegion::kXOR_Op);
- test.translate(30, 0);
- }
+ SkRegion test; + SkIRect rects[] = {{40, 20, 50, 30}, {70, 40, 80, 50}, { 60, 10, 70, 20}}; + test.setRects(rects, SK_ARRAY_COUNT(rects)); + SkPaint paint; + for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN, SK_ColorMAGENTA } ) { + paint.setColor(color); + canvas->drawRegion(test, paint); + SkRegion second; + test.translate(10, test.getBounds().fBottom, &second); + test.op(second, SkRegion::kXOR_Op); + test.translate(30, 0); + } ## #SeeAlso SkCanvas::translate SkIRect::offset SkPath::offset @@ -1614,21 +1343,21 @@ Replaces target Region with operand Region. ## #Example - SkRegion operand({35, 35, 85, 85});
- const char* labels[] = {"difference", "intersect", "union", "xor", "reverse diff", "replace"};
- int index = 0;
- SkPaint paint;
- for (auto op : { SkRegion::kDifference_Op, SkRegion::kIntersect_Op, SkRegion::kUnion_Op,
- SkRegion::kXOR_Op, SkRegion::kReverseDifference_Op, SkRegion::kReplace_Op } ) {
- SkRegion target({10, 10, 60, 60});
- target.op(operand, op);
- canvas->drawRegion(target, paint);
- canvas->drawString(labels[index++], 40, 100, paint);
- canvas->translate(80, 0);
- if (SkRegion::kUnion_Op == op) {
- canvas->translate(-240, 120);
- }
- }
+ SkRegion operand({35, 35, 85, 85}); + const char* labels[] = {"difference", "intersect", "union", "xor", "reverse diff", "replace"}; + int index = 0; + SkPaint paint; + for (auto op : { SkRegion::kDifference_Op, SkRegion::kIntersect_Op, SkRegion::kUnion_Op, + SkRegion::kXOR_Op, SkRegion::kReverseDifference_Op, SkRegion::kReplace_Op } ) { + SkRegion target({10, 10, 60, 60}); + target.op(operand, op); + canvas->drawRegion(target, paint); + canvas->drawString(labels[index++], 40, 100, paint); + canvas->translate(80, 0); + if (SkRegion::kUnion_Op == op) { + canvas->translate(-240, 120); + } + } ## #SeeAlso SkPathOp @@ -1647,26 +1376,18 @@ May be used to verify that Op is a legal value. #Method bool op(const SkIRect& rect, Op op) #In Transform #Line # applies binary operator ## - -Replaces Region with the result of Region op rect. -Returns true if replaced Region is not empty. - -#Param rect IRect operand ## -#Param op operator, one of: #list_of_op_types# -## - -#Return false if result is empty ## +#Populate #Example #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- SkRegion xRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- xRegion.setPath(xPath, SkRegion(drawBounds));
- xRegion.op(drawBounds, SkRegion::kReverseDifference_Op);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + SkRegion xRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + xRegion.setPath(xPath, SkRegion(drawBounds)); + xRegion.op(drawBounds, SkRegion::kReverseDifference_Op); canvas->drawRegion(xRegion, paint); ## @@ -1677,31 +1398,20 @@ Returns true if replaced Region is not empty. # ------------------------------------------------------------------------------ #Method bool op(int left, int top, int right, int bottom, Op op) - -Replaces Region with the result of Region op IRect (left, top, right, bottom). -Returns true if replaced Region is not empty. - -#Param left edge of bounds on x-axis ## -#Param top edge of bounds on y-axis ## -#Param right edge of bounds on x-axis ## -#Param bottom edge of bounds on y-axis ## -#Param op operator, one of: #list_of_op_types# -## - -#Return false if result is empty ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- SkRegion xRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- xRegion.setPath(xPath, SkRegion(drawBounds));
- xRegion.op(drawBounds.fLeft + frame * drawBounds.width(), drawBounds.fTop,
- drawBounds.fRight, drawBounds.fBottom, SkRegion::kReverseDifference_Op);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + SkRegion xRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + xRegion.setPath(xPath, SkRegion(drawBounds)); + xRegion.op(drawBounds.fLeft + frame * drawBounds.width(), drawBounds.fTop, + drawBounds.fRight, drawBounds.fBottom, SkRegion::kReverseDifference_Op); canvas->drawRegion(xRegion, paint); ## @@ -1712,29 +1422,21 @@ Returns true if replaced Region is not empty. # ------------------------------------------------------------------------------ #Method bool op(const SkRegion& rgn, Op op) - -Replaces Region with the result of Region op rgn. -Returns true if replaced Region is not empty. - -#Param rgn Region operand ## -#Param op operator, one of: #list_of_op_types# -## - -#Return false if result is empty ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath, opPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- opPath.addCircle(64, 64, frame * 64);
- SkRegion xRegion, opRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- opRegion.setPath(opPath, SkRegion(drawBounds));
- xRegion.setPath(xPath, SkRegion(drawBounds));
- xRegion.op(opRegion, SkRegion::kReverseDifference_Op);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath, opPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + opPath.addCircle(64, 64, frame * 64); + SkRegion xRegion, opRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + opRegion.setPath(opPath, SkRegion(drawBounds)); + xRegion.setPath(xPath, SkRegion(drawBounds)); + xRegion.op(opRegion, SkRegion::kReverseDifference_Op); canvas->drawRegion(xRegion, paint); ## @@ -1745,32 +1447,23 @@ Returns true if replaced Region is not empty. # ------------------------------------------------------------------------------ #Method bool op(const SkIRect& rect, const SkRegion& rgn, Op op) - -Replaces Region with the result of rect op rgn. -Returns true if replaced Region is not empty. - -#Param rect IRect operand ## -#Param rgn Region operand ## -#Param op operator, one of: #list_of_op_types# -## - -#Return false if result is empty ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath, opPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- opPath.addCircle(64, 64, frame * 64);
- SkRegion xRegion, opRegion, rectRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- opRegion.setPath(opPath, SkRegion(drawBounds));
- xRegion.setPath(xPath, SkRegion(drawBounds));
- drawBounds.inset(frame * drawBounds.width() / 2, 0);
- rectRegion.op(drawBounds, opRegion, SkRegion::kIntersect_Op);
- xRegion.op(rectRegion, SkRegion::kReverseDifference_Op);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath, opPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + opPath.addCircle(64, 64, frame * 64); + SkRegion xRegion, opRegion, rectRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + opRegion.setPath(opPath, SkRegion(drawBounds)); + xRegion.setPath(xPath, SkRegion(drawBounds)); + drawBounds.inset(frame * drawBounds.width() / 2, 0); + rectRegion.op(drawBounds, opRegion, SkRegion::kIntersect_Op); + xRegion.op(rectRegion, SkRegion::kReverseDifference_Op); canvas->drawRegion(xRegion, paint); ## @@ -1781,32 +1474,23 @@ Returns true if replaced Region is not empty. # ------------------------------------------------------------------------------ #Method bool op(const SkRegion& rgn, const SkIRect& rect, Op op) - -Replaces Region with the result of rgn op rect. -Returns true if replaced Region is not empty. - -#Param rgn Region operand ## -#Param rect IRect operand ## -#Param op operator, one of: #list_of_op_types# -## - -#Return false if result is empty ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath, opPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- opPath.addCircle(64, 64, frame * 64);
- SkRegion xRegion, opRegion, rectRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- opRegion.setPath(opPath, SkRegion(drawBounds));
- xRegion.setPath(xPath, SkRegion(drawBounds));
- drawBounds.inset(frame * drawBounds.width() / 2, 0);
- rectRegion.op(opRegion, drawBounds, SkRegion::kUnion_Op);
- xRegion.op(rectRegion, SkRegion::kReverseDifference_Op);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath, opPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + opPath.addCircle(64, 64, frame * 64); + SkRegion xRegion, opRegion, rectRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + opRegion.setPath(opPath, SkRegion(drawBounds)); + xRegion.setPath(xPath, SkRegion(drawBounds)); + drawBounds.inset(frame * drawBounds.width() / 2, 0); + rectRegion.op(opRegion, drawBounds, SkRegion::kUnion_Op); + xRegion.op(rectRegion, SkRegion::kReverseDifference_Op); canvas->drawRegion(xRegion, paint); ## @@ -1817,35 +1501,26 @@ Returns true if replaced Region is not empty. # ------------------------------------------------------------------------------ #Method bool op(const SkRegion& rgna, const SkRegion& rgnb, Op op) - -Replaces Region with the result of rgna op rgnb. -Returns true if replaced Region is not empty. - -#Param rgna Region operand ## -#Param rgnb Region operand ## -#Param op operator, one of: #list_of_op_types# -## - -#Return false if result is empty ## +#Populate #Example #Duration 4 #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath, opPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- xPath.setFillType(SkPath::kInverseWinding_FillType);
- opPath.addCircle(64, 64, frame * 64);
- opPath.setFillType(SkPath::kInverseWinding_FillType);
- SkRegion xRegion, opRegion, rectRegion;
- SkIRect drawBounds = {0, 0, 128, 128};
- opRegion.setPath(opPath, SkRegion(drawBounds));
- xRegion.setPath(xPath, SkRegion(drawBounds));
- drawBounds.inset(frame * drawBounds.width() / 2, 0);
- rectRegion.setRect(drawBounds);
- rectRegion.op(xRegion, SkRegion::kIntersect_Op);
- xRegion.op(rectRegion, opRegion, SkRegion::kReverseDifference_Op);
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath, opPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + xPath.setFillType(SkPath::kInverseWinding_FillType); + opPath.addCircle(64, 64, frame * 64); + opPath.setFillType(SkPath::kInverseWinding_FillType); + SkRegion xRegion, opRegion, rectRegion; + SkIRect drawBounds = {0, 0, 128, 128}; + opRegion.setPath(opPath, SkRegion(drawBounds)); + xRegion.setPath(xPath, SkRegion(drawBounds)); + drawBounds.inset(frame * drawBounds.width() / 2, 0); + rectRegion.setRect(drawBounds); + rectRegion.op(xRegion, SkRegion::kIntersect_Op); + xRegion.op(rectRegion, opRegion, SkRegion::kReverseDifference_Op); canvas->drawRegion(xRegion, paint); ## @@ -1870,28 +1545,22 @@ Android framework only. #Method size_t writeToMemory(void* buffer) const #In Utility #Line # writes to buffer ## - -Writes Region to buffer, and returns number of bytes written. -If buffer is nullptr, returns number number of bytes that would be written. - -#Param buffer storage for binary data ## - -#Return size of Region ## +#Populate #Example #Height 128 - SkPaint paint;
- paint.setTextSize(128);
- SkPath xPath;
- paint.getTextPath("X", 1, 20, 110, &xPath);
- SkIRect drawBounds = {0, 0, 128, 128};
- SkRegion xRegion;
- xRegion.setPath(xPath, SkRegion(drawBounds));
- size_t size = xRegion.writeToMemory(nullptr);
- sk_sp<SkData> data = SkData::MakeUninitialized(size);
- xRegion.writeToMemory(data->writable_data());
- SkRegion copy;
- copy.readFromMemory(data->data(), data->size());
+ SkPaint paint; + paint.setTextSize(128); + SkPath xPath; + paint.getTextPath("X", 1, 20, 110, &xPath); + SkIRect drawBounds = {0, 0, 128, 128}; + SkRegion xRegion; + xRegion.setPath(xPath, SkRegion(drawBounds)); + size_t size = xRegion.writeToMemory(nullptr); + sk_sp<SkData> data = SkData::MakeUninitialized(size); + xRegion.writeToMemory(data->writable_data()); + SkRegion copy; + copy.readFromMemory(data->data(), data->size()); canvas->drawRegion(copy, paint); ## @@ -1904,23 +1573,16 @@ If buffer is nullptr, returns number number of bytes that would be written. #Method size_t readFromMemory(const void* buffer, size_t length) #In Utility #Line # reads from buffer ## - -Constructs Region from buffer of size length. Returns bytes read. -Returned value will be multiple of four or zero if length was too small. - -#Param buffer storage for binary data ## -#Param length size of buffer ## - -#Return bytes read ## +#Populate #Example #Height 100 - SkRegion region({20, 20, 80, 80});
- size_t size = region.writeToMemory(nullptr);
- sk_sp<SkData> data = SkData::MakeUninitialized(size);
- region.writeToMemory(data->writable_data());
- SkRegion copy;
- copy.readFromMemory(data->data(), data->size());
+ SkRegion region({20, 20, 80, 80}); + size_t size = region.writeToMemory(nullptr); + sk_sp<SkData> data = SkData::MakeUninitialized(size); + region.writeToMemory(data->writable_data()); + SkRegion copy; + copy.readFromMemory(data->data(), data->size()); canvas->drawRegion(copy, SkPaint()); ## |