2011-05-05 18:34:38 -04:00
|
|
|
#include <cogl/cogl.h>
|
|
|
|
|
2012-04-02 18:41:54 -04:00
|
|
|
#include <string.h>
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2019-01-20 05:41:48 -05:00
|
|
|
#include "test-declarations.h"
|
2012-04-02 18:41:54 -04:00
|
|
|
#include "test-utils.h"
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2012-04-02 18:41:54 -04:00
|
|
|
#define QUAD_WIDTH 32
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
#define RED 0
|
|
|
|
#define GREEN 1
|
|
|
|
#define BLUE 2
|
|
|
|
#define ALPHA 3
|
|
|
|
|
|
|
|
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24)
|
|
|
|
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16)
|
|
|
|
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
|
|
|
|
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
|
|
|
|
|
2013-07-01 20:48:54 -04:00
|
|
|
typedef enum _MakeTextureFlags
|
|
|
|
{
|
|
|
|
TEXTURE_FLAG_SET_PREMULTIPLIED = 1,
|
|
|
|
TEXTURE_FLAG_SET_UNPREMULTIPLIED = 1<<1,
|
|
|
|
} MakeTextureFlags;
|
|
|
|
|
2011-05-05 18:34:38 -04:00
|
|
|
static guchar *
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
gen_tex_data (uint32_t color)
|
2011-05-05 18:34:38 -04:00
|
|
|
{
|
|
|
|
guchar *tex_data, *p;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
uint8_t r = MASK_RED (color);
|
|
|
|
uint8_t g = MASK_GREEN (color);
|
|
|
|
uint8_t b = MASK_BLUE (color);
|
|
|
|
uint8_t a = MASK_ALPHA (color);
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
|
|
|
|
|
|
|
|
for (p = tex_data + QUAD_WIDTH * QUAD_WIDTH * 4; p > tex_data;)
|
|
|
|
{
|
|
|
|
*(--p) = a;
|
|
|
|
*(--p) = b;
|
|
|
|
*(--p) = g;
|
|
|
|
*(--p) = r;
|
|
|
|
}
|
|
|
|
|
|
|
|
return tex_data;
|
|
|
|
}
|
|
|
|
|
2012-04-02 18:41:54 -04:00
|
|
|
static CoglTexture *
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
make_texture (uint32_t color,
|
2012-04-02 18:41:54 -04:00
|
|
|
CoglPixelFormat src_format,
|
2013-07-01 20:48:54 -04:00
|
|
|
MakeTextureFlags flags)
|
2011-05-05 18:34:38 -04:00
|
|
|
{
|
2019-08-25 11:44:07 -04:00
|
|
|
static CoglUserDataKey bitmap_free_key;
|
2012-04-02 18:41:54 -04:00
|
|
|
CoglTexture2D *tex_2d;
|
2011-05-05 18:34:38 -04:00
|
|
|
guchar *tex_data = gen_tex_data (color);
|
2013-07-01 20:48:54 -04:00
|
|
|
CoglBitmap *bmp = cogl_bitmap_new_for_data (test_ctx,
|
|
|
|
QUAD_WIDTH,
|
|
|
|
QUAD_WIDTH,
|
|
|
|
src_format,
|
|
|
|
QUAD_WIDTH * 4,
|
|
|
|
tex_data);
|
2019-08-25 11:44:07 -04:00
|
|
|
cogl_object_set_user_data (COGL_OBJECT (bmp),
|
|
|
|
&bitmap_free_key,
|
|
|
|
tex_data,
|
|
|
|
g_free);
|
2013-07-01 20:48:54 -04:00
|
|
|
|
|
|
|
tex_2d = cogl_texture_2d_new_from_bitmap (bmp);
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2013-07-01 20:48:54 -04:00
|
|
|
if (flags & TEXTURE_FLAG_SET_PREMULTIPLIED)
|
|
|
|
cogl_texture_set_premultiplied (tex_2d, TRUE);
|
|
|
|
else if (flags & TEXTURE_FLAG_SET_UNPREMULTIPLIED)
|
|
|
|
cogl_texture_set_premultiplied (tex_2d, FALSE);
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2013-07-01 20:48:54 -04:00
|
|
|
cogl_object_unref (bmp);
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2013-10-09 08:31:12 -04:00
|
|
|
return tex_2d;
|
2011-05-05 18:34:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-02 18:41:54 -04:00
|
|
|
set_region (CoglTexture *tex,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
uint32_t color,
|
2012-04-02 18:41:54 -04:00
|
|
|
CoglPixelFormat format)
|
2011-05-05 18:34:38 -04:00
|
|
|
{
|
2012-04-02 18:41:54 -04:00
|
|
|
guchar *tex_data = gen_tex_data (color);
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2012-04-02 18:41:54 -04:00
|
|
|
cogl_texture_set_region (tex,
|
|
|
|
0, 0, /* src x, y */
|
|
|
|
0, 0, /* dst x, y */
|
|
|
|
QUAD_WIDTH, QUAD_WIDTH, /* dst width, height */
|
|
|
|
QUAD_WIDTH, QUAD_WIDTH, /* src width, height */
|
|
|
|
format,
|
|
|
|
0, /* auto compute row stride */
|
|
|
|
tex_data);
|
|
|
|
}
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2012-04-02 18:41:54 -04:00
|
|
|
static void
|
|
|
|
check_texture (CoglPipeline *pipeline,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
CoglTexture *tex,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
uint32_t expected_result)
|
2012-04-02 18:41:54 -04:00
|
|
|
{
|
|
|
|
/* New API */
|
2013-10-09 08:31:12 -04:00
|
|
|
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
|
2013-01-18 12:57:06 -05:00
|
|
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
|
2012-04-02 18:41:54 -04:00
|
|
|
x * QUAD_WIDTH,
|
|
|
|
y * QUAD_WIDTH,
|
|
|
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
|
|
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
2013-01-18 12:57:06 -05:00
|
|
|
test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
|
2011-05-05 18:34:38 -04:00
|
|
|
}
|
|
|
|
|
2012-04-02 18:41:54 -04:00
|
|
|
void
|
|
|
|
test_premult (void)
|
2011-05-05 18:34:38 -04:00
|
|
|
{
|
2012-04-02 18:41:54 -04:00
|
|
|
CoglPipeline *pipeline;
|
|
|
|
CoglTexture *tex;
|
|
|
|
|
2013-01-18 12:57:06 -05:00
|
|
|
cogl_framebuffer_orthographic (test_fb, 0, 0,
|
|
|
|
cogl_framebuffer_get_width (test_fb),
|
|
|
|
cogl_framebuffer_get_height (test_fb),
|
2012-04-02 18:41:54 -04:00
|
|
|
-1,
|
|
|
|
100);
|
|
|
|
|
2013-01-18 12:57:06 -05:00
|
|
|
cogl_framebuffer_clear4f (test_fb,
|
2012-04-02 18:41:54 -04:00
|
|
|
COGL_BUFFER_BIT_COLOR,
|
|
|
|
1.0f, 1.0f, 1.0f, 1.0f);
|
|
|
|
|
|
|
|
/* New API */
|
2013-01-18 12:57:06 -05:00
|
|
|
pipeline = cogl_pipeline_new (test_ctx);
|
2012-04-02 18:41:54 -04:00
|
|
|
cogl_pipeline_set_blend (pipeline,
|
|
|
|
"RGBA = ADD (SRC_COLOR, 0)", NULL);
|
|
|
|
cogl_pipeline_set_layer_combine (pipeline, 0,
|
|
|
|
"RGBA = REPLACE (TEXTURE)", NULL);
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/* If the user explicitly specifies an unmultiplied internal format then
|
|
|
|
* Cogl shouldn't automatically premultiply the given texture data... */
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xff00ff80, "
|
|
|
|
"src = RGBA_8888, internal = RGBA_8888)\n");
|
|
|
|
tex = make_texture (0xff00ff80,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 0, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0xff00ff80); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/* If the user explicitly requests a premultiplied internal format and
|
|
|
|
* gives unmultiplied src data then Cogl should always premultiply that
|
|
|
|
* for us */
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xff00ff80, "
|
|
|
|
"src = RGBA_8888, internal = RGBA_8888_PRE)\n");
|
|
|
|
tex = make_texture (0xff00ff80,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_PREMULTIPLIED);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 1, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0x80008080); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
2013-07-01 20:48:54 -04:00
|
|
|
/* If the user doesn't explicitly declare that the texture is premultiplied
|
|
|
|
* then Cogl should assume it is by default should premultiply
|
|
|
|
* unpremultiplied texture data...
|
|
|
|
*/
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xff00ff80, "
|
|
|
|
"src = RGBA_8888, internal = ANY)\n");
|
|
|
|
tex = make_texture (0xff00ff80,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
0); /* default premultiplied status */
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 2, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0x80008080); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/* If the user requests a premultiplied internal texture format and supplies
|
|
|
|
* premultiplied source data, Cogl should never modify that source data...
|
|
|
|
*/
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0x80008080, "
|
|
|
|
"src = RGBA_8888_PRE, "
|
|
|
|
"internal = RGBA_8888_PRE)\n");
|
|
|
|
tex = make_texture (0x80008080,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_PREMULTIPLIED);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 3, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0x80008080); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/* If the user requests an unmultiplied internal texture format, but
|
|
|
|
* supplies premultiplied source data, then Cogl should always
|
|
|
|
* un-premultiply the source data... */
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0x80008080, "
|
|
|
|
"src = RGBA_8888_PRE, internal = RGBA_8888)\n");
|
|
|
|
tex = make_texture (0x80008080,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 4, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0xff00ff80); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/* If the user allows any internal texture format and provides premultipled
|
|
|
|
* source data then by default Cogl shouldn't modify the source data...
|
|
|
|
* (In the future there will be additional Cogl API to control this
|
|
|
|
* behaviour) */
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0x80008080, "
|
|
|
|
"src = RGBA_8888_PRE, internal = ANY)\n");
|
|
|
|
tex = make_texture (0x80008080,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
0); /* default premultiplied status */
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 5, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0x80008080); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Test cogl_texture_set_region() ....
|
|
|
|
*/
|
|
|
|
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xDEADBEEF, "
|
|
|
|
"src = RGBA_8888, internal = RGBA_8888)\n");
|
|
|
|
tex = make_texture (0xDEADBEEF,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
|
2012-04-02 18:41:54 -04:00
|
|
|
set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 6, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0xff00ff80); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
/* Updating a texture region for an unmultiplied texture using premultiplied
|
|
|
|
* region data should result in Cogl unmultiplying the given region data...
|
|
|
|
*/
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xDEADBEEF, "
|
|
|
|
"src = RGBA_8888, internal = RGBA_8888)\n");
|
|
|
|
tex = make_texture (0xDEADBEEF,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
|
2012-04-02 18:41:54 -04:00
|
|
|
set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 7, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0xff00ff80); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xDEADBEEF, "
|
|
|
|
"src = RGBA_8888_PRE, "
|
|
|
|
"internal = RGBA_8888_PRE)\n");
|
|
|
|
tex = make_texture (0xDEADBEEF,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_PREMULTIPLIED);
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
|
2012-04-02 18:41:54 -04:00
|
|
|
set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 8, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0x80008080); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
/* Updating a texture region for a premultiplied texture using unmultiplied
|
|
|
|
* region data should result in Cogl premultiplying the given region data...
|
|
|
|
*/
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("make_texture (0xDEADBEEF, "
|
|
|
|
"src = RGBA_8888_PRE, "
|
|
|
|
"internal = RGBA_8888_PRE)\n");
|
|
|
|
tex = make_texture (0xDEADBEEF,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
2013-07-01 20:48:54 -04:00
|
|
|
TEXTURE_FLAG_SET_PREMULTIPLIED);
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
|
2012-04-02 18:41:54 -04:00
|
|
|
set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
|
2019-11-22 06:03:38 -05:00
|
|
|
check_texture (pipeline, 9, 0, /* position */
|
2012-04-02 18:41:54 -04:00
|
|
|
tex,
|
|
|
|
0x80008080); /* expected */
|
2011-05-05 18:34:38 -04:00
|
|
|
|
|
|
|
|
2012-02-23 07:30:51 -05:00
|
|
|
if (cogl_test_verbose ())
|
2011-05-05 18:34:38 -04:00
|
|
|
g_print ("OK\n");
|
|
|
|
}
|
|
|
|
|