Index: src/core/SkAAClip.cpp |
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp |
index 14152f8317ef6a0167b7399d0927528aafd4b990..5d21a47a49470e6f2d85845021cbbed3b76b26bb 100644 |
--- a/src/core/SkAAClip.cpp |
+++ b/src/core/SkAAClip.cpp |
@@ -684,6 +684,34 @@ bool SkAAClip::setRect(const SkIRect& bounds) { |
#endif |
} |
+bool SkAAClip::isRect() const { |
+ if (this->isEmpty()) { |
+ return false; |
+ } |
+ |
+ const RunHead* head = fRunHead; |
+ if (head->fRowCount != 1) { |
+ return false; |
+ } |
+ const YOffset* yoff = head->yoffsets(); |
+ if (yoff->fY != fBounds.fBottom - 1) { |
+ return false; |
+ } |
+ |
+ const uint8_t* row = head->data() + yoff->fOffset; |
+ int width = fBounds.width(); |
+ do { |
+ if (row[1] != 0xFF) { |
+ return false; |
+ } |
+ int n = row[0]; |
+ SkASSERT(n <= width); |
+ width -= n; |
+ row += 2; |
+ } while (width > 0); |
+ return true; |
+} |
+ |
bool SkAAClip::setRect(const SkRect& r, bool doAA) { |
if (r.isEmpty()) { |
return this->setEmpty(); |