diff options
-rw-r--r-- | components/gfx/display_list/mod.rs | 38 | ||||
-rw-r--r-- | components/gfx/lib.rs | 4 | ||||
-rw-r--r-- | components/gfx/paint_context.rs (renamed from components/gfx/render_context.rs) | 8 | ||||
-rw-r--r-- | components/gfx/paint_task.rs | 12 |
4 files changed, 31 insertions, 31 deletions
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<AzFloat>, current_transform: &Matrix2D<AzFloat>, current_clip_stack: &mut Vec<Rect<Au>>) { 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<AzFloat>, current_clip_stack: &mut Vec<Rect<Au>>) { // 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 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<FontContext>, /// 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<Au> { trait ScaledFontExtensionMethods { fn draw_text_into_context(&self, - rctx: &RenderContext, + rctx: &PaintContext, run: &Box<TextRun>, range: &Range<CharIndex>, baseline_origin: Point2D<Au>, @@ -813,7 +813,7 @@ trait ScaledFontExtensionMethods { impl ScaledFontExtensionMethods for ScaledFont { fn draw_text_into_context(&self, - rctx: &RenderContext, + rctx: &PaintContext, run: &Box<TextRun>, range: &Range<CharIndex>, baseline_origin: Point2D<Au>, 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(); }); } |