mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Eliminate more warnings
This commit is contained in:
parent
ed4db46505
commit
6c3bab5ba1
8 changed files with 19 additions and 18 deletions
|
@ -5,7 +5,8 @@ use geom::rect::Rect;
|
|||
use image::base::Image;
|
||||
use render_task::RenderContext;
|
||||
|
||||
use std::arc::{ARC, clone};
|
||||
use std::arc::ARC;
|
||||
use clone_arc = std::arc::clone;
|
||||
use dvec::DVec;
|
||||
use text::text_run::TextRun;
|
||||
|
||||
|
@ -43,7 +44,7 @@ fn draw_Text(self: &DisplayItem, ctx: &RenderContext) {
|
|||
|
||||
fn draw_Image(self: &DisplayItem, ctx: &RenderContext) {
|
||||
match self.data {
|
||||
ImageData(img) => draw_image(ctx, self.bounds, img),
|
||||
ImageData(ref img) => draw_image(ctx, self.bounds, clone_arc(img)),
|
||||
_ => fail
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +57,7 @@ pub fn SolidColor(bounds: Rect<au>, r: u8, g: u8, b: u8) -> DisplayItem {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn Text(bounds: Rect<au>, run: ~TextRun, offset: uint, length: uint) -> DisplayItem {
|
||||
pub fn Text(bounds: Rect<au>, +run: ~TextRun, offset: uint, length: uint) -> DisplayItem {
|
||||
DisplayItem {
|
||||
draw: |self, ctx| draw_Text(self, ctx),
|
||||
bounds: bounds,
|
||||
|
@ -65,11 +66,11 @@ pub fn Text(bounds: Rect<au>, run: ~TextRun, offset: uint, length: uint) -> Disp
|
|||
}
|
||||
|
||||
// ARC should be cloned into ImageData, but Images are not sendable
|
||||
pub fn Image(bounds: Rect<au>, image: ARC<~image::base::Image>) -> DisplayItem {
|
||||
pub fn Image(bounds: Rect<au>, +image: ARC<~image::base::Image>) -> DisplayItem {
|
||||
DisplayItem {
|
||||
draw: |self, ctx| draw_Image(self, ctx),
|
||||
bounds: bounds,
|
||||
data: ImageData(clone(&image))
|
||||
data: ImageData(image)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ impl au : cmp::Eq {
|
|||
pub pure fn min(x: au, y: au) -> au { if x < y { x } else { y } }
|
||||
pub pure fn max(x: au, y: au) -> au { if x > y { x } else { y } }
|
||||
|
||||
pub fn box<A:Copy Num>(x: A, y: A, w: A, h: A) -> Rect<A> {
|
||||
pub fn box<A:Copy Num>(+x: A, +y: A, +w: A, +h: A) -> Rect<A> {
|
||||
Rect(Point2D(x, y), Size2D(w, h))
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,9 @@ pub fn PngCompositor(output: Chan<~[u8]>) -> PngCompositor {
|
|||
debug!("png_compositor: begin_drawing");
|
||||
sender.send(draw_target.take());
|
||||
}
|
||||
Draw(sender, dt) => {
|
||||
Draw(move sender, move dt) => {
|
||||
debug!("png_compositor: draw");
|
||||
do_draw(sender, dt.clone(), output, cairo_surface);
|
||||
do_draw(sender, dt, output, &cairo_surface);
|
||||
}
|
||||
Exit => break
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ pub fn PngCompositor(output: Chan<~[u8]>) -> PngCompositor {
|
|||
}
|
||||
}
|
||||
|
||||
fn do_draw(sender: pipes::Chan<DrawTarget>,
|
||||
fn do_draw(+sender: pipes::Chan<DrawTarget>,
|
||||
+dt: DrawTarget,
|
||||
output: Chan<~[u8]>,
|
||||
cairo_surface: ImageSurface) {
|
||||
cairo_surface: &ImageSurface) {
|
||||
let buffer = BytesWriter();
|
||||
cairo_surface.write_to_png_stream(&buffer);
|
||||
output.send(buffer.buf.get());
|
||||
|
|
|
@ -120,7 +120,7 @@ pub fn draw_solid_color(ctx: &RenderContext, bounds: &Rect<au>, r: u8, g: u8, b:
|
|||
ctx.canvas.fill_rect(&bounds.to_azure_rect(), &ColorPattern(color));
|
||||
}
|
||||
|
||||
pub fn draw_image(ctx: &RenderContext, bounds: Rect<au>, image: ARC<~Image>) {
|
||||
pub fn draw_image(ctx: &RenderContext, bounds: Rect<au>, +image: ARC<~Image>) {
|
||||
let image = std::arc::get(&image);
|
||||
let size = Size2D(image.width as i32, image.height as i32);
|
||||
let stride = image.width * 4;
|
||||
|
|
|
@ -50,10 +50,10 @@ impl u8 : U8Methods {
|
|||
trait InputStateUtil {
|
||||
fn get() -> CharOrEof;
|
||||
fn unget(ch: u8);
|
||||
fn parse_err(err: ~str) -> !;
|
||||
fn parse_err(+err: ~str) -> !;
|
||||
fn expect(ch: u8);
|
||||
fn parse_ident() -> ~str;
|
||||
fn expect_ident(expected: ~str);
|
||||
fn expect_ident(+expected: ~str);
|
||||
fn eat_whitespace();
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ impl InputState : InputStateUtil {
|
|||
self.lookahead = Some(CoeChar(ch));
|
||||
}
|
||||
|
||||
fn parse_err(err: ~str) -> ! {
|
||||
fn parse_err(+err: ~str) -> ! {
|
||||
fail err
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ impl InputState : InputStateUtil {
|
|||
return str::from_bytes(result);
|
||||
}
|
||||
|
||||
fn expect_ident(expected: ~str) {
|
||||
fn expect_ident(+expected: ~str) {
|
||||
let actual = self.parse_ident();
|
||||
if expected != actual {
|
||||
self.parse_err(#fmt("expected '%s' but found '%s'", expected, actual));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use gfx::surface;
|
||||
use io::WriterUtil;
|
||||
|
||||
fn encode(writer: io::Writer, surface: surface::image_surface) {
|
||||
fn encode(writer: io::Writer, surface: &surface::image_surface) {
|
||||
assert surface.format == gfx::surface::fo_rgba_8888;
|
||||
|
||||
writer.write_u8(0u8); // identsize
|
||||
|
|
|
@ -19,7 +19,7 @@ pub struct ImageHolder {
|
|||
|
||||
}
|
||||
|
||||
fn ImageHolder(url : &Url, image_cache_task: ImageCacheTask, cb: fn~()) -> ImageHolder {
|
||||
fn ImageHolder(url : &Url, image_cache_task: ImageCacheTask, +cb: fn~()) -> ImageHolder {
|
||||
debug!("ImageHolder() %?", url.to_str());
|
||||
let holder = ImageHolder {
|
||||
url : Some(copy *url),
|
||||
|
|
|
@ -279,7 +279,7 @@ impl RenderBox {
|
|||
GenericBox(*) => { },
|
||||
ImageBox(_,i) => {
|
||||
match i.get_image() {
|
||||
Some(image) => list.push(~dl::Image(bounds, image)),
|
||||
Some(image) => list.push(~dl::Image(bounds, arc::clone(&image))),
|
||||
/* No image data at all? Okay, add some fallback content instead. */
|
||||
None => {
|
||||
// TODO: shouldn't need to unbox CSSValue by now
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue