Commit Graph

5 Commits

Author SHA1 Message Date
Neil Roberts
5030356e0e cogl: Move data only used for upload out of CoglTexture
The CoglTexture struct previously contained some fields which are only
used to upload data such as the CoglBitmap and the source GL
format. These are now moved to a separate CoglTextureUploadData struct
which only exists for the duration of one of the cogl_texture_*_new
functions. In cogl-texture there are utility functions which operate
on this new struct rather than on CoglTexture directly.

Some of the fields that were previously stored in the CoglBitmap
struct are now copied to the CoglTexture such as the width, height,
format and internal GL format.

The rowstride was previously stored in CoglTexture and this was
publicly accessible with the cogl_texture_get_rowstride
function. However this doesn't seem to be a useful function because
there is no need to use the same rowstride again when uploading or
downloading new data. Instead cogl_texture_get_rowstride now just
calculates a suitable rowstride from the format and width of the
texture.
2009-12-02 22:03:07 +00:00
Neil Roberts
1df0e36c6c cogl: Use a vtable for the texture backends instead of a type and switch
Instead of storing an enum with the backend type for each texture and
then using a switch statement to decide which function to call, we
should store pointers to all of the functions in a struct and have
each texture point to that struct. This is potentially slightly faster
when there are more backends and it makes implementing new backends
easier because it's more obvious which functions have to be
implemented.
2009-11-25 13:47:28 +00:00
Robert Bragg
61654a9ab4 [cogl-texture-2d-sliced] allow COGL_FORMAT_ANY with _new_with_size()
It's useful when initialzing offscreen draw buffers to be able to ask
Cogl to create a texture of a given size and with the default internal
pixel format.
2009-11-04 03:34:07 +00:00
Robert Bragg
5387aa0e9e [cogl-spans] split out cogl-spans code from cogl-texture-2d-sliced
When we implement atlas textures we will probably want to use the spans API
to handle texture repeating so it doesn't make sense to leave the code in
cogl-texture-2d-sliced.c.  Since it's a standalone set of data structures
and algorithms it also seems reasonable to split out from cogl-texture.
2009-10-16 18:58:52 +01:00
Vladimir Nadvornik
65015a137e [cogl-texture] Split CoglTexture into an abstract class + CoglTexture2dSliced
cogl-texture-2d-sliced provides an implementation of CoglTexture and this
seperation lays the foundation for potentially supporting atlas textures,
pixmap textures (as in GLX_EXT_texture_from_pixmap) and fast-path
GL_TEXTURE_{1D,2D,3D,RECTANGLE} textures in a maintainable fashion.
2009-10-16 18:58:51 +01:00