aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'components/gfx')
-rw-r--r--components/gfx/buffer_map.rs8
-rw-r--r--components/gfx/color.rs2
-rw-r--r--components/gfx/display_list/mod.rs16
-rw-r--r--components/gfx/font.rs4
-rw-r--r--components/gfx/font_cache_task.rs4
-rw-r--r--components/gfx/font_context.rs2
-rw-r--r--components/gfx/lib.rs8
-rw-r--r--components/gfx/platform/freetype/font.rs2
-rw-r--r--components/gfx/platform/freetype/font_context.rs4
-rw-r--r--components/gfx/platform/freetype/font_list.rs12
-rw-r--r--components/gfx/platform/macos/font.rs2
-rw-r--r--components/gfx/render_task.rs4
-rw-r--r--components/gfx/text/glyph.rs6
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs36
-rw-r--r--components/gfx/text/shaping/mod.rs2
-rw-r--r--components/gfx/text/text_run.rs2
16 files changed, 57 insertions, 57 deletions
diff --git a/components/gfx/buffer_map.rs b/components/gfx/buffer_map.rs
index 0551385f717..79612f6a9bd 100644
--- a/components/gfx/buffer_map.rs
+++ b/components/gfx/buffer_map.rs
@@ -103,7 +103,7 @@ impl BufferMap {
};
if {
let list = &mut self.map.get_mut(&old_key).buffers;
- let condemned_buffer = list.pop().take_unwrap();
+ let condemned_buffer = list.pop().take().unwrap();
self.mem -= condemned_buffer.get_mem();
condemned_buffer.destroy(graphics_context);
list.is_empty()
@@ -126,7 +126,7 @@ impl BufferMap {
buffer_val.last_action = self.counter;
self.counter += 1;
- let buffer = buffer_val.buffers.pop().take_unwrap();
+ let buffer = buffer_val.buffers.pop().take().unwrap();
self.mem -= buffer.get_mem();
if buffer_val.buffers.is_empty() {
flag = true;
@@ -146,8 +146,8 @@ impl BufferMap {
/// Destroys all buffers.
pub fn clear(&mut self, graphics_context: &NativePaintingGraphicsContext) {
let map = mem::replace(&mut self.map, HashMap::new());
- for (_, value) in map.move_iter() {
- for tile in value.buffers.move_iter() {
+ for (_, value) in map.into_iter() {
+ for tile in value.buffers.into_iter() {
tile.destroy(graphics_context)
}
}
diff --git a/components/gfx/color.rs b/components/gfx/color.rs
index ffd5b5ed2b2..83d34f2e39d 100644
--- a/components/gfx/color.rs
+++ b/components/gfx/color.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use azure::AzFloat;
-use AzColor = azure::azure_hl::Color;
+use azure::azure_hl::Color as AzColor;
pub type Color = AzColor;
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index e0796c61fb2..bb274e74672 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -134,7 +134,7 @@ impl ScaledFontExtensionMethods for ScaledFont {
&mut glyphbuf,
azure_pattern,
&mut options,
- ptr::mut_null());
+ ptr::null_mut());
}
}
}
@@ -198,7 +198,7 @@ impl StackingContext {
positioned_descendants: Vec::new(),
};
- for item in list.move_iter() {
+ for item in list.into_iter() {
match item {
ClipDisplayItemClass(box ClipDisplayItem {
base: base,
@@ -219,7 +219,7 @@ impl StackingContext {
ContentStackingLevel => stacking_context.content.push(item),
PositionedDescendantStackingLevel(z_index) => {
match stacking_context.positioned_descendants
- .mut_iter()
+ .iter_mut()
.find(|& &(z, _)| z_index == z) {
Some(&(_, ref mut my_list)) => {
my_list.push(item);
@@ -270,9 +270,9 @@ impl StackingContext {
push(&mut self.floats, floats, FloatStackingLevel);
push(&mut self.content, content, ContentStackingLevel);
- for (z_index, list) in positioned_descendants.move_iter() {
+ for (z_index, list) in positioned_descendants.into_iter() {
match self.positioned_descendants
- .mut_iter()
+ .iter_mut()
.find(|& &(existing_z_index, _)| z_index == existing_z_index) {
Some(&(_, ref mut existing_list)) => {
push(existing_list, list, PositionedDescendantStackingLevel(z_index));
@@ -386,7 +386,7 @@ impl DisplayList {
// TODO(pcwalton): Sort positioned children according to z-index.
// Step 3: Positioned descendants with negative z-indices.
- for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() {
+ for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() {
if *z_index < 0 {
result.push_all_move(mem::replace(list, DisplayList::new()))
}
@@ -404,7 +404,7 @@ impl DisplayList {
result.push_all_move(content);
// Steps 8 and 9: Positioned descendants with nonnegative z-indices.
- for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() {
+ for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() {
if *z_index >= 0 {
result.push_all_move(mem::replace(list, DisplayList::new()))
}
@@ -418,7 +418,7 @@ impl DisplayList {
/// Sets the stacking level for this display list and all its subitems.
fn set_stacking_level(&mut self, new_level: StackingLevel) {
- for item in self.list.mut_iter() {
+ for item in self.list.iter_mut() {
item.mut_base().level = new_level;
match item.mut_sublist() {
None => {}
diff --git a/components/gfx/font.rs b/components/gfx/font.rs
index 74930da0b4a..5d4af74d0a9 100644
--- a/components/gfx/font.rs
+++ b/components/gfx/font.rs
@@ -115,7 +115,7 @@ impl Font {
let shaper = &self.shaper;
self.shape_cache.find_or_create(&text, |txt| {
let mut glyphs = GlyphStore::new(text.as_slice().char_len() as int, is_whitespace);
- shaper.get_ref().shape_text(txt.as_slice(), &mut glyphs);
+ shaper.as_ref().unwrap().shape_text(txt.as_slice(), &mut glyphs);
Arc::new(glyphs)
})
}
@@ -132,7 +132,7 @@ impl Font {
let shaper = Shaper::new(self);
self.shaper = Some(shaper);
- self.shaper.get_ref()
+ self.shaper.as_ref().unwrap()
}
pub fn get_table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs
index 9dd453fa8a2..59fcd4146b9 100644
--- a/components/gfx/font_cache_task.rs
+++ b/components/gfx/font_cache_task.rs
@@ -36,7 +36,7 @@ impl FontFamily {
// TODO(Issue #190): if not in the fast path above, do
// expensive matching of weights, etc.
- for template in self.templates.mut_iter() {
+ for template in self.templates.iter_mut() {
let maybe_template = template.get_if_matches(fctx, desc);
if maybe_template.is_some() {
return maybe_template;
@@ -46,7 +46,7 @@ impl FontFamily {
// If a request is made for a font family that exists,
// pick the first valid font in the family if we failed
// to find an exact match for the descriptor.
- for template in self.templates.mut_iter() {
+ for template in self.templates.iter_mut() {
let maybe_template = template.get();
if maybe_template.is_some() {
return maybe_template;
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs
index 9a97e0178dd..3520da107f5 100644
--- a/components/gfx/font_context.rs
+++ b/components/gfx/font_context.rs
@@ -34,7 +34,7 @@ fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt
#[cfg(target_os="macos")]
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
- let cgfont = template.ctfont.get_ref().copy_to_CGFont();
+ let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
ScaledFont::new(backend, &cgfont, pt_size as AzFloat)
}
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index 71afd785ed6..2895750c1a2 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -22,11 +22,11 @@ extern crate stb_image;
extern crate png;
extern crate serialize;
#[phase(plugin)]
-extern crate servo_macros = "macros";
-extern crate servo_net = "net";
+extern crate "macros" as servo_macros;
+extern crate "net" as servo_net;
#[phase(plugin, link)]
-extern crate servo_util = "util";
-extern crate servo_msg = "msg";
+extern crate "util" as servo_util;
+extern crate "msg" as servo_msg;
extern crate style;
extern crate sync;
extern crate url;
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index c26b6272b39..5bc2ce0abe4 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -96,7 +96,7 @@ impl FontHandleMethods for FontHandle {
fn create_face_from_buffer(lib: FT_Library, cbuf: *const u8, cbuflen: uint, pt_size: Option<f64>)
-> Result<FT_Face, ()> {
unsafe {
- let mut face: FT_Face = ptr::mut_null();
+ let mut face: FT_Face = ptr::null_mut();
let face_index = 0 as FT_Long;
let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
face_index, &mut face);
diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs
index b6e8222dc61..39047ac04db 100644
--- a/components/gfx/platform/freetype/font_context.rs
+++ b/components/gfx/platform/freetype/font_context.rs
@@ -61,13 +61,13 @@ impl FontContextHandle {
let ptr = libc::malloc(mem::size_of::<struct_FT_MemoryRec_>() as size_t);
let allocator: &mut struct_FT_MemoryRec_ = mem::transmute(ptr);
ptr::write(allocator, struct_FT_MemoryRec_ {
- user: ptr::mut_null(),
+ user: ptr::null_mut(),
alloc: ft_alloc,
free: ft_free,
realloc: ft_realloc,
});
- let mut ctx: FT_Library = ptr::mut_null();
+ let mut ctx: FT_Library = ptr::null_mut();
let result = FT_New_Library(ptr as FT_Memory, &mut ctx);
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs
index 9e412bad6b0..2b6c85a4363 100644
--- a/components/gfx/platform/freetype/font_list.rs
+++ b/components/gfx/platform/freetype/font_list.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/. */
-#![allow(uppercase_variables)]
+#![allow(non_snake_case)]
extern crate freetype;
extern crate fontconfig;
@@ -35,7 +35,7 @@ pub fn get_available_families(callback: |String|) {
let fontSet = FcConfigGetFonts(config, FcSetSystem);
for i in range(0, (*fontSet).nfont as int) {
let font = (*fontSet).fonts.offset(i);
- let mut family: *mut FcChar8 = ptr::mut_null();
+ let mut family: *mut FcChar8 = ptr::null_mut();
let mut v: c_int = 0;
while FcPatternGetString(*font, FC_FAMILY.as_ptr() as *mut i8, v, &mut family) == FcResultMatch {
let family_name = string::raw::from_buf(family as *const i8 as *const u8);
@@ -71,7 +71,7 @@ pub fn get_variations_for_family(family_name: &str, callback: |String|) {
for i in range(0, (*matches).nfont as int) {
let font = (*matches).fonts.offset(i);
- let mut file: *mut FcChar8 = ptr::mut_null();
+ let mut file: *mut FcChar8 = ptr::null_mut();
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut i8, 0, &mut file) == FcResultMatch {
string::raw::from_buf(file as *const i8 as *const u8)
} else {
@@ -103,14 +103,14 @@ pub fn get_system_default_family(generic_name: &str) -> Option<String> {
unsafe {
let pattern = FcNameParse(generic_name_ptr as *mut FcChar8);
- FcConfigSubstitute(ptr::mut_null(), pattern, FcMatchPattern);
+ FcConfigSubstitute(ptr::null_mut(), pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
let mut result = 0;
- let family_match = FcFontMatch(ptr::mut_null(), pattern, &mut result);
+ let family_match = FcFontMatch(ptr::null_mut(), pattern, &mut result);
let family_name = if result == FcResultMatch {
- let mut match_string: *mut FcChar8 = ptr::mut_null();
+ let mut match_string: *mut FcChar8 = ptr::null_mut();
FcPatternGetString(family_match, FC_FAMILY.as_ptr() as *mut i8, 0, &mut match_string);
let result = string::raw::from_buf(match_string as *const i8 as *const u8);
FcPatternDestroy(family_match);
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs
index f616ef328bd..b025b70566c 100644
--- a/components/gfx/platform/macos/font.rs
+++ b/components/gfx/platform/macos/font.rs
@@ -138,7 +138,7 @@ impl FontHandleMethods for FontHandle {
let glyphs = [glyph as CGGlyph];
let advance = self.ctfont.get_advances_for_glyphs(kCTFontDefaultOrientation,
&glyphs[0],
- ptr::mut_null(),
+ ptr::null_mut(),
1);
Some(advance as FractionalPixel)
}
diff --git a/components/gfx/render_task.rs b/components/gfx/render_task.rs
index 6c4075cbd65..e19db054239 100644
--- a/components/gfx/render_task.rs
+++ b/components/gfx/render_task.rs
@@ -237,7 +237,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
let mut replies = Vec::new();
self.compositor.set_render_state(self.id, RenderingRenderState);
for RenderRequest { buffer_requests, scale, layer_id, epoch }
- in requests.move_iter() {
+ in requests.into_iter() {
if self.epoch == epoch {
self.render(&mut replies, buffer_requests, scale, layer_id);
} else {
@@ -251,7 +251,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
self.compositor.paint(self.id, self.epoch, replies);
}
UnusedBufferMsg(unused_buffers) => {
- for buffer in unused_buffers.move_iter().rev() {
+ for buffer in unused_buffers.into_iter().rev() {
self.buffer_map.insert(native_graphics_context!(self), buffer);
}
}
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index 5fcfb227a6c..4ae1ce13b95 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -156,8 +156,8 @@ fn is_simple_glyph_id(id: GlyphId) -> bool {
}
fn is_simple_advance(advance: Au) -> bool {
- let unsignedAu = advance.to_u32().unwrap();
- (unsignedAu & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsignedAu
+ let unsigned_au = advance.to_u32().unwrap();
+ (unsigned_au & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsigned_au
}
type DetailedGlyphCount = u16;
@@ -700,7 +700,7 @@ impl<'a> GlyphIterator<'a> {
// Slow path when there is a glyph range.
#[inline(never)]
fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> {
- match self.glyph_range.get_mut_ref().next() {
+ match self.glyph_range.as_mut().unwrap().next() {
Some(j) => Some((self.char_index,
DetailGlyphInfo(self.store, self.char_index, j.get() as u16 /* ??? */))),
None => {
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index 789126e767d..f41ea82cf6d 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -175,9 +175,9 @@ impl Shaper {
// configure static function callbacks.
// NB. This funcs structure could be reused globally, as it never changes.
let hb_funcs: *mut hb_font_funcs_t = hb_font_funcs_create();
- hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::mut_null(), None);
- hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::mut_null(), None);
- hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::mut_null(), ptr::mut_null());
+ hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
+ hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
+ hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
hb_font_set_funcs(hb_font, hb_funcs, font_ptr as *mut c_void, None);
Shaper {
@@ -211,7 +211,7 @@ impl ShaperMethods for Shaper {
0,
text.len() as c_int);
- hb_shape(self.hb_font, hb_buffer, ptr::mut_null(), 0);
+ hb_shape(self.hb_font, hb_buffer, ptr::null_mut(), 0);
self.save_glyph_results(text, glyphs, hb_buffer);
hb_buffer_destroy(hb_buffer);
}
@@ -241,15 +241,15 @@ impl Shaper {
}
// make map of what chars have glyphs
- let mut byteToGlyph: Vec<i32>;
+ let mut byte_to_glyph: Vec<i32>;
// fast path: all chars are single-byte.
if byte_max == char_max {
- byteToGlyph = Vec::from_elem(byte_max as uint, NO_GLYPH);
+ byte_to_glyph = Vec::from_elem(byte_max as uint, NO_GLYPH);
} else {
- byteToGlyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
+ byte_to_glyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
for (i, _) in text.char_indices() {
- *byteToGlyph.get_mut(i) = NO_GLYPH;
+ *byte_to_glyph.get_mut(i) = NO_GLYPH;
}
}
@@ -258,10 +258,10 @@ impl Shaper {
// loc refers to a *byte* offset within the utf8 string.
let loc = glyph_data.byte_offset_of_glyph(i);
if loc < byte_max {
- assert!(*byteToGlyph.get(loc as uint) != CONTINUATION_BYTE);
- *byteToGlyph.get_mut(loc as uint) = i as i32;
+ assert!(*byte_to_glyph.get(loc as uint) != CONTINUATION_BYTE);
+ *byte_to_glyph.get_mut(loc as uint) = i as i32;
} else {
- debug!("ERROR: tried to set out of range byteToGlyph: idx={}, glyph idx={}",
+ debug!("ERROR: tried to set out of range byte_to_glyph: idx={}, glyph idx={}",
loc,
i);
}
@@ -271,7 +271,7 @@ impl Shaper {
debug!("text: {:s}", text);
debug!("(char idx): char->(glyph index):");
for (i, ch) in text.char_indices() {
- debug!("{}: {} --> {:d}", i, ch, *byteToGlyph.get(i) as int);
+ debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i) as int);
}
// some helpers
@@ -303,7 +303,7 @@ impl Shaper {
char_byte_span.begin(), char_byte_span.length(), glyph_span.begin());
while char_byte_span.end() != byte_max &&
- byteToGlyph[char_byte_span.end() as uint] == NO_GLYPH {
+ byte_to_glyph[char_byte_span.end() as uint] == NO_GLYPH {
debug!("Extending char byte span to include byte offset={} with no associated \
glyph", char_byte_span.end());
let range = text.char_range_at(char_byte_span.end() as uint);
@@ -315,8 +315,8 @@ impl Shaper {
// in cases where one char made several glyphs and left some unassociated chars.
let mut max_glyph_idx = glyph_span.end();
for i in char_byte_span.each_index() {
- if byteToGlyph[i as uint] > NO_GLYPH {
- max_glyph_idx = cmp::max(byteToGlyph[i as uint] as int + 1, max_glyph_idx);
+ if byte_to_glyph[i as uint] > NO_GLYPH {
+ max_glyph_idx = cmp::max(byte_to_glyph[i as uint] as int + 1, max_glyph_idx);
}
}
@@ -375,7 +375,7 @@ impl Shaper {
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() as uint] == NO_GLYPH {
+ && byte_to_glyph[covered_byte_span.end() as uint] == NO_GLYPH {
let range = text.char_range_at(covered_byte_span.end() as uint);
drop(range.ch);
covered_byte_span.extend_to(range.next as int);
@@ -511,11 +511,11 @@ extern fn get_font_table_func(_: *mut hb_face_t, tag: hb_tag_t, user_data: *mut
// TODO(Issue #197): reuse font table data, which will change the unsound trickery here.
match (*font).get_table_for_tag(tag as FontTableTag) {
- None => ptr::mut_null(),
+ None => ptr::null_mut(),
Some(ref font_table) => {
let skinny_font_table_ptr: *const FontTable = font_table; // private context
- let mut blob: *mut hb_blob_t = ptr::mut_null();
+ let mut blob: *mut hb_blob_t = ptr::null_mut();
(*skinny_font_table_ptr).with_buffer(|buf: *const u8, len: uint| {
// HarfBuzz calls `destroy_blob_func` when the buffer is no longer needed.
blob = hb_blob_create(buf as *const c_char,
diff --git a/components/gfx/text/shaping/mod.rs b/components/gfx/text/shaping/mod.rs
index ef4bc2088f0..7fce60a3106 100644
--- a/components/gfx/text/shaping/mod.rs
+++ b/components/gfx/text/shaping/mod.rs
@@ -9,7 +9,7 @@
use text::glyph::GlyphStore;
-pub use Shaper = text::shaping::harfbuzz::Shaper;
+pub use text::shaping::harfbuzz::Shaper;
pub mod harfbuzz;
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index 70c10f1c64c..57ca437e4f2 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -104,7 +104,7 @@ impl<'a> Iterator<Range<CharIndex>> for LineIterator<'a> {
None => {
// flush any remaining chars as a line
if self.clump.is_some() {
- let mut c = self.clump.take_unwrap();
+ let mut c = self.clump.take().unwrap();
c.extend_to(self.range.end());
return Some(c);
} else {