From 81ded0d8abc5a1ca95cbfa7a7bf2c475aa1af506 Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Tue, 4 Apr 2017 15:40:32 +0200 Subject: [PATCH] Add the posibility to specify buffer for CGContext --- src/context.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context.rs b/src/context.rs index 1788c6b..3f05001 100644 --- a/src/context.rs +++ b/src/context.rs @@ -88,7 +88,8 @@ impl TCFType 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,