SKTexture creation methods can't be properly used with SKMutableTexture subclass

Originator:brandon
Number:rdar://17783483 Date Originated:July 23, 2014
Status:Closed Resolved:
Product:OS X SDK Product Version:OS X 10.10 (14A298i)
Classification:Serious bug Reproducible:Always
 
Summary:
When attempting to use SKTexture creation methods with the SKMutableTexture subclass[1] some of the methods don't return a SKMutableTexture. Even when the methods *do* return a SKMutableTexture instance, calling `modifyPixelDataWithBlock:` will invoke the block with a null pixelData pointer and zero data length.

This negates most usefulness of the SKMutableTexture class because the only way to use it is to start with a blank texture of a certain size using its own initializers.

I had previously filed Radar 17400234 about this, but I closed it prematurely since my sample project only tested two of SKTexture's initializers. Upon further testing it's clear that this hasn't been fixed properly.

[1]: "To use this class, create a mutable texture using either one of its creation methods or those of its superclass"

Steps to Reproduce:
1. Install Xcode
2. Create a new SpriteKit project
3. Attempt to create an SKMutableTexture instance with `textureWithImage:` (others included in the sample project I've provided).
4. Observe that the returned instance is of type SKTexture.
5. Attempt to create an SKMutableTexture instance with `textureWithImageNamed:`
6. Observe that the returned instance is of type SKMutableTexture.
7. Attempt to mutate the image buffer with `modifyPixelDataWithBlock:`.
8. Observe that the pixelData and length arguments are invalid.

Expected Results:
I would expect to get a SKMutableTexture back that is actually mutable with its `modifyPixelDataWithBlock:` method.

Actual Results:
I only get a SKTexture back, or when I do get a SKMutableTexture back I can't use `modifyPixelDataWithBlock:` to do anything because I don't actually get the pixelData pointer and data length value passed into the block.

Version:
Xcode Version 6.0 (6A267n)
OS X 10.10 (14A298i)

Comments

Engineering has determined that there are no plans to address this based on the following:

This is as designed for this release. Internally we are planning on making some changes in the next one, but for now, this is not to be fixed.

We are now closing this bug report.

If you have questions regarding the resolution of this issue, please update your bug report with that information.

Please be sure to regularly check new Apple releases for any updates that might affect this issue.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!