diff --git a/azure.rc b/azure.rc index 6250e37..c0d4285 100644 --- a/azure.rc +++ b/azure.rc @@ -2,8 +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/. */ -#[link(name = "azure", - vers = "0.1")]; +#[crate_id = "github.com/mozilla-servo/rust-azure#azure:0.1"]; #[crate_type = "lib"]; #[feature(globs)]; diff --git a/azure.rs b/azure.rs index 61cd1e5..8e9a5aa 100644 --- a/azure.rs +++ b/azure.rs @@ -303,7 +303,7 @@ pub type AzPathRef = *c_void; pub type AzPathBuilderRef = *c_void; -#[link_args="-lazure"] +#[link(name = "azure")] extern { pub fn AzSanityCheck(/* FIXME: variadic function */); diff --git a/azure_hl.rs b/azure_hl.rs index 13154c1..81e55ff 100644 --- a/azure_hl.rs +++ b/azure_hl.rs @@ -112,7 +112,6 @@ pub struct ColorPattern { } impl Drop for ColorPattern { - #[fixed_stack_segment] fn drop(&mut self) { unsafe { AzReleaseColorPattern(self.azure_color_pattern); @@ -120,7 +119,6 @@ impl Drop for ColorPattern { } } -#[fixed_stack_segment] pub fn ColorPattern(color: Color) -> ColorPattern { unsafe { ColorPattern { @@ -239,7 +237,7 @@ pub enum Filter { } impl Filter { - fn as_azure_filter(self) -> AzFilter { + pub fn as_azure_filter(self) -> AzFilter { self as AzFilter } } @@ -298,7 +296,6 @@ pub struct DrawTarget { } impl Drop for DrawTarget { - #[fixed_stack_segment] fn drop(&mut self) { unsafe { match self.skia_context { @@ -317,7 +314,6 @@ pub struct StolenGLResources { } impl DrawTarget { - #[fixed_stack_segment] pub fn new(backend: BackendType, size: Size2D, format: SurfaceFormat) -> DrawTarget { unsafe { @@ -333,7 +329,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn new_with_data(backend: BackendType, data: ~[u8], offset: uint, @@ -357,7 +352,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn new_with_fbo(backend: BackendType, native_graphics_context: &NativePaintingGraphicsContext, size: Size2D, @@ -381,7 +375,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn clone(&self) -> DrawTarget { unsafe { AzRetainDrawTarget(self.azure_draw_target); @@ -400,7 +393,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn make_current(&self) { match self.skia_context { None => {} @@ -413,7 +405,6 @@ impl DrawTarget { } /// Consumes this draw target and returns the underlying native surface and GL context, if they exist. - #[fixed_stack_segment] pub fn steal_gl_resources(self) -> Option { match self.skia_context { None => None, @@ -427,14 +418,12 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn get_size(&self) -> AzIntSize { unsafe { AzDrawTargetGetSize(self.azure_draw_target) } } - #[fixed_stack_segment] pub fn flush(&self) { unsafe { AzDrawTargetFlush(self.azure_draw_target); @@ -445,14 +434,12 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn clear_rect(&self, rect: &Rect) { unsafe { AzDrawTargetClearRect(self.azure_draw_target, &rect.as_azure_rect()); } } - #[fixed_stack_segment] pub fn fill(&self, path: &Path, pattern: &ColorPattern, draw_options: &DrawOptions) { unsafe { AzDrawTargetFill(self.azure_draw_target, @@ -462,7 +449,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn fill_rect(&self, rect: &Rect, pattern: &ColorPattern) { unsafe { AzDrawTargetFillRect(self.azure_draw_target, @@ -471,7 +457,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn stroke_line(&self, start: Point2D, end: Point2D, @@ -488,7 +473,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn stroke_rect(&self, rect: &Rect, pattern: &ColorPattern, @@ -503,7 +487,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn draw_surface(&self, surface: SourceSurface, dest: Rect, @@ -520,7 +503,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn snapshot(&self) -> SourceSurface { unsafe { let azure_surface = AzDrawTargetGetSnapshot(self.azure_draw_target); @@ -528,7 +510,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn create_source_surface_from_data(&self, data: &[u8], size: Size2D, @@ -547,14 +528,12 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn set_transform(&self, matrix: &Matrix2D) { unsafe { AzDrawTargetSetTransform(self.azure_draw_target, cast::transmute(matrix)); } } - #[fixed_stack_segment] pub fn fill_glyphs(&self, azfontref: AzScaledFontRef, glyphbuf: struct__AzGlyphBuffer, azure_pattern: AzColorPatternRef, options: struct__AzDrawOptions, @@ -569,7 +548,6 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn create_path_builder(&self) -> PathBuilder { unsafe { PathBuilder { @@ -578,14 +556,12 @@ impl DrawTarget { } } - #[fixed_stack_segment] pub fn push_clip(&self, path: &Path) { unsafe { AzDrawTargetPushClip(self.azure_draw_target,path.azure_path); } } - #[fixed_stack_segment] pub fn pop_clip(&self) { unsafe { AzDrawTargetPopClip(self.azure_draw_target); @@ -604,7 +580,6 @@ pub struct SourceSurface { } impl Drop for SourceSurface { - #[fixed_stack_segment] fn drop(&mut self) { unsafe { AzReleaseSourceSurface(self.azure_source_surface); @@ -619,13 +594,11 @@ pub fn SourceSurface(azure_source_surface: AzSourceSurfaceRef) -> SourceSurface } // FIXME Rust #8753 no fixed stack segment for default methods -#[fixed_stack_segment] unsafe fn AzSourceSurfaceGetSize_(aSurface: AzSourceSurfaceRef) -> AzIntSize { AzSourceSurfaceGetSize(aSurface) } // FIXME Rust #8753 no fixed stack segment for default methods -#[fixed_stack_segment] unsafe fn AzSourceSurfaceGetFormat_(aSurface: AzSourceSurfaceRef) -> AzSurfaceFormat { AzSourceSurfaceGetFormat(aSurface) } @@ -633,7 +606,6 @@ unsafe fn AzSourceSurfaceGetFormat_(aSurface: AzSourceSurfaceRef) -> AzSurfaceFo pub trait SourceSurfaceMethods { fn get_azure_source_surface(&self) -> AzSourceSurfaceRef; - #[fixed_stack_segment] fn size(&self) -> Size2D { unsafe { let size = AzSourceSurfaceGetSize_(self.get_azure_source_surface()); @@ -641,7 +613,6 @@ pub trait SourceSurfaceMethods { } } - #[fixed_stack_segment] fn format(&self) -> SurfaceFormat { unsafe { SurfaceFormat::new(AzSourceSurfaceGetFormat_(self.get_azure_source_surface())) @@ -650,7 +621,6 @@ pub trait SourceSurfaceMethods { } impl SourceSurface { - #[fixed_stack_segment] pub fn get_data_surface(&self) -> DataSourceSurface { unsafe { let data_source_surface = AzSourceSurfaceGetDataSurface( @@ -671,7 +641,6 @@ pub struct DataSourceSurface { } impl Drop for DataSourceSurface { - #[fixed_stack_segment] fn drop(&mut self) { unsafe { AzReleaseSourceSurface(self.azure_data_source_surface); @@ -680,8 +649,7 @@ impl Drop for DataSourceSurface { } impl DataSourceSurface { - #[fixed_stack_segment] - pub fn with_data(&self, f: &fn(&[u8])) { + pub fn with_data(&self, f: |&[u8]|) { unsafe { let buf = AzDataSourceSurfaceGetData(self.azure_data_source_surface); let len = self.stride() * self.size().height; @@ -689,7 +657,6 @@ impl DataSourceSurface { } } - #[fixed_stack_segment] pub fn stride(&self) -> i32 { unsafe { AzDataSourceSurfaceGetStride(self.azure_data_source_surface) @@ -708,12 +675,11 @@ impl SourceSurfaceMethods for DataSourceSurface { } } -struct Path { +pub struct Path { priv azure_path: AzPathRef } impl Drop for Path { - #[fixed_stack_segment] fn drop(&mut self){ unsafe { AzReleasePath(self.azure_path); @@ -721,12 +687,11 @@ impl Drop for Path { } } -struct PathBuilder { +pub struct PathBuilder { priv azure_path_builder: AzPathBuilderRef } impl PathBuilder { - #[fixed_stack_segment] pub fn move_to(&self, point: Point2D) { unsafe { let az_point = point.as_azure_point(); @@ -734,7 +699,6 @@ impl PathBuilder { } } - #[fixed_stack_segment] pub fn line_to(&self, point: Point2D) { unsafe { let az_point = point.as_azure_point(); @@ -742,7 +706,6 @@ impl PathBuilder { } } - #[fixed_stack_segment] pub fn finish(&self) -> Path{ unsafe { let az_path = AzPathBuilderFinish(self.azure_path_builder); @@ -754,7 +717,6 @@ impl PathBuilder { } impl Drop for PathBuilder { - #[fixed_stack_segment] fn drop(&mut self) { unsafe { AzReleasePathBuilder(self.azure_path_builder); @@ -762,7 +724,6 @@ impl Drop for PathBuilder { } } -#[fixed_stack_segment] pub fn current_gl_context() -> AzGLContext { unsafe { AzSkiaGetCurrentGLContext() @@ -770,7 +731,6 @@ pub fn current_gl_context() -> AzGLContext { } #[cfg(target_os="linux")] -#[fixed_stack_segment] pub fn current_display() -> *c_void { use glfw; unsafe { @@ -779,7 +739,6 @@ pub fn current_display() -> *c_void { } #[cfg(target_os="linux")] -#[fixed_stack_segment] pub fn current_graphics_metadata() -> NativeGraphicsMetadata { use xlib::xlib::XDisplayString; use std::c_str::CString; @@ -792,7 +751,6 @@ pub fn current_graphics_metadata() -> NativeGraphicsMetadata { } #[cfg(target_os="macos")] -#[fixed_stack_segment] pub fn current_graphics_metadata() -> NativeGraphicsMetadata { use opengles::cgl::{CGLGetCurrentContext, CGLGetPixelFormat}; unsafe { @@ -803,12 +761,9 @@ pub fn current_graphics_metadata() -> NativeGraphicsMetadata { } #[cfg(target_os="android")] -#[fixed_stack_segment] pub fn current_graphics_metadata() -> NativeGraphicsMetadata { use egl::egl::GetCurrentDisplay; - unsafe { - NativeGraphicsMetadata { - display: GetCurrentDisplay(), - } + NativeGraphicsMetadata { + display: GetCurrentDisplay(), } } diff --git a/linkhack.rs b/linkhack.rs index 0ded6c7..70fa98e 100644 --- a/linkhack.rs +++ b/linkhack.rs @@ -5,18 +5,30 @@ // Some crumminess to make sure we link correctly #[cfg(target_os = "linux")] -#[link_args = "-L. -lazure -lstdc++ -lskia -lfontconfig -lX11"] -#[nolink] +#[link(name = "azure")] +#[link(name = "stdc++")] +#[link(name = "skia")] +#[link(name = "fontconfig")] +#[link(name = "X11")] extern { } #[cfg(target_os = "android")] -#[link_args = "-L. -lazure -lstdc++ -lskia -lexpat -lfontconfig -lEGL"] -#[nolink] +#[link(name = "azure")] +#[link(name = "stdc++")] +#[link(name = "skia")] +#[link(name = "expat")] +#[link(name = "fontconfig")] +#[link(name = "EGL")] extern { } #[cfg(target_os = "macos")] -#[link_args = "-L. -lazure -lstdc++ -framework ApplicationServices \ - -lskia -framework IOSurface -lobjc -framework OpenGL \ - -framework Foundation -framework QuartzCore"] -#[nolink] +#[link(name = "azure")] +#[link(name = "stdc++")] +#[link(name = "skia")] +#[link(name = "objc")] +#[link(name = "IOSurface", kind = "framework")] +#[link(name = "OpenGL", kind = "framework")] +#[link(name = "Foundation", kind = "framework")] +#[link(name = "QuartzCore", kind = "framework")] +#[link(name = "ApplicationServices", kind = "framework")] extern { } diff --git a/scaled_font.rs b/scaled_font.rs index fc1eb18..78386a0 100644 --- a/scaled_font.rs +++ b/scaled_font.rs @@ -52,7 +52,6 @@ pub struct ScaledFont { } impl Drop for ScaledFont { - #[fixed_stack_segment] fn drop(&mut self) { unsafe { AzReleaseScaledFont(self.azure_scaled_font); @@ -67,7 +66,6 @@ impl ScaledFont { #[cfg(target_os="linux")] #[cfg(target_os="android")] - #[fixed_stack_segment] pub fn new(backend: BackendType, native_font: FT_Face, size: AzFloat) -> ScaledFont { use azure::AZ_NATIVE_FONT_SKIA_FONT_FACE; @@ -98,7 +96,6 @@ impl ScaledFont { /// Mac-specific function to create a font for the given backend. #[cfg(target_os="macos")] - #[fixed_stack_segment] pub fn new(backend: BackendType, native_font: &CGFont, size: AzFloat) -> ScaledFont { use azure::AZ_NATIVE_FONT_MAC_FONT_FACE; use azure_hl::{CoreGraphicsBackend,CoreGraphicsAcceleratedBackend}; @@ -133,7 +130,7 @@ impl ScaledFont { // FIXME: Move this stuff to a rust-skia? // FIXME: Demangle the names!!! #[cfg(target_os="macos")] -#[link_args="-lskia"] +#[link(name = "skia")] extern { pub fn _Z26SkCreateTypefaceFromCTFontPK8__CTFont(font: CTFontRef) -> *SkTypeface; } diff --git a/test.rs b/test.rs index c7f804f..4af49b2 100644 --- a/test.rs +++ b/test.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #[test] -#[fixed_stack_segment] fn sanity_check() { use azure::AzSanityCheck;