From daba9043027636c0ce4fad5658ffe52077fc8cd7 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:31:13 +0900 Subject: [PATCH 01/23] Rename gfx/render_task.rs -> gfx/paint_task.rs --- components/compositing/compositor.rs | 2 +- components/compositing/compositor_layer.rs | 2 +- components/compositing/constellation.rs | 4 ++-- components/compositing/pipeline.rs | 4 ++-- components/gfx/display_list/mod.rs | 2 +- components/gfx/lib.rs | 2 +- components/gfx/{render_task.rs => paint_task.rs} | 0 components/layout/display_list_builder.rs | 2 +- components/layout/layout_task.rs | 4 ++-- components/layout_traits/lib.rs | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) rename components/gfx/{render_task.rs => paint_task.rs} (100%) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 486e94bba07..bbdec47a6d3 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -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::{RenderChan, RenderMsg, RenderRequest, UnusedBufferMsg}; use layers::geometry::{DevicePixel, LayerPixel}; use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::rendergl; diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index b830e630f34..6e570f69f62 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}; diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 71a32fca6e1..d2b8cf9892c 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; @@ -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.render_chan.send_opt(paint_task::ExitMsg(None)); let LayoutControlChan(ref old_layout) = old_pipeline.layout_chan; let _ = old_layout.send_opt(ExitNowMsg); } diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index e6972d1361b..118d2424094 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::{RenderChan, RenderTask}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId}; use servo_msg::constellation_msg::{LoadData, WindowSizeData}; use servo_net::image_cache_task::ImageCacheTask; diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 68b0e3d38ed..195989ba5e9 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -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::RenderLayer; use script_traits::UntrustedNodeAddress; use servo_msg::compositor_msg::LayerId; use servo_net::image::base::Image; diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 701390e072c..bc095e2aa55 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -59,7 +59,7 @@ mod render_context; 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_task.rs b/components/gfx/paint_task.rs similarity index 100% rename from components/gfx/render_task.rs rename to components/gfx/paint_task.rs diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 56eb4e4cf34..79866baa1ad 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::RenderLayer; use servo_msg::compositor_msg::{FixedPosition, Scrollable}; use servo_msg::constellation_msg::{ConstellationChan, FrameRectMsg}; use servo_net::image::holder::ImageHolder; diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 5a7b7011f99..9b5f4a00f22 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -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, RenderInitMsg, RenderChan, RenderLayer}; use layout_traits; use layout_traits::{LayoutControlMsg, LayoutTaskFactory}; use log; @@ -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.render_chan.send(paint_task::ExitMsg(Some(response_chan))); response_port.recv() } diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 9c662a5c3a5..d08de4cc01c 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::RenderChan; use servo_msg::constellation_msg::{ConstellationChan, PipelineId}; use servo_msg::constellation_msg::Failure; use servo_net::image_cache_task::ImageCacheTask; From cddb7fe7c59722584bf95a8b993bb4d11de598fd Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:33:54 +0900 Subject: [PATCH 02/23] Rename RenderTask -> PaintTask. --- components/compositing/pipeline.rs | 18 +++++++++--------- components/gfx/paint_task.rs | 30 +++++++++++++++--------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index 118d2424094..51632ab9820 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -9,7 +9,7 @@ use script_traits::{AttachLayoutMsg, LoadMsg, NewLayoutInfo, ExitPipelineMsg}; use devtools_traits::DevtoolsControlChan; use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked}; -use gfx::paint_task::{RenderChan, RenderTask}; +use gfx::paint_task::{RenderChan, PaintTask}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId}; use servo_msg::constellation_msg::{LoadData, WindowSizeData}; use servo_net::image_cache_task::ImageCacheTask; @@ -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, + render_port, + compositor_proxy, + constellation_chan.clone(), + font_cache_task.clone(), + failure.clone(), + time_profiler_chan.clone(), + render_shutdown_chan); LayoutTaskFactory::create(None::<&mut LTF>, id, diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 6013fc8f936..dc4aa560911 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -96,7 +96,7 @@ impl RenderChan { } } -pub struct RenderTask { +pub struct PaintTask { id: PipelineId, port: Receiver, compositor: C, @@ -125,7 +125,7 @@ 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") @@ -167,7 +167,7 @@ fn initialize_layers(compositor: &mut C, } } -impl RenderTask where C: RenderListener + Send { +impl PaintTask where C: RenderListener + Send { pub fn create(id: PipelineId, port: Receiver, compositor: C, @@ -177,7 +177,7 @@ 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::RENDER, proc() { { // Ensures that the render task and graphics context are destroyed before the // shutdown message. @@ -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,27 +203,27 @@ 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 rendering loop"); loop { match self.port.recv() { @@ -232,7 +232,7 @@ impl RenderTask where C: RenderListener + Send { self.root_stacking_context = Some(stacking_context.clone()); if !self.paint_permission { - debug!("render_task: render ready msg"); + debug!("paint_task: render ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; c.send(RendererReadyMsg(self.id)); continue; @@ -245,7 +245,7 @@ impl RenderTask where C: RenderListener + Send { } RenderMsg(requests) => { if !self.paint_permission { - debug!("render_task: render ready msg"); + debug!("paint_task: render ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; c.send(RendererReadyMsg(self.id)); self.compositor.render_msg_discarded(); @@ -265,7 +265,7 @@ impl RenderTask where C: RenderListener + Send { self.compositor.set_render_state(self.id, IdleRenderState); - 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; } From 062854b1647ad4ac619a53a71ec38c5aa009a28a Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:39:21 +0900 Subject: [PATCH 03/23] Rename canvas_render_task -> canvas_paint_task --- .../canvas/{canvas_render_task.rs => canvas_paint_task.rs} | 0 components/canvas/lib.rs | 2 +- components/script/dom/canvasrenderingcontext2d.rs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename components/canvas/{canvas_render_task.rs => canvas_paint_task.rs} (100%) diff --git a/components/canvas/canvas_render_task.rs b/components/canvas/canvas_paint_task.rs similarity index 100% rename from components/canvas/canvas_render_task.rs rename to components/canvas/canvas_paint_task.rs 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/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 8a48eb48ccd..eba8094c334 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, CanvasRenderTask, ClearRect, Close, FillRect, Recreate, StrokeRect}; #[dom_struct] pub struct CanvasRenderingContext2D { From 71257e66045bfad9bdcff37387ecf826d86b9913 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:40:45 +0900 Subject: [PATCH 04/23] Rename CanvasRenderTask -> CanvasPaintTask. --- components/canvas/canvas_paint_task.rs | 22 +++++++++---------- .../script/dom/canvasrenderingcontext2d.rs | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index a5ab92a2dfe..ee71bd16483 100644 --- a/components/canvas/canvas_paint_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/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index eba8094c334..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_paint_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), } } From d87def07435a8d96f6f67db1f005541acb59098c Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:50:35 +0900 Subject: [PATCH 05/23] Rename RenderContext -> PaintContext --- components/gfx/display_list/mod.rs | 38 +++++++++---------- components/gfx/lib.rs | 4 +- .../{render_context.rs => paint_context.rs} | 8 ++-- components/gfx/paint_task.rs | 12 +++--- 4 files changed, 31 insertions(+), 31 deletions(-) rename components/gfx/{render_context.rs => paint_context.rs} (99%) diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 195989ba5e9..c81afb19204 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -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; @@ -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 render_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. @@ -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) } @@ -562,30 +562,30 @@ impl<'a> Iterator<&'a DisplayItem> for DisplayItemIterator<'a> { impl DisplayItem { /// Renders this display item into the given render 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/lib.rs b/components/gfx/lib.rs index bc095e2aa55..3c901aadac9 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -50,10 +50,10 @@ 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; +mod paint_context; // Rendering pub mod color; 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..c3f1c458d70 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 } @@ -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/paint_task.rs b/components/gfx/paint_task.rs index dc4aa560911..0c588c12ac5 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -8,7 +8,7 @@ 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; @@ -504,7 +504,7 @@ impl WorkerThread { { // Build the render context. - let mut render_context = RenderContext { + let mut paint_context = PaintContext { draw_target: draw_target.clone(), font_ctx: &mut self.font_context, page_rect: tile.page_rect, @@ -518,19 +518,19 @@ impl WorkerThread { 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(); }); } From cee3d517e836080eebd999741a1fe079ed3f1750 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:53:10 +0900 Subject: [PATCH 06/23] Rename RenderLayer -> PaintLayer --- components/gfx/display_list/mod.rs | 6 +++--- components/gfx/paint_task.rs | 18 +++++++++--------- components/layout/display_list_builder.rs | 8 ++++---- components/layout/layout_task.rs | 6 +++--- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index c81afb19204..fc7ee4a989a 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -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 paint_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, diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 0c588c12ac5..1c78a2d2de9 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -40,7 +40,7 @@ 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. @@ -49,10 +49,10 @@ pub struct RenderLayer { 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, @@ -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, }) } } diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 79866baa1ad..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::paint_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 9b5f4a00f22..058bd6e14ad 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -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::paint_task::{mod, RenderInitMsg, RenderChan, RenderLayer}; +use gfx::paint_task::{mod, RenderInitMsg, RenderChan, PaintLayer}; use layout_traits; use layout_traits::{LayoutControlMsg, LayoutTaskFactory}; use log; @@ -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,7 +684,7 @@ impl LayoutTask { origin, 0, 1.0, - Some(render_layer))); + Some(paint_layer))); rw_data.stacking_context = Some(stacking_context.clone()); From 9b6faaf7f02178b0b6df87131da7a2b4ce24a354 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:54:41 +0900 Subject: [PATCH 07/23] Rename RenderRequest -> PaintRequest --- components/compositing/compositor.rs | 8 ++++---- components/gfx/paint_task.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index bbdec47a6d3..8c9edd8ab36 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -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::paint_task::{RenderChan, RenderMsg, RenderRequest, UnusedBufferMsg}; +use gfx::paint_task::{RenderChan, RenderMsg, PaintRequest, UnusedBufferMsg}; use layers::geometry::{DevicePixel, LayerPixel}; use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::rendergl; @@ -838,10 +838,10 @@ impl IOCompositor { requests: Vec<(Rc>, Vec)>) -> HashMap)> { + Vec)> { 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) = @@ -862,7 +862,7 @@ impl IOCompositor { 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, diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 1c78a2d2de9..e3e21b46965 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -60,7 +60,7 @@ impl PaintLayer { } } -pub struct RenderRequest { +pub struct PaintRequest { pub buffer_requests: Vec, pub scale: f32, pub layer_id: LayerId, @@ -69,7 +69,7 @@ pub struct RenderRequest { pub enum Msg { RenderInitMsg(Arc), - RenderMsg(Vec), + RenderMsg(Vec), UnusedBufferMsg(Vec>), PaintPermissionGranted, PaintPermissionRevoked, @@ -254,7 +254,7 @@ impl PaintTask where C: RenderListener + Send { let mut replies = Vec::new(); self.compositor.set_render_state(self.id, RenderingRenderState); - for RenderRequest { buffer_requests, scale, layer_id, epoch } + 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); From 7ff790d9416e2bcfbf2d8caefbbb7bf6ac840770 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 03:58:58 +0900 Subject: [PATCH 08/23] Rename RenderChan -> PaintChan --- components/compositing/compositor.rs | 12 ++++++------ components/compositing/compositor_layer.rs | 6 +++--- components/compositing/constellation.rs | 2 +- components/compositing/pipeline.rs | 22 +++++++++++----------- components/gfx/paint_task.rs | 14 +++++++------- components/layout/layout_task.rs | 16 ++++++++-------- components/layout_traits/lib.rs | 4 ++-- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 8c9edd8ab36..1d1007e3ec3 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -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::paint_task::{RenderChan, RenderMsg, PaintRequest, UnusedBufferMsg}; +use gfx::paint_task::{PaintChan, RenderMsg, PaintRequest, UnusedBufferMsg}; use layers::geometry::{DevicePixel, LayerPixel}; use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::rendergl; @@ -837,22 +837,22 @@ impl IOCompositor { fn convert_buffer_requests_to_pipeline_requests_map(&self, requests: Vec<(Rc>, Vec)>) -> - 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!())) } }; @@ -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 => {} diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 6e570f69f62..38b9aea80dc 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -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); } } @@ -224,7 +224,7 @@ impl CompositorLayer for Layer { 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)); } } diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index d2b8cf9892c..79f0283b54c 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -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(paint_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); } diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index 51632ab9820..1f382c42a9d 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -9,7 +9,7 @@ use script_traits::{AttachLayoutMsg, LoadMsg, NewLayoutInfo, ExitPipelineMsg}; use devtools_traits::DevtoolsControlChan; use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked}; -use gfx::paint_task::{RenderChan, PaintTask}; +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; @@ -25,7 +25,7 @@ pub struct Pipeline { 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<()>, /// The most recently loaded page @@ -37,7 +37,7 @@ pub struct Pipeline { pub struct CompositionPipeline { pub id: PipelineId, pub script_chan: ScriptControlChan, - pub render_chan: RenderChan, + pub paint_chan: PaintChan, } impl Pipeline { @@ -60,7 +60,7 @@ 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_port, paint_chan) = PaintChan::new(); let (render_shutdown_chan, render_shutdown_port) = channel(); let (layout_shutdown_chan, layout_shutdown_port) = channel(); let (pipeline_chan, pipeline_port) = channel(); @@ -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,7 +129,7 @@ impl Pipeline { subpage_id, script_chan, LayoutControlChan(pipeline_chan), - render_chan, + paint_chan, layout_shutdown_port, render_shutdown_port, load_data) @@ -139,7 +139,7 @@ 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<()>, load_data: LoadData) @@ -149,7 +149,7 @@ 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, load_data: load_data, @@ -162,12 +162,12 @@ 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); + let _ = self.paint_chan.send_opt(PaintPermissionRevoked); } pub fn exit(&self) { @@ -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/gfx/paint_task.rs b/components/gfx/paint_task.rs index e3e21b46965..cbcbd7b3ea8 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -77,21 +77,21 @@ 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: render 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) } } diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 058bd6e14ad..2abab9d2894 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -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::paint_task::{mod, RenderInitMsg, RenderChan, PaintLayer}; +use gfx::paint_task::{mod, RenderInitMsg, 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(paint_task::ExitMsg(Some(response_chan))); + self.paint_chan.send(paint_task::ExitMsg(Some(response_chan))); response_port.recv() } @@ -690,7 +690,7 @@ impl LayoutTask { debug!("Layout done!"); - self.render_chan.send(RenderInitMsg(stacking_context)); + self.paint_chan.send(RenderInitMsg(stacking_context)); }); } diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index d08de4cc01c..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::paint_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, From 79722bdc031db5e8ee7bbd860ba75a43654fd572 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 11:52:31 +0900 Subject: [PATCH 09/23] Rename gfx::paint_task::Msg --- components/compositing/compositor.rs | 6 +++--- components/gfx/paint_task.rs | 8 ++++---- components/layout/layout_task.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 1d1007e3ec3..2f0b2c1ea58 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -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::paint_task::{PaintChan, RenderMsg, PaintRequest, UnusedBufferMsg}; +use gfx::paint_task::{PaintChan, PaintMsg, PaintRequest, UnusedBufferMsg}; use layers::geometry::{DevicePixel, LayerPixel}; use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::rendergl; @@ -379,7 +379,7 @@ impl IOCompositor { } fn has_render_msg_tracking(&self) -> bool { - // only track RenderMsg's if the compositor outputs to a file. + // only track PaintMsg's if the compositor outputs to a file. opts::get().output_file.is_some() } @@ -928,7 +928,7 @@ impl IOCompositor { let mut num_render_msgs_sent = 0; for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() { num_render_msgs_sent += 1; - let _ = chan.send_opt(RenderMsg(requests)); + let _ = chan.send_opt(PaintMsg(requests)); } self.add_outstanding_render_msg(num_render_msgs_sent); diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index cbcbd7b3ea8..1f1f47119fa 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -68,8 +68,8 @@ pub struct PaintRequest { } pub enum Msg { - RenderInitMsg(Arc), - RenderMsg(Vec), + PaintInitMsg(Arc), + PaintMsg(Vec), UnusedBufferMsg(Vec>), PaintPermissionGranted, PaintPermissionRevoked, @@ -227,7 +227,7 @@ impl PaintTask where C: RenderListener + Send { loop { match self.port.recv() { - RenderInitMsg(stacking_context) => { + PaintInitMsg(stacking_context) => { self.epoch.next(); self.root_stacking_context = Some(stacking_context.clone()); @@ -243,7 +243,7 @@ impl PaintTask where C: RenderListener + Send { self.epoch, &*stacking_context); } - RenderMsg(requests) => { + PaintMsg(requests) => { if !self.paint_permission { debug!("paint_task: render ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 2abab9d2894..e7eb5b57e22 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -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::paint_task::{mod, RenderInitMsg, PaintChan, PaintLayer}; +use gfx::paint_task::{mod, PaintInitMsg, PaintChan, PaintLayer}; use layout_traits; use layout_traits::{LayoutControlMsg, LayoutTaskFactory}; use log; @@ -690,7 +690,7 @@ impl LayoutTask { debug!("Layout done!"); - self.paint_chan.send(RenderInitMsg(stacking_context)); + self.paint_chan.send(PaintInitMsg(stacking_context)); }); } From 94071f6330bc9a22f8387f10ccab9a91fe196133 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 11:54:59 +0900 Subject: [PATCH 10/23] Rename compositor_task::Msg. --- components/compositing/compositor.rs | 8 ++++---- components/compositing/compositor_task.rs | 12 ++++++------ components/compositing/headless.rs | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 2f0b2c1ea58..1ec3a96372e 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; @@ -258,11 +258,11 @@ impl IOCompositor { self.change_ready_state(pipeline_id, ready_state); } - (ChangeRenderState(pipeline_id, render_state), NotShuttingDown) => { + (ChangePaintState(pipeline_id, render_state), NotShuttingDown) => { self.change_render_state(pipeline_id, render_state); } - (RenderMsgDiscarded, NotShuttingDown) => { + (PaintMsgDiscarded, NotShuttingDown) => { self.remove_outstanding_render_msg(); } diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 8b5510f25f6..674b239de65 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -143,11 +143,11 @@ impl RenderListener for Box { } fn render_msg_discarded(&mut self) { - self.send(RenderMsgDiscarded); + self.send(PaintMsgDiscarded); } fn set_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { - self.send(ChangeRenderState(pipeline_id, render_state)) + self.send(ChangePaintState(pipeline_id, render_state)) } } @@ -183,9 +183,9 @@ pub enum Msg { /// 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), + ChangePaintState(PipelineId, RenderState), /// Alerts the compositor that the RenderMsg has been discarded. - RenderMsgDiscarded, + PaintMsgDiscarded, /// Sets the channel to the current layout and render tasks, along with their id SetIds(SendableFrameTree, Sender<()>, ConstellationChan), /// Sends an updated version of the frame tree. @@ -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/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 } From b5f73fb1797ad3e1ad3df4a7f9f308b7b41d4c28 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 11:58:57 +0900 Subject: [PATCH 11/23] Rename RenderListener -> PaintListener, and its methods. --- components/compositing/compositor_task.rs | 10 +++++----- components/gfx/paint_task.rs | 12 ++++++------ components/msg/compositor_msg.rs | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 674b239de65..1da5716fd70 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, RenderState, 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,11 +142,11 @@ impl RenderListener for Box { } } - fn render_msg_discarded(&mut self) { + fn paint_msg_discarded(&mut self) { self.send(PaintMsgDiscarded); } - fn set_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { + fn set_paint_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { self.send(ChangePaintState(pipeline_id, render_state)) } } diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 1f1f47119fa..a537f3d7e83 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -22,7 +22,7 @@ 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::{LayerMetadata, PaintListener, RenderingRenderState, ScrollPolicy}; use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineId}; use servo_msg::constellation_msg::{RendererReadyMsg}; use servo_msg::platform::surface::NativeSurfaceAzureMethods; @@ -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); @@ -167,7 +167,7 @@ fn initialize_layers(compositor: &mut C, } } -impl PaintTask where C: RenderListener + Send { +impl PaintTask where C: PaintListener + Send { pub fn create(id: PipelineId, port: Receiver, compositor: C, @@ -248,12 +248,12 @@ impl PaintTask where C: RenderListener + Send { debug!("paint_task: render ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; c.send(RendererReadyMsg(self.id)); - self.compositor.render_msg_discarded(); + self.compositor.paint_msg_discarded(); continue; } let mut replies = Vec::new(); - self.compositor.set_render_state(self.id, RenderingRenderState); + self.compositor.set_paint_state(self.id, RenderingRenderState); for PaintRequest { buffer_requests, scale, layer_id, epoch } in requests.into_iter() { if self.epoch == epoch { @@ -263,7 +263,7 @@ impl PaintTask where C: RenderListener + Send { } } - self.compositor.set_render_state(self.id, IdleRenderState); + self.compositor.set_paint_state(self.id, IdleRenderState); debug!("paint_task: returning surfaces"); self.compositor.paint(self.id, self.epoch, replies); diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index 9c82d790fd2..d4e8e208223 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -83,7 +83,7 @@ pub struct LayerMetadata { /// The interface used by the renderer to acquire draw targets for each render 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 @@ -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, RenderState); } /// The interface used by the script task to tell the compositor to update its ready state, From 806b6f09c99eafb7bda9f3fc0b96a1b121f85a53 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 13:28:13 +0900 Subject: [PATCH 12/23] Rename RenderState -> PaintState --- components/compositing/compositor.rs | 16 ++++++++-------- components/compositing/compositor_task.rs | 10 +++++----- components/compositing/windowing.rs | 6 +++--- components/gfx/paint_task.rs | 8 ++++---- components/msg/compositor_msg.rs | 10 +++++----- ports/android/glut_app/window.rs | 16 ++++++++-------- ports/glfw/window.rs | 16 ++++++++-------- ports/glutin/window.rs | 16 ++++++++-------- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 1ec3a96372e..e2c6d23d12e 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -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}; @@ -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. + render_states: HashMap, /// Whether the page being rendered has loaded completely. /// Differs from ReadyState because we can finish loading (ready) @@ -358,7 +358,7 @@ impl IOCompositor { } - fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { + fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: PaintState) { match self.render_states.entry(pipeline_id) { Occupied(entry) => { *entry.into_mut() = render_state; @@ -375,7 +375,7 @@ impl IOCompositor { if self.ready_states.len() == 0 { return false; } - return self.render_states.values().all(|&value| value == IdleRenderState); + return self.render_states.values().all(|&value| value == IdlePaintState); } fn has_render_msg_tracking(&self) -> bool { @@ -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.render_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() { diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 1da5716fd70..abeef153234 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::{PaintListener, 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; @@ -146,8 +146,8 @@ impl PaintListener for Box { self.send(PaintMsgDiscarded); } - fn set_paint_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { - self.send(ChangePaintState(pipeline_id, render_state)) + fn set_paint_state(&mut self, pipeline_id: PipelineId, paint_state: PaintState) { + self.send(ChangePaintState(pipeline_id, paint_state)) } } @@ -182,8 +182,8 @@ 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. - ChangePaintState(PipelineId, RenderState), + /// Alerts the compositor to the current status of painting. + ChangePaintState(PipelineId, PaintState), /// Alerts the compositor that the RenderMsg has been discarded. PaintMsgDiscarded, /// Sets the channel to the current layout and render tasks, along with their id diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 4476ddf43fa..2603e9162ee 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_render_state(&self, paint_state: PaintState); /// Returns the hidpi factor of the monitor. fn hidpi_factor(&self) -> ScaleFactor; diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index a537f3d7e83..79d81e4f091 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -21,8 +21,8 @@ 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, PaintListener, 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::platform::surface::NativeSurfaceAzureMethods; @@ -253,7 +253,7 @@ impl PaintTask where C: PaintListener + Send { } let mut replies = Vec::new(); - self.compositor.set_paint_state(self.id, RenderingRenderState); + self.compositor.set_paint_state(self.id, PaintingPaintState); for PaintRequest { buffer_requests, scale, layer_id, epoch } in requests.into_iter() { if self.epoch == epoch { @@ -263,7 +263,7 @@ impl PaintTask where C: PaintListener + Send { } } - self.compositor.set_paint_state(self.id, IdleRenderState); + self.compositor.set_paint_state(self.id, IdlePaintState); debug!("paint_task: returning surfaces"); self.compositor.paint(self.id, self.epoch, replies); diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index d4e8e208223..989d4d56968 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)] @@ -100,7 +100,7 @@ pub trait PaintListener for Sized? { replies: Vec<(LayerId, Box)>); fn paint_msg_discarded(&mut self); - fn set_paint_state(&mut self, PipelineId, RenderState); + 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/ports/android/glut_app/window.rs b/ports/android/glut_app/window.rs index 7aa0fec27eb..dab81299d89 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 render_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), + render_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_render_state(&self, paint_state: PaintState) { + self.render_state.set(paint_state); //FIXME: set_window_title causes crash with Android version of freeGLUT. Temporarily blocked. //self.update_window_title() } @@ -216,10 +216,10 @@ impl Window { // } // FinishedLoading => { // match self.render_state { - // RenderingRenderState => { + // 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..a4f7a7a2bd7 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, + render_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), + render_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_render_state(&self, paint_state: PaintState) { + self.render_state.set(paint_state); self.update_window_title() } @@ -303,10 +303,10 @@ impl Window { } FinishedLoading => { match self.render_state.get() { - RenderingRenderState => { + 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..2fe6cc5204c 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, + render_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), + render_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_render_state(&self, paint_state: PaintState) { + self.render_state.set(paint_state); self.update_window_title() } @@ -234,10 +234,10 @@ impl Window { } FinishedLoading => { match self.render_state.get() { - RenderingRenderState => { + PaintingPaintState => { window.set_title("Rendering - Servo [glutin]") } - IdleRenderState => { + IdlePaintState => { window.set_title("Servo [glutin]") } } From 189f40f6f8a355abf765c58b4b28b52e8c22b19c Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 13:37:08 +0900 Subject: [PATCH 13/23] Rename IOCompositor's members. --- components/compositing/compositor.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index e2c6d23d12e..c3f76687229 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -97,7 +97,7 @@ pub struct IOCompositor { /// the compositor. shutdown_state: ShutdownState, - /// Tracks outstanding render_msg's sent to the render tasks. + /// Tracks outstanding render_msg's sent to the paint tasks. outstanding_render_msgs: uint, /// Tracks the last composite time. @@ -113,7 +113,7 @@ pub struct IOCompositor { ready_states: HashMap, /// Current paint status of each pipeline. - render_states: HashMap, + paint_states: HashMap, /// Whether the page being rendered has loaded completely. /// Differs from ReadyState because we can finish loading (ready) @@ -200,7 +200,7 @@ 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, @@ -258,8 +258,8 @@ impl IOCompositor { self.change_ready_state(pipeline_id, ready_state); } - (ChangePaintState(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); } (PaintMsgDiscarded, NotShuttingDown) => { @@ -358,24 +358,24 @@ impl IOCompositor { } - fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: PaintState) { - 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_render_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 == IdlePaintState); + return self.paint_states.values().all(|&value| value == IdlePaintState); } fn has_render_msg_tracking(&self) -> bool { @@ -437,7 +437,7 @@ impl IOCompositor { -> Rc> { // 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, PaintingPaintState); + 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() { @@ -948,7 +948,7 @@ impl IOCompositor { return false; } - if !self.all_pipelines_in_idle_render_state() { + if !self.all_pipelines_in_idle_paint_state() { return false; } From 15a32247a68fd7c86123762e7a9452a802d24c5b Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 13:43:46 +0900 Subject: [PATCH 14/23] Rename WindowMethods::set_paint_state() --- components/compositing/compositor.rs | 2 +- components/compositing/windowing.rs | 2 +- ports/android/glut_app/window.rs | 10 +++++----- ports/glfw/window.rs | 10 +++++----- ports/glutin/window.rs | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index c3f76687229..d5a0474ca30 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -368,7 +368,7 @@ impl IOCompositor { } } - self.window.set_render_state(paint_state); + self.window.set_paint_state(paint_state); } fn all_pipelines_in_idle_paint_state(&self) -> bool { diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 2603e9162ee..0dffe0a8f94 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -91,7 +91,7 @@ pub trait WindowMethods { /// Sets the ready state of the current page. fn set_ready_state(&self, ready_state: ReadyState); /// Sets the paint state of the current page. - fn set_render_state(&self, paint_state: PaintState); + fn set_paint_state(&self, paint_state: PaintState); /// Returns the hidpi factor of the monitor. fn hidpi_factor(&self) -> ScaleFactor; diff --git a/ports/android/glut_app/window.rs b/ports/android/glut_app/window.rs index dab81299d89..a8f76ae628b 100644 --- a/ports/android/glut_app/window.rs +++ b/ports/android/glut_app/window.rs @@ -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(IdlePaintState), + paint_state: Cell::new(IdlePaintState), throbber_frame: Cell::new(0), }; @@ -181,8 +181,8 @@ impl WindowMethods for Window { } /// Sets the paint state. - fn set_render_state(&self, paint_state: PaintState) { - self.render_state.set(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,7 +215,7 @@ impl Window { // glut::set_window_title(self.glut_window, format!("{:c} Performing Layout . Servo", throbber)) // } // FinishedLoading => { - // match self.render_state { + // match self.paint_state { // PaintingPaintState => { // glut::set_window_title(self.glut_window, format!("{:c} Rendering . Servo", throbber)) // } diff --git a/ports/glfw/window.rs b/ports/glfw/window.rs index a4f7a7a2bd7..422ea221c02 100644 --- a/ports/glfw/window.rs +++ b/ports/glfw/window.rs @@ -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(IdlePaintState), + paint_state: Cell::new(IdlePaintState), last_title_set_time: Cell::new(Timespec::new(0, 0)), }; @@ -160,8 +160,8 @@ impl WindowMethods for Window { } /// Sets the paint state. - fn set_render_state(&self, paint_state: PaintState) { - self.render_state.set(paint_state); + fn set_paint_state(&self, paint_state: PaintState) { + self.paint_state.set(paint_state); self.update_window_title() } @@ -302,7 +302,7 @@ impl Window { self.glfw_window.set_title("Performing Layout — Servo [GLFW]") } FinishedLoading => { - match self.render_state.get() { + match self.paint_state.get() { PaintingPaintState => { self.glfw_window.set_title("Rendering — Servo [GLFW]") } diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 2fe6cc5204c..f9d4dfdfa5d 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -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(IdlePaintState), + paint_state: Cell::new(IdlePaintState), key_modifiers: Cell::new(KeyModifiers::empty()), last_title_set_time: Cell::new(Timespec::new(0, 0)), @@ -174,8 +174,8 @@ impl WindowMethods for Window { } /// Sets the paint state. - fn set_render_state(&self, paint_state: PaintState) { - self.render_state.set(paint_state); + fn set_paint_state(&self, paint_state: PaintState) { + self.paint_state.set(paint_state); self.update_window_title() } @@ -233,7 +233,7 @@ impl Window { window.set_title("Performing Layout - Servo [glutin]") } FinishedLoading => { - match self.render_state.get() { + match self.paint_state.get() { PaintingPaintState => { window.set_title("Rendering - Servo [glutin]") } From 37c060cad7efc8364fb959093161f2a353110466 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 13:55:07 +0900 Subject: [PATCH 15/23] Fix README.md: a tile size is used for 'painting'. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From b921986cd68e3692d7ad33b41da3fa7c880442b5 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 14:13:07 +0900 Subject: [PATCH 16/23] Rename RendererReadyMsg -> PainterReadyMsg --- components/compositing/constellation.rs | 4 ++-- components/gfx/paint_task.rs | 6 +++--- components/msg/constellation_msg.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 79f0283b54c..7e3907ebe64 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -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; @@ -453,7 +453,7 @@ impl Constellation { self.handle_navigate_msg(direction); } // Notification that rendering has finished and is requesting permission to paint. - RendererReadyMsg(pipeline_id) => { + PainterReadyMsg(pipeline_id) => { debug!("constellation got renderer ready message"); self.handle_renderer_ready_msg(pipeline_id); } diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 79d81e4f091..4d4d3809bd8 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -24,7 +24,7 @@ use native::task::NativeTaskBuilder; 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; @@ -234,7 +234,7 @@ impl PaintTask where C: PaintListener + Send { if !self.paint_permission { debug!("paint_task: render ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; - c.send(RendererReadyMsg(self.id)); + c.send(PainterReadyMsg(self.id)); continue; } @@ -247,7 +247,7 @@ impl PaintTask where C: PaintListener + Send { if !self.paint_permission { debug!("paint_task: render ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; - c.send(RendererReadyMsg(self.id)); + c.send(PainterReadyMsg(self.id)); self.compositor.paint_msg_discarded(); continue; } 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), } From a9839fa18e82c1b9dae126314e4a788fd87738bd Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 14:17:12 +0900 Subject: [PATCH 17/23] Rename RenderFontCacheEntry -> PaintFontCacheEntry. --- components/gfx/font_context.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 87eb7a77833..b1270b39a47 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -52,7 +52,7 @@ struct FallbackFontCacheEntry { /// A cached azure font (per render task) that /// can be shared by multiple text runs. -struct RenderFontCacheEntry { +struct PaintFontCacheEntry { pt_size: Au, identifier: String, font: Rc>, @@ -72,7 +72,7 @@ pub struct FontContext { /// Strong reference as the render FontContext is (for now) recycled /// per frame. TODO: Make this weak when incremental redraw is done. - render_font_cache: Vec, + render_font_cache: Vec, last_style: Option>, last_fontgroup: Option>, @@ -241,7 +241,7 @@ impl FontContext { } let render_font = Rc::new(RefCell::new(create_scaled_font(template, pt_size))); - self.render_font_cache.push(RenderFontCacheEntry{ + self.render_font_cache.push(PaintFontCacheEntry{ font: render_font.clone(), pt_size: pt_size, identifier: template.identifier.clone(), From 4d562f893c94656028e3f23f3b62110d839202d7 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 14:23:20 +0900 Subject: [PATCH 18/23] Rename TaskState::RENDER -> TaskState::PAINT --- components/gfx/paint_task.rs | 2 +- components/util/task_state.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 4d4d3809bd8..55706d255d6 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -177,7 +177,7 @@ impl PaintTask where C: PaintListener + Send { time_profiler_chan: TimeProfilerChan, shutdown_chan: Sender<()>) { let ConstellationChan(c) = constellation_chan.clone(); - spawn_named_with_send_on_failure("PaintTask", 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 // shutdown message. 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))] From f04c64f500f6ef1935b33a5db9eda1d2dc5db1b2 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 14:31:57 +0900 Subject: [PATCH 19/23] Replace almost "render" to "paint" words in gfx crate. --- components/gfx/buffer_map.rs | 2 +- components/gfx/display_list/mod.rs | 36 +++++++++---------- components/gfx/display_list/optimizer.rs | 4 +-- components/gfx/font_context.rs | 26 +++++++------- components/gfx/lib.rs | 4 +-- components/gfx/paint_context.rs | 4 +-- components/gfx/paint_task.rs | 34 +++++++++--------- .../gfx/platform/macos/font_template.rs | 2 +- components/gfx/text/shaping/harfbuzz.rs | 2 +- 9 files changed, 57 insertions(+), 57 deletions(-) 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 fc7ee4a989a..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. @@ -181,7 +181,7 @@ impl StackingContext { let temporary_draw_target = paint_context.get_or_create_temporary_draw_target(self.opacity); { - let mut render_subcontext = PaintContext { + let mut paint_subcontext = PaintContext { draw_target: temporary_draw_target.clone(), font_ctx: &mut *paint_context.font_ctx, page_rect: paint_context.page_rect, @@ -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); @@ -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,7 +560,7 @@ 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, paint_context: &mut PaintContext, current_transform: &Matrix2D, 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 b1270b39a47..e77f5d2d8a1 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -50,7 +50,7 @@ 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 PaintFontCacheEntry { pt_size: Au, @@ -60,7 +60,7 @@ struct PaintFontCacheEntry { /// 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(PaintFontCacheEntry{ - 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 3c901aadac9..943de358ddd 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -52,10 +52,10 @@ extern crate freetype; pub use paint_context::PaintContext; -// Private rendering modules +// Private painting modules mod paint_context; -// Rendering +// Painting pub mod color; #[path="display_list/mod.rs"] pub mod display_list; diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index c3f1c458d70..4a5e9767d08 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -657,7 +657,7 @@ impl<'a> PaintContext<'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> PaintContext<'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 } diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 55706d255d6..a15e82a031e 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.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/. */ -//! The task that handles all rendering/painting. +//! The task that handles all painting. use buffer_map::BufferMap; use display_list::{mod, StackingContext}; @@ -43,7 +43,7 @@ use sync::Arc; 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, @@ -87,7 +87,7 @@ impl PaintChan { pub fn send(&self, msg: Msg) { let &PaintChan(ref chan) = self; - assert!(chan.send_opt(msg).is_ok(), "PaintChan.send: render port closed") + assert!(chan.send_opt(msg).is_ok(), "PaintChan.send: paint port closed") } pub fn send_opt(&self, msg: Msg) -> Result<(), Msg> { @@ -128,7 +128,7 @@ pub struct PaintTask { // 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") ) ) @@ -179,7 +179,7 @@ impl PaintTask where C: PaintListener + Send { let ConstellationChan(c) = constellation_chan.clone(); 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( @@ -223,7 +223,7 @@ impl PaintTask where C: PaintListener + Send { } fn start(&mut self) { - debug!("paint_task: beginning rendering loop"); + debug!("paint_task: beginning painting loop"); loop { match self.port.recv() { @@ -232,7 +232,7 @@ impl PaintTask where C: PaintListener + Send { self.root_stacking_context = Some(stacking_context.clone()); if !self.paint_permission { - debug!("paint_task: render ready msg"); + debug!("paint_task: paint ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; c.send(PainterReadyMsg(self.id)); continue; @@ -245,7 +245,7 @@ impl PaintTask where C: PaintListener + Send { } PaintMsg(requests) => { if !self.paint_permission { - debug!("paint_task: render ready msg"); + debug!("paint_task: paint ready msg"); let ConstellationChan(ref mut c) = self.constellation_chan; c.send(PainterReadyMsg(self.id)); self.compositor.paint_msg_discarded(); @@ -257,9 +257,9 @@ impl PaintTask where C: PaintListener + Send { 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); } } @@ -342,8 +342,8 @@ impl PaintTask where C: PaintListener + 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,7 +503,7 @@ impl WorkerThread { }; { - // Build the render context. + // Build the paint context. let mut paint_context = PaintContext { draw_target: draw_target.clone(), font_ctx: &mut self.font_context, @@ -511,7 +511,7 @@ impl WorkerThread { 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); @@ -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 { From 8cee554898f2a583cd7c86540f1155f2ca9492c3 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 14:51:49 +0900 Subject: [PATCH 20/23] Replace almost "render" to "paint" in compositing crate. This doesn't touch some "render" words which are used as general means. --- components/compositing/compositor.rs | 66 +++++++++++----------- components/compositing/compositor_layer.rs | 18 +++--- components/compositing/compositor_task.rs | 6 +- components/compositing/constellation.rs | 10 ++-- components/compositing/pipeline.rs | 26 ++++----- 5 files changed, 63 insertions(+), 63 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index d5a0474ca30..44015c8012c 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -97,8 +97,8 @@ pub struct IOCompositor { /// the compositor. shutdown_state: ShutdownState, - /// Tracks outstanding render_msg's sent to the paint 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, @@ -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()); @@ -207,7 +207,7 @@ impl IOCompositor { 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, } } @@ -263,7 +263,7 @@ impl IOCompositor { } (PaintMsgDiscarded, NotShuttingDown) => { - self.remove_outstanding_render_msg(); + 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() } @@ -378,32 +378,32 @@ impl IOCompositor { return self.paint_states.values().all(|&value| value == IdlePaintState); } - fn has_render_msg_tracking(&self) -> bool { + 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"); } } @@ -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"); } @@ -856,7 +856,7 @@ impl IOCompositor { } }; - // 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(); @@ -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; + 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,7 +944,7 @@ impl IOCompositor { return false; } - if self.has_outstanding_render_msgs() { + if self.has_outstanding_paint_msgs() { 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 38b9aea80dc..804ebb8625a 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -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 @@ -217,8 +217,8 @@ 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() @@ -229,7 +229,7 @@ impl CompositorLayer for Layer { } /// 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 abeef153234..89aed5defa0 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -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. /// @@ -184,9 +184,9 @@ pub enum Msg { ChangeReadyState(PipelineId, ReadyState), /// Alerts the compositor to the current status of painting. ChangePaintState(PipelineId, PaintState), - /// Alerts the compositor that the RenderMsg has been discarded. + /// Alerts the compositor that the PaintMsg has been discarded. PaintMsgDiscarded, - /// Sets the channel to the current layout and render tasks, along with their id + /// 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<()>), diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 7e3907ebe64..5155801f553 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -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. + // Notification that painting has finished and is requesting permission to paint. PainterReadyMsg(pipeline_id) => { - debug!("constellation got renderer ready message"); - self.handle_renderer_ready_msg(pipeline_id); + debug!("constellation got painter ready message"); + self.handle_painter_ready_msg(pipeline_id); } ResizedWindowMsg(new_size) => { debug!("constellation got window resize message"); @@ -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/pipeline.rs b/components/compositing/pipeline.rs index 1f382c42a9d..cf1ebd16f8c 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -19,7 +19,7 @@ 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, @@ -27,7 +27,7 @@ pub struct Pipeline { pub layout_chan: LayoutControlChan, 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, } @@ -41,7 +41,7 @@ pub struct CompositionPipeline { } 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, paint_chan) = PaintChan::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(); @@ -103,13 +103,13 @@ impl Pipeline { }; PaintTask::create(id, - render_port, + paint_port, compositor_proxy, constellation_chan.clone(), font_cache_task.clone(), failure.clone(), time_profiler_chan.clone(), - render_shutdown_chan); + paint_shutdown_chan); LayoutTaskFactory::create(None::<&mut LTF>, id, @@ -131,7 +131,7 @@ impl Pipeline { LayoutControlChan(pipeline_chan), paint_chan, layout_shutdown_port, - render_shutdown_port, + paint_shutdown_port, load_data) } @@ -141,7 +141,7 @@ impl Pipeline { layout_chan: LayoutControlChan, paint_chan: PaintChan, layout_shutdown_port: Receiver<()>, - render_shutdown_port: Receiver<()>, + paint_shutdown_port: Receiver<()>, load_data: LoadData) -> Pipeline { Pipeline { @@ -151,7 +151,7 @@ impl Pipeline { layout_chan: layout_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, } } @@ -166,20 +166,20 @@ impl Pipeline { } pub fn revoke_paint_permission(&self) { - debug!("pipeline revoking render channel paint permission"); + 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(); } } From 9cda2c3395d89a1c3e6525666319bb3b25938b63 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 14:59:29 +0900 Subject: [PATCH 21/23] Replace almost "render" to "paint" in layout crate. This doesn't touch some "render" words which are used as general means. --- components/layout/layout_task.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index e7eb5b57e22..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; @@ -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, From b9db453444612f7c06a197d64e6c6c7ef6bcc825 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 15:12:04 +0900 Subject: [PATCH 22/23] Replace render to paint in util/opts.rs. Some general words are not replaced. --- components/util/opts.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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, From 037eff0f4cb7ff4f3746d7a4f915964d35bae9e2 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Mon, 8 Dec 2014 15:32:33 +0900 Subject: [PATCH 23/23] Replace 'render' to 'paint' in compositor_msg.rs --- components/msg/compositor_msg.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index 989d4d56968..4635e2667d4 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -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 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,