Re: Efficiency Question...
Re: Efficiency Question...
- Subject: Re: Efficiency Question...
- From: Kyle Sluder <email@hidden>
- Date: Tue, 06 Mar 2012 08:24:51 -0800
On Mar 5, 2012, at 11:21 PM, Graham Cox <email@hidden> wrote:
>
> Is the goal to go from red to blue from left to right?
>
> Why not add a single layer with red on the left, alpha = 1, and blue on the right, alpha = 1? I don't see why you need to composite two layers.
>
> Drawing a gradient dynamically is probably more efficient than blitting a PNG, and will be resolution independent.
These scenarios are rarely so cut and dry.
If all you want is a simple gradient, then using a CAGradientLayer should be the fastest approach. It should result in zero backing store allocation.
If you want to do something more complex, you might well do best to load a PNG and set it as the layer's content, rather than perform the rendering yourself. Tour VRAM usage will be known, and drawing your layer will involve zero CPU usage or texture uploads.
It all depends on your willingness to accept visual artifacts, the size constraints of your binary, and what Instruments tells you is e best approach.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden