Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Added drawArc to Canvas. - #2995

Merged
dragostis merged 3 commits into
flutter-team-archive:masterfrom
dragostis:drawarc
Sep 12, 2016
Merged

dragostis merged 3 commits into
flutter-team-archive:masterfrom
dragostis:drawarc

Conversation

@dragostis

Copy link
Copy Markdown
Contributor

Added a way to call SkCanvas::drawArc from Dart. This method is
optimized for the arc case and should be faster that drawing paths.

Added a way to call SkCanvas::drawArc from Dart. This method is
optimized for the arc case and should be faster that drawing paths.
Comment thread lib/ui/painting/canvas.cc
if (!canvas_)
return;
canvas_->drawArc(SkRect::MakeLTRB(left, top, right, bottom),
startAngle * 180.0 / M_PI,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arguments in the Dart API should be in radians.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/ui/painting.dart Outdated
/// 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still mentions the "implied path" :-)

@dragostis

Copy link
Copy Markdown
Contributor Author

Some traces: Archive.zip

@dragostis

Copy link
Copy Markdown
Contributor Author

@chinmaygarde

Copy link
Copy Markdown
Contributor

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.

@dragostis

Copy link
Copy Markdown
Contributor Author

@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:
dart-timeline-2016-8-12.json.zip Re-opening.

Comment thread lib/ui/painting.dart
/// 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably mention that it is faster than creating a path to draw the arc, if that's true.

@Hixie

Hixie commented Sep 12, 2016

Copy link
Copy Markdown
Contributor

LGTM with the above comment fix

@dragostis
dragostis merged commit 67888c5 into flutter-team-archive:master Sep 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants