diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/canvas/canvas_paint_task.rs | 12 | ||||
-rw-r--r-- | components/gfx/paint_context.rs | 23 | ||||
-rw-r--r-- | components/servo/Cargo.lock | 2 |
3 files changed, 16 insertions, 21 deletions
diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index 982861b0637..095a8d76aca 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use azure::azure_hl::{DrawTarget, SurfaceFormat, BackendType, StrokeOptions, DrawOptions}; -use azure::azure_hl::{ColorPattern, PatternRef}; +use azure::azure_hl::{ColorPattern, PatternRef, JoinStyle, CapStyle}; use geom::rect::Rect; use geom::size::Size2D; use gfx::color; @@ -22,20 +22,20 @@ pub enum CanvasMsg { Close, } -pub struct CanvasPaintTask { +pub struct CanvasPaintTask<'a> { drawtarget: DrawTarget, fill_color: ColorPattern, stroke_color: ColorPattern, - stroke_opts: StrokeOptions, + stroke_opts: StrokeOptions<'a>, } -impl CanvasPaintTask { - fn new(size: Size2D<i32>) -> CanvasPaintTask { +impl<'a> CanvasPaintTask<'a> { + fn new(size: Size2D<i32>) -> CanvasPaintTask<'a> { CanvasPaintTask { drawtarget: CanvasPaintTask::create(size), fill_color: ColorPattern::new(color::black()), stroke_color: ColorPattern::new(color::black()), - stroke_opts: StrokeOptions::new(1.0, 1.0), + stroke_opts: StrokeOptions::new(1.0, JoinStyle::MiterOrBevel, CapStyle::Butt, 1.0, &[]), } } diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 566dd48b030..d831a01d7ec 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -10,8 +10,9 @@ use azure::azure_hl::{DrawOptions, DrawSurfaceOptions, DrawTarget, ExtendMode, F use azure::azure_hl::{GaussianBlurInput, GradientStop, Filter, LinearGradientPattern}; use azure::azure_hl::{PatternRef, Path, PathBuilder, CompositionOp}; use azure::azure_hl::{GaussianBlurAttribute, StrokeOptions, SurfaceFormat}; +use azure::azure_hl::{JoinStyle, CapStyle}; use azure::scaled_font::ScaledFont; -use azure::{AZ_CAP_BUTT, AzFloat, struct__AzDrawOptions, struct__AzGlyph}; +use azure::{AzFloat, struct__AzDrawOptions, struct__AzGlyph}; use azure::{struct__AzGlyphBuffer, struct__AzPoint, AzDrawTargetFillGlyphs}; use color; use display_list::TextOrientation::{SidewaysLeft, SidewaysRight, Upright}; @@ -23,7 +24,6 @@ use geom::point::Point2D; use geom::rect::Rect; use geom::side_offsets::SideOffsets2D; use geom::size::Size2D; -use libc::size_t; use libc::types::common::c99::{uint16_t, uint32_t}; use png::PixelsByColorType; use net::image::base::Image; @@ -608,24 +608,19 @@ impl<'a> PaintContext<'a> { dash_size: DashSize) { let rect = bounds.to_azure_rect(); let draw_opts = DrawOptions::new(1u as AzFloat, 0 as uint16_t); - let mut stroke_opts = StrokeOptions::new(0u as AzFloat, 10u as AzFloat); - let mut dash: [AzFloat; 2] = [0u as AzFloat, 0u as AzFloat]; - - stroke_opts.set_cap_style(AZ_CAP_BUTT as u8); - let border_width = match direction { Direction::Top => border.top, Direction::Left => border.left, Direction::Right => border.right, Direction::Bottom => border.bottom }; - - stroke_opts.line_width = border_width; - dash[0] = border_width * (dash_size as int) as AzFloat; - dash[1] = border_width * (dash_size as int) as AzFloat; - stroke_opts.mDashPattern = dash.as_mut_ptr(); - stroke_opts.mDashLength = dash.len() as size_t; - + let dash_pattern = [border_width * (dash_size as int) as AzFloat, + border_width * (dash_size as int) as AzFloat]; + let stroke_opts = StrokeOptions::new(border_width as AzFloat, + JoinStyle::MiterOrBevel, + CapStyle::Butt, + 10u as AzFloat, + &dash_pattern); let (start, end) = match direction { Direction::Top => { let y = rect.origin.y + border.top * 0.5; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index abf404d4cbf..e2cf7c06a77 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -36,7 +36,7 @@ dependencies = [ [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#ec5fddfe96f889e35cc83abd2255f8325f2ec147" +source = "git+https://github.com/servo/rust-azure#2c60291733afe631eba90105e9ac9c8847e89cac" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", |