iPad Pro, object.fill, can't allocate region

Doing a simple display.captureBounds, save image to temp directory, then using that image to fill a rect. This works fine on other devices like iPhone 4s, iPad 2, but with the iPad Pro (device) I get:

malloc: *** mach_vm_map(size=18446735226076921856) failed (error code=3)
*** error: can’t allocate region
*** set a breakpoint in malloc_error_break to debug

<Error>: CGImageCreate: unsupported image width: 2147483648.
<Error>: CGBitmapContextInfoCreate: unable to allocate 8847632629760 bytes for bitmap data

Even if the source image (selected from the album) is 440 x 180 this error happens.

The image was saved as a jpg file. Like I said, works fine on iPhone 4s and iPad 2.
 

Ideas?

SOLVED - Too much making merry yesterday I guess!

Can I get you to file a bug report on this?  Create a simple example that causes the problem. It needs to have a main.lua, config.lua and build.settings as well as any images or other assets needed and put it in a .zip file. Use the “Report a bug” link at the top of the page.

Thanks

Rob

@lessmsios,

Solved how?  Share with others in case they make the same mistake.

Rob - not sure if this is a bug, could be the other devices were more tolerant.

How solved for the iPad Pro:

Prior to saving the captured image I set the width and height of the captured image (bounded by a rectangle) to the same dimensions as the rectangle. You would think the display object would have had those dimensions preset on capture - but at least the width wasn’t. Probably why I got that weird width in the error mentioned in the first post. So let:

l = Rect with a marching ants outline

target = destination Rect that will be painted

l = display.newRect ------

l.stroke.effect = “generator.marchingAnts”;

bounds = l.contentBounds;

(after an image is chosen the user can zoom/pan/scale with their fingers, then once they end their manipulation capture what’s within the Rect, capture it, size it, save it, then paint the target)

local screenCap = display.captureBounds(bounds);
screenCap.width = target.width; screenCap.height = target.height;
screenCap.x, screenCap.y = 0,0;
screenCap.xScale, screenCap.yScale = 1,1;

Not sure if setting the x,y and scale helped but it works. Like I said, didn’t have to do this for the other iDevices.

David

Can I get you to file a bug report on this?  Create a simple example that causes the problem. It needs to have a main.lua, config.lua and build.settings as well as any images or other assets needed and put it in a .zip file. Use the “Report a bug” link at the top of the page.

Thanks

Rob

@lessmsios,

Solved how?  Share with others in case they make the same mistake.

Rob - not sure if this is a bug, could be the other devices were more tolerant.

How solved for the iPad Pro:

Prior to saving the captured image I set the width and height of the captured image (bounded by a rectangle) to the same dimensions as the rectangle. You would think the display object would have had those dimensions preset on capture - but at least the width wasn’t. Probably why I got that weird width in the error mentioned in the first post. So let:

l = Rect with a marching ants outline

target = destination Rect that will be painted

l = display.newRect ------

l.stroke.effect = “generator.marchingAnts”;

bounds = l.contentBounds;

(after an image is chosen the user can zoom/pan/scale with their fingers, then once they end their manipulation capture what’s within the Rect, capture it, size it, save it, then paint the target)

local screenCap = display.captureBounds(bounds);
screenCap.width = target.width; screenCap.height = target.height;
screenCap.x, screenCap.y = 0,0;
screenCap.xScale, screenCap.yScale = 1,1;

Not sure if setting the x,y and scale helped but it works. Like I said, didn’t have to do this for the other iDevices.

David