~[] to Vec in gfx/text/shaping/harfbuzz.rs

This commit is contained in:
Matt Murphy 2014-04-25 08:52:29 -05:00 committed by Ms2ger
parent f32d1f007f
commit 2903e55de0
2 changed files with 7 additions and 7 deletions

View file

@ -555,20 +555,20 @@ impl<'a> GlyphStore {
self.entry_buffer[i] = entry; self.entry_buffer[i] = entry;
} }
pub fn add_glyphs_for_char_index(&mut self, i: uint, data_for_glyphs: &[GlyphData]) { pub fn add_glyphs_for_char_index(&mut self, i: uint, data_for_glyphs: &Vec<GlyphData>) {
assert!(i < self.entry_buffer.len()); assert!(i < self.entry_buffer.len());
assert!(data_for_glyphs.len() > 0); assert!(data_for_glyphs.len() > 0);
let glyph_count = data_for_glyphs.len(); let glyph_count = data_for_glyphs.len();
let first_glyph_data = data_for_glyphs[0]; let first_glyph_data = data_for_glyphs.get(0);
let entry = match first_glyph_data.is_missing { let entry = match first_glyph_data.is_missing {
true => GlyphEntry::missing(glyph_count), true => GlyphEntry::missing(glyph_count),
false => { false => {
let glyphs_vec = slice::from_fn(glyph_count, |i| { let glyphs_vec = slice::from_fn(glyph_count, |i| {
DetailedGlyph::new(data_for_glyphs[i].index, DetailedGlyph::new(data_for_glyphs.get(i).index,
data_for_glyphs[i].advance, data_for_glyphs.get(i).advance,
data_for_glyphs[i].offset) data_for_glyphs.get(i).offset)
}); });
self.detail_store.add_detailed_glyphs_for_entry(i, glyphs_vec); self.detail_store.add_detailed_glyphs_for_entry(i, glyphs_vec);

View file

@ -411,7 +411,7 @@ impl Shaper {
glyphs.add_glyph_for_char_index(char_idx, &data); glyphs.add_glyph_for_char_index(char_idx, &data);
} else { } else {
// collect all glyphs to be assigned to the first character. // collect all glyphs to be assigned to the first character.
let mut datas = ~[]; let mut datas = Vec::new();
for glyph_i in glyph_span.eachi() { for glyph_i in glyph_span.eachi() {
let shape = glyph_data.get_entry_for_glyph(glyph_i, &mut y_pos); let shape = glyph_data.get_entry_for_glyph(glyph_i, &mut y_pos);
@ -425,7 +425,7 @@ impl Shaper {
} }
// now add the detailed glyph entry. // now add the detailed glyph entry.
glyphs.add_glyphs_for_char_index(char_idx, datas); glyphs.add_glyphs_for_char_index(char_idx, &datas);
// set the other chars, who have no glyphs // set the other chars, who have no glyphs
let mut i = covered_byte_span.begin(); let mut i = covered_byte_span.begin();