Replace almost "render" to "paint" words in gfx crate.

This commit is contained in:
Tetsuharu OHZEKI 2014-12-08 14:31:57 +09:00
parent 4d562f893c
commit f04c64f500
9 changed files with 57 additions and 57 deletions

View file

@ -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.

View file

@ -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<GradientStop>,
}
/// Renders a border.
/// Paints a border.
#[deriving(Clone)]
pub struct BorderDisplayItem {
/// Fields common to all display items.
@ -532,7 +532,7 @@ pub struct BorderRadii<T> {
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<AzFloat>,

View file

@ -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<Au>,

View file

@ -50,7 +50,7 @@ struct FallbackFontCacheEntry {
font: Rc<RefCell<Font>>,
}
/// 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<LayoutFontCacheEntry>,
fallback_font_cache: Vec<FallbackFontCacheEntry>,
/// 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<PaintFontCacheEntry>,
paint_font_cache: Vec<PaintFontCacheEntry>,
last_style: Option<Arc<SpecifiedFontStyle>>,
last_fontgroup: Option<Rc<FontGroup>>,
@ -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<FontTemplateData>,
pt_size: Au)
-> Rc<RefCell<ScaledFont>> {
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.

View file

@ -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;

View file

@ -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
}

View file

@ -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<C> {
// 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<C> PaintTask<C> 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<C> PaintTask<C> 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<C> PaintTask<C> 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<C> PaintTask<C> 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<C> PaintTask<C> 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<C> PaintTask<C> 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<LayerBufferSet>)>,
mut tiles: Vec<BufferRequest>,
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<AzFloat> = Matrix2D::identity();
let matrix = matrix.scale(scale as AzFloat, scale as AzFloat);
@ -544,10 +544,10 @@ impl WorkerThread {
scale: f32)
-> Box<LayerBuffer> {
// 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| {

View file

@ -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<CTFont>,
pub identifier: String,

View file

@ -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 {