mirror of
https://github.com/brl/mutter.git
synced 2025-08-03 15:14:46 +00:00
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.
This commit is contained in:
@@ -102,7 +102,8 @@ _cogl_texture_driver_prep_gl_for_pixels_download (int pixels_rowstride,
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_texture_driver_upload_subregion_to_gl (CoglTexture *tex,
|
||||
_cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
||||
GLuint gl_handle,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
@@ -111,8 +112,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglTexture *tex,
|
||||
int height,
|
||||
CoglBitmap *source_bmp,
|
||||
GLuint source_gl_format,
|
||||
GLuint source_gl_type,
|
||||
GLuint gl_handle)
|
||||
GLuint source_gl_type)
|
||||
{
|
||||
int bpp = _cogl_get_format_bpp (source_bmp->format);
|
||||
|
||||
@@ -122,11 +122,11 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglTexture *tex,
|
||||
src_y,
|
||||
bpp);
|
||||
|
||||
/* Upload new image data */
|
||||
GE( _cogl_texture_driver_bind (tex->gl_target,
|
||||
gl_handle, tex->gl_intformat) );
|
||||
/* We don't need to use _cogl_texture_driver_bind here because we're
|
||||
not using the bound texture to render yet */
|
||||
GE( glBindTexture (gl_target, gl_handle) );
|
||||
|
||||
GE( glTexSubImage2D (tex->gl_target, 0,
|
||||
GE( glTexSubImage2D (gl_target, 0,
|
||||
dst_x, dst_y,
|
||||
width, height,
|
||||
source_gl_format,
|
||||
|
Reference in New Issue
Block a user