In bug 229021 comment 19 Sam points out the existence of CGBitmapContextCreateForFlatteningImage, which duplicates some of the logic added in that bug for creating a CGBitmap with a configuration and color space appropriate for converting a CGImage into a ShareableBitmap. We should look into whether we can use it, to avoid having our own flattening logic.
<rdar://problem/83466936>