开发者

Is there a performance penalty for large CCSprites that are mostly transparent?

I have some CCSprites that are children of a CCParallaxNode that scroll horizontally. They are all the same size, i.e, 2048X640 (for the -hd versions, 1024X320 for the non-hd), but they cont开发者_如何学Cains large amounts of transparency. For example, the clouds sprite is a thin, wispy layer of clouds and the rest is transparent. Do I take a performance hit by using the big image - should I be trimming it down to the minimum height and setting the vertical position manually, rather that laying all the sprites at the origin?

UPDATE: I trimmed all the layers down to their minimum heights (still 2048 or 1024 wide depending on display) and the framerate went from less than 30 to close to 50. So, yeah, big hit!


You probably are taking a big performance hit for that. I bet if you trimmed the images down, you would see a drop in the file size, as well as a huge drop in the amount of memory that the images take up.

An image of dimensions 2048 x 640 would be stored as 2048 x 1024... which is massive. A texture that large isn't even supported on anything before a 3GS I believe. It doesn't matter that it is mostly transparent, it still needs to store the whole texture.


The short answer is yes, you are taking a performance hit (even if it is minimal).

Even if the full Sprite is not actually shown on the screen, it is indeed loaded in memory. You should re-size your sprites to adjust to the size of the screen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜