3 ms·
Neat. I don't know if I'd ever use this, but, its a cool hack. Random thoughts off the top of my head, re: making it faster: - Can you can decode into an ARGB
by Zev 15y ago
Neat. I don't know if I'd ever use this, but, its a cool hack.
Random thoughts off the top of my head, re: making it faster:
- Can you can decode into an ARGB buffer, instead of an RGBA buffer? iOS uses ARGB as its native bitmap format, so, there will probably be a bit of a speed bump if you can avoid shuffling bits around as much.
- I wonder if using CGDataProviderCreateWithCFData() and passing in a data blob created with CFDataCreateWithBytesNoCopy() to see if any copying bytes around can be reduced.
- Maybe cache CGColorSpaceCreateDeviceRGB() somewhere (either just make it static, or in NSThread's threadDictionary). Release on memory warnings and such.
- UIImage does a bunch of caching internally. You could mimic it and cache images that have been created, to make it really cheap to re-query for an image/reuse an already-existing image. Again, release on memory warnings and such.