Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: src/core/SkDraw.cpp

Issue 1893433002: In SkDraw::drawRect, use SkPath for huge rects. Base URL: https://skia.googlesource.com/skia@fixed-assert
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkAAClip.cpp ('k') | src/core/SkRasterClip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/core/SkAAClip.cpp ('k') | src/core/SkRasterClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698