Index: src/core/SkDraw.cpp |
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp |
index 232973488e82d388143f5fa3f1d2760fc7d23d13..94bee2e5f85383e7362957f9af42bc771d6e9324 100644 |
--- a/src/core/SkDraw.cpp |
+++ b/src/core/SkDraw.cpp |
@@ -796,6 +796,19 @@ static SkPoint* rect_points(SkRect& r) { |
return SkTCast<SkPoint*>(&r); |
} |
+namespace { |
+ |
+void drawRectAsPath(const SkDraw& origDraw, const SkMatrix* matrix, const SkRect& prePaintRect, const SkPaint& paint) { |
+ SkDraw draw(origDraw); |
+ draw.fMatrix = matrix; |
+ SkPath tmp; |
+ tmp.addRect(prePaintRect); |
+ tmp.setFillType(SkPath::kWinding_FillType); |
+ draw.drawPath(tmp, paint, nullptr, true); |
+} |
+ |
+} // namespace |
+ |
void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint, |
const SkMatrix* paintMatrix, const SkRect* postPaintRect) const { |
SkDEBUGCODE(this->validate();) |
@@ -820,14 +833,7 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint, |
RectType rtype = ComputeRectType(paint, *fMatrix, &strokeSize); |
if (kPath_RectType == rtype) { |
- SkDraw draw(*this); |
- if (paintMatrix) { |
- draw.fMatrix = matrix; |
- } |
- SkPath tmp; |
- tmp.addRect(prePaintRect); |
- tmp.setFillType(SkPath::kWinding_FillType); |
- draw.drawPath(tmp, paint, nullptr, true); |
+ drawRectAsPath(*this, matrix, prePaintRect, paint); |
return; |
} |
@@ -852,6 +858,12 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint, |
} |
} |
+ // If bbox is larger than the largest SkIRect, use drawRectAsPath. |
+ if (!bbox.canRound()) { |
+ drawRectAsPath(*this, matrix, prePaintRect, paint); |
+ return; |
+ } |
+ |
SkIRect ir = bbox.roundOut(); |
if (fRC->quickReject(ir)) { |
return; |