mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
Auto merge of #6954 - dzbarsky:stroke_rect, r=glennw
Implement strokeRect with zero-width or zero-height rects <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6954) <!-- Reviewable:end -->
This commit is contained in:
commit
eecd975209
6 changed files with 23 additions and 9 deletions
|
@ -314,6 +314,21 @@ impl<'a> CanvasPaintTask<'a> {
|
|||
new_draw_target.stroke_rect(rect, self.state.stroke_style.to_pattern_ref(),
|
||||
&self.state.stroke_opts, &self.state.draw_options);
|
||||
});
|
||||
} else if rect.size.width == 0. || rect.size.height == 0. {
|
||||
let cap = match self.state.stroke_opts.line_join {
|
||||
JoinStyle::Round => CapStyle::Round,
|
||||
_ => CapStyle::Butt
|
||||
};
|
||||
|
||||
let stroke_opts =
|
||||
StrokeOptions::new(self.state.stroke_opts.line_width,
|
||||
self.state.stroke_opts.line_join,
|
||||
cap,
|
||||
self.state.stroke_opts.miter_limit,
|
||||
self.state.stroke_opts.mDashPattern);
|
||||
self.drawtarget.stroke_line(rect.origin, rect.bottom_right(),
|
||||
self.state.stroke_style.to_pattern_ref(),
|
||||
&stroke_opts, &self.state.draw_options);
|
||||
} else {
|
||||
self.drawtarget.stroke_rect(rect, self.state.stroke_style.to_pattern_ref(),
|
||||
&self.state.stroke_opts, &self.state.draw_options);
|
||||
|
|
|
@ -706,7 +706,7 @@ impl<'a> PaintContext<'a> {
|
|||
|
||||
self.draw_target.stroke_line(start,
|
||||
end,
|
||||
&ColorPattern::new(color),
|
||||
PatternRef::Color(&ColorPattern::new(color)),
|
||||
&stroke_opts,
|
||||
&draw_opts);
|
||||
}
|
||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -64,7 +64,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
[[package]]
|
||||
name = "azure"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-azure#0ee76c98d92b0ff180f8b4474c4f4b7c80b67ecf"
|
||||
source = "git+https://github.com/servo/rust-azure#a6d3af35eafe9a02af3fa58b1f1d30eb9cb57ccd"
|
||||
dependencies = [
|
||||
"core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue