diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2020-01-25 22:06:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-25 22:06:47 -0500 |
commit | 0bd266149263cbdcd0ddd677ab3a7eaa0322b660 (patch) | |
tree | b68daa966a4e2ac3c75d4f8e63ea751ffb0df40e /components/canvas_traits/canvas.rs | |
parent | 694bb408cc4d59394ca2698967606f28ba053e43 (diff) | |
parent | 5a773bf55a3dfd1b486887c3c36bafe0cbe58f2e (diff) | |
download | servo-0bd266149263cbdcd0ddd677ab3a7eaa0322b660.tar.gz servo-0bd266149263cbdcd0ddd677ab3a7eaa0322b660.zip |
Auto merge of #25603 - pylbrecht:raqote, r=jdm
Update CanvasRenderingContext2D fillStyle and strokeStyle only when required
So far fill and stroke style updates have been sent to the canvas paint
thread by `SetFillStyle()` and `SetStrokeStyle()`. This resulted in
fill/stroke style updates not being considered by the canvas paint
thread between the latest call of `SetFillStyle()`/`SetStrokeStyle()` and
the drawing operation (e.g. fill or stroke).
This issue is solved by making `SetFillStyle()` and `SetStrokeStyle()`
update the local canvas state and propagating the state to the canvas
paint thread along with the drawing operations that require it.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix part of #25331
<!-- Either: -->
- [x] There are tests for these changes
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/canvas_traits/canvas.rs')
-rw-r--r-- | components/canvas_traits/canvas.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs index ee659e16f3a..b203399a200 100644 --- a/components/canvas_traits/canvas.rs +++ b/components/canvas_traits/canvas.rs @@ -44,9 +44,9 @@ pub enum Canvas2dMsg { Clip, ClosePath, Ellipse(Point2D<f32>, f32, f32, f32, f32, f32, bool), - Fill, - FillText(String, f64, f64, Option<f64>), - FillRect(Rect<f32>), + Fill(FillOrStrokeStyle), + FillText(String, f64, f64, Option<f64>, FillOrStrokeStyle), + FillRect(Rect<f32>, FillOrStrokeStyle), GetImageData(Rect<u64>, Size2D<u64>, IpcBytesSender), IsPointInPath(f64, f64, FillRule, IpcSender<bool>), LineTo(Point2D<f32>), @@ -56,10 +56,8 @@ pub enum Canvas2dMsg { Rect(Rect<f32>), RestoreContext, SaveContext, - StrokeRect(Rect<f32>), - Stroke, - SetFillStyle(FillOrStrokeStyle), - SetStrokeStyle(FillOrStrokeStyle), + StrokeRect(Rect<f32>, FillOrStrokeStyle), + Stroke(FillOrStrokeStyle), SetLineWidth(f32), SetLineCap(LineCapStyle), SetLineJoin(LineJoinStyle), |