From fec7eb4b1d367db25c3cbf4d01b26d4e8181bb7e Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Fri, 27 Jun 2014 12:32:13 -0600 Subject: [PATCH] Upgrade Rust. --- lib.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib.rs b/lib.rs index 53f2c82..6a8c0dd 100644 --- a/lib.rs +++ b/lib.rs @@ -20,7 +20,7 @@ extern crate opengles; // Rust bindings to the IOSurface framework on Mac OS X. -use core_foundation::base::{CFRelease, CFTypeID, TCFType}; +use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; use core_foundation::string::CFStringRef; use geom::size::Size2D; @@ -62,10 +62,25 @@ impl Clone for IOSurface { } impl TCFType for IOSurface { + #[inline] fn as_concrete_TypeRef(&self) -> IOSurfaceRef { self.obj } + #[inline] + unsafe fn wrap_under_get_rule(reference: IOSurfaceRef) -> IOSurface { + let reference: IOSurfaceRef = mem::transmute(CFRetain(mem::transmute(reference))); + TCFType::wrap_under_create_rule(reference) + } + + #[inline] + fn as_CFTypeRef(&self) -> CFTypeRef { + unsafe { + mem::transmute(self.as_concrete_TypeRef()) + } + } + + #[inline] unsafe fn wrap_under_create_rule(obj: IOSurfaceRef) -> IOSurface { IOSurface { obj: obj,