mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
prefs: Move some DebugOptions
to Preferences
and clean up (#34998)
- Move options configuring antialiasing and WebRender shader precache to the `Preferences` to group them with other related WebRender and DOM settings. - Remove the option to disable antialiasing for canvases. This was unused. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
e1b4649faf
commit
2d09552234
12 changed files with 24 additions and 81 deletions
|
@ -25,7 +25,6 @@ use webrender_api::units::{DeviceIntSize, RectExt as RectExt_};
|
|||
use webrender_api::{ImageDescriptor, ImageDescriptorFlags, ImageFormat, ImageKey};
|
||||
use webrender_traits::{CrossProcessCompositorApi, ImageUpdate, SerializableImageData};
|
||||
|
||||
use crate::canvas_paint_thread::AntialiasMode;
|
||||
use crate::raqote_backend::Repetition;
|
||||
|
||||
/// The canvas data stores a state machine for the current status of
|
||||
|
@ -445,7 +444,6 @@ impl<'a> CanvasData<'a> {
|
|||
pub fn new(
|
||||
size: Size2D<u64>,
|
||||
compositor_api: CrossProcessCompositorApi,
|
||||
antialias: AntialiasMode,
|
||||
font_context: Arc<FontContext>,
|
||||
) -> CanvasData<'a> {
|
||||
let backend = create_backend();
|
||||
|
@ -454,7 +452,7 @@ impl<'a> CanvasData<'a> {
|
|||
backend,
|
||||
drawtarget: draw_target,
|
||||
path_state: None,
|
||||
state: CanvasPaintState::new(antialias),
|
||||
state: CanvasPaintState::default(),
|
||||
saved_states: vec![],
|
||||
compositor_api,
|
||||
image_key: None,
|
||||
|
|
|
@ -20,11 +20,6 @@ use webrender_traits::CrossProcessCompositorApi;
|
|||
|
||||
use crate::canvas_data::*;
|
||||
|
||||
pub enum AntialiasMode {
|
||||
Default,
|
||||
None,
|
||||
}
|
||||
|
||||
pub struct CanvasPaintThread<'a> {
|
||||
canvases: HashMap<CanvasId, CanvasData<'a>>,
|
||||
next_canvas_id: CanvasId,
|
||||
|
@ -95,12 +90,8 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
}
|
||||
recv(create_receiver) -> msg => {
|
||||
match msg {
|
||||
Ok(ConstellationCanvasMsg::Create {
|
||||
id_sender: creator,
|
||||
size,
|
||||
antialias
|
||||
}) => {
|
||||
let canvas_id = canvas_paint_thread.create_canvas(size, antialias);
|
||||
Ok(ConstellationCanvasMsg::Create { id_sender: creator, size }) => {
|
||||
let canvas_id = canvas_paint_thread.create_canvas(size);
|
||||
creator.send(canvas_id).unwrap();
|
||||
},
|
||||
Ok(ConstellationCanvasMsg::Exit) => break,
|
||||
|
@ -118,22 +109,12 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
(create_sender, ipc_sender)
|
||||
}
|
||||
|
||||
pub fn create_canvas(&mut self, size: Size2D<u64>, antialias: bool) -> CanvasId {
|
||||
let antialias = if antialias {
|
||||
AntialiasMode::Default
|
||||
} else {
|
||||
AntialiasMode::None
|
||||
};
|
||||
|
||||
pub fn create_canvas(&mut self, size: Size2D<u64>) -> CanvasId {
|
||||
let canvas_id = self.next_canvas_id;
|
||||
self.next_canvas_id.0 += 1;
|
||||
|
||||
let canvas_data = CanvasData::new(
|
||||
size,
|
||||
self.compositor_api.clone(),
|
||||
antialias,
|
||||
self.font_context.clone(),
|
||||
);
|
||||
let canvas_data =
|
||||
CanvasData::new(size, self.compositor_api.clone(), self.font_context.clone());
|
||||
self.canvases.insert(canvas_id, canvas_data);
|
||||
|
||||
canvas_id
|
||||
|
|
|
@ -21,7 +21,6 @@ use crate::canvas_data::{
|
|||
self, Backend, CanvasPaintState, Color, CompositionOp, DrawOptions, Filter, GenericDrawTarget,
|
||||
GenericPathBuilder, GradientStop, GradientStops, Path, SourceSurface, StrokeOptions, TextRun,
|
||||
};
|
||||
use crate::canvas_paint_thread::AntialiasMode;
|
||||
|
||||
thread_local! {
|
||||
/// The shared font cache used by all canvases that render on a thread. It would be nicer
|
||||
|
@ -85,12 +84,12 @@ impl Backend for RaqoteBackend {
|
|||
}
|
||||
|
||||
fn recreate_paint_state<'a>(&self, _state: &CanvasPaintState<'a>) -> CanvasPaintState<'a> {
|
||||
CanvasPaintState::new(AntialiasMode::Default)
|
||||
CanvasPaintState::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> CanvasPaintState<'a> {
|
||||
pub fn new(_antialias: AntialiasMode) -> CanvasPaintState<'a> {
|
||||
impl Default for CanvasPaintState<'_> {
|
||||
fn default() -> Self {
|
||||
let pattern = Pattern::Color(255, 0, 0, 0);
|
||||
CanvasPaintState {
|
||||
draw_options: DrawOptions::Raqote(raqote::DrawOptions::new()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue