makes linux/Arc<FontContextHandle> Rc<FontContextHandle>

This commit is contained in:
patrick kim 2013-12-11 11:24:25 +09:00
parent 0026eb0899
commit ac216be06d
2 changed files with 6 additions and 6 deletions

View file

@ -78,7 +78,7 @@ impl FontHandleMethods for FontHandle {
buf: ~[u8],
style: &SpecifiedFontStyle)
-> Result<FontHandle, ()> {
let ft_ctx: FT_Library = fctx.ctx.get().ctx;
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
if ft_ctx.is_null() { return Err(()); }
let face_result = do buf.as_imm_buf |bytes: *u8, len: uint| {
@ -291,7 +291,7 @@ impl<'self> FontHandle {
pub fn new_from_file(fctx: &FontContextHandle, file: &str,
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
unsafe {
let ft_ctx: FT_Library = fctx.ctx.get().ctx;
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
if ft_ctx.is_null() { return Err(()); }
let mut face: FT_Face = ptr::null();
@ -319,7 +319,7 @@ impl<'self> FontHandle {
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
-> Result<FontHandle, ()> {
unsafe {
let ft_ctx: FT_Library = fctx.ctx.get().ctx;
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
if ft_ctx.is_null() { return Err(()); }
let mut face: FT_Face = ptr::null();

View file

@ -11,7 +11,7 @@ use freetype::freetype::{FTErrorMethods, FT_Library};
use freetype::freetype::{FT_Done_FreeType, FT_Init_FreeType};
use std::ptr;
use extra::arc::Arc;
use std::rc::Rc;
#[deriving(Clone)]
struct FreeTypeLibraryHandle {
@ -20,7 +20,7 @@ struct FreeTypeLibraryHandle {
#[deriving(Clone)]
pub struct FontContextHandle {
ctx: Arc<FreeTypeLibraryHandle>,
ctx: Rc<FreeTypeLibraryHandle>,
}
impl Drop for FreeTypeLibraryHandle {
@ -39,7 +39,7 @@ impl FontContextHandle {
let result = FT_Init_FreeType(&ctx);
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
FontContextHandle {
ctx: Arc::new(FreeTypeLibraryHandle { ctx: ctx }),
ctx: Rc::new(FreeTypeLibraryHandle { ctx: ctx }),
}
}
}