Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement drawing shadows in canvas. #6355
Conversation
|
| &self.state.shadow_color, | ||
| &Point2D(self.state.shadow_offset_x as AzFloat, | ||
| self.state.shadow_offset_y as AzFloat), | ||
| (self.state.shadow_blur / 2.0f64) as AzFloat, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
hyowon
Jun 12, 2015
Author
Contributor
The shadowBlur attribute specifies the level of the blurring effect.
And the sigma as the standard deviation to perform a 2D Gaussian blur is half the value of shadowBlur.
Please refer to the 4-1 on the spec https://html.spec.whatwg.org/multipage/#when-shadows-are-drawn.
| &self.state.shadow_color, | ||
| &Point2D(self.state.shadow_offset_x as AzFloat, | ||
| self.state.shadow_offset_y as AzFloat), | ||
| (self.state.shadow_blur / 2.0f64) as AzFloat, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I think draw_rect(), draw_image() and draw_image_self() should call a higher-order function draw_with_shadow() taking a closure and shadow_src_rect. -S-awaiting-review +S-needs-code-changes Review status: all files reviewed, 5 unresolved discussions, all commit checks successful.
components/canvas/canvas_paint_task.rs, line 625 [r3] (raw file): https://html.spec.whatwg.org/multipage/scripting.html#when-shadows-are-drawn components/canvas/canvas_paint_task.rs, line 626 [r3] (raw file): components/canvas/canvas_paint_task.rs, line 629 [r3] (raw file): Comments from the review on Reviewable.io |
|
|
|
As you commented, I've added draw_with_shadow(). It makes the code more concise. Thanks. Review status: 26 of 27 files reviewed, 5 unresolved discussions, some commit checks failed. components/canvas/canvas_paint_task.rs, line 625 [r3] (raw file): components/canvas/canvas_paint_task.rs, line 626 [r3] (raw file): components/canvas/canvas_paint_task.rs, line 629 [r3] (raw file): Comments from the review on Reviewable.io |
|
-S-awaiting-review -S-needs-rebase +S-needs-squash Looks good, squash and I will r+ it. Reviewed 1 of 1 files at r5. Comments from the review on Reviewable.io |
|
@bors-servo: r+ -S-awaiting-review -S-needs-squash +S-awaiting-merge Reviewed 3 of 3 files at r6. Comments from the review on Reviewable.io |
|
|
https://html.spec.whatwg.org/multipage/#when-shadows-are-drawn r? @nox cc @mmatyas @yichoi <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6355) <!-- Reviewable:end -->
hyowon commentedJun 12, 2015
https://html.spec.whatwg.org/multipage/#when-shadows-are-drawn
r? @nox
cc @mmatyas @yichoi