SkRegion.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. /*
  2. * Copyright 2005 The Android Open Source Project
  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. #ifndef SkRegion_DEFINED
  8. #define SkRegion_DEFINED
  9. #include "include/core/SkRect.h"
  10. class SkPath;
  11. class SkRgnBuilder;
  12. /** \class SkRegion
  13. SkRegion describes the set of pixels used to clip SkCanvas. SkRegion is compact,
  14. efficiently storing a single integer rectangle, or a run length encoded array
  15. of rectangles. SkRegion may reduce the current SkCanvas clip, or may be drawn as
  16. one or more integer rectangles. SkRegion iterator returns the scan lines or
  17. rectangles contained by it, optionally intersecting a bounding rectangle.
  18. */
  19. class SK_API SkRegion {
  20. typedef int32_t RunType;
  21. public:
  22. /** Constructs an empty SkRegion. SkRegion is set to empty bounds
  23. at (0, 0) with zero width and height.
  24. @return empty SkRegion
  25. */
  26. SkRegion();
  27. /** Constructs a copy of an existing region.
  28. Copy constructor makes two regions identical by value. Internally, region and
  29. the returned result share pointer values. The underlying SkRect array is
  30. copied when modified.
  31. Creating a SkRegion copy is very efficient and never allocates memory.
  32. SkRegion are always copied by value from the interface; the underlying shared
  33. pointers are not exposed.
  34. @param region SkRegion to copy by value
  35. @return copy of SkRegion
  36. */
  37. SkRegion(const SkRegion& region);
  38. /** Constructs a rectangular SkRegion matching the bounds of rect.
  39. @param rect bounds of constructed SkRegion
  40. @return rectangular SkRegion
  41. */
  42. explicit SkRegion(const SkIRect& rect);
  43. /** Releases ownership of any shared data and deletes data if SkRegion is sole owner.
  44. */
  45. ~SkRegion();
  46. /** Constructs a copy of an existing region.
  47. Makes two regions identical by value. Internally, region and
  48. the returned result share pointer values. The underlying SkRect array is
  49. copied when modified.
  50. Creating a SkRegion copy is very efficient and never allocates memory.
  51. SkRegion are always copied by value from the interface; the underlying shared
  52. pointers are not exposed.
  53. @param region SkRegion to copy by value
  54. @return SkRegion to copy by value
  55. */
  56. SkRegion& operator=(const SkRegion& region);
  57. /** Compares SkRegion and other; returns true if they enclose exactly
  58. the same area.
  59. @param other SkRegion to compare
  60. @return true if SkRegion pair are equivalent
  61. */
  62. bool operator==(const SkRegion& other) const;
  63. /** Compares SkRegion and other; returns true if they do not enclose the same area.
  64. @param other SkRegion to compare
  65. @return true if SkRegion pair are not equivalent
  66. */
  67. bool operator!=(const SkRegion& other) const {
  68. return !(*this == other);
  69. }
  70. /** Sets SkRegion to src, and returns true if src bounds is not empty.
  71. This makes SkRegion and src identical by value. Internally,
  72. SkRegion and src share pointer values. The underlying SkRect array is
  73. copied when modified.
  74. Creating a SkRegion copy is very efficient and never allocates memory.
  75. SkRegion are always copied by value from the interface; the underlying shared
  76. pointers are not exposed.
  77. @param src SkRegion to copy
  78. @return copy of src
  79. */
  80. bool set(const SkRegion& src) {
  81. *this = src;
  82. return !this->isEmpty();
  83. }
  84. /** Exchanges SkIRect array of SkRegion and other. swap() internally exchanges pointers,
  85. so it is lightweight and does not allocate memory.
  86. swap() usage has largely been replaced by operator=(const SkRegion& region).
  87. SkPath do not copy their content on assignment until they are written to,
  88. making assignment as efficient as swap().
  89. @param other operator=(const SkRegion& region) set
  90. */
  91. void swap(SkRegion& other);
  92. /** Returns true if SkRegion is empty.
  93. Empty SkRegion has bounds width or height less than or equal to zero.
  94. SkRegion() constructs empty SkRegion; setEmpty()
  95. and setRect() with dimensionless data make SkRegion empty.
  96. @return true if bounds has no width or height
  97. */
  98. bool isEmpty() const { return fRunHead == emptyRunHeadPtr(); }
  99. /** Returns true if SkRegion is one SkIRect with positive dimensions.
  100. @return true if SkRegion contains one SkIRect
  101. */
  102. bool isRect() const { return fRunHead == kRectRunHeadPtr; }
  103. /** Returns true if SkRegion is described by more than one rectangle.
  104. @return true if SkRegion contains more than one SkIRect
  105. */
  106. bool isComplex() const { return !this->isEmpty() && !this->isRect(); }
  107. /** Returns minimum and maximum axes values of SkIRect array.
  108. Returns (0, 0, 0, 0) if SkRegion is empty.
  109. @return combined bounds of all SkIRect elements
  110. */
  111. const SkIRect& getBounds() const { return fBounds; }
  112. /** Returns a value that increases with the number of
  113. elements in SkRegion. Returns zero if SkRegion is empty.
  114. Returns one if SkRegion equals SkIRect; otherwise, returns
  115. value greater than one indicating that SkRegion is complex.
  116. Call to compare SkRegion for relative complexity.
  117. @return relative complexity
  118. */
  119. int computeRegionComplexity() const;
  120. /** Appends outline of SkRegion to path.
  121. Returns true if SkRegion is not empty; otherwise, returns false, and leaves path
  122. unmodified.
  123. @param path SkPath to append to
  124. @return true if path changed
  125. */
  126. bool getBoundaryPath(SkPath* path) const;
  127. /** Constructs an empty SkRegion. SkRegion is set to empty bounds
  128. at (0, 0) with zero width and height. Always returns false.
  129. @return false
  130. */
  131. bool setEmpty();
  132. /** Constructs a rectangular SkRegion matching the bounds of rect.
  133. If rect is empty, constructs empty and returns false.
  134. @param rect bounds of constructed SkRegion
  135. @return true if rect is not empty
  136. */
  137. bool setRect(const SkIRect& rect);
  138. /** Constructs SkRegion with bounds (left, top, right, bottom).
  139. Returns true if left is less than right and top is less than bottom; otherwise,
  140. constructs empty SkRegion and returns false.
  141. @param left edge of bounds on x-axis
  142. @param top edge of bounds on y-axis
  143. @param right edge of bounds on x-axis
  144. @param bottom edge of bounds on y-axis
  145. @return rectangular SkRegion
  146. */
  147. bool setRect(int32_t left, int32_t top, int32_t right, int32_t bottom) {
  148. return this->setRect({ left, top, right, bottom });
  149. }
  150. /** Constructs SkRegion as the union of SkIRect in rects array. If count is
  151. zero, constructs empty SkRegion. Returns false if constructed SkRegion is empty.
  152. May be faster than repeated calls to op().
  153. @param rects array of SkIRect
  154. @param count array size
  155. @return true if constructed SkRegion is not empty
  156. */
  157. bool setRects(const SkIRect rects[], int count);
  158. /** Constructs a copy of an existing region.
  159. Makes two regions identical by value. Internally, region and
  160. the returned result share pointer values. The underlying SkRect array is
  161. copied when modified.
  162. Creating a SkRegion copy is very efficient and never allocates memory.
  163. SkRegion are always copied by value from the interface; the underlying shared
  164. pointers are not exposed.
  165. @param region SkRegion to copy by value
  166. @return SkRegion to copy by value
  167. */
  168. bool setRegion(const SkRegion& region);
  169. /** Constructs SkRegion to match outline of path within clip.
  170. Returns false if constructed SkRegion is empty.
  171. Constructed SkRegion draws the same pixels as path through clip when
  172. anti-aliasing is disabled.
  173. @param path SkPath providing outline
  174. @param clip SkRegion containing path
  175. @return true if constructed SkRegion is not empty
  176. */
  177. bool setPath(const SkPath& path, const SkRegion& clip);
  178. /** Returns true if SkRegion intersects rect.
  179. Returns false if either rect or SkRegion is empty, or do not intersect.
  180. @param rect SkIRect to intersect
  181. @return true if rect and SkRegion have area in common
  182. */
  183. bool intersects(const SkIRect& rect) const;
  184. /** Returns true if SkRegion intersects other.
  185. Returns false if either other or SkRegion is empty, or do not intersect.
  186. @param other SkRegion to intersect
  187. @return true if other and SkRegion have area in common
  188. */
  189. bool intersects(const SkRegion& other) const;
  190. /** Returns true if SkIPoint (x, y) is inside SkRegion.
  191. Returns false if SkRegion is empty.
  192. @param x test SkIPoint x-coordinate
  193. @param y test SkIPoint y-coordinate
  194. @return true if (x, y) is inside SkRegion
  195. */
  196. bool contains(int32_t x, int32_t y) const;
  197. /** Returns true if other is completely inside SkRegion.
  198. Returns false if SkRegion or other is empty.
  199. @param other SkIRect to contain
  200. @return true if other is inside SkRegion
  201. */
  202. bool contains(const SkIRect& other) const;
  203. /** Returns true if other is completely inside SkRegion.
  204. Returns false if SkRegion or other is empty.
  205. @param other SkRegion to contain
  206. @return true if other is inside SkRegion
  207. */
  208. bool contains(const SkRegion& other) const;
  209. /** Returns true if SkRegion is a single rectangle and contains r.
  210. May return false even though SkRegion contains r.
  211. @param r SkIRect to contain
  212. @return true quickly if r points are equal or inside
  213. */
  214. bool quickContains(const SkIRect& r) const {
  215. return this->quickContains(r.fLeft, r.fTop, r.fRight, r.fBottom);
  216. }
  217. /** Returns true if SkRegion is a single rectangle and contains SkIRect
  218. (left, top, right, bottom).
  219. Returns false if SkRegion is empty or SkIRect (left, top, right, bottom) is empty.
  220. May return false even though SkRegion contains (left, top, right, bottom).
  221. @param left edge of bounds on x-axis
  222. @param top edge of bounds on y-axis
  223. @param right edge of bounds on x-axis
  224. @param bottom edge of bounds on y-axis
  225. @return true quickly if SkIRect are equal or inside
  226. */
  227. bool quickContains(int32_t left, int32_t top, int32_t right,
  228. int32_t bottom) const {
  229. SkASSERT(this->isEmpty() == fBounds.isEmpty()); // valid region
  230. return left < right && top < bottom &&
  231. fRunHead == kRectRunHeadPtr && // this->isRect()
  232. /* fBounds.contains(left, top, right, bottom); */
  233. fBounds.fLeft <= left && fBounds.fTop <= top &&
  234. fBounds.fRight >= right && fBounds.fBottom >= bottom;
  235. }
  236. /** Returns true if SkRegion does not intersect rect.
  237. Returns true if rect is empty or SkRegion is empty.
  238. May return false even though SkRegion does not intersect rect.
  239. @param rect SkIRect to intersect
  240. @return true if rect does not intersect
  241. */
  242. bool quickReject(const SkIRect& rect) const {
  243. return this->isEmpty() || rect.isEmpty() ||
  244. !SkIRect::Intersects(fBounds, rect);
  245. }
  246. /** Returns true if SkRegion does not intersect rgn.
  247. Returns true if rgn is empty or SkRegion is empty.
  248. May return false even though SkRegion does not intersect rgn.
  249. @param rgn SkRegion to intersect
  250. @return true if rgn does not intersect
  251. */
  252. bool quickReject(const SkRegion& rgn) const {
  253. return this->isEmpty() || rgn.isEmpty() ||
  254. !SkIRect::Intersects(fBounds, rgn.fBounds);
  255. }
  256. /** Offsets SkRegion by ivector (dx, dy). Has no effect if SkRegion is empty.
  257. @param dx x-axis offset
  258. @param dy y-axis offset
  259. */
  260. void translate(int dx, int dy) { this->translate(dx, dy, this); }
  261. /** Offsets SkRegion by ivector (dx, dy), writing result to dst. SkRegion may be passed
  262. as dst parameter, translating SkRegion in place. Has no effect if dst is nullptr.
  263. If SkRegion is empty, sets dst to empty.
  264. @param dx x-axis offset
  265. @param dy y-axis offset
  266. @param dst translated result
  267. */
  268. void translate(int dx, int dy, SkRegion* dst) const;
  269. /** \enum SkRegion::Op
  270. The logical operations that can be performed when combining two SkRegion.
  271. */
  272. enum Op {
  273. kDifference_Op, //!< target minus operand
  274. kIntersect_Op, //!< target intersected with operand
  275. kUnion_Op, //!< target unioned with operand
  276. kXOR_Op, //!< target exclusive or with operand
  277. kReverseDifference_Op, //!< operand minus target
  278. kReplace_Op, //!< replace target with operand
  279. kLastOp = kReplace_Op, //!< last operator
  280. };
  281. static const int kOpCnt = kLastOp + 1;
  282. /** Replaces SkRegion with the result of SkRegion op rect.
  283. Returns true if replaced SkRegion is not empty.
  284. @param rect SkIRect operand
  285. @param op operator, one of:
  286. kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
  287. kReplace_Op
  288. @return false if result is empty
  289. */
  290. bool op(const SkIRect& rect, Op op) {
  291. if (this->isRect() && kIntersect_Op == op) {
  292. if (!fBounds.intersect(rect)) {
  293. return this->setEmpty();
  294. }
  295. return true;
  296. }
  297. return this->op(*this, rect, op);
  298. }
  299. /** Replaces SkRegion with the result of SkRegion op SkIRect (left, top, right, bottom).
  300. Returns true if replaced SkRegion is not empty.
  301. @param left edge of bounds on x-axis
  302. @param top edge of bounds on y-axis
  303. @param right edge of bounds on x-axis
  304. @param bottom edge of bounds on y-axis
  305. @param op operator, one of:
  306. kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
  307. kReplace_Op
  308. @return false if result is empty
  309. */
  310. bool op(int left, int top, int right, int bottom, Op op) {
  311. SkIRect rect;
  312. rect.set(left, top, right, bottom);
  313. return this->op(*this, rect, op);
  314. }
  315. /** Replaces SkRegion with the result of SkRegion op rgn.
  316. Returns true if replaced SkRegion is not empty.
  317. @param rgn SkRegion operand
  318. @param op operator, one of:
  319. kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
  320. kReplace_Op
  321. @return false if result is empty
  322. */
  323. bool op(const SkRegion& rgn, Op op) { return this->op(*this, rgn, op); }
  324. /** Replaces SkRegion with the result of rect op rgn.
  325. Returns true if replaced SkRegion is not empty.
  326. @param rect SkIRect operand
  327. @param rgn SkRegion operand
  328. @param op operator, one of:
  329. kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
  330. kReplace_Op
  331. @return false if result is empty
  332. */
  333. bool op(const SkIRect& rect, const SkRegion& rgn, Op op);
  334. /** Replaces SkRegion with the result of rgn op rect.
  335. Returns true if replaced SkRegion is not empty.
  336. @param rgn SkRegion operand
  337. @param rect SkIRect operand
  338. @param op operator, one of:
  339. kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
  340. kReplace_Op
  341. @return false if result is empty
  342. */
  343. bool op(const SkRegion& rgn, const SkIRect& rect, Op op);
  344. /** Replaces SkRegion with the result of rgna op rgnb.
  345. Returns true if replaced SkRegion is not empty.
  346. @param rgna SkRegion operand
  347. @param rgnb SkRegion operand
  348. @param op operator, one of:
  349. kDifference_Op, kIntersect_Op, kUnion_Op, kXOR_Op, kReverseDifference_Op,
  350. kReplace_Op
  351. @return false if result is empty
  352. */
  353. bool op(const SkRegion& rgna, const SkRegion& rgnb, Op op);
  354. #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
  355. /** Private. Android framework only.
  356. @return string representation of SkRegion
  357. */
  358. char* toString();
  359. #endif
  360. /** \class SkRegion::Iterator
  361. Returns sequence of rectangles, sorted along y-axis, then x-axis, that make
  362. up SkRegion.
  363. */
  364. class SK_API Iterator {
  365. public:
  366. /** Initializes SkRegion::Iterator with an empty SkRegion. done() on SkRegion::Iterator
  367. returns true.
  368. Call reset() to initialized SkRegion::Iterator at a later time.
  369. @return empty SkRegion iterator
  370. */
  371. Iterator() : fRgn(nullptr), fDone(true) {}
  372. /** Sets SkRegion::Iterator to return elements of SkIRect array in region.
  373. @param region SkRegion to iterate
  374. @return SkRegion iterator
  375. */
  376. Iterator(const SkRegion& region);
  377. /** SkPoint SkRegion::Iterator to start of SkRegion.
  378. Returns true if SkRegion was set; otherwise, returns false.
  379. @return true if SkRegion was set
  380. */
  381. bool rewind();
  382. /** Resets iterator, using the new SkRegion.
  383. @param region SkRegion to iterate
  384. */
  385. void reset(const SkRegion& region);
  386. /** Returns true if SkRegion::Iterator is pointing to final SkIRect in SkRegion.
  387. @return true if data parsing is complete
  388. */
  389. bool done() const { return fDone; }
  390. /** Advances SkRegion::Iterator to next SkIRect in SkRegion if it is not done.
  391. */
  392. void next();
  393. /** Returns SkIRect element in SkRegion. Does not return predictable results if SkRegion
  394. is empty.
  395. @return part of SkRegion as SkIRect
  396. */
  397. const SkIRect& rect() const { return fRect; }
  398. /** Returns SkRegion if set; otherwise, returns nullptr.
  399. @return iterated SkRegion
  400. */
  401. const SkRegion* rgn() const { return fRgn; }
  402. private:
  403. const SkRegion* fRgn;
  404. const SkRegion::RunType* fRuns;
  405. SkIRect fRect = {0, 0, 0, 0};
  406. bool fDone;
  407. };
  408. /** \class SkRegion::Cliperator
  409. Returns the sequence of rectangles, sorted along y-axis, then x-axis, that make
  410. up SkRegion intersected with the specified clip rectangle.
  411. */
  412. class SK_API Cliperator {
  413. public:
  414. /** Sets SkRegion::Cliperator to return elements of SkIRect array in SkRegion within clip.
  415. @param region SkRegion to iterate
  416. @param clip bounds of iteration
  417. @return SkRegion iterator
  418. */
  419. Cliperator(const SkRegion& region, const SkIRect& clip);
  420. /** Returns true if SkRegion::Cliperator is pointing to final SkIRect in SkRegion.
  421. @return true if data parsing is complete
  422. */
  423. bool done() { return fDone; }
  424. /** Advances iterator to next SkIRect in SkRegion contained by clip.
  425. */
  426. void next();
  427. /** Returns SkIRect element in SkRegion, intersected with clip passed to
  428. SkRegion::Cliperator constructor. Does not return predictable results if SkRegion
  429. is empty.
  430. @return part of SkRegion inside clip as SkIRect
  431. */
  432. const SkIRect& rect() const { return fRect; }
  433. private:
  434. Iterator fIter;
  435. SkIRect fClip;
  436. SkIRect fRect = {0, 0, 0, 0};
  437. bool fDone;
  438. };
  439. /** \class SkRegion::Spanerator
  440. Returns the line segment ends within SkRegion that intersect a horizontal line.
  441. */
  442. class Spanerator {
  443. public:
  444. /** Sets SkRegion::Spanerator to return line segments in SkRegion on scan line.
  445. @param region SkRegion to iterate
  446. @param y horizontal line to intersect
  447. @param left bounds of iteration
  448. @param right bounds of iteration
  449. @return SkRegion iterator
  450. */
  451. Spanerator(const SkRegion& region, int y, int left, int right);
  452. /** Advances iterator to next span intersecting SkRegion within line segment provided
  453. in constructor. Returns true if interval was found.
  454. @param left pointer to span start; may be nullptr
  455. @param right pointer to span end; may be nullptr
  456. @return true if interval was found
  457. */
  458. bool next(int* left, int* right);
  459. private:
  460. const SkRegion::RunType* fRuns;
  461. int fLeft, fRight;
  462. bool fDone;
  463. };
  464. /** Writes SkRegion to buffer, and returns number of bytes written.
  465. If buffer is nullptr, returns number number of bytes that would be written.
  466. @param buffer storage for binary data
  467. @return size of SkRegion
  468. */
  469. size_t writeToMemory(void* buffer) const;
  470. /** Constructs SkRegion from buffer of size length. Returns bytes read.
  471. Returned value will be multiple of four or zero if length was too small.
  472. @param buffer storage for binary data
  473. @param length size of buffer
  474. @return bytes read
  475. */
  476. size_t readFromMemory(const void* buffer, size_t length);
  477. private:
  478. static constexpr int kOpCount = kReplace_Op + 1;
  479. // T
  480. // [B N L R S]
  481. // S
  482. static constexpr int kRectRegionRuns = 7;
  483. struct RunHead;
  484. static RunHead* emptyRunHeadPtr() { return (SkRegion::RunHead*) -1; }
  485. static constexpr RunHead* kRectRunHeadPtr = nullptr;
  486. // allocate space for count runs
  487. void allocateRuns(int count);
  488. void allocateRuns(int count, int ySpanCount, int intervalCount);
  489. void allocateRuns(const RunHead& src);
  490. SkDEBUGCODE(void dump() const;)
  491. SkIRect fBounds;
  492. RunHead* fRunHead;
  493. void freeRuns();
  494. /**
  495. * Return the runs from this region, consing up fake runs if the region
  496. * is empty or a rect. In those 2 cases, we use tmpStorage to hold the
  497. * run data.
  498. */
  499. const RunType* getRuns(RunType tmpStorage[], int* intervals) const;
  500. // This is called with runs[] that do not yet have their interval-count
  501. // field set on each scanline. That is computed as part of this call
  502. // (inside ComputeRunBounds).
  503. bool setRuns(RunType runs[], int count);
  504. int count_runtype_values(int* itop, int* ibot) const;
  505. bool isValid() const;
  506. static void BuildRectRuns(const SkIRect& bounds,
  507. RunType runs[kRectRegionRuns]);
  508. // If the runs define a simple rect, return true and set bounds to that
  509. // rect. If not, return false and ignore bounds.
  510. static bool RunsAreARect(const SkRegion::RunType runs[], int count,
  511. SkIRect* bounds);
  512. /**
  513. * If the last arg is null, just return if the result is non-empty,
  514. * else store the result in the last arg.
  515. */
  516. static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*);
  517. friend struct RunHead;
  518. friend class Iterator;
  519. friend class Spanerator;
  520. friend class SkRegionPriv;
  521. friend class SkRgnBuilder;
  522. friend class SkFlatRegion;
  523. };
  524. #endif