From 3346d3b912d51e75f28396837370e3d2d5aec6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Moreau?= Date: Sat, 18 Oct 2014 21:31:24 -0400 Subject: [PATCH] mfreerdp: fix crash with <32bpp color depths --- client/Mac/MRDPView.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index 48c4430dd..ea6a8e901 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -944,10 +944,10 @@ BOOL mac_post_connect(freerdp* instance) flags = CLRCONV_ALPHA | CLRCONV_RGB555; - if (settings->ColorDepth > 16) + //if (settings->ColorDepth > 16) flags |= CLRBUF_32BPP; - else - flags |= CLRBUF_16BPP; + //else + // flags |= CLRBUF_16BPP; gdi_init(instance, flags, NULL); gdi = instance->context->gdi; @@ -1120,17 +1120,17 @@ CGContextRef mac_create_bitmap_context(rdpContext* context) CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - if (gdi->dstBpp == 16) + if (gdi->bytesPerPixel == 2) { bitmap_context = CGBitmapContextCreate(gdi->primary_buffer, - gdi->width, gdi->height, 5, gdi->width * 2, colorSpace, - kCGBitmapByteOrder16Little | kCGImageAlphaNoneSkipFirst); + gdi->width, gdi->height, 5, gdi->width * gdi->bytesPerPixel, + colorSpace, kCGBitmapByteOrder16Little | kCGImageAlphaNoneSkipFirst); } else { bitmap_context = CGBitmapContextCreate(gdi->primary_buffer, - gdi->width, gdi->height, 8, gdi->width * 4, colorSpace, - kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst); + gdi->width, gdi->height, 8, gdi->width * gdi->bytesPerPixel, + colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst); } CGColorSpaceRelease(colorSpace);