diff --git a/README.md b/README.md index 75195b48697..b5a5d3d78cc 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ cp servobuild.example .servobuild - `-p INTERVAL` turns on the profiler and dumps info to the console every `INTERVAL` seconds -- `-s SIZE` sets the tile size for rendering; defaults to 512 +- `-s SIZE` sets the tile size for painting; defaults to 512 - `-z` disables all graphical output; useful for running JS / layout tests ### Keyboard Shortcuts diff --git a/components/canvas/canvas_render_task.rs b/components/canvas/canvas_paint_task.rs similarity index 76% rename from components/canvas/canvas_render_task.rs rename to components/canvas/canvas_paint_task.rs index a5ab92a2dfe..ee71bd16483 100644 --- a/components/canvas/canvas_render_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -18,17 +18,17 @@ pub enum CanvasMsg { Close, } -pub struct CanvasRenderTask { +pub struct CanvasPaintTask { drawtarget: DrawTarget, fill_color: ColorPattern, stroke_color: ColorPattern, stroke_opts: StrokeOptions, } -impl CanvasRenderTask { - fn new(size: Size2D) -> CanvasRenderTask { - CanvasRenderTask { - drawtarget: CanvasRenderTask::create(size), +impl CanvasPaintTask { + fn new(size: Size2D) -> CanvasPaintTask { + CanvasPaintTask { + drawtarget: CanvasPaintTask::create(size), fill_color: ColorPattern::new(Color::new(0., 0., 0., 1.)), stroke_color: ColorPattern::new(Color::new(0., 0., 0., 1.)), stroke_opts: StrokeOptions::new(1.0, 1.0), @@ -38,14 +38,14 @@ impl CanvasRenderTask { pub fn start(size: Size2D) -> Sender { let (chan, port) = comm::channel::(); spawn_named("CanvasTask", proc() { - let mut renderer = CanvasRenderTask::new(size); + let mut painter = CanvasPaintTask::new(size); loop { match port.recv() { - FillRect(ref rect) => renderer.fill_rect(rect), - StrokeRect(ref rect) => renderer.stroke_rect(rect), - ClearRect(ref rect) => renderer.clear_rect(rect), - Recreate(size) => renderer.recreate(size), + FillRect(ref rect) => painter.fill_rect(rect), + StrokeRect(ref rect) => painter.stroke_rect(rect), + ClearRect(ref rect) => painter.clear_rect(rect), + Recreate(size) => painter.recreate(size), Close => break, } } @@ -72,6 +72,6 @@ impl CanvasRenderTask { } fn recreate(&mut self, size: Size2D) { - self.drawtarget = CanvasRenderTask::create(size); + self.drawtarget = CanvasPaintTask::create(size); } } diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 3574d657853..2604c28af07 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -9,4 +9,4 @@ extern crate azure; extern crate geom; extern crate "util" as servo_util; -pub mod canvas_render_task; +pub mod canvas_paint_task; diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 486e94bba07..44015c8012c 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -4,11 +4,11 @@ use compositor_layer::{CompositorData, CompositorLayer, DoesntWantScrollEvents}; use compositor_layer::WantsScrollEvents; -use compositor_task::{ChangeReadyState, ChangeRenderState, CompositorEventListener}; +use compositor_task::{ChangeReadyState, ChangePaintState, CompositorEventListener}; use compositor_task::{CompositorProxy, CompositorReceiver, CompositorTask}; use compositor_task::{CreateOrUpdateDescendantLayer, CreateOrUpdateRootLayer, Exit}; use compositor_task::{FrameTreeUpdateMsg, GetGraphicsMetadata, LayerProperties}; -use compositor_task::{LoadComplete, Msg, Paint, RenderMsgDiscarded, ScrollFragmentPoint}; +use compositor_task::{LoadComplete, Msg, Paint, PaintMsgDiscarded, ScrollFragmentPoint}; use compositor_task::{ScrollTimeout, SetIds, SetLayerOrigin, ShutdownComplete}; use constellation::{SendableFrameTree, FrameTreeDiff}; use pipeline::CompositionPipeline; @@ -29,7 +29,7 @@ use geom::point::{Point2D, TypedPoint2D}; use geom::rect::{Rect, TypedRect}; use geom::size::TypedSize2D; use geom::scale_factor::ScaleFactor; -use gfx::render_task::{RenderChan, RenderMsg, RenderRequest, UnusedBufferMsg}; +use gfx::paint_task::{PaintChan, PaintMsg, PaintRequest, UnusedBufferMsg}; use layers::geometry::{DevicePixel, LayerPixel}; use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::rendergl; @@ -39,8 +39,8 @@ use png; use gleam::gl::types::{GLint, GLsizei}; use gleam::gl; use script_traits::{ViewportMsg, ScriptControlChan}; -use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdleRenderState, LayerId}; -use servo_msg::compositor_msg::{ReadyState, RenderingRenderState, RenderState, Scrollable}; +use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdlePaintState, LayerId}; +use servo_msg::compositor_msg::{ReadyState, PaintingPaintState, PaintState, Scrollable}; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, LoadUrlMsg}; use servo_msg::constellation_msg::{NavigateMsg, LoadData, PipelineId, ResizedWindowMsg}; use servo_msg::constellation_msg::{WindowSizeData, KeyState, Key, KeyModifiers}; @@ -97,8 +97,8 @@ pub struct IOCompositor { /// the compositor. shutdown_state: ShutdownState, - /// Tracks outstanding render_msg's sent to the render tasks. - outstanding_render_msgs: uint, + /// Tracks outstanding paint_msg's sent to the paint tasks. + outstanding_paint_msgs: uint, /// Tracks the last composite time. last_composite_time: u64, @@ -112,8 +112,8 @@ pub struct IOCompositor { /// Current display/reflow status of each pipeline. ready_states: HashMap, - /// Current render status of each pipeline. - render_states: HashMap, + /// Current paint status of each pipeline. + paint_states: HashMap, /// Whether the page being rendered has loaded completely. /// Differs from ReadyState because we can finish loading (ready) @@ -173,8 +173,8 @@ impl IOCompositor { -> IOCompositor { // Create an initial layer tree. // - // TODO: There should be no initial layer tree until the renderer creates one from the - // display list. This is only here because we don't have that logic in the renderer yet. + // TODO: There should be no initial layer tree until the painter creates one from the + // display list. This is only here because we don't have that logic in the painter yet. let window_size = window.framebuffer_size(); let hidpi_factor = window.hidpi_factor(); let context = CompositorTask::create_graphics_context(&window.native_metadata()); @@ -200,14 +200,14 @@ impl IOCompositor { zoom_action: false, zoom_time: 0f64, ready_states: HashMap::new(), - render_states: HashMap::new(), + paint_states: HashMap::new(), got_load_complete_message: false, got_set_ids_message: false, constellation_chan: constellation_chan, time_profiler_chan: time_profiler_chan, memory_profiler_chan: memory_profiler_chan, fragment_point: None, - outstanding_render_msgs: 0, + outstanding_paint_msgs: 0, last_composite_time: 0, } } @@ -258,12 +258,12 @@ impl IOCompositor { self.change_ready_state(pipeline_id, ready_state); } - (ChangeRenderState(pipeline_id, render_state), NotShuttingDown) => { - self.change_render_state(pipeline_id, render_state); + (ChangePaintState(pipeline_id, paint_state), NotShuttingDown) => { + self.change_paint_state(pipeline_id, paint_state); } - (RenderMsgDiscarded, NotShuttingDown) => { - self.remove_outstanding_render_msg(); + (PaintMsgDiscarded, NotShuttingDown) => { + self.remove_outstanding_paint_msg(); } (SetIds(frame_tree, response_chan, new_constellation_chan), NotShuttingDown) => { @@ -298,7 +298,7 @@ impl IOCompositor { for (layer_id, new_layer_buffer_set) in replies.into_iter() { self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch); } - self.remove_outstanding_render_msg(); + self.remove_outstanding_paint_msg(); } (ScrollFragmentPoint(pipeline_id, layer_id, point), NotShuttingDown) => { @@ -308,14 +308,14 @@ impl IOCompositor { (LoadComplete(..), NotShuttingDown) => { self.got_load_complete_message = true; - // If we're rendering in headless mode, schedule a recomposite. + // If we're painting in headless mode, schedule a recomposite. if opts::get().output_file.is_some() { self.composite_if_necessary(); } } (ScrollTimeout(timestamp), NotShuttingDown) => { - debug!("scroll timeout, drawing unrendered content!"); + debug!("scroll timeout, drawing unpainted content!"); match self.composition_request { CompositeOnScrollTimeout(this_timestamp) if timestamp == this_timestamp => { self.composition_request = CompositeNow @@ -344,7 +344,7 @@ impl IOCompositor { } self.window.set_ready_state(self.get_earliest_pipeline_ready_state()); - // If we're rendering in headless mode, schedule a recomposite. + // If we're painting in headless mode, schedule a recomposite. if opts::get().output_file.is_some() { self.composite_if_necessary() } @@ -358,52 +358,52 @@ impl IOCompositor { } - fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { - match self.render_states.entry(pipeline_id) { + fn change_paint_state(&mut self, pipeline_id: PipelineId, paint_state: PaintState) { + match self.paint_states.entry(pipeline_id) { Occupied(entry) => { - *entry.into_mut() = render_state; + *entry.into_mut() = paint_state; } Vacant(entry) => { - entry.set(render_state); + entry.set(paint_state); } } - self.window.set_render_state(render_state); + self.window.set_paint_state(paint_state); } - fn all_pipelines_in_idle_render_state(&self) -> bool { + fn all_pipelines_in_idle_paint_state(&self) -> bool { if self.ready_states.len() == 0 { return false; } - return self.render_states.values().all(|&value| value == IdleRenderState); + return self.paint_states.values().all(|&value| value == IdlePaintState); } - fn has_render_msg_tracking(&self) -> bool { - // only track RenderMsg's if the compositor outputs to a file. + fn has_paint_msg_tracking(&self) -> bool { + // only track PaintMsg's if the compositor outputs to a file. opts::get().output_file.is_some() } - fn has_outstanding_render_msgs(&self) -> bool { - self.has_render_msg_tracking() && self.outstanding_render_msgs > 0 + fn has_outstanding_paint_msgs(&self) -> bool { + self.has_paint_msg_tracking() && self.outstanding_paint_msgs > 0 } - fn add_outstanding_render_msg(&mut self, count: uint) { - // return early if not tracking render_msg's - if !self.has_render_msg_tracking() { + fn add_outstanding_paint_msg(&mut self, count: uint) { + // return early if not tracking paint_msg's + if !self.has_paint_msg_tracking() { return; } - debug!("add_outstanding_render_msg {}", self.outstanding_render_msgs); - self.outstanding_render_msgs += count; + debug!("add_outstanding_paint_msg {}", self.outstanding_paint_msgs); + self.outstanding_paint_msgs += count; } - fn remove_outstanding_render_msg(&mut self) { - if !self.has_render_msg_tracking() { + fn remove_outstanding_paint_msg(&mut self) { + if !self.has_paint_msg_tracking() { return; } - if self.outstanding_render_msgs > 0 { - self.outstanding_render_msgs -= 1; + if self.outstanding_paint_msgs > 0 { + self.outstanding_paint_msgs -= 1; } else { - debug!("too many rerender msgs completed"); + debug!("too many repaint msgs completed"); } } @@ -435,9 +435,9 @@ impl IOCompositor { frame_tree: &SendableFrameTree, frame_rect: Option>) -> Rc> { - // Initialize the ReadyState and RenderState for this pipeline. + // Initialize the ReadyState and PaintState for this pipeline. self.ready_states.insert(frame_tree.pipeline.id, Blank); - self.render_states.insert(frame_tree.pipeline.id, RenderingRenderState); + self.paint_states.insert(frame_tree.pipeline.id, PaintingPaintState); let root_layer = create_root_layer_for_pipeline_and_rect(&frame_tree.pipeline, frame_rect); for kid in frame_tree.children.iter() { @@ -483,7 +483,7 @@ impl IOCompositor { opts::get().tile_size); // Add the first child / base layer to the front of the child list, so that - // child iframe layers are rendered on top of the base layer. These iframe + // child iframe layers are painted on top of the base layer. These iframe // layers were added previously when creating the layer tree skeleton in // create_frame_tree_root_layers. root_layer.children().insert(0, first_child); @@ -604,7 +604,7 @@ impl IOCompositor { } None => { // FIXME: This may potentially be triggered by a race condition where a - // buffers are being rendered but the layer is removed before rendering + // buffers are being painted but the layer is removed before painting // completes. panic!("compositor given paint command for non-existent layer"); } @@ -837,32 +837,32 @@ impl IOCompositor { fn convert_buffer_requests_to_pipeline_requests_map(&self, requests: Vec<(Rc>, Vec)>) -> - HashMap)> { + HashMap)> { let scale = self.device_pixels_per_page_px(); let mut results: - HashMap)> = HashMap::new(); + HashMap)> = HashMap::new(); for (layer, mut layer_requests) in requests.into_iter() { let &(_, ref mut vec) = match results.entry(layer.extra_data.borrow().pipeline.id) { Occupied(mut entry) => { *entry.get_mut() = - (layer.extra_data.borrow().pipeline.render_chan.clone(), vec!()); + (layer.extra_data.borrow().pipeline.paint_chan.clone(), vec!()); entry.into_mut() } Vacant(entry) => { - entry.set((layer.extra_data.borrow().pipeline.render_chan.clone(), vec!())) + entry.set((layer.extra_data.borrow().pipeline.paint_chan.clone(), vec!())) } }; - // All the BufferRequests are in layer/device coordinates, but the render task + // All the BufferRequests are in layer/device coordinates, but the paint task // wants to know the page coordinates. We scale them before sending them. for request in layer_requests.iter_mut() { request.page_rect = request.page_rect / scale.get(); } - vec.push(RenderRequest { + vec.push(PaintRequest { buffer_requests: layer_requests, scale: scale.get(), layer_id: layer.extra_data.borrow().id, @@ -879,7 +879,7 @@ impl IOCompositor { let unused_buffers = self.scene.collect_unused_buffers(); if unused_buffers.len() != 0 { let message = UnusedBufferMsg(unused_buffers); - let _ = pipeline.render_chan.send_opt(message); + let _ = pipeline.paint_chan.send_opt(message); } }, None => {} @@ -925,17 +925,17 @@ impl IOCompositor { let pipeline_requests = self.convert_buffer_requests_to_pipeline_requests_map(layers_and_requests); - let mut num_render_msgs_sent = 0; + let mut num_paint_msgs_sent = 0; for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() { - num_render_msgs_sent += 1; - let _ = chan.send_opt(RenderMsg(requests)); + num_paint_msgs_sent += 1; + let _ = chan.send_opt(PaintMsg(requests)); } - self.add_outstanding_render_msg(num_render_msgs_sent); + self.add_outstanding_paint_msg(num_paint_msgs_sent); true } - fn is_ready_to_render_image_output(&self) -> bool { + fn is_ready_to_paint_image_output(&self) -> bool { if !self.got_load_complete_message { return false; } @@ -944,11 +944,11 @@ impl IOCompositor { return false; } - if self.has_outstanding_render_msgs() { + if self.has_outstanding_paint_msgs() { return false; } - if !self.all_pipelines_in_idle_render_state() { + if !self.all_pipelines_in_idle_paint_state() { return false; } @@ -961,7 +961,7 @@ impl IOCompositor { fn composite(&mut self) { let output_image = opts::get().output_file.is_some() && - self.is_ready_to_render_image_output(); + self.is_ready_to_paint_image_output(); let mut framebuffer_ids = vec!(); let mut texture_ids = vec!(); @@ -992,7 +992,7 @@ impl IOCompositor { origin: Zero::zero(), size: self.window_size.as_f32(), }; - // Render the scene. + // paint the scene. match self.scene.root { Some(ref layer) => { rendergl::render_scene(layer.clone(), self.context, &self.scene); diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index b830e630f34..804ebb8625a 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -14,7 +14,7 @@ use geom::matrix::identity; use geom::point::{Point2D, TypedPoint2D}; use geom::size::{Size2D, TypedSize2D}; use geom::rect::Rect; -use gfx::render_task::UnusedBufferMsg; +use gfx::paint_task::UnusedBufferMsg; use layers::color::Color; use layers::geometry::LayerPixel; use layers::layers::{Layer, LayerBufferSet}; @@ -75,19 +75,19 @@ pub trait CompositorLayer { fn add_buffers(&self, new_buffers: Box, epoch: Epoch) -> bool; - /// Destroys all layer tiles, sending the buffers back to the renderer to be destroyed or + /// Destroys all layer tiles, sending the buffers back to the painter to be destroyed or /// reused. fn clear(&self); /// Destroys tiles for this layer and all descendent layers, sending the buffers back to the - /// renderer to be destroyed or reused. + /// painter to be destroyed or reused. fn clear_all_tiles(&self); /// Destroys all tiles of all layers, including children, *without* sending them back to the - /// renderer. You must call this only when the render task is destined to be going down; + /// painter. You must call this only when the paint task is destined to be going down; /// otherwise, you will leak tiles. /// - /// This is used during shutdown, when we know the render task is going away. + /// This is used during shutdown, when we know the paint task is going away. fn forget_all_tiles(&self); /// Move the layer's descendants that don't want scroll events and scroll by a relative @@ -194,7 +194,7 @@ impl CompositorLayer for Layer { epoch, self.extra_data.borrow().pipeline.id); let msg = UnusedBufferMsg(new_buffers.buffers); - let _ = self.extra_data.borrow().pipeline.render_chan.send_opt(msg); + let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg); return false; } @@ -206,7 +206,7 @@ impl CompositorLayer for Layer { let unused_buffers = self.collect_unused_buffers(); if !unused_buffers.is_empty() { // send back unused buffers let msg = UnusedBufferMsg(unused_buffers); - let _ = self.extra_data.borrow().pipeline.render_chan.send_opt(msg); + let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg); } } @@ -217,19 +217,19 @@ impl CompositorLayer for Layer { let mut buffers = self.collect_buffers(); if !buffers.is_empty() { - // We have no way of knowing without a race whether the render task is even up and - // running, but mark the buffers as not leaking. If the render task died, then the + // We have no way of knowing without a race whether the paint task is even up and + // running, but mark the buffers as not leaking. If the paint task died, then the // buffers are going to be cleaned up. for buffer in buffers.iter_mut() { buffer.mark_wont_leak() } - let _ = self.extra_data.borrow().pipeline.render_chan.send_opt(UnusedBufferMsg(buffers)); + let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(UnusedBufferMsg(buffers)); } } /// Destroys tiles for this layer and all descendent layers, sending the buffers back to the - /// renderer to be destroyed or reused. + /// painter to be destroyed or reused. fn clear_all_tiles(&self) { self.clear(); for kid in self.children().iter() { @@ -238,10 +238,10 @@ impl CompositorLayer for Layer { } /// Destroys all tiles of all layers, including children, *without* sending them back to the - /// renderer. You must call this only when the render task is destined to be going down; + /// painter. You must call this only when the paint task is destined to be going down; /// otherwise, you will leak tiles. /// - /// This is used during shutdown, when we know the render task is going away. + /// This is used during shutdown, when we know the paint task is going away. fn forget_all_tiles(&self) { let tiles = self.collect_buffers(); for tile in tiles.into_iter() { diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 8b5510f25f6..89aed5defa0 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -18,7 +18,7 @@ use geom::size::Size2D; use layers::platform::surface::{NativeCompositingGraphicsContext, NativeGraphicsMetadata}; use layers::layers::LayerBufferSet; use servo_msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState}; -use servo_msg::compositor_msg::{RenderListener, RenderState, ScriptListener, ScrollPolicy}; +use servo_msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy}; use servo_msg::constellation_msg::{ConstellationChan, PipelineId}; use servo_util::memory::MemoryProfilerChan; use servo_util::time::TimeProfilerChan; @@ -108,8 +108,8 @@ impl LayerProperties { } } -/// Implementation of the abstract `RenderListener` interface. -impl RenderListener for Box { +/// Implementation of the abstract `PaintListener` interface. +impl PaintListener for Box { fn get_graphics_metadata(&mut self) -> Option { let (chan, port) = channel(); self.send(GetGraphicsMetadata(chan)); @@ -142,12 +142,12 @@ impl RenderListener for Box { } } - fn render_msg_discarded(&mut self) { - self.send(RenderMsgDiscarded); + fn paint_msg_discarded(&mut self) { + self.send(PaintMsgDiscarded); } - fn set_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { - self.send(ChangeRenderState(pipeline_id, render_state)) + fn set_paint_state(&mut self, pipeline_id: PipelineId, paint_state: PaintState) { + self.send(ChangePaintState(pipeline_id, paint_state)) } } @@ -161,7 +161,7 @@ pub enum Msg { /// at the time that we send it an ExitMsg. ShutdownComplete, - /// Requests the compositor's graphics metadata. Graphics metadata is what the renderer needs + /// Requests the compositor's graphics metadata. Graphics metadata is what the painter needs /// to create surfaces that the compositor can see. On Linux this is the X display; on Mac this /// is the pixel format. /// @@ -182,11 +182,11 @@ pub enum Msg { Paint(PipelineId, Epoch, Vec<(LayerId, Box)>), /// Alerts the compositor to the current status of page loading. ChangeReadyState(PipelineId, ReadyState), - /// Alerts the compositor to the current status of rendering. - ChangeRenderState(PipelineId, RenderState), - /// Alerts the compositor that the RenderMsg has been discarded. - RenderMsgDiscarded, - /// Sets the channel to the current layout and render tasks, along with their id + /// Alerts the compositor to the current status of painting. + ChangePaintState(PipelineId, PaintState), + /// Alerts the compositor that the PaintMsg has been discarded. + PaintMsgDiscarded, + /// Sets the channel to the current layout and paint tasks, along with their id SetIds(SendableFrameTree, Sender<()>, ConstellationChan), /// Sends an updated version of the frame tree. FrameTreeUpdateMsg(FrameTreeDiff, Sender<()>), @@ -209,8 +209,8 @@ impl Show for Msg { ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"), Paint(..) => write!(f, "Paint"), ChangeReadyState(..) => write!(f, "ChangeReadyState"), - ChangeRenderState(..) => write!(f, "ChangeRenderState"), - RenderMsgDiscarded(..) => write!(f, "RenderMsgDiscarded"), + ChangePaintState(..) => write!(f, "ChangePaintState"), + PaintMsgDiscarded(..) => write!(f, "PaintMsgDiscarded"), SetIds(..) => write!(f, "SetIds"), FrameTreeUpdateMsg(..) => write!(f, "FrameTreeUpdateMsg"), LoadComplete => write!(f, "LoadComplete"), diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 71a32fca6e1..5155801f553 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -10,7 +10,7 @@ use devtools_traits::DevtoolsControlChan; use geom::rect::{Rect, TypedRect}; use geom::scale_factor::ScaleFactor; use gfx::font_cache_task::FontCacheTask; -use gfx::render_task; +use gfx::paint_task; use layers::geometry::DevicePixel; use layout_traits::{LayoutControlChan, LayoutTaskFactory, ExitNowMsg}; use libc; @@ -21,7 +21,7 @@ use servo_msg::compositor_msg::LayerId; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, FailureMsg, Failure, FrameRectMsg}; use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed, InitLoadUrlMsg}; use servo_msg::constellation_msg::{LoadCompleteMsg, LoadUrlMsg, LoadData, Msg, NavigateMsg}; -use servo_msg::constellation_msg::{NavigationType, PipelineId, RendererReadyMsg, ResizedWindowMsg}; +use servo_msg::constellation_msg::{NavigationType, PipelineId, PainterReadyMsg, ResizedWindowMsg}; use servo_msg::constellation_msg::{ScriptLoadedURLInIFrameMsg, SubpageId, WindowSizeData}; use servo_msg::constellation_msg::{KeyEvent, Key, KeyState, KeyModifiers}; use servo_msg::constellation_msg; @@ -452,10 +452,10 @@ impl Constellation { debug!("constellation got navigation message"); self.handle_navigate_msg(direction); } - // Notification that rendering has finished and is requesting permission to paint. - RendererReadyMsg(pipeline_id) => { - debug!("constellation got renderer ready message"); - self.handle_renderer_ready_msg(pipeline_id); + // Notification that painting has finished and is requesting permission to paint. + PainterReadyMsg(pipeline_id) => { + debug!("constellation got painter ready message"); + self.handle_painter_ready_msg(pipeline_id); } ResizedWindowMsg(new_size) => { debug!("constellation got window resize message"); @@ -506,7 +506,7 @@ impl Constellation { fn force_pipeline_exit(old_pipeline: &Rc) { let ScriptControlChan(ref old_script) = old_pipeline.script_chan; let _ = old_script.send_opt(ExitPipelineMsg(old_pipeline.id)); - let _ = old_pipeline.render_chan.send_opt(render_task::ExitMsg(None)); + let _ = old_pipeline.paint_chan.send_opt(paint_task::ExitMsg(None)); let LayoutControlChan(ref old_layout) = old_pipeline.layout_chan; let _ = old_layout.send_opt(ExitNowMsg); } @@ -787,8 +787,8 @@ impl Constellation { }); } - fn handle_renderer_ready_msg(&mut self, pipeline_id: PipelineId) { - debug!("Renderer {} ready to send paint msg", pipeline_id); + fn handle_painter_ready_msg(&mut self, pipeline_id: PipelineId) { + debug!("Painter {} ready to send paint msg", pipeline_id); // This message could originate from a pipeline in the navigation context or // from a pending frame. The only time that we will grant paint permission is // when the message originates from a pending frame or the current frame. diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs index 9174750aa50..459af00fcc2 100644 --- a/components/compositing/headless.rs +++ b/components/compositing/headless.rs @@ -4,7 +4,7 @@ use compositor_task::{GetGraphicsMetadata, CreateOrUpdateRootLayer, CreateOrUpdateDescendantLayer}; use compositor_task::{Exit, ChangeReadyState, LoadComplete, Paint, ScrollFragmentPoint, SetIds}; -use compositor_task::{SetLayerOrigin, ShutdownComplete, ChangeRenderState, RenderMsgDiscarded}; +use compositor_task::{SetLayerOrigin, ShutdownComplete, ChangePaintState, PaintMsgDiscarded}; use compositor_task::{CompositorEventListener, CompositorReceiver, ScrollTimeout, FrameTreeUpdateMsg}; use windowing::WindowEvent; @@ -103,8 +103,8 @@ impl CompositorEventListener for NullCompositor { CreateOrUpdateRootLayer(..) | CreateOrUpdateDescendantLayer(..) | SetLayerOrigin(..) | Paint(..) | - ChangeReadyState(..) | ChangeRenderState(..) | ScrollFragmentPoint(..) | - LoadComplete | RenderMsgDiscarded(..) | ScrollTimeout(..) => () + ChangeReadyState(..) | ChangePaintState(..) | ScrollFragmentPoint(..) | + LoadComplete | PaintMsgDiscarded(..) | ScrollTimeout(..) => () } true } diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index e6972d1361b..cf1ebd16f8c 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -8,8 +8,8 @@ use script_traits::{ScriptControlChan, ScriptTaskFactory}; use script_traits::{AttachLayoutMsg, LoadMsg, NewLayoutInfo, ExitPipelineMsg}; use devtools_traits::DevtoolsControlChan; -use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked}; -use gfx::render_task::{RenderChan, RenderTask}; +use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked}; +use gfx::paint_task::{PaintChan, PaintTask}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId}; use servo_msg::constellation_msg::{LoadData, WindowSizeData}; use servo_net::image_cache_task::ImageCacheTask; @@ -19,15 +19,15 @@ use servo_net::storage_task::StorageTask; use servo_util::time::TimeProfilerChan; use std::rc::Rc; -/// A uniquely-identifiable pipeline of script task, layout task, and render task. +/// A uniquely-identifiable pipeline of script task, layout task, and paint task. pub struct Pipeline { pub id: PipelineId, pub subpage_id: Option, pub script_chan: ScriptControlChan, pub layout_chan: LayoutControlChan, - pub render_chan: RenderChan, + pub paint_chan: PaintChan, pub layout_shutdown_port: Receiver<()>, - pub render_shutdown_port: Receiver<()>, + pub paint_shutdown_port: Receiver<()>, /// The most recently loaded page pub load_data: LoadData, } @@ -37,11 +37,11 @@ pub struct Pipeline { pub struct CompositionPipeline { pub id: PipelineId, pub script_chan: ScriptControlChan, - pub render_chan: RenderChan, + pub paint_chan: PaintChan, } impl Pipeline { - /// Starts a render task, layout task, and possibly a script task. + /// Starts a paint task, layout task, and possibly a script task. /// Returns the channels wrapped in a struct. /// If script_pipeline is not None, then subpage_id must also be not None. pub fn create( @@ -60,8 +60,8 @@ impl Pipeline { load_data: LoadData) -> Pipeline { let layout_pair = ScriptTaskFactory::create_layout_channel(None::<&mut STF>); - let (render_port, render_chan) = RenderChan::new(); - let (render_shutdown_chan, render_shutdown_port) = channel(); + let (paint_port, paint_chan) = PaintChan::new(); + let (paint_shutdown_chan, paint_shutdown_port) = channel(); let (layout_shutdown_chan, layout_shutdown_port) = channel(); let (pipeline_chan, pipeline_port) = channel(); @@ -102,14 +102,14 @@ impl Pipeline { } }; - RenderTask::create(id, - render_port, - compositor_proxy, - constellation_chan.clone(), - font_cache_task.clone(), - failure.clone(), - time_profiler_chan.clone(), - render_shutdown_chan); + PaintTask::create(id, + paint_port, + compositor_proxy, + constellation_chan.clone(), + font_cache_task.clone(), + failure.clone(), + time_profiler_chan.clone(), + paint_shutdown_chan); LayoutTaskFactory::create(None::<&mut LTF>, id, @@ -118,7 +118,7 @@ impl Pipeline { constellation_chan, failure, script_chan.clone(), - render_chan.clone(), + paint_chan.clone(), resource_task, image_cache_task, font_cache_task, @@ -129,9 +129,9 @@ impl Pipeline { subpage_id, script_chan, LayoutControlChan(pipeline_chan), - render_chan, + paint_chan, layout_shutdown_port, - render_shutdown_port, + paint_shutdown_port, load_data) } @@ -139,9 +139,9 @@ impl Pipeline { subpage_id: Option, script_chan: ScriptControlChan, layout_chan: LayoutControlChan, - render_chan: RenderChan, + paint_chan: PaintChan, layout_shutdown_port: Receiver<()>, - render_shutdown_port: Receiver<()>, + paint_shutdown_port: Receiver<()>, load_data: LoadData) -> Pipeline { Pipeline { @@ -149,9 +149,9 @@ impl Pipeline { subpage_id: subpage_id, script_chan: script_chan, layout_chan: layout_chan, - render_chan: render_chan, + paint_chan: paint_chan, layout_shutdown_port: layout_shutdown_port, - render_shutdown_port: render_shutdown_port, + paint_shutdown_port: paint_shutdown_port, load_data: load_data, } } @@ -162,24 +162,24 @@ impl Pipeline { } pub fn grant_paint_permission(&self) { - let _ = self.render_chan.send_opt(PaintPermissionGranted); + let _ = self.paint_chan.send_opt(PaintPermissionGranted); } pub fn revoke_paint_permission(&self) { - debug!("pipeline revoking render channel paint permission"); - let _ = self.render_chan.send_opt(PaintPermissionRevoked); + debug!("pipeline revoking paint channel paint permission"); + let _ = self.paint_chan.send_opt(PaintPermissionRevoked); } pub fn exit(&self) { debug!("pipeline {} exiting", self.id); - // Script task handles shutting down layout, and layout handles shutting down the renderer. + // Script task handles shutting down layout, and layout handles shutting down the painter. // For now, if the script task has failed, we give up on clean shutdown. let ScriptControlChan(ref chan) = self.script_chan; if chan.send_opt(ExitPipelineMsg(self.id)).is_ok() { // Wait until all slave tasks have terminated and run destructors // NOTE: We don't wait for script task as we don't always own it - let _ = self.render_shutdown_port.recv_opt(); + let _ = self.paint_shutdown_port.recv_opt(); let _ = self.layout_shutdown_port.recv_opt(); } } @@ -188,7 +188,7 @@ impl Pipeline { CompositionPipeline { id: self.id.clone(), script_chan: self.script_chan.clone(), - render_chan: self.render_chan.clone(), + paint_chan: self.paint_chan.clone(), } } } diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 4476ddf43fa..0dffe0a8f94 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -12,7 +12,7 @@ use geom::size::TypedSize2D; use layers::geometry::DevicePixel; use layers::platform::surface::NativeGraphicsMetadata; use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers}; -use servo_msg::compositor_msg::{ReadyState, RenderState}; +use servo_msg::compositor_msg::{ReadyState, PaintState}; use servo_util::geometry::ScreenPx; use std::fmt::{FormatError, Formatter, Show}; use std::rc::Rc; @@ -90,8 +90,8 @@ pub trait WindowMethods { /// Sets the ready state of the current page. fn set_ready_state(&self, ready_state: ReadyState); - /// Sets the render state of the current page. - fn set_render_state(&self, render_state: RenderState); + /// Sets the paint state of the current page. + fn set_paint_state(&self, paint_state: PaintState); /// Returns the hidpi factor of the monitor. fn hidpi_factor(&self) -> ScaleFactor; diff --git a/components/gfx/buffer_map.rs b/components/gfx/buffer_map.rs index 04dc2a28f19..fab6ffc2f5e 100644 --- a/components/gfx/buffer_map.rs +++ b/components/gfx/buffer_map.rs @@ -12,7 +12,7 @@ use std::hash::sip::SipState; use std::mem; /// This is a struct used to store buffers when they are not in use. -/// The render task can quickly query for a particular size of buffer when it +/// The paint task can quickly query for a particular size of buffer when it /// needs it. pub struct BufferMap { /// A HashMap that stores the Buffers. diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 68b0e3d38ed..1cc152333da 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -2,12 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -//! Servo heavily uses display lists, which are retained-mode lists of rendering commands to -//! perform. Using a list instead of rendering elements in immediate mode allows transforms, hit +//! Servo heavily uses display lists, which are retained-mode lists of painting commands to +//! perform. Using a list instead of painting elements in immediate mode allows transforms, hit //! testing, and invalidation to be performed using the same primitives as painting. It also allows -//! Servo to aggressively cull invisible and out-of-bounds rendering elements, to reduce overdraw. -//! Finally, display lists allow tiles to be farmed out onto multiple CPUs and rendered in -//! parallel (although this benefit does not apply to GPU-based rendering). +//! Servo to aggressively cull invisible and out-of-bounds painting elements, to reduce overdraw. +//! Finally, display lists allow tiles to be farmed out onto multiple CPUs and painted in +//! parallel (although this benefit does not apply to GPU-based painting). //! //! Display items describe relatively high-level drawing operations (for example, entire borders //! and shadows instead of lines and blur operations), to reduce the amount of allocation required. @@ -16,7 +16,7 @@ use color::Color; use display_list::optimizer::DisplayListOptimizer; -use render_context::{RenderContext, ToAzureRect}; +use paint_context::{PaintContext, ToAzureRect}; use text::glyph::CharIndex; use text::TextRun; @@ -24,7 +24,7 @@ use azure::azure::AzFloat; use collections::dlist::{mod, DList}; use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D}; use libc::uintptr_t; -use render_task::RenderLayer; +use paint_task::PaintLayer; use script_traits::UntrustedNodeAddress; use servo_msg::compositor_msg::LayerId; use servo_net::image::base::Image; @@ -138,7 +138,7 @@ pub struct StackingContext { /// The display items that make up this stacking context. pub display_list: Box, /// The layer for this stacking context, if there is one. - pub layer: Option>, + pub layer: Option>, /// The position and size of this stacking context. pub bounds: Rect, /// The clipping rect for this stacking context, in the coordinate system of the *parent* @@ -160,7 +160,7 @@ impl StackingContext { bounds: Rect, z_index: i32, opacity: AzFloat, - layer: Option>) + layer: Option>) -> StackingContext { StackingContext { display_list: display_list, @@ -174,19 +174,19 @@ impl StackingContext { /// Draws the stacking context in the proper order according to the steps in CSS 2.1 § E.2. pub fn optimize_and_draw_into_context(&self, - render_context: &mut RenderContext, + paint_context: &mut PaintContext, tile_bounds: &Rect, current_transform: &Matrix2D, current_clip_stack: &mut Vec>) { let temporary_draw_target = - render_context.get_or_create_temporary_draw_target(self.opacity); + paint_context.get_or_create_temporary_draw_target(self.opacity); { - let mut render_subcontext = RenderContext { + let mut paint_subcontext = PaintContext { draw_target: temporary_draw_target.clone(), - font_ctx: &mut *render_context.font_ctx, - page_rect: render_context.page_rect, - screen_rect: render_context.screen_rect, - ..*render_context + font_ctx: &mut *paint_context.font_ctx, + page_rect: paint_context.page_rect, + screen_rect: paint_context.screen_rect, + ..*paint_context }; // Optimize the display list to throw out out-of-bounds display items and so forth. @@ -203,7 +203,7 @@ impl StackingContext { // Steps 1 and 2: Borders and background for the root. for display_item in display_list.background_and_borders.iter() { - display_item.draw_into_context(&mut render_subcontext, + display_item.draw_into_context(&mut paint_subcontext, current_transform, current_clip_stack) } @@ -222,7 +222,7 @@ impl StackingContext { let new_tile_rect = self.compute_tile_rect_for_child_stacking_context(tile_bounds, &**positioned_kid); - positioned_kid.optimize_and_draw_into_context(&mut render_subcontext, + positioned_kid.optimize_and_draw_into_context(&mut paint_subcontext, &new_tile_rect, &new_transform, current_clip_stack); @@ -231,14 +231,14 @@ impl StackingContext { // Step 4: Block backgrounds and borders. for display_item in display_list.block_backgrounds_and_borders.iter() { - display_item.draw_into_context(&mut render_subcontext, + display_item.draw_into_context(&mut paint_subcontext, current_transform, current_clip_stack) } // Step 5: Floats. for display_item in display_list.floats.iter() { - display_item.draw_into_context(&mut render_subcontext, + display_item.draw_into_context(&mut paint_subcontext, current_transform, current_clip_stack) } @@ -247,7 +247,7 @@ impl StackingContext { // Step 7: Content. for display_item in display_list.content.iter() { - display_item.draw_into_context(&mut render_subcontext, + display_item.draw_into_context(&mut paint_subcontext, current_transform, current_clip_stack) } @@ -267,7 +267,7 @@ impl StackingContext { let new_tile_rect = self.compute_tile_rect_for_child_stacking_context(tile_bounds, &**positioned_kid); - positioned_kid.optimize_and_draw_into_context(&mut render_subcontext, + positioned_kid.optimize_and_draw_into_context(&mut paint_subcontext, &new_tile_rect, &new_transform, current_clip_stack); @@ -277,7 +277,7 @@ impl StackingContext { // TODO(pcwalton): Step 10: Outlines. } - render_context.draw_temporary_draw_target_if_necessary(&temporary_draw_target, + paint_context.draw_temporary_draw_target_if_necessary(&temporary_draw_target, self.opacity) } @@ -439,14 +439,14 @@ impl BaseDisplayItem { } } -/// Renders a solid color. +/// Paints a solid color. #[deriving(Clone)] pub struct SolidColorDisplayItem { pub base: BaseDisplayItem, pub color: Color, } -/// Renders text. +/// Paints text. #[deriving(Clone)] pub struct TextDisplayItem { /// Fields common to all display items. @@ -472,7 +472,7 @@ pub enum TextOrientation { SidewaysRight, } -/// Renders an image. +/// Paints an image. #[deriving(Clone)] pub struct ImageDisplayItem { pub base: BaseDisplayItem, @@ -500,7 +500,7 @@ pub struct GradientDisplayItem { pub stops: Vec, } -/// Renders a border. +/// Paints a border. #[deriving(Clone)] pub struct BorderDisplayItem { /// Fields common to all display items. @@ -532,7 +532,7 @@ pub struct BorderRadii { pub bottom_left: T, } -/// Renders a line segment. +/// Paints a line segment. #[deriving(Clone)] pub struct LineDisplayItem { pub base: BaseDisplayItem, @@ -560,32 +560,32 @@ impl<'a> Iterator<&'a DisplayItem> for DisplayItemIterator<'a> { } impl DisplayItem { - /// Renders this display item into the given render context. + /// Paints this display item into the given paint context. fn draw_into_context(&self, - render_context: &mut RenderContext, + paint_context: &mut PaintContext, current_transform: &Matrix2D, current_clip_stack: &mut Vec>) { // TODO(pcwalton): This will need some tweaking to deal with more complex clipping regions. let clip_rect = &self.base().clip_rect; if current_clip_stack.len() == 0 || current_clip_stack.last().unwrap() != clip_rect { while current_clip_stack.len() != 0 { - render_context.draw_pop_clip(); + paint_context.draw_pop_clip(); drop(current_clip_stack.pop()); } - render_context.draw_push_clip(clip_rect); + paint_context.draw_push_clip(clip_rect); current_clip_stack.push(*clip_rect); } - render_context.draw_target.set_transform(current_transform); + paint_context.draw_target.set_transform(current_transform); match *self { SolidColorDisplayItemClass(ref solid_color) => { - render_context.draw_solid_color(&solid_color.base.bounds, solid_color.color) + paint_context.draw_solid_color(&solid_color.base.bounds, solid_color.color) } TextDisplayItemClass(ref text) => { debug!("Drawing text at {}.", text.base.bounds); - render_context.draw_text(&**text, current_transform); + paint_context.draw_text(&**text, current_transform); } ImageDisplayItemClass(ref image_item) => { @@ -600,7 +600,7 @@ impl DisplayItem { bounds.origin.y = bounds.origin.y + y_offset; bounds.size = image_item.stretch_size; - render_context.draw_image(bounds, image_item.image.clone()); + paint_context.draw_image(bounds, image_item.image.clone()); x_offset = x_offset + image_item.stretch_size.width; } @@ -610,7 +610,7 @@ impl DisplayItem { } BorderDisplayItemClass(ref border) => { - render_context.draw_border(&border.base.bounds, + paint_context.draw_border(&border.base.bounds, border.border_widths, &border.radius, border.color, @@ -618,14 +618,14 @@ impl DisplayItem { } GradientDisplayItemClass(ref gradient) => { - render_context.draw_linear_gradient(&gradient.base.bounds, + paint_context.draw_linear_gradient(&gradient.base.bounds, &gradient.start_point, &gradient.end_point, gradient.stops.as_slice()); } LineDisplayItemClass(ref line) => { - render_context.draw_line(&line.base.bounds, + paint_context.draw_line(&line.base.bounds, line.color, line.style) } diff --git a/components/gfx/display_list/optimizer.rs b/components/gfx/display_list/optimizer.rs index 9ce3fbfc3f1..cb5703b6c3e 100644 --- a/components/gfx/display_list/optimizer.rs +++ b/components/gfx/display_list/optimizer.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -//! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. +//! Transforms a display list to produce a visually-equivalent, but cheaper-to-paint, one. use display_list::{DisplayItem, DisplayList, StackingContext}; @@ -11,7 +11,7 @@ use geom::rect::Rect; use servo_util::geometry::{mod, Au}; use sync::Arc; -/// Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. +/// Transforms a display list to produce a visually-equivalent, but cheaper-to-paint, one. pub struct DisplayListOptimizer { /// The visible rect in page coordinates. visible_rect: Rect, diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 87eb7a77833..e77f5d2d8a1 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -50,9 +50,9 @@ struct FallbackFontCacheEntry { font: Rc>, } -/// A cached azure font (per render task) that +/// A cached azure font (per paint task) that /// can be shared by multiple text runs. -struct RenderFontCacheEntry { +struct PaintFontCacheEntry { pt_size: Au, identifier: String, font: Rc>, @@ -60,7 +60,7 @@ struct RenderFontCacheEntry { /// The FontContext represents the per-thread/task state necessary for /// working with fonts. It is the public API used by the layout and -/// render code. It talks directly to the font cache task where +/// paint code. It talks directly to the font cache task where /// required. pub struct FontContext { platform_handle: FontContextHandle, @@ -70,9 +70,9 @@ pub struct FontContext { layout_font_cache: Vec, fallback_font_cache: Vec, - /// Strong reference as the render FontContext is (for now) recycled + /// Strong reference as the paint FontContext is (for now) recycled /// per frame. TODO: Make this weak when incremental redraw is done. - render_font_cache: Vec, + paint_font_cache: Vec, last_style: Option>, last_fontgroup: Option>, @@ -86,7 +86,7 @@ impl FontContext { font_cache_task: font_cache_task, layout_font_cache: vec!(), fallback_font_cache: vec!(), - render_font_cache: vec!(), + paint_font_cache: vec!(), last_style: None, last_fontgroup: None, } @@ -97,7 +97,7 @@ impl FontContext { descriptor: FontTemplateDescriptor, pt_size: Au, variant: font_variant::T) -> Font { // TODO: (Bug #3463): Currently we only support fake small-caps - // rendering. We should also support true small-caps (where the + // painting. We should also support true small-caps (where the // font supports it) in the future. let actual_pt_size = match variant { font_variant::small_caps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR), @@ -227,26 +227,26 @@ impl FontContext { font_group } - /// Create a render font for use with azure. May return a cached + /// Create a paint font for use with azure. May return a cached /// reference if already used by this font context. - pub fn get_render_font_from_template(&mut self, + pub fn get_paint_font_from_template(&mut self, template: &Arc, pt_size: Au) -> Rc> { - for cached_font in self.render_font_cache.iter() { + for cached_font in self.paint_font_cache.iter() { if cached_font.pt_size == pt_size && cached_font.identifier == template.identifier { return cached_font.font.clone(); } } - let render_font = Rc::new(RefCell::new(create_scaled_font(template, pt_size))); - self.render_font_cache.push(RenderFontCacheEntry{ - font: render_font.clone(), + let paint_font = Rc::new(RefCell::new(create_scaled_font(template, pt_size))); + self.paint_font_cache.push(PaintFontCacheEntry{ + font: paint_font.clone(), pt_size: pt_size, identifier: template.identifier.clone(), }); - render_font + paint_font } /// Returns a reference to the font cache task. diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 701390e072c..943de358ddd 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -50,16 +50,16 @@ extern crate freetype; #[cfg(target_os="macos")] extern crate core_graphics; #[cfg(target_os="macos")] extern crate core_text; -pub use render_context::RenderContext; +pub use paint_context::PaintContext; -// Private rendering modules -mod render_context; +// Private painting modules +mod paint_context; -// Rendering +// Painting pub mod color; #[path="display_list/mod.rs"] pub mod display_list; -pub mod render_task; +pub mod paint_task; // Fonts pub mod font; diff --git a/components/gfx/render_context.rs b/components/gfx/paint_context.rs similarity index 99% rename from components/gfx/render_context.rs rename to components/gfx/paint_context.rs index 1cbface3a8b..4a5e9767d08 100644 --- a/components/gfx/render_context.rs +++ b/components/gfx/paint_context.rs @@ -33,7 +33,7 @@ use sync::Arc; use text::TextRun; use text::glyph::CharIndex; -pub struct RenderContext<'a> { +pub struct PaintContext<'a> { pub draw_target: DrawTarget, pub font_ctx: &'a mut Box, /// The rectangle that this context encompasses in page coordinates. @@ -54,7 +54,7 @@ enum DashSize { DashedBorder = 3 } -impl<'a> RenderContext<'a> { +impl<'a> PaintContext<'a> { pub fn get_draw_target(&self) -> &DrawTarget { &self.draw_target } @@ -657,7 +657,7 @@ impl<'a> RenderContext<'a> { }; self.font_ctx - .get_render_font_from_template(&text.text_run.font_template, + .get_paint_font_from_template(&text.text_run.font_template, text.text_run.actual_pt_size) .borrow() .draw_text_into_context(self, @@ -717,7 +717,7 @@ impl<'a> RenderContext<'a> { temporary_draw_target: &DrawTarget, opacity: AzFloat) { if (*temporary_draw_target) == self.draw_target { - // We're directly rendering to the surface; nothing to do. + // We're directly painting to the surface; nothing to do. return } @@ -803,7 +803,7 @@ impl ToRadiiPx for BorderRadii { trait ScaledFontExtensionMethods { fn draw_text_into_context(&self, - rctx: &RenderContext, + rctx: &PaintContext, run: &Box, range: &Range, baseline_origin: Point2D, @@ -813,7 +813,7 @@ trait ScaledFontExtensionMethods { impl ScaledFontExtensionMethods for ScaledFont { fn draw_text_into_context(&self, - rctx: &RenderContext, + rctx: &PaintContext, run: &Box, range: &Range, baseline_origin: Point2D, diff --git a/components/gfx/render_task.rs b/components/gfx/paint_task.rs similarity index 85% rename from components/gfx/render_task.rs rename to components/gfx/paint_task.rs index 6013fc8f936..a15e82a031e 100644 --- a/components/gfx/render_task.rs +++ b/components/gfx/paint_task.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -//! The task that handles all rendering/painting. +//! The task that handles all painting. use buffer_map::BufferMap; use display_list::{mod, StackingContext}; use font_cache_task::FontCacheTask; use font_context::FontContext; -use render_context::RenderContext; +use paint_context::PaintContext; use azure::azure_hl::{B8G8R8A8, Color, DrawTarget, SkiaBackend, StolenGLResources}; use azure::AzFloat; @@ -21,10 +21,10 @@ use layers::platform::surface::{NativeSurface, NativeSurfaceMethods}; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers; use native::task::NativeTaskBuilder; -use servo_msg::compositor_msg::{Epoch, IdleRenderState, LayerId}; -use servo_msg::compositor_msg::{LayerMetadata, RenderListener, RenderingRenderState, ScrollPolicy}; +use servo_msg::compositor_msg::{Epoch, IdlePaintState, LayerId}; +use servo_msg::compositor_msg::{LayerMetadata, PaintListener, PaintingPaintState, ScrollPolicy}; use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineId}; -use servo_msg::constellation_msg::{RendererReadyMsg}; +use servo_msg::constellation_msg::{PainterReadyMsg}; use servo_msg::platform::surface::NativeSurfaceAzureMethods; use servo_util::geometry::{Au, ZERO_POINT}; use servo_util::opts; @@ -40,19 +40,19 @@ use sync::Arc; /// Information about a hardware graphics layer that layout sends to the painting task. #[deriving(Clone)] -pub struct RenderLayer { +pub struct PaintLayer { /// A per-pipeline ID describing this layer that should be stable across reflows. pub id: LayerId, - /// The color of the background in this layer. Used for unrendered content. + /// The color of the background in this layer. Used for unpainted content. pub background_color: Color, /// The scrolling policy of this layer. pub scroll_policy: ScrollPolicy, } -impl RenderLayer { - /// Creates a new `RenderLayer`. - pub fn new(id: LayerId, background_color: Color, scroll_policy: ScrollPolicy) -> RenderLayer { - RenderLayer { +impl PaintLayer { + /// Creates a new `PaintLayer`. + pub fn new(id: LayerId, background_color: Color, scroll_policy: ScrollPolicy) -> PaintLayer { + PaintLayer { id: id, background_color: background_color, scroll_policy: scroll_policy, @@ -60,7 +60,7 @@ impl RenderLayer { } } -pub struct RenderRequest { +pub struct PaintRequest { pub buffer_requests: Vec, pub scale: f32, pub layer_id: LayerId, @@ -68,8 +68,8 @@ pub struct RenderRequest { } pub enum Msg { - RenderInitMsg(Arc), - RenderMsg(Vec), + PaintInitMsg(Arc), + PaintMsg(Vec), UnusedBufferMsg(Vec>), PaintPermissionGranted, PaintPermissionRevoked, @@ -77,26 +77,26 @@ pub enum Msg { } #[deriving(Clone)] -pub struct RenderChan(Sender); +pub struct PaintChan(Sender); -impl RenderChan { - pub fn new() -> (Receiver, RenderChan) { +impl PaintChan { + pub fn new() -> (Receiver, PaintChan) { let (chan, port) = channel(); - (port, RenderChan(chan)) + (port, PaintChan(chan)) } pub fn send(&self, msg: Msg) { - let &RenderChan(ref chan) = self; - assert!(chan.send_opt(msg).is_ok(), "RenderChan.send: render port closed") + let &PaintChan(ref chan) = self; + assert!(chan.send_opt(msg).is_ok(), "PaintChan.send: paint port closed") } pub fn send_opt(&self, msg: Msg) -> Result<(), Msg> { - let &RenderChan(ref chan) = self; + let &PaintChan(ref chan) = self; chan.send_opt(msg) } } -pub struct RenderTask { +pub struct PaintTask { id: PipelineId, port: Receiver, compositor: C, @@ -125,10 +125,10 @@ pub struct RenderTask { } // If we implement this as a function, we get borrowck errors from borrowing -// the whole RenderTask struct. +// the whole PaintTask struct. macro_rules! native_graphics_context( ($task:expr) => ( - $task.native_graphics_context.as_ref().expect("Need a graphics context to do rendering") + $task.native_graphics_context.as_ref().expect("Need a graphics context to do painting") ) ) @@ -136,7 +136,7 @@ fn initialize_layers(compositor: &mut C, pipeline_id: PipelineId, epoch: Epoch, root_stacking_context: &StackingContext) - where C: RenderListener { + where C: PaintListener { let mut metadata = Vec::new(); build(&mut metadata, root_stacking_context, &ZERO_POINT); compositor.initialize_layers_for_pipeline(pipeline_id, metadata, epoch); @@ -147,16 +147,16 @@ fn initialize_layers(compositor: &mut C, let page_position = stacking_context.bounds.origin + *page_position; match stacking_context.layer { None => {} - Some(ref render_layer) => { + Some(ref paint_layer) => { metadata.push(LayerMetadata { - id: render_layer.id, + id: paint_layer.id, position: Rect(Point2D(page_position.x.to_nearest_px() as uint, page_position.y.to_nearest_px() as uint), Size2D(stacking_context.bounds.size.width.to_nearest_px() as uint, stacking_context.bounds.size.height.to_nearest_px() as uint)), - background_color: render_layer.background_color, - scroll_policy: render_layer.scroll_policy, + background_color: paint_layer.background_color, + scroll_policy: paint_layer.scroll_policy, }) } } @@ -167,7 +167,7 @@ fn initialize_layers(compositor: &mut C, } } -impl RenderTask where C: RenderListener + Send { +impl PaintTask where C: PaintListener + Send { pub fn create(id: PipelineId, port: Receiver, compositor: C, @@ -177,9 +177,9 @@ impl RenderTask where C: RenderListener + Send { time_profiler_chan: TimeProfilerChan, shutdown_chan: Sender<()>) { let ConstellationChan(c) = constellation_chan.clone(); - spawn_named_with_send_on_failure("RenderTask", task_state::RENDER, proc() { + spawn_named_with_send_on_failure("PaintTask", task_state::PAINT, proc() { { - // Ensures that the render task and graphics context are destroyed before the + // Ensures that the paint task and graphics context are destroyed before the // shutdown message. let mut compositor = compositor; let native_graphics_context = compositor.get_graphics_metadata().map( @@ -189,7 +189,7 @@ impl RenderTask where C: RenderListener + Send { time_profiler_chan.clone()); // FIXME: rust/#5967 - let mut render_task = RenderTask { + let mut paint_task = PaintTask { id: id, port: port, compositor: compositor, @@ -203,38 +203,38 @@ impl RenderTask where C: RenderListener + Send { worker_threads: worker_threads, }; - render_task.start(); + paint_task.start(); // Destroy all the buffers. - match render_task.native_graphics_context.as_ref() { - Some(ctx) => render_task.buffer_map.clear(ctx), + match paint_task.native_graphics_context.as_ref() { + Some(ctx) => paint_task.buffer_map.clear(ctx), None => (), } // Tell all the worker threads to shut down. - for worker_thread in render_task.worker_threads.iter_mut() { + for worker_thread in paint_task.worker_threads.iter_mut() { worker_thread.exit() } } - debug!("render_task: shutdown_chan send"); + debug!("paint_task: shutdown_chan send"); shutdown_chan.send(()); }, FailureMsg(failure_msg), c, true); } fn start(&mut self) { - debug!("render_task: beginning rendering loop"); + debug!("paint_task: beginning painting loop"); loop { match self.port.recv() { - RenderInitMsg(stacking_context) => { + PaintInitMsg(stacking_context) => { self.epoch.next(); self.root_stacking_context = Some(stacking_context.clone()); if !self.paint_permission { - debug!("render_task: render ready msg"); + debug!("paint_task: paint ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; - c.send(RendererReadyMsg(self.id)); + c.send(PainterReadyMsg(self.id)); continue; } @@ -243,29 +243,29 @@ impl RenderTask where C: RenderListener + Send { self.epoch, &*stacking_context); } - RenderMsg(requests) => { + PaintMsg(requests) => { if !self.paint_permission { - debug!("render_task: render ready msg"); + debug!("paint_task: paint ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; - c.send(RendererReadyMsg(self.id)); - self.compositor.render_msg_discarded(); + c.send(PainterReadyMsg(self.id)); + self.compositor.paint_msg_discarded(); continue; } let mut replies = Vec::new(); - self.compositor.set_render_state(self.id, RenderingRenderState); - for RenderRequest { buffer_requests, scale, layer_id, epoch } + self.compositor.set_paint_state(self.id, PaintingPaintState); + for PaintRequest { buffer_requests, scale, layer_id, epoch } in requests.into_iter() { if self.epoch == epoch { - self.render(&mut replies, buffer_requests, scale, layer_id); + self.paint(&mut replies, buffer_requests, scale, layer_id); } else { - debug!("renderer epoch mismatch: {} != {}", self.epoch, epoch); + debug!("painter epoch mismatch: {} != {}", self.epoch, epoch); } } - self.compositor.set_render_state(self.id, IdleRenderState); + self.compositor.set_paint_state(self.id, IdlePaintState); - debug!("render_task: returning surfaces"); + debug!("paint_task: returning surfaces"); self.compositor.paint(self.id, self.epoch, replies); } UnusedBufferMsg(unused_buffers) => { @@ -291,7 +291,7 @@ impl RenderTask where C: RenderListener + Send { self.paint_permission = false; } ExitMsg(response_ch) => { - debug!("render_task: exitmsg response send"); + debug!("paint_task: exitmsg response send"); response_ch.map(|ch| ch.send(())); break; } @@ -342,8 +342,8 @@ impl RenderTask where C: RenderListener + Send { }) } - /// Renders one layer and sends the tiles back to the layer. - fn render(&mut self, + /// Paints one layer and sends the tiles back to the layer. + fn paint(&mut self, replies: &mut Vec<(LayerId, Box)>, mut tiles: Vec, scale: f32, @@ -493,7 +493,7 @@ impl WorkerThread { DrawTarget::new(SkiaBackend, size, B8G8R8A8) } else { // FIXME(pcwalton): Cache the components of draw targets (texture color buffer, - // renderbuffers) instead of recreating them. + // paintbuffers) instead of recreating them. let draw_target = DrawTarget::new_with_fbo(SkiaBackend, native_graphics_context!(self), size, @@ -503,34 +503,34 @@ impl WorkerThread { }; { - // Build the render context. - let mut render_context = RenderContext { + // Build the paint context. + let mut paint_context = PaintContext { draw_target: draw_target.clone(), font_ctx: &mut self.font_context, page_rect: tile.page_rect, screen_rect: tile.screen_rect, }; - // Apply the translation to render the tile we want. + // Apply the translation to paint the tile we want. let tile_bounds = tile.page_rect; let matrix: Matrix2D = Matrix2D::identity(); let matrix = matrix.scale(scale as AzFloat, scale as AzFloat); let matrix = matrix.translate(-tile_bounds.origin.x as AzFloat, -tile_bounds.origin.y as AzFloat); - render_context.draw_target.set_transform(&matrix); + paint_context.draw_target.set_transform(&matrix); // Clear the buffer. - render_context.clear(); + paint_context.clear(); // Draw the display list. profile(time::PaintingPerTileCategory, None, self.time_profiler_sender.clone(), || { let mut clip_stack = Vec::new(); - stacking_context.optimize_and_draw_into_context(&mut render_context, + stacking_context.optimize_and_draw_into_context(&mut paint_context, &tile.page_rect, &matrix, &mut clip_stack); - render_context.draw_target.flush(); + paint_context.draw_target.flush(); }); } @@ -544,10 +544,10 @@ impl WorkerThread { scale: f32) -> Box { // Extract the texture from the draw target and place it into its slot in the buffer. If - // using CPU rendering, upload it first. + // using CPU painting, upload it first. // // FIXME(pcwalton): We should supply the texture and native surface *to* the draw target in - // GPU rendering mode, so that it doesn't have to recreate it. + // GPU painting mode, so that it doesn't have to recreate it. if !opts::get().gpu_painting { let mut buffer = layer_buffer.unwrap(); draw_target.snapshot().get_data_surface().with_data(|data| { diff --git a/components/gfx/platform/macos/font_template.rs b/components/gfx/platform/macos/font_template.rs index 8641d491523..23cfea2a848 100644 --- a/components/gfx/platform/macos/font_template.rs +++ b/components/gfx/platform/macos/font_template.rs @@ -10,7 +10,7 @@ use core_text; /// Platform specific font representation for mac. /// The identifier is a PostScript font name. The /// CTFont object is cached here for use by the -/// render functions that create CGFont references. +/// paint functions that create CGFont references. pub struct FontTemplateData { pub ctfont: Option, pub identifier: String, diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index f097d96722a..4133bad9cfa 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -198,7 +198,7 @@ impl Shaper { } impl ShaperMethods for Shaper { - /// Calculate the layout metrics associated with the given text when rendered in a specific + /// Calculate the layout metrics associated with the given text when painted in a specific /// font. fn shape_text(&self, text: &str, glyphs: &mut GlyphStore) { unsafe { diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 56eb4e4cf34..130ef0b8065 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -30,7 +30,7 @@ use gfx::display_list::{ImageDisplayItem, ImageDisplayItemClass, LineDisplayItem use gfx::display_list::{LineDisplayItemClass, PseudoDisplayItemClass, SidewaysLeft, SidewaysRight}; use gfx::display_list::{SolidColorDisplayItem, SolidColorDisplayItemClass, StackingContext}; use gfx::display_list::{TextDisplayItem, TextDisplayItemClass, Upright}; -use gfx::render_task::RenderLayer; +use gfx::paint_task::PaintLayer; use servo_msg::compositor_msg::{FixedPosition, Scrollable}; use servo_msg::constellation_msg::{ConstellationChan, FrameRectMsg}; use servo_net::image::holder::ImageHolder; @@ -812,7 +812,7 @@ pub trait BlockFlowDisplayListBuilding { fn build_display_list_for_floating_block(&mut self, layout_context: &LayoutContext); fn create_stacking_context(&self, display_list: Box, - layer: Option>) + layer: Option>) -> Arc; } @@ -875,7 +875,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { let transparent = color::rgba(1.0, 1.0, 1.0, 0.0); let stacking_context = self.create_stacking_context(display_list, - Some(Arc::new(RenderLayer::new(self.layer_id(0), + Some(Arc::new(PaintLayer::new(self.layer_id(0), transparent, scroll_policy)))); self.base.display_list_building_result = StackingContextResult(stacking_context) @@ -897,7 +897,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { fn create_stacking_context(&self, display_list: Box, - layer: Option>) + layer: Option>) -> Arc { let bounds = Rect(self.base.stacking_relative_position, self.base.overflow.size.to_physical(self.base.writing_mode)); diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 5a7b7011f99..995742cd745 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! The layout task. Performs layout on the DOM, builds display lists and sends them to be -//! rendered. +//! painted. use css::node_style::StyledNode; use construct::FlowConstructionResult; @@ -28,7 +28,7 @@ use geom::scale_factor::ScaleFactor; use gfx::color; use gfx::display_list::{DisplayList, OpaqueNode, StackingContext}; use gfx::font_cache_task::FontCacheTask; -use gfx::render_task::{mod, RenderInitMsg, RenderChan, RenderLayer}; +use gfx::paint_task::{mod, PaintInitMsg, PaintChan, PaintLayer}; use layout_traits; use layout_traits::{LayoutControlMsg, LayoutTaskFactory}; use log; @@ -119,7 +119,7 @@ pub struct LayoutTask { pub script_chan: ScriptControlChan, /// The channel on which messages can be sent to the painting task. - pub render_chan: RenderChan, + pub paint_chan: PaintChan, /// The channel on which messages can be sent to the time profiler. pub time_profiler_chan: TimeProfilerChan, @@ -173,7 +173,7 @@ impl LayoutTaskFactory for LayoutTask { constellation_chan: ConstellationChan, failure_msg: Failure, script_chan: ScriptControlChan, - render_chan: RenderChan, + paint_chan: PaintChan, resource_task: ResourceTask, img_cache_task: ImageCacheTask, font_cache_task: FontCacheTask, @@ -191,7 +191,7 @@ impl LayoutTaskFactory for LayoutTask { pipeline_port, constellation_chan, script_chan, - render_chan, + paint_chan, resource_task, img_cache_task, font_cache_task, @@ -240,7 +240,7 @@ impl LayoutTask { pipeline_port: Receiver, constellation_chan: ConstellationChan, script_chan: ScriptControlChan, - render_chan: RenderChan, + paint_chan: PaintChan, resource_task: ResourceTask, image_cache_task: ImageCacheTask, font_cache_task: FontCacheTask, @@ -264,7 +264,7 @@ impl LayoutTask { chan: chan, constellation_chan: constellation_chan, script_chan: script_chan, - render_chan: render_chan, + paint_chan: paint_chan, time_profiler_chan: time_profiler_chan, resource_task: resource_task, image_cache_task: image_cache_task.clone(), @@ -463,7 +463,7 @@ impl LayoutTask { LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data); } - self.render_chan.send(render_task::ExitMsg(Some(response_chan))); + self.paint_chan.send(paint_task::ExitMsg(Some(response_chan))); response_port.recv() } @@ -676,7 +676,7 @@ impl LayoutTask { let mut display_list = box DisplayList::new(); flow::mut_base(layout_root.deref_mut()).display_list_building_result .add_to(&mut *display_list); - let render_layer = Arc::new(RenderLayer::new(layout_root.layer_id(0), + let paint_layer = Arc::new(PaintLayer::new(layout_root.layer_id(0), color, Scrollable)); let origin = Rect(Point2D(Au(0), Au(0)), root_size); @@ -684,13 +684,13 @@ impl LayoutTask { origin, 0, 1.0, - Some(render_layer))); + Some(paint_layer))); rw_data.stacking_context = Some(stacking_context.clone()); debug!("Layout done!"); - self.render_chan.send(RenderInitMsg(stacking_context)); + self.paint_chan.send(PaintInitMsg(stacking_context)); }); } @@ -825,7 +825,7 @@ impl LayoutTask { } }); - // Build the display list if necessary, and send it to the renderer. + // Build the display list if necessary, and send it to the painter. if data.goal == ReflowForDisplay { self.build_display_list_for_reflow(data, node, diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 9c662a5c3a5..229791ff928 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -20,7 +20,7 @@ extern crate "util" as servo_util; // that these modules won't have to depend on layout. use gfx::font_cache_task::FontCacheTask; -use gfx::render_task::RenderChan; +use gfx::paint_task::PaintChan; use servo_msg::constellation_msg::{ConstellationChan, PipelineId}; use servo_msg::constellation_msg::Failure; use servo_net::image_cache_task::ImageCacheTask; @@ -48,7 +48,7 @@ pub trait LayoutTaskFactory { constellation_chan: ConstellationChan, failure_msg: Failure, script_chan: ScriptControlChan, - render_chan: RenderChan, + paint_chan: PaintChan, resource_task: ResourceTask, img_cache_task: ImageCacheTask, font_cache_task: FontCacheTask, diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index 9c82d790fd2..4635e2667d4 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -12,11 +12,11 @@ use std::fmt; use constellation_msg::PipelineId; -/// The status of the renderer. +/// The status of the painter. #[deriving(PartialEq, Clone)] -pub enum RenderState { - IdleRenderState, - RenderingRenderState, +pub enum PaintState { + IdlePaintState, + PaintingPaintState, } #[deriving(Eq, Ord, PartialEq, PartialOrd, Clone)] @@ -81,13 +81,13 @@ pub struct LayerMetadata { pub scroll_policy: ScrollPolicy, } -/// The interface used by the renderer to acquire draw targets for each render frame and +/// The interface used by the painter to acquire draw targets for each paint frame and /// submit them to be drawn to the display. -pub trait RenderListener for Sized? { +pub trait PaintListener for Sized? { fn get_graphics_metadata(&mut self) -> Option; /// Informs the compositor of the layers for the given pipeline. The compositor responds by - /// creating and/or destroying render layers as necessary. + /// creating and/or destroying paint layers as necessary. fn initialize_layers_for_pipeline(&mut self, pipeline_id: PipelineId, metadata: Vec, @@ -99,8 +99,8 @@ pub trait RenderListener for Sized? { epoch: Epoch, replies: Vec<(LayerId, Box)>); - fn render_msg_discarded(&mut self); - fn set_render_state(&mut self, PipelineId, RenderState); + fn paint_msg_discarded(&mut self); + fn set_paint_state(&mut self, PipelineId, PaintState); } /// The interface used by the script task to tell the compositor to update its ready state, diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 7734501abc2..483f03803cf 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -202,7 +202,7 @@ pub enum Msg { LoadUrlMsg(PipelineId, LoadData), ScriptLoadedURLInIFrameMsg(Url, PipelineId, SubpageId, IFrameSandboxState), NavigateMsg(NavigationDirection), - RendererReadyMsg(PipelineId), + PainterReadyMsg(PipelineId), ResizedWindowMsg(WindowSizeData), KeyEvent(Key, KeyState, KeyModifiers), } diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 8a48eb48ccd..be9320d4b42 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -13,7 +13,7 @@ use geom::point::Point2D; use geom::rect::Rect; use geom::size::Size2D; -use canvas::canvas_render_task::{CanvasMsg, CanvasRenderTask, ClearRect, Close, FillRect, Recreate, StrokeRect}; +use canvas::canvas_paint_task::{CanvasMsg, CanvasPaintTask, ClearRect, Close, FillRect, Recreate, StrokeRect}; #[dom_struct] pub struct CanvasRenderingContext2D { @@ -28,7 +28,7 @@ impl CanvasRenderingContext2D { CanvasRenderingContext2D { reflector_: Reflector::new(), global: GlobalField::from_rooted(global), - renderer: CanvasRenderTask::start(size), + renderer: CanvasPaintTask::start(size), canvas: JS::from_rooted(canvas), } } diff --git a/components/util/opts.rs b/components/util/opts.rs index cdd426ef380..9f19ead5f5e 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -31,10 +31,10 @@ pub struct Opts { /// The initial URLs to load. pub urls: Vec, - /// How many threads to use for CPU rendering (`-t`). + /// How many threads to use for CPU painting (`-t`). /// - /// FIXME(pcwalton): This is not currently used. All rendering is sequential. - pub n_render_threads: uint, + /// FIXME(pcwalton): This is not currently used. All painting is sequential. + pub n_paint_threads: uint, /// True to use GPU painting via Skia-GL, false to use CPU painting via Skia (`-g`). Note that /// compositing is always done on the GPU. @@ -88,7 +88,7 @@ pub struct Opts { /// True if each step of layout is traced to an external JSON file /// for debugging purposes. Settings this implies sequential layout - /// and render. + /// and paint. pub trace_layout: bool, /// If true, instrument the runtime for each task created and dump @@ -145,7 +145,7 @@ fn args_fail(msg: &str) { os::set_exit_status(1); } -// Always use CPU rendering on android. +// Always use CPU painting on android. #[cfg(target_os="android")] static FORCE_CPU_PAINTING: bool = true; @@ -156,7 +156,7 @@ static FORCE_CPU_PAINTING: bool = false; pub fn default_opts() -> Opts { Opts { urls: vec!(), - n_render_threads: 1, + n_paint_threads: 1, gpu_painting: false, tile_size: 512, device_pixels_per_px: None, @@ -194,7 +194,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { getopts::optopt("s", "size", "Size of tiles", "512"), getopts::optopt("", "device-pixel-ratio", "Device pixels per px", ""), getopts::optflag("e", "experimental", "Enable experimental web features"), - getopts::optopt("t", "threads", "Number of render threads", "1"), + getopts::optopt("t", "threads", "Number of paint threads", "1"), getopts::optflagopt("p", "profile", "Profiler flag and output interval", "10"), getopts::optflagopt("m", "memory-profile", "Memory profiler flag and output interval", "10"), getopts::optflag("x", "exit", "Exit after load flag"), @@ -253,8 +253,8 @@ pub fn from_cmdline_args(args: &[String]) -> bool { ScaleFactor(from_str(dppx_str.as_slice()).unwrap()) ); - let mut n_render_threads: uint = match opt_match.opt_str("t") { - Some(n_render_threads_str) => from_str(n_render_threads_str.as_slice()).unwrap(), + let mut n_paint_threads: uint = match opt_match.opt_str("t") { + Some(n_paint_threads_str) => from_str(n_paint_threads_str.as_slice()).unwrap(), None => 1, // FIXME: Number of cores. }; @@ -278,7 +278,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { let mut bubble_inline_sizes_separately = debug_options.contains(&"bubble-widths"); let trace_layout = debug_options.contains(&"trace-layout"); if trace_layout { - n_render_threads = 1; + n_paint_threads = 1; layout_threads = 1; bubble_inline_sizes_separately = true; } @@ -308,7 +308,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { let opts = Opts { urls: urls, - n_render_threads: n_render_threads, + n_paint_threads: n_paint_threads, gpu_painting: gpu_painting, tile_size: tile_size, device_pixels_per_px: device_pixels_per_px, diff --git a/components/util/task_state.rs b/components/util/task_state.rs index f3f72d33207..cd64bb40e2c 100644 --- a/components/util/task_state.rs +++ b/components/util/task_state.rs @@ -15,7 +15,7 @@ bitflags! { flags TaskState: u32 { const SCRIPT = 0x01, const LAYOUT = 0x02, - const RENDER = 0x04, + const PAINT = 0x04, const IN_WORKER = 0x0100, const IN_GC = 0x0200, @@ -40,7 +40,7 @@ macro_rules! task_types ( ( $( $fun:ident = $flag:ident ; )* ) => ( task_types! { is_script = SCRIPT; is_layout = LAYOUT; - is_render = RENDER; + is_paint = PAINT; } #[cfg(not(ndebug))] diff --git a/ports/android/glut_app/window.rs b/ports/android/glut_app/window.rs index 7aa0fec27eb..a8f76ae628b 100644 --- a/ports/android/glut_app/window.rs +++ b/ports/android/glut_app/window.rs @@ -19,7 +19,7 @@ use geom::scale_factor::ScaleFactor; use geom::size::TypedSize2D; use layers::geometry::DevicePixel; use layers::platform::surface::NativeGraphicsMetadata; -use msg::compositor_msg::{IdleRenderState, RenderState}; +use msg::compositor_msg::{IdlePaintState, PaintState}; use msg::compositor_msg::{Blank, ReadyState}; use util::geometry::ScreenPx; @@ -41,7 +41,7 @@ pub struct Window { pub mouse_down_point: Cell>, pub ready_state: Cell, - pub render_state: Cell, + pub paint_state: Cell, pub throbber_frame: Cell, } @@ -65,7 +65,7 @@ impl Window { mouse_down_point: Cell::new(Point2D(0 as c_int, 0)), ready_state: Cell::new(Blank), - render_state: Cell::new(IdleRenderState), + paint_state: Cell::new(IdlePaintState), throbber_frame: Cell::new(0), }; @@ -180,9 +180,9 @@ impl WindowMethods for Window { //self.update_window_title() } - /// Sets the render state. - fn set_render_state(&self, render_state: RenderState) { - self.render_state.set(render_state); + /// Sets the paint state. + fn set_paint_state(&self, paint_state: PaintState) { + self.paint_state.set(paint_state); //FIXME: set_window_title causes crash with Android version of freeGLUT. Temporarily blocked. //self.update_window_title() } @@ -215,11 +215,11 @@ impl Window { // glut::set_window_title(self.glut_window, format!("{:c} Performing Layout . Servo", throbber)) // } // FinishedLoading => { - // match self.render_state { - // RenderingRenderState => { + // match self.paint_state { + // PaintingPaintState => { // glut::set_window_title(self.glut_window, format!("{:c} Rendering . Servo", throbber)) // } - // IdleRenderState => glut::set_window_title(self.glut_window, "Servo"), + // IdlePaintState => glut::set_window_title(self.glut_window, "Servo"), // } // } // } diff --git a/ports/glfw/window.rs b/ports/glfw/window.rs index ccdd94c8914..422ea221c02 100644 --- a/ports/glfw/window.rs +++ b/ports/glfw/window.rs @@ -24,7 +24,7 @@ use layers::geometry::DevicePixel; use layers::platform::surface::NativeGraphicsMetadata; use libc::c_int; use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState}; -use msg::compositor_msg::{IdleRenderState, RenderState, RenderingRenderState}; +use msg::compositor_msg::{IdlePaintState, PaintState, PaintingPaintState}; use msg::constellation_msg; use std::cell::{Cell, RefCell}; use std::comm::Receiver; @@ -45,7 +45,7 @@ pub struct Window { mouse_down_point: Cell>, ready_state: Cell, - render_state: Cell, + paint_state: Cell, last_title_set_time: Cell, } @@ -78,7 +78,7 @@ impl Window { mouse_down_point: Cell::new(Point2D(0 as c_int, 0)), ready_state: Cell::new(Blank), - render_state: Cell::new(IdleRenderState), + paint_state: Cell::new(IdlePaintState), last_title_set_time: Cell::new(Timespec::new(0, 0)), }; @@ -159,9 +159,9 @@ impl WindowMethods for Window { self.update_window_title() } - /// Sets the render state. - fn set_render_state(&self, render_state: RenderState) { - self.render_state.set(render_state); + /// Sets the paint state. + fn set_paint_state(&self, paint_state: PaintState) { + self.paint_state.set(paint_state); self.update_window_title() } @@ -302,11 +302,11 @@ impl Window { self.glfw_window.set_title("Performing Layout — Servo [GLFW]") } FinishedLoading => { - match self.render_state.get() { - RenderingRenderState => { + match self.paint_state.get() { + PaintingPaintState => { self.glfw_window.set_title("Rendering — Servo [GLFW]") } - IdleRenderState => { + IdlePaintState => { self.glfw_window.set_title("Servo [GLFW]") } } diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 18d28ba4289..f9d4dfdfa5d 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -18,7 +18,7 @@ use geom::size::TypedSize2D; use gleam::gl; use layers::geometry::DevicePixel; use layers::platform::surface::NativeGraphicsMetadata; -use msg::compositor_msg::{IdleRenderState, RenderState, RenderingRenderState}; +use msg::compositor_msg::{IdlePaintState, PaintState, PaintingPaintState}; use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState}; use std::cell::{Cell, RefCell}; use std::rc::Rc; @@ -66,7 +66,7 @@ pub struct Window { mouse_pos: Cell>, ready_state: Cell, - render_state: Cell, + paint_state: Cell, key_modifiers: Cell, last_title_set_time: Cell, @@ -118,7 +118,7 @@ impl Window { mouse_pos: Cell::new(Point2D(0, 0)), ready_state: Cell::new(Blank), - render_state: Cell::new(IdleRenderState), + paint_state: Cell::new(IdlePaintState), key_modifiers: Cell::new(KeyModifiers::empty()), last_title_set_time: Cell::new(Timespec::new(0, 0)), @@ -173,9 +173,9 @@ impl WindowMethods for Window { self.update_window_title() } - /// Sets the render state. - fn set_render_state(&self, render_state: RenderState) { - self.render_state.set(render_state); + /// Sets the paint state. + fn set_paint_state(&self, paint_state: PaintState) { + self.paint_state.set(paint_state); self.update_window_title() } @@ -233,11 +233,11 @@ impl Window { window.set_title("Performing Layout - Servo [glutin]") } FinishedLoading => { - match self.render_state.get() { - RenderingRenderState => { + match self.paint_state.get() { + PaintingPaintState => { window.set_title("Rendering - Servo [glutin]") } - IdleRenderState => { + IdlePaintState => { window.set_title("Servo [glutin]") } }