mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #18242 - joone:ellipse, r=jdm
Implement Ellipse Canvas 2D API This patch needs to update rust-azure to 0.21.0. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #17598 <!-- Either: --> - [] There are tests for these changes OR - [] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18242) <!-- Reviewable:end -->
This commit is contained in:
commit
3a4b98ad38
8 changed files with 52 additions and 16 deletions
|
@ -173,6 +173,9 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
Canvas2dMsg::ArcTo(ref cp1, ref cp2, radius) => {
|
||||
painter.arc_to(cp1, cp2, radius)
|
||||
}
|
||||
Canvas2dMsg::Ellipse(ref center, radius_x, radius_y, rotation, start, end, ccw) => {
|
||||
painter.ellipse(center, radius_x, radius_y, rotation, start, end, ccw)
|
||||
}
|
||||
Canvas2dMsg::RestoreContext => painter.restore_context_state(),
|
||||
Canvas2dMsg::SaveContext => painter.save_context_state(),
|
||||
Canvas2dMsg::SetFillStyle(style) => painter.set_fill_style(style),
|
||||
|
@ -501,6 +504,17 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn ellipse(&mut self,
|
||||
center: &Point2D<AzFloat>,
|
||||
radius_x: AzFloat,
|
||||
radius_y: AzFloat,
|
||||
rotation_angle: AzFloat,
|
||||
start_angle: AzFloat,
|
||||
end_angle: AzFloat,
|
||||
ccw: bool) {
|
||||
self.path_builder.ellipse(*center, radius_x, radius_y, rotation_angle, start_angle, end_angle, ccw);
|
||||
}
|
||||
|
||||
fn set_fill_style(&mut self, style: FillOrStrokeStyle) {
|
||||
if let Some(pattern) = style.to_azure_pattern(&self.drawtarget) {
|
||||
self.state.fill_style = pattern
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue