diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2013-08-09 13:41:10 -0700 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2013-08-15 13:55:40 -0700 |
commit | ffe60ea02704c0bd4545a194bff3f2feafd0133c (patch) | |
tree | 97f40c907aae08235e4bc856681cd1eb6df5a274 /src/components/gfx | |
parent | 907d9f23cf8ab5be112376199c3c57ba9e4a3035 (diff) | |
download | servo-ffe60ea02704c0bd4545a194bff3f2feafd0133c.tar.gz servo-ffe60ea02704c0bd4545a194bff3f2feafd0133c.zip |
Trait changes, and eliminate 'copy'
Diffstat (limited to 'src/components/gfx')
-rw-r--r-- | src/components/gfx/font.rs | 10 | ||||
-rw-r--r-- | src/components/gfx/font_context.rs | 12 | ||||
-rw-r--r-- | src/components/gfx/opts.rs | 4 | ||||
-rw-r--r-- | src/components/gfx/platform/linux/font.rs | 2 | ||||
-rw-r--r-- | src/components/gfx/render_task.rs | 3 | ||||
-rw-r--r-- | src/components/gfx/surface.rs | 2 | ||||
-rw-r--r-- | src/components/gfx/text/glyph.rs | 4 | ||||
-rw-r--r-- | src/components/gfx/text/shaping/harfbuzz.rs | 2 | ||||
-rw-r--r-- | src/components/gfx/text/text_run.rs | 4 |
9 files changed, 23 insertions, 20 deletions
diff --git a/src/components/gfx/font.rs b/src/components/gfx/font.rs index 7f4bddd7805..03f8def38d2 100644 --- a/src/components/gfx/font.rs +++ b/src/components/gfx/font.rs @@ -183,7 +183,7 @@ impl FontGroup { pub fn new(families: @str, style: &UsedFontStyle, fonts: ~[@mut Font]) -> FontGroup { FontGroup { families: families, - style: copy *style, + style: (*style).clone(), fonts: fonts, } } @@ -264,7 +264,7 @@ impl Font { handle: handle, azure_font: None, shaper: None, - style: copy *style, + style: (*style).clone(), metrics: metrics, backend: backend, profiler_chan: profiler_chan, @@ -281,7 +281,7 @@ impl Font { handle: handle, azure_font: None, shaper: None, - style: copy *style, + style: (*style).clone(), metrics: metrics, backend: backend, profiler_chan: profiler_chan, @@ -387,7 +387,7 @@ impl Font { fields: 0x0200 as uint16_t }; - let mut origin = copy baseline_origin; + let mut origin = baseline_origin.clone(); let mut azglyphs = ~[]; azglyphs.reserve(range.length()); @@ -462,7 +462,7 @@ impl Font { } pub fn get_descriptor(&self) -> FontDescriptor { - FontDescriptor::new(copy self.style, SelectorPlatformIdentifier(self.handle.face_identifier())) + FontDescriptor::new(self.style.clone(), SelectorPlatformIdentifier(self.handle.face_identifier())) } pub fn glyph_index(&self, codepoint: char) -> Option<GlyphIndex> { diff --git a/src/components/gfx/font_context.rs b/src/components/gfx/font_context.rs index 50aaaa8e065..310539db016 100644 --- a/src/components/gfx/font_context.rs +++ b/src/components/gfx/font_context.rs @@ -117,7 +117,7 @@ impl<'self> FontContext { debug!("(transform family) searching for `%s`", family); match self.generic_fonts.find(&family) { None => family, - Some(mapped_family) => copy *mapped_family + Some(mapped_family) => (*mapped_family).clone() } } @@ -142,7 +142,7 @@ impl<'self> FontContext { let font_id = SelectorPlatformIdentifier(font_entry.handle.face_identifier()); - let font_desc = FontDescriptor::new(copy *style, font_id); + let font_desc = FontDescriptor::new((*style).clone(), font_id); let instance = self.get_font_by_descriptor(&font_desc); @@ -164,7 +164,7 @@ impl<'self> FontContext { for result.iter().advance |font_entry| { let font_id = SelectorPlatformIdentifier(font_entry.handle.face_identifier()); - let font_desc = FontDescriptor::new(copy *style, font_id); + let font_desc = FontDescriptor::new((*style).clone(), font_id); let instance = self.get_font_by_descriptor(&font_desc); @@ -176,7 +176,7 @@ impl<'self> FontContext { assert!(fonts.len() > 0); // TODO(Issue #179): Split FontStyle into specified and used styles - let used_style = copy *style; + let used_style = (*style).clone(); debug!("(create font group) --- finished ---"); @@ -187,8 +187,8 @@ impl<'self> FontContext { return match &desc.selector { // TODO(Issue #174): implement by-platform-name font selectors. &SelectorPlatformIdentifier(ref identifier) => { - let result_handle = self.handle.create_font_from_identifier(copy *identifier, - copy desc.style); + let result_handle = self.handle.create_font_from_identifier((*identifier).clone(), + desc.style.clone()); result::chain(result_handle, |handle| { Ok(Font::new_from_adopted_handle(self, handle, diff --git a/src/components/gfx/opts.rs b/src/components/gfx/opts.rs index ac54b5bc9b6..c0bfabbe837 100644 --- a/src/components/gfx/opts.rs +++ b/src/components/gfx/opts.rs @@ -39,13 +39,13 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts { let opt_match = match getopts::getopts(args, opts) { result::Ok(m) => m, - result::Err(f) => fail!(getopts::fail_str(copy f)), + result::Err(f) => fail!(getopts::fail_str(f.clone())), }; let urls = if opt_match.free.is_empty() { fail!(~"servo asks that you provide 1 or more URLs") } else { - copy opt_match.free + opt_match.free.clone() }; let render_backend = match getopts::opt_maybe_str(&opt_match, "r") { diff --git a/src/components/gfx/platform/linux/font.rs b/src/components/gfx/platform/linux/font.rs index dc2eb8bdd3b..8ae4580fcf3 100644 --- a/src/components/gfx/platform/linux/font.rs +++ b/src/components/gfx/platform/linux/font.rs @@ -173,7 +173,7 @@ impl FontHandleMethods for FontHandle { FontHandleMethods::new_from_buffer(fctx, buf.clone(), style) } FontSourceFile(ref file) => { - FontHandle::new_from_file(fctx, copy *file, style) + FontHandle::new_from_file(fctx, (*file).clone(), style) } } } diff --git a/src/components/gfx/render_task.rs b/src/components/gfx/render_task.rs index dab31cdc2f4..20f49738ee0 100644 --- a/src/components/gfx/render_task.rs +++ b/src/components/gfx/render_task.rs @@ -39,6 +39,7 @@ pub enum Msg { } /// A request from the compositor to the renderer for tiles that need to be (re)displayed. +#[deriving(Clone)] pub struct BufferRequest { // The rect in pixels that will be drawn to the screen screen_rect: Rect<uint>, @@ -112,7 +113,7 @@ impl<C: RenderListener + Send> RenderTask<C> { id: id, port: port.take(), compositor: compositor, - font_ctx: @mut FontContext::new(copy opts.render_backend, + font_ctx: @mut FontContext::new(opts.render_backend.clone(), false, profiler_chan.clone()), opts: opts, diff --git a/src/components/gfx/surface.rs b/src/components/gfx/surface.rs index 4c965db812b..b30c165c08b 100644 --- a/src/components/gfx/surface.rs +++ b/src/components/gfx/surface.rs @@ -28,7 +28,7 @@ pub struct ImageSurface { impl ImageSurface { pub fn new(size: Size2D<int>, format: format) -> ImageSurface { ImageSurface { - size: copy size, + size: size.clone(), format: format, buffer: vec::from_elem((size.area() as uint) * format.bpp(), 0u8) } diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs index f6569cc959b..d1373922a51 100644 --- a/src/components/gfx/text/glyph.rs +++ b/src/components/gfx/text/glyph.rs @@ -25,6 +25,7 @@ use extra::sort; /// In the uncommon case (multiple glyphs per unicode character, large glyph index/advance, or /// glyph offsets), we pack the glyph count into GlyphEntry, and store the other glyph information /// in DetailedGlyphStore. +#[deriving(Clone)] struct GlyphEntry { value: u32 } @@ -256,6 +257,7 @@ impl GlyphEntry { // Stores data for a detailed glyph, in the case that several glyphs // correspond to one character, or the glyph's data couldn't be packed. +#[deriving(Clone)] struct DetailedGlyph { index: GlyphIndex, // glyph's advance, in the text's direction (RTL or RTL) @@ -274,7 +276,7 @@ impl DetailedGlyph { } } -#[deriving(Eq)] +#[deriving(Eq, Clone)] struct DetailedGlyphRecord { // source string offset/GlyphEntry offset in the TextRun entry_offset: uint, diff --git a/src/components/gfx/text/shaping/harfbuzz.rs b/src/components/gfx/text/shaping/harfbuzz.rs index 851beb87c8c..736328c5995 100644 --- a/src/components/gfx/text/shaping/harfbuzz.rs +++ b/src/components/gfx/text/shaping/harfbuzz.rs @@ -398,7 +398,7 @@ impl Shaper { // cspan: [-] // covsp: [---------------] - let mut covered_byte_span = copy char_byte_span; + let mut covered_byte_span = char_byte_span.clone(); // extend, clipping at end of text range. while covered_byte_span.end() < byte_max && byteToGlyph[covered_byte_span.end()] == NO_GLYPH { diff --git a/src/components/gfx/text/text_run.rs b/src/components/gfx/text/text_run.rs index c436181977c..1bb5464803f 100644 --- a/src/components/gfx/text/text_run.rs +++ b/src/components/gfx/text/text_run.rs @@ -33,7 +33,7 @@ impl SendableTextRun { }; TextRun { - text: copy self.text, + text: self.text.clone(), font: font, underline: self.underline, glyphs: self.glyphs.clone(), @@ -115,7 +115,7 @@ impl<'self> TextRun { pub fn serialize(&self) -> SendableTextRun { SendableTextRun { - text: copy self.text, + text: self.text.clone(), font: self.font.get_descriptor(), underline: self.underline, glyphs: self.glyphs.clone(), |