diff options
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r-- | src/core/SkDraw.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index bf91aa15b5..39b684356a 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -722,6 +722,16 @@ static SkPoint* rect_points(SkRect& r) { return SkTCast<SkPoint*>(&r); } +static void draw_rect_as_path(const SkDraw& orig, const SkRect& prePaintRect, + const SkPaint& paint, const SkMatrix* matrix) { + SkDraw draw(orig); + draw.fMatrix = matrix; + SkPath tmp; + tmp.addRect(prePaintRect); + tmp.setFillType(SkPath::kWinding_FillType); + draw.drawPath(tmp, paint, nullptr, true); +} + void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint, const SkMatrix* paintMatrix, const SkRect* postPaintRect) const { SkDEBUGCODE(this->validate();) @@ -746,14 +756,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); + draw_rect_as_path(*this, prePaintRect, paint, matrix); return; } @@ -778,6 +781,12 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint, } } + if (!SkRect::MakeLargestS32().contains(bbox)) { + // bbox.roundOut() is undefined; use slow path. + draw_rect_as_path(*this, prePaintRect, paint, matrix); + return; + } + SkIRect ir = bbox.roundOut(); if (fRC->quickReject(ir)) { return; |