summaryrefslogtreecommitdiff
path: root/test-fixtures/test-utils.h
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-07-02 01:48:54 +0100
committerRobert Bragg <robert@linux.intel.com>2014-01-09 15:49:47 +0000
commitaf7398788a2d4e39d55372edf2466097fcd8b97d (patch)
tree982e54ec5680a14e44f472985afa068906ea0aa1 /test-fixtures/test-utils.h
parentcbd6951134dbd7b5e576e8570e8dc37d32add47f (diff)
downloadcogl-af7398788a2d4e39d55372edf2466097fcd8b97d.tar.gz
remove internal_format and redundant error arguments
Texture allocation is now consistently handled lazily such that the internal format can now be controlled using cogl_texture_set_components() and cogl_texture_set_premultiplied() before allocating the texture with cogl_texture_allocate(). This means that the internal_format arguments to texture constructors are now redundant and since most of the texture constructors now can't ever fail the error arguments are also redundant. This now means we no longer use CoglPixelFormat in the public api for describing the internal format of textures which had been bad solution originally due to how specific CoglPixelFormat is which is missleading when we don't support such explicit control over the internal format. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 99a53c82e9ab0a1e5ee35941bf83dc334b1fbe87) Note: there are numerous API changes for functions currently marked as 'unstable' which we don't think are in use by anyone depending on a stable 1.x api. Compared to the original patch though this avoids changing the cogl_texture_rectangle_new_with_size() api which we know is used by Mutter.
Diffstat (limited to 'test-fixtures/test-utils.h')
-rw-r--r--test-fixtures/test-utils.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index 9093fa86..5e40370d 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -81,8 +81,7 @@ test_utils_fini (void);
* @width: width of texture in pixels.
* @height: height of texture in pixels.
* @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE
- * @internal_format: the #CoglPixelFormat to use for the GPU storage of the
- * texture.
+ * @components: What texture components are required
*
* Creates a new #CoglTexture with the specified dimensions and pixel format.
*
@@ -100,7 +99,7 @@ test_utils_texture_new_with_size (CoglContext *ctx,
int width,
int height,
TestUtilsTextureFlags flags,
- CoglPixelFormat internal_format);
+ CoglTextureComponents components);
/*
* test_utils_texture_new_from_data:
@@ -109,14 +108,6 @@ test_utils_texture_new_with_size (CoglContext *ctx,
* @height: height of texture in pixels
* @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE
* @format: the #CoglPixelFormat the buffer is stored in in RAM
- * @internal_format: the #CoglPixelFormat that will be used for storing
- * the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
- * premultiplied format similar to the format of the source data will
- * be used. The default blending equations of Cogl expect premultiplied
- * color data; the main use of passing a non-premultiplied format here
- * is if you have non-premultiplied source data and are going to adjust
- * the blend mode (see cogl_material_set_blend()) or use the data for
- * something other than straight blending.
* @rowstride: the memory offset in bytes between the starts of
* scanlines in @data
* @data: pointer the memory region where the source buffer resides
@@ -124,6 +115,13 @@ test_utils_texture_new_with_size (CoglContext *ctx,
*
* Creates a new #CoglTexture based on data residing in memory.
*
+ * Note: If the given @format has an alpha channel then the data
+ * will be loaded into a premultiplied internal format. If you want
+ * to avoid having the source data be premultiplied then you can
+ * either specify that the data is already premultiplied or use
+ * test_utils_texture_new_from_bitmap which lets you explicitly
+ * request whether the data should internally be premultipled or not.
+ *
* Return value: A newly created #CoglTexture or %NULL on failure
*/
CoglTexture *
@@ -132,7 +130,6 @@ test_utils_texture_new_from_data (CoglContext *ctx,
int height,
TestUtilsTextureFlags flags,
CoglPixelFormat format,
- CoglPixelFormat internal_format,
int rowstride,
const uint8_t *data);
@@ -140,9 +137,12 @@ test_utils_texture_new_from_data (CoglContext *ctx,
* test_utils_texture_new_from_bitmap:
* @bitmap: A #CoglBitmap pointer
* @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE
- * @internal_format: the #CoglPixelFormat to use for the GPU storage of the
- * texture
- * @error: A #CoglError to catch exceptional errors or %NULL
+ * @premultiplied: Whether the texture should hold premultipled data.
+ * (if the bitmap already holds premultiplied data
+ * and %TRUE is given then no premultiplication will
+ * be done. The data will be premultipled while
+ * uploading if the bitmap has an alpha channel but
+ * does not already have a premultiplied format.)
*
* Creates a #CoglTexture from a #CoglBitmap.
*
@@ -151,7 +151,7 @@ test_utils_texture_new_from_data (CoglContext *ctx,
CoglTexture *
test_utils_texture_new_from_bitmap (CoglBitmap *bitmap,
TestUtilsTextureFlags flags,
- CoglPixelFormat internal_format);
+ CoglBool premultiplied);
/*
* test_utils_check_pixel: