Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What triggers "Color Copied Images" and "Color Hits Green and Misses Red" in Instruments?

Tags:

The Instruments User Guide has this to say:

  • Color Copied Images. Puts a cyan overlay over images that were copied by Core Animation.

But that doesn't explain why an image got copied. There doesn't seem to be an obvious pattern from one copied image to another, although it is regular and reproducible.

The docs currently don't even mention Color Hits Green and Misses Red, but I'm thinking it might have something to do with CALayer’s shouldRasterize property.

Any ideas?

like image 898
Wilbur Vandrsmith Avatar asked Jun 10 '11 04:06

Wilbur Vandrsmith


2 Answers

For "Color Copied Images," this was talked about nicely in Session 419 WWDC 2014:

"If an image is in a color format that the GPU can not directly work with, it will be converted in the CPU."

Example: Imagine getting images from an online source where you don't control the format. JPEG supports 24-bit color images (8 bits per color). TIFF format can store colors in 48-bit color images (16 bits per color). Depending on what iOS wants, these differences might have to be converted.

The solution would be to covert them in the background to the right color format to prevent a performance problem of doing these conversions on the main thread.

For "Color Hits Green and Misses Red," OP is correct, it's to check whether you are using the "shouldRasterize" property correctly. Green means good, you re-used the cache you created from the "shouldRasterize" property. Red means bad, you needed to write to the cache (causes an offscreen pass), and then draw.

like image 177
kgaidis Avatar answered May 20 '23 22:05

kgaidis


Images can be copied if they are backed by a custom data provider or can’t be mapped into another process for some other reason.

like image 21
Ben Stiglitz Avatar answered May 20 '23 23:05

Ben Stiglitz