4
#include "test-utils.h"
7
create_texture (CoglContext *context)
9
static const uint8_t data[] =
11
0xff, 0x00, 0x00, 0xff,
12
0x00, 0xfa, 0x00, 0xfa
15
return cogl_texture_2d_new_from_data (context,
16
2, 1, /* width/height */
17
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
24
test_alpha_test (void)
26
CoglTexture *tex = create_texture (test_ctx);
27
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
28
int fb_width = cogl_framebuffer_get_width (test_fb);
29
int fb_height = cogl_framebuffer_get_height (test_fb);
30
CoglColor clear_color;
32
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
33
cogl_pipeline_set_layer_filters (pipeline, 0,
34
COGL_PIPELINE_FILTER_NEAREST,
35
COGL_PIPELINE_FILTER_NEAREST);
36
cogl_pipeline_set_alpha_test_function (pipeline,
37
COGL_PIPELINE_ALPHA_FUNC_GEQUAL,
38
254 / 255.0f /* alpha reference */);
40
cogl_color_init_from_4ub (&clear_color, 0x00, 0x00, 0xff, 0xff);
41
cogl_framebuffer_clear (test_fb,
42
COGL_BUFFER_BIT_COLOR,
45
cogl_framebuffer_draw_rectangle (test_fb,
50
cogl_object_unref (pipeline);
51
cogl_object_unref (tex);
53
/* The left side of the framebuffer should use the first pixel from
54
* the texture which is red */
55
test_utils_check_region (test_fb,
60
/* The right side of the framebuffer should use the clear color
61
* because the second pixel from the texture is clipped from the
63
test_utils_check_region (test_fb,
70
if (cogl_test_verbose ())