Rust upgrade
This commit is contained in:
+4
-2
@@ -19,12 +19,13 @@ pub type CGDataProviderRef = *__CGDataProvider;
|
||||
|
||||
pub impl CGDataProviderRef : AbstractCFTypeRef {
|
||||
pure fn as_type_ref(&self) -> CFTypeRef { *self as CFTypeRef }
|
||||
static pure fn type_id() -> CFTypeID unsafe { CGDataProviderGetTypeID() }
|
||||
static pure fn type_id() -> CFTypeID { unsafe { CGDataProviderGetTypeID() } }
|
||||
}
|
||||
|
||||
pub type CGDataProvider = CFWrapper<CGDataProviderRef, (), ()>;
|
||||
|
||||
pub fn new_from_buffer(buf: *u8, len: uint) -> CGDataProvider unsafe {
|
||||
pub fn new_from_buffer(buf: *u8, len: uint) -> CGDataProvider {
|
||||
unsafe {
|
||||
let result = CGDataProviderCreateWithData(
|
||||
ptr::null(),
|
||||
cast::transmute(buf),
|
||||
@@ -32,6 +33,7 @@ pub fn new_from_buffer(buf: *u8, len: uint) -> CGDataProvider unsafe {
|
||||
ptr::null());
|
||||
|
||||
CFWrapper::wrap_owned(result)
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
|
||||
@@ -11,15 +11,17 @@ pub type CGFontRef = *__CGFont;
|
||||
|
||||
pub impl CGFontRef : AbstractCFTypeRef {
|
||||
pure fn as_type_ref(&self) -> CFTypeRef { *self as CFTypeRef }
|
||||
static pure fn type_id() -> CFTypeID unsafe { CGFontGetTypeID() }
|
||||
static pure fn type_id() -> CFTypeID { unsafe { CGFontGetTypeID() } }
|
||||
}
|
||||
|
||||
pub type CGFont = CFWrapper<CGFontRef, (), ()>;
|
||||
|
||||
pub fn create_with_data_provider(provider: &CGDataProvider) -> CGFont {
|
||||
// TODO: error handling
|
||||
let value = CGFontCreateWithDataProvider(*provider.borrow_ref());
|
||||
CFWrapper::wrap_owned(value)
|
||||
unsafe {
|
||||
// TODO: error handling
|
||||
let value = CGFontCreateWithDataProvider(*provider.borrow_ref());
|
||||
CFWrapper::wrap_owned(value)
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
|
||||
Reference in New Issue
Block a user