Index: src/core/SkAAClip.cpp |
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp |
index 14152f8317ef6a0167b7399d0927528aafd4b990..54a6dcd795e5bf7a36daed63655e068a1bbbcb98 100644 |
--- a/src/core/SkAAClip.cpp |
+++ b/src/core/SkAAClip.cpp |
@@ -684,6 +684,35 @@ 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; |
+ } |
+ SkASSERT(0 == yoff->fOffset); |
+ |
+ const uint8_t* row = head->data(); |
+ 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(); |