summaryrefslogtreecommitdiff
path: root/cogl/cogl-texture-private.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2010-02-01 12:11:58 +0000
committerNeil Roberts <neil@linux.intel.com>2010-02-01 13:27:34 +0000
commite20c98e54899497fce26f60e10a8787e1ed6fec4 (patch)
treee5c9f8edd00f88bbdc2ae8d9dfb13041ca1ef496 /cogl/cogl-texture-private.h
parenta6f061e41fa97267c35e15869ba91d21de2ad1f2 (diff)
downloadcogl-e20c98e54899497fce26f60e10a8787e1ed6fec4.tar.gz
cogl: Let GL do the format conversion when uploading texture data
Cogl accepts a pixel format for both the data in memory and the internal format to be used for the texture. If they do not match then it would convert them using the CoglBitmap functions before uploading the data. However, GL also lets you specify both formats so it makes more sense to let GL do the conversion. The driver may need the texture in a specific format so it may end up being converted anyway. The cogl_texture_upload_data functions have been removed and replaced with a single function to prepare the bitmap. This will only do the premultiplication conversion because that is the only part that GL can't do directly.
Diffstat (limited to 'cogl/cogl-texture-private.h')
-rw-r--r--cogl/cogl-texture-private.h44
1 files changed, 12 insertions, 32 deletions
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h
index e5937433..857e3f6a 100644
--- a/cogl/cogl-texture-private.h
+++ b/cogl/cogl-texture-private.h
@@ -32,7 +32,6 @@
typedef struct _CoglTexture CoglTexture;
typedef struct _CoglTextureVtable CoglTextureVtable;
-typedef struct _CoglTextureUploadData CoglTextureUploadData;
typedef void (*CoglTextureSliceCallback) (CoglHandle handle,
GLuint gl_handle,
@@ -107,17 +106,6 @@ struct _CoglTextureVtable
gint (* get_height) (CoglTexture *tex);
};
-/* This represents the state needed to upload texture data. There are
- utility functions in cogl-texture which use this state */
-struct _CoglTextureUploadData
-{
- CoglBitmap bitmap;
- gboolean bitmap_owner;
- GLenum gl_intformat;
- GLenum gl_format;
- GLenum gl_type;
-};
-
struct _CoglTexture
{
CoglHandleObject _parent;
@@ -162,28 +150,20 @@ _cogl_texture_ensure_mipmaps (CoglHandle handle);
void
_cogl_texture_ensure_non_quad_rendering (CoglHandle handle);
-/* Utility functions to help uploading a bitmap. These are intended to
- * be used by CoglTexture implementations or drivers... */
-
-void
-_cogl_texture_upload_data_free (CoglTextureUploadData *data);
-
-void
-_cogl_texture_upload_data_swap_bitmap (CoglTextureUploadData *data,
- CoglBitmap *new_bitmap);
-
-gboolean
-_cogl_texture_upload_data_prepare_format
- (CoglTextureUploadData *data,
- CoglPixelFormat *internal_format);
-
-gboolean
-_cogl_texture_upload_data_convert (CoglTextureUploadData *data,
- CoglPixelFormat internal_format);
+/* Utility function to help uploading a bitmap. If the bitmap needs
+ premult conversion then it will be copied and *copied_bitmap will
+ be set to TRUE. Otherwise dst_bmp will be set to a shallow copy of
+ src_bmp. The GLenums needed for uploading are returned */
gboolean
-_cogl_texture_upload_data_prepare (CoglTextureUploadData *data,
- CoglPixelFormat internal_format);
+_cogl_texture_prepare_for_upload (CoglBitmap *src_bmp,
+ CoglPixelFormat dst_format,
+ CoglPixelFormat *dst_format_out,
+ CoglBitmap *dst_bmp,
+ gboolean *copied_bitmap,
+ GLenum *out_glintformat,
+ GLenum *out_glformat,
+ GLenum *out_gltype);
void
_cogl_texture_prep_gl_alignment_for_pixels_upload (int pixels_rowstride);