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

Unified Diff: src/core/SkCanvas.cpp

Issue 2257023003: Plumb drawArc to SkDevice (Closed) Base URL: https://chromium.googlesource.com/skia.git@distance
Patch Set: Address comments Created 4 years, 4 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 | « include/utils/SkPaintFilterCanvas.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 539fd36028ac214dad18d49df808b34b6a187ea9..518d177cc8352a85910454a3effd42835c088de3 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2273,6 +2273,29 @@ void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
LOOPER_END
}
+void SkCanvas::onDrawArc(const SkRect& oval, SkScalar startAngle,
+ SkScalar sweepAngle, bool useCenter,
+ const SkPaint& paint) {
+ TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawArc()");
+ const SkRect* bounds = nullptr;
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ // Note we're using the entire oval as the bounds.
+ if (this->quickReject(paint.computeFastBounds(oval, &storage))) {
+ return;
+ }
+ bounds = &oval;
+ }
+
+ LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds)
+
+ while (iter.next()) {
+ iter.fDevice->drawArc(iter, oval, startAngle, sweepAngle, useCenter, looper.paint());
+ }
+
+ LOOPER_END
+}
+
void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()");
SkRect storage;
@@ -3081,15 +3104,7 @@ void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle,
if (SkScalarAbs(sweepAngle) >= SkIntToScalar(360)) {
this->drawOval(oval, paint);
} else {
- SkPath path;
- if (useCenter) {
- path.moveTo(oval.centerX(), oval.centerY());
- }
- path.arcTo(oval, startAngle, sweepAngle, !useCenter);
- if (useCenter) {
- path.close();
- }
- this->drawPath(path, paint);
+ this->onDrawArc(oval, startAngle, sweepAngle, useCenter, paint);
}
}
« no previous file with comments | « include/utils/SkPaintFilterCanvas.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698