cogl-atlas-texture: Support reorganizing the atlas when it is full
authorNeil Roberts <neil@linux.intel.com>
Fri, 4 Dec 2009 18:24:15 +0000 (18:24 +0000)
committerNeil Roberts <neil@linux.intel.com>
Fri, 4 Dec 2009 20:27:02 +0000 (20:27 +0000)
commitbc845e26d9cab75ecba69d12a937cf7d42bcaf71
treeea48e2b0cd390076ce866100395babc6285348b8
parent1fb32167ec37f7b3bc8193258faa5963fe49569e
cogl-atlas-texture: Support reorganizing the atlas when it is full

When space can't be found in the atlas for a new texture it will now
try to reorganize the atlas to make space. A new CoglAtlas is created
and all of the textures are readded in decreasing size order. If the
textures still don't fit then the size of the atlas is doubled until
either we find a space or we reach the texture size limits. If we
successfully find an organization that fits then all of the textures
will be migrated to a new texture. This involves copying the texture
data into CPU memory and then uploading it again. Potentially it could
eventually use a PBO or an FBO to transfer the image without going
through the CPU.

The algorithm for laying out the textures works a lot better if the
rectangles are added in order so we might eventually want some API for
creating multiple textures in one go to avoid reorganizing the atlas
as far as possible.
clutter/cogl/cogl/cogl-atlas-texture.c