mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #17916 - DarkDrek:Use_AntialiasMode_in_CanvasPaintThread_new, r=emilio
Use AntialiasMode in CanvasPaintThread::new Change suggested in #17661 <!-- Please describe your changes on the following line: --> I only changed `canvas_paint_thread.rs` since `CanvasPaintThread::start` is used outside of the current crate and `azure::azure_hl::AntialiasMode` isn't available there. --- <!-- 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 #17661 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because @jdm said so <!-- 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. --> <!-- 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/17916) <!-- Reviewable:end -->
This commit is contained in:
commit
0337ebb5a9
1 changed files with 8 additions and 9 deletions
|
@ -80,13 +80,7 @@ struct CanvasPaintState<'a> {
|
|||
}
|
||||
|
||||
impl<'a> CanvasPaintState<'a> {
|
||||
fn new(antialias: bool) -> CanvasPaintState<'a> {
|
||||
let antialias = if antialias {
|
||||
AntialiasMode::Default
|
||||
} else {
|
||||
AntialiasMode::None
|
||||
};
|
||||
|
||||
fn new(antialias: AntialiasMode) -> CanvasPaintState<'a> {
|
||||
CanvasPaintState {
|
||||
draw_options: DrawOptions::new(1.0, CompositionOp::Over, antialias),
|
||||
fill_style: Pattern::Color(ColorPattern::new(Color::black())),
|
||||
|
@ -104,7 +98,7 @@ impl<'a> CanvasPaintState<'a> {
|
|||
impl<'a> CanvasPaintThread<'a> {
|
||||
fn new(size: Size2D<i32>,
|
||||
webrender_api_sender: webrender_api::RenderApiSender,
|
||||
antialias: bool) -> CanvasPaintThread<'a> {
|
||||
antialias: AntialiasMode) -> CanvasPaintThread<'a> {
|
||||
let draw_target = CanvasPaintThread::create(size);
|
||||
let path_builder = draw_target.create_path_builder();
|
||||
let webrender_api = webrender_api_sender.create_api();
|
||||
|
@ -127,6 +121,11 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
antialias: bool)
|
||||
-> IpcSender<CanvasMsg> {
|
||||
let (sender, receiver) = ipc::channel::<CanvasMsg>().unwrap();
|
||||
let antialias = if antialias {
|
||||
AntialiasMode::Default
|
||||
} else {
|
||||
AntialiasMode::None
|
||||
};
|
||||
thread::Builder::new().name("CanvasThread".to_owned()).spawn(move || {
|
||||
let mut painter = CanvasPaintThread::new(size, webrender_api_sender, antialias);
|
||||
loop {
|
||||
|
@ -550,7 +549,7 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
|
||||
fn recreate(&mut self, size: Size2D<i32>) {
|
||||
self.drawtarget = CanvasPaintThread::create(size);
|
||||
self.state = CanvasPaintState::new(self.state.draw_options.antialias == AntialiasMode::Default);
|
||||
self.state = CanvasPaintState::new(self.state.draw_options.antialias);
|
||||
self.saved_states.clear();
|
||||
// Webrender doesn't let images change size, so we clear the webrender image key.
|
||||
if let Some(image_key) = self.image_key.take() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue