4

I was surprised today that a JPEG backed CGImage backed CALayer (I mean a [[JPEG backed CGImage] backed CALayer]) was so slow that for a 8MP photo it felt no GPU there.

I tried creating a new bitmap backed CGImage by drawing the original CGImage into a CGBitmapContext, which solved the speed problem somehow. But it brought a 6xMB memory burst (from 3MB) and took 1s or so to do the drawing thing.

Is there a way to get the decoded image from the original CGImage? Or other ways to make a JPEG backed CGImage faster, maybe tell it to just use a cache bitmap and never trash it?


I switched to the CGDataProviderCopyData approach. A little faster, but still takes 0.8s on iPhone 4S. I start to wonder what's the mechanism behind the CALayer backed by a encoded source? It gets slow when the image is shrunk and more part of the image got shown. But not as slow as 1fps even when the whole picture is shown (actually I can still get something like 10fps).

BlueWanderer
  • 2,671
  • 2
  • 21
  • 36

0 Answers0