comparison ios/dw.m @ 2411:5db33d37cc1a

iOS: Fix crashes when creating pixmaps, pixmaps still need tons of work. But this prevents the immediate crash on creation.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 30 Mar 2021 16:17:39 +0000
parents 2ab3e88e5d68
children 3b59cbd26fab
comparison
equal deleted inserted replaced
2410:0286ac44d347 2411:5db33d37cc1a
6464 HPIXMAP pixmap = NULL; 6464 HPIXMAP pixmap = NULL;
6465 6465
6466 if((pixmap = calloc(1,sizeof(struct _hpixmap)))) 6466 if((pixmap = calloc(1,sizeof(struct _hpixmap))))
6467 { 6467 {
6468 CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); 6468 CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
6469 CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, calloc(width*height, 4), width*height*32, NULL); 6469 CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, calloc(width*height, 4), width*height*4, NULL);
6470 CGImageRef image = CGImageCreate(width, height, 8, 32, 32 * width, 6470 CGImageRef image = CGImageCreate(width, height, 8, 32, 4 * width,
6471 rgb, kCGBitmapByteOrderDefault | kCGImageAlphaLast, 6471 rgb, kCGBitmapByteOrderDefault | kCGImageAlphaLast,
6472 provider, NULL, false, kCGRenderingIntentDefault); 6472 provider, NULL, false, kCGRenderingIntentDefault);
6473 pixmap->width = width; 6473 pixmap->width = width;
6474 pixmap->height = height; 6474 pixmap->height = height;
6475 pixmap->handle = handle; 6475 pixmap->handle = handle;