summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-04 22:51:30 -0400
committerPietro Gagliardi <[email protected]>2014-04-04 22:51:30 -0400
commitb97e6b864f2bb6c3ffbc12cba81f3be250f48d92 (patch)
treee01848bc14084c40904e96cdcb92b92644b67919
parent8eee2a92b7c4e3884c3b4e0c37a6bd7e6b37d4e4 (diff)
Fixed 32-bit Mac OS X builds: Area crashed due to random ABI changes. Also more TODOs.
-rw-r--r--bleh_darwin.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/bleh_darwin.m b/bleh_darwin.m
index b8f7d93..0e1cce5 100644
--- a/bleh_darwin.m
+++ b/bleh_darwin.m
@@ -243,6 +243,12 @@ static SEL s_drawInRect;
static SEL s_release;
static BOOL drawImage_init = NO;
+/*
+hey guys you know what's fun? 32-bit ABI changes!
+*/
+static BOOL (*objc_msgSend_drawInRect)(id, SEL, NSRect, NSRect, NSCompositingOperation, CGFloat, BOOL, id) =
+ (BOOL (*)(id, SEL, NSRect, NSRect, NSCompositingOperation, CGFloat, BOOL, id)) objc_msgSend;
+
void drawImage(void *pixels, int64_t width, int64_t height, int64_t stride, int64_t xdest, int64_t ydest)
{
unsigned char *planes[1]; /* NSBitmapImageRep wants an array of planes; we have one plane */
@@ -270,7 +276,8 @@ void drawImage(void *pixels, int64_t width, int64_t height, int64_t stride, int6
(NSBitmapFormat) NSAlphaNonpremultipliedBitmapFormat, /* bitmapFormat: | this is where the flag for placing alpha first would go if alpha came first; the default is alpha last, which is how we're doing things (otherwise the docs say "Color planes are arranged in the standard order—for example, red before green before blue for RGB color.") */
(NSInteger) stride, /* bytesPerRow: */
(NSInteger) 32); /* bitsPerPixel: */
- objc_msgSend(bitmap, s_drawInRect,
+ /* TODO this CAN fail; check error */
+ objc_msgSend_drawInRect(bitmap, s_drawInRect,
NSMakeRect((CGFloat) xdest, (CGFloat) ydest,
(CGFloat) width, (CGFloat) height), /* drawInRect: */
NSZeroRect, /* fromRect: | draw whole image */