Repository navigation
Added drawArc to Canvas. - #2995
Conversation
Added a way to call SkCanvas::drawArc from Dart. This method is optimized for the arc case and should be faster that drawing paths.
| if (!canvas_) | ||
| return; | ||
| canvas_->drawArc(SkRect::MakeLTRB(left, top, right, bottom), | ||
| startAngle * 180.0 / M_PI, |
There was a problem hiding this comment.
I don't think this layer is meant to have or enforce opinions about argument types. Should just forward the arguments as is to Skia. We can perform these conversions at a higher level.
There was a problem hiding this comment.
The arguments in the Dart API should be in radians.
There was a problem hiding this comment.
@chinmaygarde Based my assumption on https://github.com/flutter/engine/blob/master/lib/ui/painting/path.cc#L136.
| /// angles going clockwise around the oval. If useCenter is true, the oval | ||
| /// center is inserted into the implied path before the arc and the path is | ||
| /// angles going clockwise around the oval. If useCenter is true, the path is | ||
| /// closed back to the center, forming a wedge. Otherwise, the implied path |
There was a problem hiding this comment.
this still mentions the "implied path" :-)
|
Some traces: Archive.zip |
|
Related to #3599 and https://bugs.chromium.org/p/skia/issues/detail?id=5227. |
|
Though we updated the Skia revision quite recently, just want to make absolutely sure that you checked with https://chromium.googlesource.com/skia/+/4f3a0ca85d28a8fc7fcc1ac5c4a1864c66bdea14 already pulled in. |
|
@chinmaygarde Very good point! Seems like I've been using an older checkout of Skia when I did the traces. This fix seems to do its job: |
| /// that intersects the center of the rectangle and with positive | ||
| /// angles going clockwise around the oval. If useCenter is true, the arc is | ||
| /// closed back to the center, forming a circle sector. Otherwise, the arc is | ||
| /// not closed, forming a circle segment. |
There was a problem hiding this comment.
This should probably mention that it is faster than creating a path to draw the arc, if that's true.
Added a way to call SkCanvas::drawArc from Dart. This method is
optimized for the arc case and should be faster that drawing paths.