summaryrefslogtreecommitdiff
path: root/libs/hwui/SkiaCanvas.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2017-11-06 13:55:59 -0500
committerDerek Sollenberger <djsollen@google.com>2017-11-06 13:55:59 -0500
commitef3b2187354bd648bf9e1ab1d0757f5de22a42ce (patch)
tree814afe712067e06084a5542c9e2789df4b6ba0dd /libs/hwui/SkiaCanvas.cpp
parent622597fbc5651cc2ddf68c94fefe79fffdde19ff (diff)
If the absolute value of a sweep angle >= 360 then draw it as an oval.
Skia's drawArc API is defined to keep winding when drawing an arc with a sweep angle > 360. This allows for special path effects and for points on the arc to potentially be double drawn. This is not the case for the HWUI implementation that optimistically turns the call into a drawOval. This CL updates Skia's pipeline to be in line with the HWUI implemenation. Test: CtsGraphicsTestCases were added to cover this Bug: 68764873 Change-Id: I22cd15a53cd2df44421518256d45a2b5d0525a86
Diffstat (limited to 'libs/hwui/SkiaCanvas.cpp')
-rw-r--r--libs/hwui/SkiaCanvas.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 70dfa8664696..508869a0cbdd 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -521,7 +521,11 @@ void SkiaCanvas::drawArc(float left, float top, float right, float bottom, float
float sweepAngle, bool useCenter, const SkPaint& paint) {
if (CC_UNLIKELY(paint.nothingToDraw())) return;
SkRect arc = SkRect::MakeLTRB(left, top, right, bottom);
- mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
+ if (fabs(sweepAngle) >= 360.0f) {
+ mCanvas->drawOval(arc, paint);
+ } else {
+ mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
+ }
}
void SkiaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {