mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
auto merge of #483 : oncemoreification/servo/fix_some_warnings, r=brson
Less yelling: https://github.com/mozilla/servo/issues/455
This commit is contained in:
commit
5be7bfa14f
4 changed files with 29 additions and 22 deletions
|
@ -133,8 +133,8 @@ impl ShapedGlyphData {
|
|||
};
|
||||
|
||||
ShapedGlyphEntry {
|
||||
cluster: (*glyph_info_i).cluster as uint,
|
||||
codepoint: (*glyph_info_i).codepoint as GlyphIndex,
|
||||
cluster: (*glyph_info_i).cluster as uint,
|
||||
codepoint: (*glyph_info_i).codepoint as GlyphIndex,
|
||||
advance: x_advance,
|
||||
offset: offset,
|
||||
}
|
||||
|
@ -165,7 +165,11 @@ impl Drop for Shaper {
|
|||
|
||||
impl Shaper {
|
||||
pub fn new(font: @mut Font) -> Shaper {
|
||||
let font_ptr: *mut Font = &mut *font;
|
||||
// Indirection for Rust Issue #6248, dynamic freeze scope artifically extended
|
||||
let font_ptr = {
|
||||
let borrowed_font= &mut *font;
|
||||
borrowed_font as *mut Font
|
||||
};
|
||||
let hb_face: *hb_face_t = hb_face_create_for_tables(get_font_table_func,
|
||||
font_ptr as *c_void,
|
||||
null());
|
||||
|
@ -176,7 +180,7 @@ impl Shaper {
|
|||
hb_font_set_ppem(hb_font, pt_size as c_uint, pt_size as c_uint);
|
||||
|
||||
// Set scaling. Note that this takes 16.16 fixed point.
|
||||
hb_font_set_scale(hb_font,
|
||||
hb_font_set_scale(hb_font,
|
||||
Shaper::float_to_fixed(pt_size) as c_int,
|
||||
Shaper::float_to_fixed(pt_size) as c_int);
|
||||
|
||||
|
@ -187,7 +191,7 @@ impl Shaper {
|
|||
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, null(), null());
|
||||
hb_font_set_funcs(hb_font, hb_funcs, font_ptr as *c_void, null());
|
||||
|
||||
Shaper {
|
||||
Shaper {
|
||||
font: font,
|
||||
hb_face: hb_face,
|
||||
hb_font: hb_font,
|
||||
|
@ -208,7 +212,7 @@ impl Shaper {
|
|||
}
|
||||
}
|
||||
|
||||
impl ShaperMethods for Shaper {
|
||||
impl ShaperMethods for Shaper {
|
||||
/// Calculate the layout metrics associated with the given text when rendered in a specific
|
||||
/// font.
|
||||
fn shape_text(&self, text: &str, glyphs: &mut GlyphStore) {
|
||||
|
@ -217,7 +221,7 @@ impl ShaperMethods for Shaper {
|
|||
|
||||
// Using as_buf because it never does a copy - we don't need the trailing null
|
||||
do str::as_buf(text) |ctext: *u8, _: uint| {
|
||||
hb_buffer_add_utf8(hb_buffer,
|
||||
hb_buffer_add_utf8(hb_buffer,
|
||||
ctext as *c_char,
|
||||
text.len() as c_int,
|
||||
0,
|
||||
|
@ -268,7 +272,7 @@ impl Shaper {
|
|||
i = range.next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
debug!("(glyph idx) -> (text byte offset)");
|
||||
for uint::range(0, glyph_data.len()) |i| {
|
||||
// loc refers to a *byte* offset within the utf8 string.
|
||||
|
@ -346,7 +350,7 @@ impl Shaper {
|
|||
glyph_span.begin(), glyph_span.length());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if there's just one glyph, then we don't need further checks.
|
||||
if glyph_span.length() == 1 { break; }
|
||||
|
||||
|
@ -389,7 +393,7 @@ impl Shaper {
|
|||
//and set glyph info for those and empty infos for the chars that are continuations.
|
||||
|
||||
// a simple example:
|
||||
// chars: 'f' 't' 't'
|
||||
// chars: 'f' 't' 't'
|
||||
// glyphs: 'ftt' '' ''
|
||||
// cgmap: t f f
|
||||
// gspan: [-]
|
||||
|
@ -398,7 +402,7 @@ impl Shaper {
|
|||
|
||||
let mut covered_byte_span = copy char_byte_span;
|
||||
// extend, clipping at end of text range.
|
||||
while covered_byte_span.end() < byte_max
|
||||
while covered_byte_span.end() < byte_max
|
||||
&& byteToGlyph[covered_byte_span.end()] == NO_GLYPH {
|
||||
let range = str::char_range_at(text, covered_byte_span.end());
|
||||
ignore(range.ch);
|
||||
|
@ -449,7 +453,7 @@ impl Shaper {
|
|||
|
||||
// now add the detailed glyph entry.
|
||||
glyphs.add_glyphs_for_char_index(char_idx, datas);
|
||||
|
||||
|
||||
// set the other chars, who have no glyphs
|
||||
let mut i = covered_byte_span.begin();
|
||||
loop {
|
||||
|
|
|
@ -43,8 +43,7 @@ priv struct ImageState {
|
|||
pub impl LocalImageCache {
|
||||
/// The local cache will only do a single remote request for a given
|
||||
/// URL in each 'round'. Layout should call this each time it begins
|
||||
// FIXME: 'pub' is an unexpected token?
|
||||
/* pub */ fn next_round(&mut self, on_image_available: @fn() -> ~fn(ImageResponseMsg)) {
|
||||
pub fn next_round(&mut self, on_image_available: @fn() -> ~fn(ImageResponseMsg)) {
|
||||
self.round_number += 1;
|
||||
self.on_image_available = Some(on_image_available);
|
||||
}
|
||||
|
@ -135,7 +134,7 @@ pub impl LocalImageCache {
|
|||
}
|
||||
|
||||
priv fn get_state(&self, url: &Url) -> @mut ImageState {
|
||||
*do self.state_map.find_or_insert_with(url.clone()) |_| {
|
||||
let state = do self.state_map.find_or_insert_with(url.clone()) |_| {
|
||||
let new_state = @mut ImageState {
|
||||
prefetched: false,
|
||||
decoded: false,
|
||||
|
@ -143,7 +142,8 @@ pub impl LocalImageCache {
|
|||
last_response: ImageNotReady
|
||||
};
|
||||
new_state
|
||||
}
|
||||
};
|
||||
*state // Unborrowing the state
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ impl ImageData for AzureDrawTargetImageData {
|
|||
// FIXME: This is not always correct. We should query the Azure draw target for the format.
|
||||
ARGB32Format
|
||||
}
|
||||
fn with_data(&self, f: WithDataFn) {
|
||||
fn with_data(&self, f: WithDataFn) {
|
||||
do self.data_source_surface.with_data |data| {
|
||||
f(data);
|
||||
}
|
||||
|
@ -174,8 +174,8 @@ fn run_main_loop(po: Port<Msg>, script_chan: SharedChan<ScriptMsg>, opts: &Opts,
|
|||
};
|
||||
|
||||
// Set the layer's transform.
|
||||
let mut origin = Point2D(buffer.rect.origin.x as f32,
|
||||
buffer.rect.origin.y as f32);
|
||||
let origin = Point2D(buffer.rect.origin.x as f32,
|
||||
buffer.rect.origin.y as f32);
|
||||
let transform = original_layer_transform.translate(origin.x,
|
||||
origin.y,
|
||||
0.0);
|
||||
|
|
|
@ -163,7 +163,7 @@ impl Drop for ScriptContext {
|
|||
|
||||
impl ScriptContext {
|
||||
/// Creates a new script context.
|
||||
pub fn new(layout_task: LayoutTask,
|
||||
pub fn new(layout_task: LayoutTask,
|
||||
script_port: Port<ScriptMsg>,
|
||||
script_chan: SharedChan<ScriptMsg>,
|
||||
resource_task: ResourceTask,
|
||||
|
@ -201,8 +201,11 @@ impl ScriptContext {
|
|||
window_size: Size2D(800, 600),
|
||||
damage: MatchSelectorsDamage,
|
||||
};
|
||||
|
||||
let script_context_ptr: *ScriptContext = &*script_context;
|
||||
// Indirection for Rust Issue #6248, dynamic freeze scope artifically extended
|
||||
let script_context_ptr = {
|
||||
let borrowed_ctx= &mut *script_context;
|
||||
borrowed_ctx as *mut ScriptContext
|
||||
};
|
||||
js_context.set_cx_private(script_context_ptr as *());
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue