Add the posibility to specify buffer for CGContext

This commit is contained in:
Daniel Abramov
2017-04-04 15:40:32 +02:00
parent a4d3c12cb5
commit 81ded0d8ab
+3 -2
View File
@@ -88,7 +88,8 @@ impl TCFType<CGContextRef> for CGContext {
}
impl CGContext {
pub fn create_bitmap_context(width: size_t,
pub fn create_bitmap_context(data: Option<*mut c_void>,
width: size_t,
height: size_t,
bits_per_component: size_t,
bytes_per_row: size_t,
@@ -96,7 +97,7 @@ impl CGContext {
bitmap_info: u32)
-> CGContext {
unsafe {
let result = CGBitmapContextCreate(ptr::null_mut(),
let result = CGBitmapContextCreate(data.unwrap_or(ptr::null_mut()),
width,
height,
bits_per_component,