W3C home > Mailing lists > Public > www-style@w3.org > September 2009

Re: Image sprites use cases

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 03 Sep 2009 12:26:44 -0400
Message-ID: <4A9FEE44.8060109@mit.edu>
To: Alex Kaminski <activewidgets@gmail.com>
CC: www-style@w3.org
Alex Kaminski wrote:
> So what? Can't you just discard the composite image and release memory
> after extracting the sprite region?

You're assuming the sprite region gets its own dedicated memory 
allocation separate from the combined image.  That's certainly not the 
case in Gecko right now; sprites are just painted directly out of the 
big image.  I'm not an expert on whether there are good reasons for this.

> And how this is different from keeping the set of separate images in a .zip package?

One can stick the zip on disk and decode into memory one at a time as 
needed.  There's no memory cost at all for the small images you happen 
not to be using on the current page.

> This example refers to the _current_ sprite technique (using background-position
> hack) and specifically its limitation that it does not allow using
> background-repeat
> and background-size for the sprite fragments. Because of this
> limitation authors make
> the images very wide or very tall to compensate for the absence of
> repeat/scaling.
> At this is exactly what causes excessive memory usage.

Not quite.  A lot of the memory usage is caused by the need to have 
blank pixels around the sprites in the image, for example.  It's not 
clear to me that this would go away in a different setup.  Maybe it would.

> Well, that is not about _our_ components. I was using our components just as
> an extreme example. Sorry if I sounded like I am pushing something for our
> own benefit. Please excuse my English :-)

Well.  Nothing wrong with pushing things for one's own benefit.  Those 
are called use cases.  ;)  And the question is whether there are enough 
use cases here.  I don't have an answer to that question...  I 
understand that you feel there are.

Received on Thursday, 3 September 2009 16:27:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:39 UTC