Use FBOs and use cogl_read_pixels() to efficiently read partial textures

* cogl_texture_get_data() is converted to use
   _cogl_texture_foreach_sub_texture_in_region() to iterate
  through the underlying textures.

 * When we need to read only a portion of the underlying
   texture, we set up a FBO and use _cogl_read_pixels()
   to read the portion we need. This is enormously more
   efficient for reading a small portion of a large atlas
   texture.

 * The CoglAtlasTexture, CoglSubTexture, and CoglTexture2dSliced
   implementation of get_texture() are removed.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
This commit is contained in:
Owen W. Taylor
2010-11-12 11:02:13 -05:00
committed by Neil Roberts
parent 47ccbf472e
commit cda29a8011
4 changed files with 186 additions and 241 deletions

View File

@ -439,21 +439,6 @@ _cogl_atlas_texture_set_region (CoglTexture *tex,
bmp);
}
static gboolean
_cogl_atlas_texture_get_data (CoglTexture *tex,
CoglPixelFormat format,
unsigned int rowstride,
guint8 *data)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
/* Forward on to the sub texture */
return cogl_texture_get_data (atlas_tex->sub_texture,
format,
rowstride,
data);
}
static CoglPixelFormat
_cogl_atlas_texture_get_format (CoglTexture *tex)
{
@ -632,7 +617,7 @@ static const CoglTextureVtable
cogl_atlas_texture_vtable =
{
_cogl_atlas_texture_set_region,
_cogl_atlas_texture_get_data,
NULL, /* get_data */
_cogl_atlas_texture_foreach_sub_texture_in_region,
_cogl_atlas_texture_get_max_waste,
_cogl_atlas_texture_is_sliced,