Sven Neumann wrote:
 You will however notice that GIMP instead needs 8 bytes per
pixel. In addition to the 3 bpp for the RGB layer it allocates a
projection the size of the image. This projection holds the result of
compositing the layer stack. It is always allocated 4 bpp. Additionally
a selection mask is allocated which adds another byte per pixel.

(As an aside, once upon a time, we did have such a thing as greyscale projections.)

So what could be done to improve this? We could for example try to get
around the need for a projection for the case where people are working
with a single layer only. Instead of displaying from the projection,
we could display directly from the layer.

I think we used to do this, too. At least, I struggled for a long time making the projection tiles be initialised to a lazy copy-on-write reference to the bottom layer (IIRC the tile hinting system would also preserve these cheap refs even when there were multiple layers where the upper layers were largely transparent). There were some annoying corner cases (duplicating a zoomed-in image) which I now don't remember if we ever got right. :(

But it still seems like the elegant way to do this (erk, but it
probably did rely on the projection being able to assume the
same depth as the image).

It might also help to allocate the selection lazily. That is to not
allocate the tiles at all until the selection mask is altered. This
might actually happen already, I am not sure about it.

Not sure. Might be able to do this elegantly (elegance again being in the eye of the beholder) by initialising all of the selection tiles to a COW of the same 'blank' tile (and doing the same in the 'clear selection' operation, etc).

Adam D. Moss   . ,,^^   [EMAIL PROTECTED]   co:3
Gimp-developer mailing list

Reply via email to