mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
makes linux/Arc<FontContextHandle> Rc<FontContextHandle>
This commit is contained in:
parent
0026eb0899
commit
ac216be06d
2 changed files with 6 additions and 6 deletions
|
@ -78,7 +78,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
buf: ~[u8],
|
buf: ~[u8],
|
||||||
style: &SpecifiedFontStyle)
|
style: &SpecifiedFontStyle)
|
||||||
-> Result<FontHandle, ()> {
|
-> 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(()); }
|
if ft_ctx.is_null() { return Err(()); }
|
||||||
|
|
||||||
let face_result = do buf.as_imm_buf |bytes: *u8, len: uint| {
|
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,
|
pub fn new_from_file(fctx: &FontContextHandle, file: &str,
|
||||||
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
|
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
|
||||||
unsafe {
|
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(()); }
|
if ft_ctx.is_null() { return Err(()); }
|
||||||
|
|
||||||
let mut face: FT_Face = ptr::null();
|
let mut face: FT_Face = ptr::null();
|
||||||
|
@ -319,7 +319,7 @@ impl<'self> FontHandle {
|
||||||
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
|
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
|
||||||
-> Result<FontHandle, ()> {
|
-> Result<FontHandle, ()> {
|
||||||
unsafe {
|
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(()); }
|
if ft_ctx.is_null() { return Err(()); }
|
||||||
|
|
||||||
let mut face: FT_Face = ptr::null();
|
let mut face: FT_Face = ptr::null();
|
||||||
|
|
|
@ -11,7 +11,7 @@ use freetype::freetype::{FTErrorMethods, FT_Library};
|
||||||
use freetype::freetype::{FT_Done_FreeType, FT_Init_FreeType};
|
use freetype::freetype::{FT_Done_FreeType, FT_Init_FreeType};
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use extra::arc::Arc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
struct FreeTypeLibraryHandle {
|
struct FreeTypeLibraryHandle {
|
||||||
|
@ -20,7 +20,7 @@ struct FreeTypeLibraryHandle {
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct FontContextHandle {
|
pub struct FontContextHandle {
|
||||||
ctx: Arc<FreeTypeLibraryHandle>,
|
ctx: Rc<FreeTypeLibraryHandle>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for FreeTypeLibraryHandle {
|
impl Drop for FreeTypeLibraryHandle {
|
||||||
|
@ -39,7 +39,7 @@ impl FontContextHandle {
|
||||||
let result = FT_Init_FreeType(&ctx);
|
let result = FT_Init_FreeType(&ctx);
|
||||||
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
|
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
|
||||||
FontContextHandle {
|
FontContextHandle {
|
||||||
ctx: Arc::new(FreeTypeLibraryHandle { ctx: ctx }),
|
ctx: Rc::new(FreeTypeLibraryHandle { ctx: ctx }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue