[cairo-commit] rendertest/src args.c, 1.4, 1.5 glitz.c, 1.8,
1.9 glitz_agl.c, 1.9, 1.10 glitz_common.h, 1.7,
1.8 glitz_egl.c, 1.2, 1.3 glitz_glx.c, 1.9, 1.10 images.h, 1.3,
1.4 pixman.c, 1.2, 1.3 png.c, 1.1.1.1, 1.2 rendertest.c, 1.12,
1.13 rendertest.h, 1.4, 1.5 traps.h, 1.2, 1.3 xcb.c, 1.8, 1.9
David Reveman
commit at pdx.freedesktop.org
Tue Nov 29 16:04:45 PST 2005
Committed by: davidr
Update of /cvs/cairo/rendertest/src
In directory gabe:/tmp/cvs-serv23727/src
Modified Files:
args.c glitz.c glitz_agl.c glitz_common.h glitz_egl.c
glitz_glx.c images.h pixman.c png.c rendertest.c rendertest.h
traps.h xcb.c
Log Message:
YUV surface support
Index: args.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/args.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- args.c 3 Nov 2004 23:51:04 -0000 1.4
+++ args.c 30 Nov 2005 00:04:43 -0000 1.5
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -55,6 +55,7 @@
" sleep this number of seconds between tests" },
{ "tests", 't', "TESTSPAN", 0, " only run these tests" },
{ "time", 'm', NULL, 0, " print timing statistics" },
+ { "format", 'f', "FORMAT", 0, " use this source surface format" },
{ 0 }
};
@@ -69,40 +70,40 @@
{
printf (" %c%c%c --%s%c%s %s\n",
- (option->flags)? ' ': '-',
- (option->flags)? ' ': option->key,
- (option->flags)? ' ': ',',
- option->name,
- (option->arg)? '=': ' ',
- (option->arg)? option->arg: "",
- option->doc);
+ (option->flags)? ' ': '-',
+ (option->flags)? ' ': option->key,
+ (option->flags)? ' ': ',',
+ option->name,
+ (option->arg)? '=': ' ',
+ (option->arg)? option->arg: "",
+ option->doc);
}
static void
_rendertest_usage (render_int_arg_state_t *state)
{
int i;
-
+
printf ("Usage: %s [OPTION]...\n"
- "Test utility for RENDER-like graphics systems.\n"
- "\n"
- "Options:\n", state->program_name);
+ "Test utility for RENDER-like graphics systems.\n"
+ "\n"
+ "Options:\n", state->program_name);
for (i = 0; _options[i].name; i++)
_print_option (&_options[i]);
if (state->backend_options->name) {
printf ("\nBackend specific options:\n");
-
+
for (i = 0; state->backend_options[i].name; i++)
_print_option (&state->backend_options[i]);
-
+
printf ("\n");
}
for (i = 0; _additional_options[i].name; i++)
_print_option (&_additional_options[i]);
-
+
printf ("\nReport bugs to <davidr at freedesktop.org>.\n");
}
@@ -148,6 +149,21 @@
return RENDER_CLIP_NONE;
}
+static render_format_t
+_render_format (char *format)
+{
+ if (strcasecmp (format, "RGB24") == 0)
+ return RENDER_FORMAT_RGB24;
+ if (strcasecmp (format, "ARGB32") == 0)
+ return RENDER_FORMAT_ARGB32;
+ else if (strcasecmp (format, "YV12") == 0)
+ return RENDER_FORMAT_YV12;
+ else if (strcasecmp (format, "YUY2") == 0)
+ return RENDER_FORMAT_YUY2;
+ else
+ return RENDER_FORMAT_ARGB32;
+}
+
static int
_parse_option (int key, char *arg, render_int_arg_state_t *s)
{
@@ -181,7 +197,7 @@
case 't': {
long int t;
char *next = NULL;
-
+
t = strtol (arg, &next, 0);
if (t < 0)
s->state->settings.last_test = -t;
@@ -189,12 +205,12 @@
s->state->settings.first_test = t;
if (next && *next != '\0') {
- t = strtol (next, NULL, 0);
- if (t)
- s->state->settings.last_test = -t;
+ t = strtol (next, NULL, 0);
+ if (t)
+ s->state->settings.last_test = -t;
} else
- s->state->settings.last_test = s->state->settings.first_test;
- }
+ s->state->settings.last_test = s->state->settings.first_test;
+ }
} break;
case 'v':
printf ("rendertest - " VERSION "\n");
@@ -202,6 +218,9 @@
case 'h':
_rendertest_usage (s);
return 200;
+ case 'f':
+ s->state->settings.format = _render_format (arg);
+ break;
default:
return s->backend_parser (key, arg, s->state);
}
@@ -211,10 +230,10 @@
static const render_option_t *
_find_matching_short_option (int key,
- const render_option_t *backend_options)
+ const render_option_t *backend_options)
{
int i;
-
+
for (i = 0; _options[i].name; i++)
if (key == _options[i].key)
return &_options[i];
@@ -232,10 +251,10 @@
static const render_option_t *
_find_matching_long_option (char *name,
- const render_option_t *backend_options)
+ const render_option_t *backend_options)
{
int i;
-
+
for (i = 0; _options[i].name; i++)
if (strcmp (name, _options[i].name) == 0)
return &_options[i];
@@ -247,15 +266,15 @@
for (i = 0; _additional_options[i].name; i++)
if (strcmp (name, _additional_options[i].name) == 0)
return &_additional_options[i];
-
+
return NULL;
}
int
render_parse_arguments (render_parser_t parser,
- const render_option_t *backend_options,
- render_arg_state_t *state,
- int argc, char **argv)
+ const render_option_t *backend_options,
+ render_arg_state_t *state,
+ int argc, char **argv)
{
int i, j, status, skip;
const render_option_t *option;
@@ -268,7 +287,7 @@
s.backend_options = backend_options;
state->settings.interactive = 0;
- state->settings.npot = 0;
+ state->settings.npot = 0;
state->settings.quiet = 0;
state->settings.sleep = 5;
state->settings.repeat = 1;
@@ -277,6 +296,7 @@
state->settings.last_test = 65535;
state->settings.time = 0;
state->settings.clip = RENDER_CLIP_NONE;
+ state->settings.format = RENDER_FORMAT_ARGB32;
for (i = 1; i < argc; i++) {
if (argv[i][0] != '-')
@@ -286,86 +306,86 @@
if (argv[i][1] == '-') {
char *eq;
-
+
eq = strchr (argv[i], '=');
if (eq) {
- arg = eq + 1;
- *eq = '\0';
+ arg = eq + 1;
+ *eq = '\0';
} else
- arg = NULL;
-
+ arg = NULL;
+
option = _find_matching_long_option (&argv[i][2], backend_options);
if (option) {
- if (option->arg) {
- if (!arg) {
- if (argc > (i + 1)) {
- arg = argv[i + 1];
- skip = 1;
- } else {
- printf ("%s: option '--%s' requires an argument\n",
- s.program_name, option->name);
- printf ("Try '%s --help' for more information.\n",
- s.program_name);
-
- return 1;
- }
- }
- } else if (arg) {
- printf ("%s: option '--%s' doesn't allow an argument\n",
- s.program_name, option->name);
- printf ("Try '%s --help' for more information.\n", s.program_name);
-
- return 1;
- }
-
- status = _parse_option (option->key, arg, &s);
- if (status) {
- if (status != 100 && status != 200)
- printf ("Try '%s --help' for more information.\n", s.program_name);
-
- return 1;
- }
+ if (option->arg) {
+ if (!arg) {
+ if (argc > (i + 1)) {
+ arg = argv[i + 1];
+ skip = 1;
+ } else {
+ printf ("%s: option '--%s' requires an argument\n",
+ s.program_name, option->name);
+ printf ("Try '%s --help' for more information.\n",
+ s.program_name);
+
+ return 1;
+ }
+ }
+ } else if (arg) {
+ printf ("%s: option '--%s' doesn't allow an argument\n",
+ s.program_name, option->name);
+ printf ("Try '%s --help' for more information.\n", s.program_name);
+
+ return 1;
+ }
+
+ status = _parse_option (option->key, arg, &s);
+ if (status) {
+ if (status != 100 && status != 200)
+ printf ("Try '%s --help' for more information.\n", s.program_name);
+
+ return 1;
+ }
} else {
- printf ("%s: unrecognized option '--%s'\n",
- s.program_name, &argv[i][2]);
- printf ("Try '%s --help' for more information.\n", s.program_name);
-
- return 1;
+ printf ("%s: unrecognized option '--%s'\n",
+ s.program_name, &argv[i][2]);
+ printf ("Try '%s --help' for more information.\n", s.program_name);
+
+ return 1;
}
} else {
for (j = 1; argv[i][j] != '\0'; j++) {
- option = _find_matching_short_option (argv[i][j], backend_options);
- if (option) {
- if (option->arg) {
- if (argv[i][j + 1] != '\0') {
- arg = &argv[i][j + 1];
- j += strlen (&argv[i][j + 1]);
- } else if (argc > (i + 1)) {
- arg = argv[i + 1];
- skip = 1;
- } else {
- printf ("%s: option requires an argument -- %c\n",
- s.program_name, option->key);
- printf ("Try '%s --help' for more information.\n",
- s.program_name);
+ option = _find_matching_short_option (argv[i][j], backend_options);
+ if (option) {
+ if (option->arg) {
+ if (argv[i][j + 1] != '\0') {
+ arg = &argv[i][j + 1];
+ j += strlen (&argv[i][j + 1]);
+ } else if (argc > (i + 1)) {
+ arg = argv[i + 1];
+ skip = 1;
+ } else {
+ printf ("%s: option requires an argument -- %c\n",
+ s.program_name, option->key);
+ printf ("Try '%s --help' for more information.\n",
+ s.program_name);
- return 1;
- }
- } else
- arg = NULL;
-
- status = _parse_option (option->key, arg, &s);
- if (status) {
- printf ("Try '%s --help' for more information.\n", s.program_name);
+ return 1;
+ }
+ } else
+ arg = NULL;
- return 1;
- }
- } else {
- printf ("%s: invalid option -- %c\n", s.program_name, argv[i][j]);
- printf ("Try '%s --help' for more information.\n", s.program_name);
+ status = _parse_option (option->key, arg, &s);
+ if (status) {
+ printf ("Try '%s --help' for more information.\n", s.program_name);
- return 1;
- }
+ return 1;
+ }
+ } else {
+ printf ("%s: invalid option -- %c\n", s.program_name, argv[i][j]);
+ printf ("Try '%s --help' for more information.\n", s.program_name);
+
+ return 1;
+ }
}
}
Index: glitz.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- glitz.c 14 Sep 2005 16:02:25 -0000 1.8
+++ glitz.c 30 Nov 2005 00:04:43 -0000 1.9
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -134,20 +134,43 @@
return GLITZ_FILTER_NEAREST;
}
}
-
+
render_surface_t *
_glitz_render_create_similar (render_surface_t *other,
- render_format_t render_format,
- int width,
- int height)
+ render_format_t render_format,
+ int width,
+ int height)
{
render_surface_t *similar;
glitz_drawable_t *drawable;
- glitz_format_t *format;
+ glitz_format_t *format = NULL;
drawable = glitz_surface_get_drawable ((glitz_surface_t *) other->surface);
- format = glitz_find_standard_format (drawable,
- _glitz_format (render_format));
+
+ switch (render_format) {
+ case RENDER_FORMAT_A1:
+ case RENDER_FORMAT_A8:
+ case RENDER_FORMAT_RGB24:
+ case RENDER_FORMAT_ARGB32:
+ format = glitz_find_standard_format (drawable,
+ _glitz_format (render_format));
+ break;
+ case RENDER_FORMAT_YV12: {
+ glitz_format_t templ;
+
+ templ.color.fourcc = GLITZ_FOURCC_YV12;
+ format = glitz_find_format (drawable, GLITZ_FORMAT_FOURCC_MASK,
+ &templ, 0);
+ } break;
+ case RENDER_FORMAT_YUY2: {
+ glitz_format_t templ;
+
+ templ.color.fourcc = GLITZ_FOURCC_YUY2;
+ format = glitz_find_format (drawable, GLITZ_FORMAT_FOURCC_MASK,
+ &templ, 0);
+ } break;
+ }
+
if (format == NULL)
return NULL;
@@ -166,7 +189,7 @@
free (similar);
return NULL;
}
-
+
return similar;
}
@@ -182,17 +205,17 @@
render_status_t
_glitz_render_composite (render_operator_t op,
- render_surface_t *src,
- render_surface_t *mask,
- render_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height)
+ render_surface_t *src,
+ render_surface_t *mask,
+ render_surface_t *dst,
+ int x_src,
+ int y_src,
+ int x_mask,
+ int y_mask,
+ int x_dst,
+ int y_dst,
+ int width,
+ int height)
{
glitz_status_t status;
@@ -233,23 +256,23 @@
width = MIN (mask->width - x_mask, width);
height = MIN (mask->height - y_mask, height);
}
-
+
glitz_composite (_glitz_operator (op),
- (glitz_surface_t *) src->surface,
- (glitz_surface_t *) ((mask) ? mask->surface: NULL),
- (glitz_surface_t *) dst->surface,
- x_src,
- y_src,
- x_mask,
- y_mask,
- x_dst,
- y_dst,
- width,
- height);
-
+ (glitz_surface_t *) src->surface,
+ (glitz_surface_t *) ((mask) ? mask->surface: NULL),
+ (glitz_surface_t *) dst->surface,
+ x_src,
+ y_src,
+ x_mask,
+ y_mask,
+ x_dst,
+ y_dst,
+ width,
+ height);
+
status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
while (glitz_surface_get_status ((glitz_surface_t *) dst->surface));
-
+
return _glitz_status (status);
}
@@ -258,8 +281,8 @@
render_status_t
_glitz_render_set_pixels (render_surface_t *dst,
- render_format_t format,
- unsigned char *data)
+ render_format_t format,
+ unsigned char *data)
{
glitz_status_t status;
@@ -272,6 +295,7 @@
pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
pf.xoffset = 0;
pf.skip_lines = 0;
+ pf.fourcc = GLITZ_FOURCC_RGB;
switch (format) {
case RENDER_FORMAT_ARGB32:
@@ -282,11 +306,11 @@
pf.masks.blue_mask = 0x000000ff;
break;
case RENDER_FORMAT_RGB24:
- pf.masks.bpp = 24;
- pf.masks.alpha_mask = 0x000000;
- pf.masks.red_mask = 0xff0000;
- pf.masks.green_mask = 0x00ff00;
- pf.masks.blue_mask = 0x0000ff;
+ pf.masks.bpp = 32;
+ pf.masks.alpha_mask = 0x00000000;
+ pf.masks.red_mask = 0x00ff0000;
+ pf.masks.green_mask = 0x0000ff00;
+ pf.masks.blue_mask = 0x000000ff;
break;
case RENDER_FORMAT_A8:
pf.masks.bpp = 8;
@@ -302,26 +326,42 @@
pf.masks.green_mask = 0x0;
pf.masks.blue_mask = 0x0;
break;
+ case RENDER_FORMAT_YV12:
+ pf.fourcc = GLITZ_FOURCC_YV12;
+ pf.masks.bpp = 12;
+ pf.masks.alpha_mask = 0x0;
+ pf.masks.red_mask = 0x0;
+ pf.masks.green_mask = 0x0;
+ pf.masks.blue_mask = 0x0;
+ break;
+ case RENDER_FORMAT_YUY2:
+ pf.fourcc = GLITZ_FOURCC_YUY2;
+ pf.masks.bpp = 16;
+ pf.masks.alpha_mask = 0x0;
+ pf.masks.red_mask = 0x0;
+ pf.masks.green_mask = 0x0;
+ pf.masks.blue_mask = 0x0;
+ break;
}
pf.bytes_per_line = (((dst->width * pf.masks.bpp) / 8) + 3) & -4;
-
+
buffer = glitz_pixel_buffer_create (drawable,
- data,
- pf.bytes_per_line * dst->height,
- GLITZ_BUFFER_HINT_STREAM_DRAW);
-
+ data,
+ pf.bytes_per_line * dst->height,
+ GLITZ_BUFFER_HINT_STREAM_DRAW);
+
glitz_set_pixels ((glitz_surface_t *) dst->surface,
- 0, 0,
+ 0, 0,
dst->width, dst->height,
- &pf,
+ &pf,
buffer);
glitz_buffer_destroy (buffer);
-
+
status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
while (glitz_surface_get_status ((glitz_surface_t *) dst->surface));
-
+
return _glitz_status (status);
}
@@ -375,39 +415,47 @@
render_status_t
_glitz_render_set_fill (render_surface_t *surface,
- render_fill_t fill)
+ render_fill_t fill)
{
if (fill == RENDER_FILL_NONE)
+ {
+ glitz_format_t *format;
+
+ format = glitz_surface_get_format ((glitz_surface_t *) surface->surface);
+ if (format->color.fourcc != GLITZ_FOURCC_RGB)
+ fill = RENDER_FILL_NEAREST;
+
surface->flags |= RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK;
+ }
else
surface->flags &= ~RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK;
-
+
glitz_surface_set_fill ((glitz_surface_t *) surface->surface,
- _glitz_fill (fill));
+ _glitz_fill (fill));
return RENDER_STATUS_SUCCESS;
}
render_status_t
_glitz_render_set_component_alpha (render_surface_t *surface,
- render_bool_t component_alpha)
+ render_bool_t component_alpha)
{
glitz_surface_set_component_alpha ((glitz_surface_t *) surface->surface,
- component_alpha);
+ component_alpha);
return RENDER_STATUS_SUCCESS;
}
render_status_t
_glitz_render_set_transform (render_surface_t *surface,
- render_matrix_t *matrix)
+ render_matrix_t *matrix)
{
glitz_transform_t transform;
transform.matrix[0][0] = DOUBLE_TO_FIXED (matrix->m[0][0]);
transform.matrix[0][1] = DOUBLE_TO_FIXED (matrix->m[0][1]);
transform.matrix[0][2] = DOUBLE_TO_FIXED (matrix->m[0][2]);
-
+
transform.matrix[1][0] = DOUBLE_TO_FIXED (matrix->m[1][0]);
transform.matrix[1][1] = DOUBLE_TO_FIXED (matrix->m[1][1]);
transform.matrix[1][2] = DOUBLE_TO_FIXED (matrix->m[1][2]);
@@ -415,32 +463,32 @@
transform.matrix[2][0] = DOUBLE_TO_FIXED (matrix->m[2][0]);
transform.matrix[2][1] = DOUBLE_TO_FIXED (matrix->m[2][1]);
transform.matrix[2][2] = DOUBLE_TO_FIXED (matrix->m[2][2]);
-
+
glitz_surface_set_transform ((glitz_surface_t *) surface->surface,
- &transform);
+ &transform);
return RENDER_STATUS_SUCCESS;
}
render_status_t
_glitz_render_set_filter (render_surface_t *surface,
- render_filter_t filter,
- render_fixed16_16_t *params,
- int n_params)
+ render_filter_t filter,
+ render_fixed16_16_t *params,
+ int n_params)
{
glitz_surface_set_filter ((glitz_surface_t *) surface->surface,
- _glitz_filter (filter),
- params, n_params);
+ _glitz_filter (filter),
+ params, n_params);
return RENDER_STATUS_SUCCESS;
}
render_status_t
_glitz_render_set_clip_rectangles (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_rectangle_t *rects,
- int n_rects)
+ int x_offset,
+ int y_offset,
+ render_rectangle_t *rects,
+ int n_rects)
{
if (n_rects > 0) {
glitz_float_t *data;
@@ -448,7 +496,7 @@
glitz_drawable_t *drawable;
glitz_geometry_format_t gf;
int count;
-
+
gf.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
gf.vertex.type = GLITZ_DATA_TYPE_FLOAT;
gf.vertex.bytes_per_vertex = sizeof (glitz_float_t) * 2;
@@ -461,8 +509,8 @@
buffer =
glitz_vertex_buffer_create (drawable, NULL,
- n_rects * 8 * sizeof (glitz_float_t),
- GLITZ_BUFFER_HINT_STATIC_DRAW);
+ n_rects * 8 * sizeof (glitz_float_t),
+ GLITZ_BUFFER_HINT_STATIC_DRAW);
if (!buffer)
return RENDER_STATUS_NO_MEMORY;
@@ -480,25 +528,25 @@
glitz_buffer_unmap (buffer);
glitz_set_geometry ((glitz_surface_t *) surface->surface,
- GLITZ_GEOMETRY_TYPE_VERTEX,
- &gf, buffer);
+ GLITZ_GEOMETRY_TYPE_VERTEX,
+ &gf, buffer);
glitz_set_array ((glitz_surface_t *) surface->surface,
- 0, 2, count, x_offset << 16, y_offset << 16);
-
+ 0, 2, count, x_offset << 16, y_offset << 16);
+
glitz_buffer_destroy (buffer);
} else
glitz_set_geometry ((glitz_surface_t *) surface->surface,
- GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL);
-
+ GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL);
+
return RENDER_STATUS_SUCCESS;
}
render_status_t
_glitz_render_set_clip_trapezoids (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_trapezoid_t *traps,
- int n_traps)
+ int x_offset,
+ int y_offset,
+ render_trapezoid_t *traps,
+ int n_traps)
{
if (n_traps > 0) {
glitz_float_t *data;
@@ -519,8 +567,8 @@
buffer =
glitz_vertex_buffer_create (drawable, NULL,
- n_traps * 8 * sizeof (glitz_float_t),
- GLITZ_BUFFER_HINT_STATIC_DRAW);
+ n_traps * 8 * sizeof (glitz_float_t),
+ GLITZ_BUFFER_HINT_STATIC_DRAW);
if (!buffer)
return RENDER_STATUS_NO_MEMORY;
@@ -536,44 +584,43 @@
*data++ = FIXED_TO_FLOAT (traps->bottom.y);
}
glitz_buffer_unmap (buffer);
-
+
glitz_set_geometry ((glitz_surface_t *) surface->surface,
- GLITZ_GEOMETRY_TYPE_VERTEX,
- &gf, buffer);
+ GLITZ_GEOMETRY_TYPE_VERTEX,
+ &gf, buffer);
glitz_set_array ((glitz_surface_t *) surface->surface,
- 0, 2, count, x_offset << 16, y_offset << 16);
-
+ 0, 2, count, x_offset << 16, y_offset << 16);
+
glitz_buffer_destroy (buffer);
} else
glitz_set_geometry ((glitz_surface_t *) surface->surface,
- GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL);
-
+ GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL);
+
return RENDER_STATUS_SUCCESS;
}
glitz_surface_t *
_glitz_create_and_attach_surface_to_drawable (glitz_drawable_t *drawable,
- glitz_drawable_t *attach,
- int width,
- int height)
+ glitz_drawable_t *attach,
+ int width,
+ int height)
{
glitz_drawable_format_t *dformat;
glitz_format_t *format, templ;
glitz_surface_t *surface;
glitz_drawable_buffer_t buffer;
-
+
dformat = glitz_drawable_get_format (attach);
- templ.type = GLITZ_FORMAT_TYPE_COLOR;
templ.color = dformat->color;
- format = glitz_find_format (drawable,
- GLITZ_FORMAT_TYPE_MASK |
- GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_ALPHA_SIZE_MASK,
- &templ,
- 0);
+ format = glitz_find_format (drawable,
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_ALPHA_SIZE_MASK,
+ &templ,
+ 0);
if (!format) {
fprintf (stderr, "Error: couldn't find surface format\n");
return NULL;
Index: glitz_agl.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_agl.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- glitz_agl.c 14 Sep 2005 16:02:25 -0000 1.9
+++ glitz_agl.c 30 Nov 2005 00:04:43 -0000 1.10
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -66,7 +66,7 @@
_parse_option (int key, char *arg, render_arg_state_t *state)
{
agl_options_t *options = state->pointer;
-
+
switch (key) {
case 'l':
options->db = 0;
@@ -80,7 +80,7 @@
default:
return 1;
}
-
+
return 0;
}
@@ -102,15 +102,15 @@
options.samples = 1;
options.db = 1;
options.offscreen = 0;
-
+
state.pointer = &options;
if (render_parse_arguments (_parse_option,
- _glx_options,
- &state,
- argc, argv))
+ _glx_options,
+ &state,
+ argc, argv))
return 1;
-
+
surface.backend = &_glitz_agl_render_backend;
surface.flags = 0;
@@ -119,22 +119,22 @@
surface.height = RENDER_DEFAULT_DST_HEIGHT;
SetRect (&win_bounds, x, y, x + surface.width, y + surface.height);
-
+
InitCursor ();
-
+
CreateNewWindow (kDocumentWindowClass,
- kWindowStandardDocumentAttributes,
- &win_bounds,
- &win);
-
+ kWindowStandardDocumentAttributes,
+ &win_bounds,
+ &win);
+
SetPortWindowPort (win);
-
+
title = CFSTR (PACKAGE);
SetWindowTitleWithCFString (win, title);
CFRelease (title);
-
+
SelectWindow (win);
-
+
templ.samples = options.samples;
mask = GLITZ_FORMAT_SAMPLES_MASK;
@@ -153,7 +153,7 @@
drawable =
glitz_agl_create_drawable_for_window (dformat, win,
- surface.width, surface.height);
+ surface.width, surface.height);
if (!drawable) {
fprintf (stderr, "Error: couldn't create glitz drawable for window\n");
return 1;
@@ -193,7 +193,7 @@
if (!surface.surface)
return 1;
-
+
ShowWindow (win);
status = render_run (&surface, &state.settings);
@@ -206,6 +206,6 @@
glitz_drawable_destroy (drawable);
glitz_agl_fini ();
-
+
return status;
}
Index: glitz_common.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_common.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- glitz_common.h 14 Sep 2005 16:02:25 -0000 1.7
+++ glitz_common.h 30 Nov 2005 00:04:43 -0000 1.8
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -34,74 +34,74 @@
render_surface_t *
_glitz_render_create_similar (render_surface_t *other,
- render_format_t format,
- int width,
- int height);
+ render_format_t format,
+ int width,
+ int height);
void
_glitz_render_destroy (render_surface_t *surface);
render_status_t
_glitz_render_composite (render_operator_t op,
- render_surface_t *src,
- render_surface_t *mask,
- render_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height);
+ render_surface_t *src,
+ render_surface_t *mask,
+ render_surface_t *dst,
+ int x_src,
+ int y_src,
+ int x_mask,
+ int y_mask,
+ int x_dst,
+ int y_dst,
+ int width,
+ int height);
render_status_t
_glitz_render_set_pixels (render_surface_t *dst,
- render_format_t format,
- unsigned char *data);
+ render_format_t format,
+ unsigned char *data);
void
_glitz_render_show (render_surface_t *surface);
render_status_t
_glitz_render_set_fill (render_surface_t *surface,
- render_fill_t fill);
+ render_fill_t fill);
render_status_t
_glitz_render_set_component_alpha (render_surface_t *surface,
- render_bool_t component_alpha);
+ render_bool_t component_alpha);
render_status_t
_glitz_render_set_transform (render_surface_t *surface,
- render_matrix_t *matrix);
+ render_matrix_t *matrix);
render_status_t
_glitz_render_set_filter (render_surface_t *surface,
- render_filter_t filter,
- render_fixed16_16_t *params,
- int n_params);
+ render_filter_t filter,
+ render_fixed16_16_t *params,
+ int n_params);
render_status_t
_glitz_render_set_clip_rectangles (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_rectangle_t *rects,
- int n_rects);
+ int x_offset,
+ int y_offset,
+ render_rectangle_t *rects,
+ int n_rects);
render_status_t
_glitz_render_set_clip_trapezoids (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_trapezoid_t *traps,
- int n_traps);
+ int x_offset,
+ int y_offset,
+ render_trapezoid_t *traps,
+ int n_traps);
glitz_surface_t *
_glitz_create_surface_for_drawable (glitz_drawable_t *drawable,
- int width,
- int height);
+ int width,
+ int height);
glitz_surface_t *
_glitz_create_and_attach_surface_to_drawable (glitz_drawable_t *drawable,
- glitz_drawable_t *attach,
- int width,
- int height);
+ glitz_drawable_t *attach,
+ int width,
+ int height);
Index: glitz_egl.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_egl.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_egl.c 14 Sep 2005 16:02:25 -0000 1.2
+++ glitz_egl.c 30 Nov 2005 00:04:43 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -72,7 +72,7 @@
_parse_option (int key, char *arg, render_arg_state_t *state)
{
egl_options_t *options = state->pointer;
-
+
switch (key) {
case 'l':
options->db = 0;
@@ -86,7 +86,7 @@
default:
return 1;
}
-
+
return 0;
}
@@ -119,11 +119,11 @@
state.pointer = &options;
if (render_parse_arguments (_parse_option,
- _egl_options,
- &state,
- argc, argv))
+ _egl_options,
+ &state,
+ argc, argv))
return 1;
-
+
surface.backend = &_glitz_egl_render_backend;
surface.flags = 0;
@@ -133,14 +133,14 @@
egl_display = eglGetDisplay (":0");
assert(egl_display);
-
- if (!eglInitialize(egl_display, &maj, &min)) {
+
+ if (!eglInitialize (egl_display, &maj, &min)) {
fprintf (stderr, "Error: eglInitialize failed\n");
return 1;
}
-
- eglGetScreensMESA(egl_display, &egl_screen, 1, &count);
- eglGetModesMESA(egl_display, egl_screen, &egl_mode, 1, &count);
+
+ eglGetScreensMESA (egl_display, &egl_screen, 1, &count);
+ eglGetModesMESA (egl_display, egl_screen, &egl_mode, 1, &count);
templ.samples = options.samples;
mask = GLITZ_FORMAT_SAMPLES_MASK;
@@ -151,24 +151,26 @@
templ.doublebuffer = 0;
mask |= GLITZ_FORMAT_DOUBLEBUFFER_MASK;
-
- dformat = glitz_egl_find_window_config (egl_display, egl_screen,
- mask, &templ, 0);
+
+ dformat = glitz_egl_find_window_config (egl_display, egl_screen,
+ mask, &templ, 0);
if (!dformat) {
fprintf (stderr, "Error: couldn't find window format\n");
return 1;
}
- egl_surface = eglCreateScreenSurfaceMESA(egl_display, dformat->id, screenAttribs);
+ egl_surface = eglCreateScreenSurfaceMESA (egl_display, dformat->id,
+ screenAttribs);
if (egl_surface == EGL_NO_SURFACE) {
fprintf (stderr, "Error: failed to create screen surface\n");
return 0;
}
-
- eglShowSurfaceMESA(egl_display, egl_screen, egl_surface, egl_mode);
-
- drawable = glitz_egl_create_surface (egl_display, egl_screen, dformat,
- egl_surface, surface.width, surface.height);
+
+ eglShowSurfaceMESA (egl_display, egl_screen, egl_surface, egl_mode);
+
+ drawable = glitz_egl_create_surface (egl_display, egl_screen,
+ dformat, egl_surface,
+ surface.width, surface.height);
if (!drawable) {
fprintf (stderr, "Error: couldn't create glitz drawable for window\n");
@@ -209,7 +211,7 @@
if (!surface.surface)
return 1;
-
+
status = render_run (&surface, &state.settings);
glitz_surface_destroy ((glitz_surface_t *) surface.surface);
@@ -221,9 +223,8 @@
glitz_egl_fini ();
-//eglShowSurfaceMESA(egl_display, egl_screen, EGL_NO_SURFACE, EGL_NO_MODE_MESA);
- eglDestroySurface(egl_display, egl_surface);
- eglTerminate(egl_display);
-
+ eglDestroySurface (egl_display, egl_surface);
+ eglTerminate (egl_display);
+
return 0;
}
Index: glitz_glx.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_glx.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- glitz_glx.c 14 Sep 2005 16:02:25 -0000 1.9
+++ glitz_glx.c 30 Nov 2005 00:04:43 -0000 1.10
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -72,7 +72,7 @@
_parse_option (int key, char *arg, render_arg_state_t *state)
{
glx_options_t *options = state->pointer;
-
+
switch (key) {
case 'd':
options->display = arg;
@@ -92,7 +92,7 @@
default:
return 1;
}
-
+
return 0;
}
@@ -119,21 +119,21 @@
options.samples = 1;
options.db = 1;
options.offscreen = 0;
-
+
state.pointer = &options;
if (render_parse_arguments (_parse_option,
- _glx_options,
- &state,
- argc, argv))
+ _glx_options,
+ &state,
+ argc, argv))
return 1;
-
+
surface.backend = &_glitz_glx_render_backend;
surface.flags = 0;
if (options.geometry) {
unsigned int width, height;
-
+
XParseGeometry (options.geometry, &x, &y, &width, &height);
surface.width = width;
surface.height = height;
@@ -170,20 +170,20 @@
fprintf (stderr, "Error: no visual info from format\n");
return 1;
}
-
- xswa.colormap = XCreateColormap (display, RootWindow (display, screen),
- vinfo->visual, AllocNone);
- win = XCreateWindow (display, RootWindow (display, screen),
- x, y, surface.width, surface.height,
- 0, vinfo->depth, InputOutput,
- vinfo->visual, CWColormap, &xswa);
-
+ xswa.colormap = XCreateColormap (display, RootWindow (display, screen),
+ vinfo->visual, AllocNone);
+
+ win = XCreateWindow (display, RootWindow (display, screen),
+ x, y, surface.width, surface.height,
+ 0, vinfo->depth, InputOutput,
+ vinfo->visual, CWColormap, &xswa);
+
XFree (vinfo);
drawable =
glitz_glx_create_drawable_for_window (display, screen, dformat, win,
- surface.width, surface.height);
+ surface.width, surface.height);
if (!drawable) {
fprintf (stderr, "Error: couldn't create glitz drawable for window\n");
return 1;
@@ -223,15 +223,15 @@
if (!surface.surface)
return 1;
-
+
XSelectInput (display, win, ExposureMask);
XMapWindow (display, win);
-
+
while (XNextEvent (display, &event)) {
if (event.type == Expose)
break;
}
-
+
XSelectInput (display, win, 0);
status = render_run (&surface, &state.settings);
@@ -244,10 +244,10 @@
glitz_drawable_destroy (drawable);
glitz_glx_fini ();
-
+
XDestroyWindow (display, win);
XFreeColormap (display, xswa.colormap);
XCloseDisplay (display);
-
+
return status;
}
Index: images.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/images.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- images.h 3 Sep 2004 14:29:26 -0000 1.3
+++ images.h 30 Nov 2005 00:04:43 -0000 1.4
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
Index: pixman.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/pixman.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pixman.c 3 Nov 2004 23:51:04 -0000 1.2
+++ pixman.c 30 Nov 2005 00:04:43 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -79,14 +79,14 @@
static render_surface_t *
_pixman_render_create_similar (render_surface_t *other,
- render_format_t render_format,
- int width,
- int height)
+ render_format_t render_format,
+ int width,
+ int height)
{
pixman_surface_t *other_surface = (pixman_surface_t *) other->surface;
render_surface_t *similar;
pixman_surface_t *surface;
- pixman_format_t *format;
+ pixman_format_t *format = 0;
switch (render_format) {
case RENDER_FORMAT_A1:
@@ -99,9 +99,9 @@
format = pixman_format_create (PIXMAN_FORMAT_NAME_RGB24);
break;
case RENDER_FORMAT_ARGB32:
- default:
format = pixman_format_create (PIXMAN_FORMAT_NAME_ARGB32);
- break;
+ default:
+ break;
}
if (format == NULL)
@@ -127,15 +127,15 @@
surface->c = NULL;
pixman_format_destroy (format);
-
+
if (surface->image == NULL) {
free (similar);
free (surface);
return NULL;
}
-
+
similar->surface = surface;
-
+
return similar;
}
@@ -152,17 +152,17 @@
static render_status_t
_pixman_render_composite (render_operator_t op,
- render_surface_t *src,
- render_surface_t *mask,
- render_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height)
+ render_surface_t *src,
+ render_surface_t *mask,
+ render_surface_t *dst,
+ int x_src,
+ int y_src,
+ int x_mask,
+ int y_mask,
+ int x_dst,
+ int y_dst,
+ int width,
+ int height)
{
pixman_image_t *mask_image = NULL;
@@ -170,25 +170,25 @@
mask_image = ((pixman_surface_t *) mask->surface)->image;
pixman_composite (_pixman_operator (op),
- ((pixman_surface_t *) src->surface)->image,
- mask_image,
- ((pixman_surface_t *) dst->surface)->image,
- x_src,
- y_src,
- x_mask,
- y_mask,
- x_dst,
- y_dst,
- width,
- height);
-
+ ((pixman_surface_t *) src->surface)->image,
+ mask_image,
+ ((pixman_surface_t *) dst->surface)->image,
+ x_src,
+ y_src,
+ x_mask,
+ y_mask,
+ x_dst,
+ y_dst,
+ width,
+ height);
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_pixman_render_set_pixels (render_surface_t *dst,
- render_format_t format,
- unsigned char *data)
+ render_format_t format,
+ unsigned char *data)
{
pixman_surface_t *s = (pixman_surface_t *) dst->surface;
pixman_bits_t *bits;
@@ -237,12 +237,12 @@
return;
XCBPutImage (s->c, ZPixmap, s->drawable, gc,
- surface->width,
- surface->height,
- 0, 0, 0, 24,
- 4 * surface->width * surface->height,
- (unsigned char *) bits);
-
+ surface->width,
+ surface->height,
+ 0, 0, 0, 24,
+ 4 * surface->width * surface->height,
+ (unsigned char *) bits);
+
XCBFreeGC (s->c, gc);
XCBSync (s->c, NULL);
@@ -250,7 +250,7 @@
static render_status_t
_pixman_render_set_fill (render_surface_t *surface,
- render_fill_t fill)
+ render_fill_t fill)
{
pixman_surface_t *s = (pixman_surface_t *) surface->surface;
@@ -271,24 +271,24 @@
pixman_image_set_repeat (s->image, 0);
break;
}
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_pixman_render_set_component_alpha (render_surface_t *surface,
- render_bool_t component_alpha)
+ render_bool_t component_alpha)
{
pixman_surface_t *s = (pixman_surface_t *) surface->surface;
-
+
pixman_image_set_component_alpha (s->image, component_alpha);
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_pixman_render_set_transform (render_surface_t *surface,
- render_matrix_t *matrix)
+ render_matrix_t *matrix)
{
pixman_transform_t transform;
pixman_surface_t *s = (pixman_surface_t *) surface->surface;
@@ -296,7 +296,7 @@
transform.matrix[0][0] = DOUBLE_TO_FIXED (matrix->m[0][0]);
transform.matrix[0][1] = DOUBLE_TO_FIXED (matrix->m[0][1]);
transform.matrix[0][2] = DOUBLE_TO_FIXED (matrix->m[0][2]);
-
+
transform.matrix[1][0] = DOUBLE_TO_FIXED (matrix->m[1][0]);
transform.matrix[1][1] = DOUBLE_TO_FIXED (matrix->m[1][1]);
transform.matrix[1][2] = DOUBLE_TO_FIXED (matrix->m[1][2]);
@@ -304,7 +304,7 @@
transform.matrix[2][0] = DOUBLE_TO_FIXED (matrix->m[2][0]);
transform.matrix[2][1] = DOUBLE_TO_FIXED (matrix->m[2][1]);
transform.matrix[2][2] = DOUBLE_TO_FIXED (matrix->m[2][2]);
-
+
pixman_image_set_transform (s->image, &transform);
return RENDER_STATUS_SUCCESS;
@@ -312,12 +312,12 @@
static render_status_t
_pixman_render_set_filter (render_surface_t *surface,
- render_filter_t filter,
- render_fixed16_16_t *params,
- int n_params)
+ render_filter_t filter,
+ render_fixed16_16_t *params,
+ int n_params)
{
pixman_surface_t *s = (pixman_surface_t *) surface->surface;
-
+
switch (filter) {
case RENDER_FILTER_NEAREST:
pixman_image_set_filter (s->image, PIXMAN_FILTER_NEAREST);
@@ -329,27 +329,27 @@
return RENDER_STATUS_NOT_SUPPORTED;
break;
}
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_pixman_render_set_clip_rectangles (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_rectangle_t *rects,
- int n_rects)
+ int x_offset,
+ int y_offset,
+ render_rectangle_t *rects,
+ int n_rects)
{
pixman_surface_t *s = (pixman_surface_t *) surface->surface;
pixman_region16_t *region;
-
+
if (n_rects > 0) {
region = pixman_region_create ();
for (; n_rects--; rects++)
pixman_region_union_rect (region, region,
- x_offset + rects->x, y_offset + rects->y,
- rects->width, rects->height);
+ x_offset + rects->x, y_offset + rects->y,
+ rects->width, rects->height);
} else
region = NULL;
@@ -357,16 +357,16 @@
if (region)
pixman_region_destroy (region);
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_pixman_render_set_clip_trapezoids (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_trapezoid_t *traps,
- int n_traps)
+ int x_offset,
+ int y_offset,
+ render_trapezoid_t *traps,
+ int n_traps)
{
return RENDER_STATUS_NOT_SUPPORTED;
}
@@ -411,11 +411,11 @@
state.pointer = NULL;
if (render_parse_arguments (_parse_option,
- _pixman_options,
- &state,
- argc, argv))
+ _pixman_options,
+ &state,
+ argc, argv))
return 1;
-
+
surface.backend = &_pixman_render_backend;
surface.flags = 0;
@@ -447,9 +447,9 @@
dst.drawable.window = XCBWINDOWNew (dst.c);
XCBCreateWindow (dst.c, 0, dst.drawable.window, root->root,
- x, y, surface.width, surface.height, 0,
- InputOutput, root->root_visual,
- mask, values);
+ x, y, surface.width, surface.height, 0,
+ InputOutput, root->root_visual,
+ mask, values);
XCBMapWindow (dst.c, dst.drawable.window);
XCBSync (dst.c, NULL);
@@ -469,6 +469,6 @@
pixman_image_destroy (dst.image);
pixman_format_destroy (format);
-
+
return 0;
}
Index: png.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/png.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- png.c 9 Aug 2004 23:18:53 -0000 1.1.1.1
+++ png.c 30 Nov 2005 00:04:43 -0000 1.2
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -37,11 +37,11 @@
static void
transform_argb_data (png_structp png,
- png_row_infop row_info,
- png_bytep data)
+ png_row_infop row_info,
+ png_bytep data)
{
unsigned int i;
-
+
for (i = 0; i < row_info->rowbytes; i += 4) {
unsigned char *base = &data[i];
unsigned char blue = base[0];
@@ -57,10 +57,10 @@
static void
user_read_data (png_structp png_ptr,
- png_bytep data, png_size_t length)
+ png_bytep data, png_size_t length)
{
unsigned char **buffer = (unsigned char **) png_get_io_ptr (png_ptr);
-
+
memcpy (data, *buffer, length);
*buffer += length;
}
@@ -69,97 +69,97 @@
int
render_read_png (unsigned char *buffer,
- unsigned int *width,
- unsigned int *height,
- unsigned char **data)
+ unsigned int *width,
+ unsigned int *height,
+ unsigned char **data)
{
- int i, stride;
- unsigned char png_sig[PNG_SIG_SIZE];
- png_struct *png;
- png_info *info;
- png_uint_32 png_width, png_height;
- int depth, color_type, interlace;
- png_byte **row_pointers;
- unsigned char *b = buffer + PNG_SIG_SIZE;
+ int i, stride;
+ unsigned char png_sig[PNG_SIG_SIZE];
+ png_struct *png;
+ png_info *info;
+ png_uint_32 png_width, png_height;
+ int depth, color_type, interlace;
+ png_byte **row_pointers;
+ unsigned char *b = buffer + PNG_SIG_SIZE;
- memcpy (png_sig, buffer, PNG_SIG_SIZE);
- if (png_check_sig (png_sig, PNG_SIG_SIZE) == 0)
- return 1;
+ memcpy (png_sig, buffer, PNG_SIG_SIZE);
+ if (png_check_sig (png_sig, PNG_SIG_SIZE) == 0)
+ return 1;
- png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
- NULL, NULL, NULL);
- if (png == NULL)
- return 1;
+ png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
+ NULL, NULL, NULL);
+ if (png == NULL)
+ return 1;
- info = png_create_info_struct (png);
- if (info == NULL) {
- png_destroy_read_struct (&png, NULL, NULL);
- return 1;
- }
+ info = png_create_info_struct (png);
+ if (info == NULL) {
+ png_destroy_read_struct (&png, NULL, NULL);
+ return 1;
+ }
- png_set_read_fn (png, (void *) &b, user_read_data);
+ png_set_read_fn (png, (void *) &b, user_read_data);
- png_set_sig_bytes (png, PNG_SIG_SIZE);
+ png_set_sig_bytes (png, PNG_SIG_SIZE);
- png_read_info (png, info);
+ png_read_info (png, info);
- png_get_IHDR (png, info,
- &png_width, &png_height, &depth,
- &color_type, &interlace, NULL, NULL);
+ png_get_IHDR (png, info,
+ &png_width, &png_height, &depth,
+ &color_type, &interlace, NULL, NULL);
- *width = png_width;
- *height = png_height;
+ *width = png_width;
+ *height = png_height;
- /* convert palette/gray image to rgb */
- if (color_type == PNG_COLOR_TYPE_PALETTE)
- png_set_palette_to_rgb (png);
+ /* convert palette/gray image to rgb */
+ if (color_type == PNG_COLOR_TYPE_PALETTE)
+ png_set_palette_to_rgb (png);
- /* expand gray bit depth if needed */
- if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
- png_set_gray_1_2_4_to_8 (png);
+ /* expand gray bit depth if needed */
+ if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
+ png_set_gray_1_2_4_to_8 (png);
- /* transform transparency to alpha */
- if (png_get_valid (png, info, PNG_INFO_tRNS))
- png_set_tRNS_to_alpha (png);
+ /* transform transparency to alpha */
+ if (png_get_valid (png, info, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha (png);
- if (depth == 16)
- png_set_strip_16 (png);
+ if (depth == 16)
+ png_set_strip_16 (png);
- if (depth < 8)
- png_set_packing (png);
+ if (depth < 8)
+ png_set_packing (png);
- if (color_type == PNG_COLOR_TYPE_GRAY) {
- /* grayscale */
- stride = ((png_width + 3) & -4);
- } else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
- /* grayscale with alpha */
- stride = ((2 * png_width + 3) & -4);
- } else {
- /* rgba */
- png_set_read_user_transform_fn (png, transform_argb_data);
- png_set_bgr (png);
- stride = 4 * png_width;
- }
-
- if (interlace != PNG_INTERLACE_NONE)
- png_set_interlace_handling (png);
+ if (color_type == PNG_COLOR_TYPE_GRAY) {
+ /* grayscale */
+ stride = ((png_width + 3) & -4);
+ } else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+ /* grayscale with alpha */
+ stride = ((2 * png_width + 3) & -4);
+ } else {
+ /* rgba */
+ png_set_read_user_transform_fn (png, transform_argb_data);
+ png_set_bgr (png);
+ stride = 4 * png_width;
+ }
- png_read_update_info (png, info);
+ if (interlace != PNG_INTERLACE_NONE)
+ png_set_interlace_handling (png);
- *data = malloc (stride * png_height);
- if (*data == NULL)
- return 1;
+ png_read_update_info (png, info);
- row_pointers = (png_byte **) malloc (png_height * sizeof (char *));
- for (i = 0; i < png_height; i++)
- row_pointers[i] = (png_byte *) (*data + i * stride);
+ *data = malloc (stride * png_height);
+ if (*data == NULL)
+ return 1;
- png_read_image (png, row_pointers);
- png_read_end (png, info);
+ row_pointers = (png_byte **) malloc (png_height * sizeof (char *));
+ for (i = 0; i < png_height; i++)
+ row_pointers[i] = (png_byte *) (*data + i * stride);
- free (row_pointers);
+ png_read_image (png, row_pointers);
+ png_read_end (png, info);
- png_destroy_read_struct (&png, &info, NULL);
-
- return 0;
+ free (row_pointers);
+
+ png_destroy_read_struct (&png, &info, NULL);
+
+ return 0;
}
Index: rendertest.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/rendertest.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rendertest.c 4 Jul 2005 10:38:46 -0000 1.12
+++ rendertest.c 30 Nov 2005 00:04:43 -0000 1.13
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...1197 lines suppressed...]
_render_composite_tests (&info, glider, argb_mask, status);
_render_set_filter (argb_mask, RENDER_FILTER_NEAREST, NULL, 0);
}
@@ -1269,7 +1300,7 @@
surface->backend->destroy (big_glider);
surface->backend->destroy (glider);
surface->backend->destroy (a_mask);
-
+
surface->backend->destroy (info.bg);
surface->backend->destroy (info.logo);
@@ -1279,6 +1310,6 @@
printf (" success: %3d\n", info.success);
printf (" not supported: %3d\n", info.not_supported);
printf (" failed: %3d\n", info.failed);
-
+
return RENDER_STATUS_SUCCESS;
}
Index: rendertest.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/rendertest.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rendertest.h 3 Nov 2004 23:51:04 -0000 1.4
+++ rendertest.h 30 Nov 2005 00:04:43 -0000 1.5
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -60,7 +60,9 @@
RENDER_FORMAT_A1,
RENDER_FORMAT_A8,
RENDER_FORMAT_RGB24,
- RENDER_FORMAT_ARGB32
+ RENDER_FORMAT_ARGB32,
+ RENDER_FORMAT_YV12,
+ RENDER_FORMAT_YUY2
} render_format_t;
typedef enum {
@@ -114,7 +116,7 @@
typedef struct render_span_fixed {
render_fixed16_16_t left, right, y;
} render_span_fixed_t;
-
+
typedef struct render_trapezoid {
render_span_fixed_t top, bottom;
} render_trapezoid_t;
@@ -130,7 +132,7 @@
typedef struct render_surface {
const render_backend_t *backend;
-
+
void *surface;
int width;
int height;
@@ -152,56 +154,56 @@
struct render_backend {
render_surface_t *(*create_similar) (render_surface_t *other,
- render_format_t format,
- int width,
- int height);
+ render_format_t format,
+ int width,
+ int height);
void (*destroy) (render_surface_t *surface);
-
+
render_status_t (*composite) (render_operator_t op,
- render_surface_t *src,
- render_surface_t *mask,
- render_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height);
+ render_surface_t *src,
+ render_surface_t *mask,
+ render_surface_t *dst,
+ int x_src,
+ int y_src,
+ int x_mask,
+ int y_mask,
+ int x_dst,
+ int y_dst,
+ int width,
+ int height);
render_status_t (*set_pixels) (render_surface_t *dst,
- render_format_t format,
- unsigned char *data);
+ render_format_t format,
+ unsigned char *data);
void (*show) (render_surface_t *dst);
render_status_t (*set_fill) (render_surface_t *surface,
- render_fill_t fill);
+ render_fill_t fill);
render_status_t (*set_component_alpha) (render_surface_t *surface,
- render_bool_t component_alpha);
+ render_bool_t component_alpha);
render_status_t (*set_transform) (render_surface_t *surface,
- render_matrix_t *matrix);
+ render_matrix_t *matrix);
render_status_t (*set_filter) (render_surface_t *surface,
- render_filter_t filter,
- render_fixed16_16_t *params,
- int n_params);
-
+ render_filter_t filter,
+ render_fixed16_16_t *params,
+ int n_params);
+
render_status_t (*set_clip_rectangles) (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_rectangle_t *rects,
- int n_rects);
-
+ int x_offset,
+ int y_offset,
+ render_rectangle_t *rects,
+ int n_rects);
+
render_status_t (*set_clip_trapezoids) (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_trapezoid_t *traps,
- int n_traps);
+ int x_offset,
+ int y_offset,
+ render_trapezoid_t *traps,
+ int n_traps);
};
@@ -217,6 +219,7 @@
int time;
render_operator_t op;
render_clip_t clip;
+ render_format_t format;
} render_settings_t;
int
@@ -227,9 +230,9 @@
int
render_read_png (unsigned char *buffer,
- unsigned int *width,
- unsigned int *height,
- unsigned char **data);
+ unsigned int *width,
+ unsigned int *height,
+ unsigned char **data);
/* args.c */
@@ -251,8 +254,8 @@
int
render_parse_arguments (render_parser_t parser,
- const render_option_t *backend_options,
- render_arg_state_t *state,
- int argc, char **argv);
+ const render_option_t *backend_options,
+ render_arg_state_t *state,
+ int argc, char **argv);
#endif /* RENDERTEST_H_INCLUDED */
Index: traps.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/traps.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- traps.h 3 Sep 2004 14:29:26 -0000 1.2
+++ traps.h 30 Nov 2005 00:04:43 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
Index: xcb.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/xcb.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xcb.c 4 Jul 2005 10:38:46 -0000 1.8
+++ xcb.c 30 Nov 2005 00:04:43 -0000 1.9
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -99,7 +99,7 @@
static XCBRenderPICTFORMAT
_xcb_format (XCBConnection *c,
- render_format_t format)
+ render_format_t format)
{
XCBRenderPICTFORMAT ret = { 0 };
static const struct tmpl_t {
@@ -108,37 +108,37 @@
} templates[] = {
{
{
- 16, 0xff,
- 8, 0xff,
- 0, 0xff,
- 24, 0xff
+ 16, 0xff,
+ 8, 0xff,
+ 0, 0xff,
+ 24, 0xff
},
32
},
{
{
- 16, 0xff,
- 8, 0xff,
- 0, 0xff,
- 0, 0x00
+ 16, 0xff,
+ 8, 0xff,
+ 0, 0xff,
+ 0, 0x00
},
24
},
{
{
- 0, 0x00,
- 0, 0x00,
- 0, 0x00,
- 0, 0xff
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0xff
},
8
},
{
{
- 0, 0x00,
- 0, 0x00,
- 0, 0x00,
- 0, 0x01
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0x01
},
1
},
@@ -162,37 +162,37 @@
tmpl = &templates[0];
break;
}
-
+
reply =
XCBRenderQueryPictFormatsReply (c, XCBRenderQueryPictFormats (c), 0);
-
+
forminfo_iter = XCBRenderQueryPictFormatsFormatsIter (reply);
while (forminfo_iter.rem) {
XCBRenderPICTFORMINFO *cformat;
cformat = forminfo_iter.data;
XCBRenderPICTFORMINFONext (&forminfo_iter);
-
+
if (cformat->type != XCBRenderPictTypeDirect)
continue;
-
+
if (cformat->depth != tmpl->depth)
continue;
-
+
if ((tmpl->direct.red_mask != 0) &&
- (tmpl->direct.red_mask != cformat->direct.red_mask))
+ (tmpl->direct.red_mask != cformat->direct.red_mask))
continue;
-
+
if ((tmpl->direct.green_mask != 0) &&
- (tmpl->direct.green_mask != cformat->direct.green_mask))
+ (tmpl->direct.green_mask != cformat->direct.green_mask))
continue;
-
+
if ((tmpl->direct.blue_mask != 0) &&
- (tmpl->direct.blue_mask != cformat->direct.blue_mask))
+ (tmpl->direct.blue_mask != cformat->direct.blue_mask))
continue;
-
+
if ((tmpl->direct.alpha_mask != 0) &&
- (tmpl->direct.alpha_mask != cformat->direct.alpha_mask))
+ (tmpl->direct.alpha_mask != cformat->direct.alpha_mask))
continue;
ret = cformat->id;
@@ -200,54 +200,54 @@
}
free (reply);
-
+
return ret;
}
static XCBRenderPICTFORMAT
_xcb_visual_format (XCBRenderQueryPictFormatsRep *reply,
- XCBVISUALID query)
+ XCBVISUALID query)
{
XCBRenderPICTSCREENIter screen_iter;
XCBRenderPICTSCREEN *cscreen;
XCBRenderPICTDEPTHIter depth_iter;
XCBRenderPICTDEPTH *cdepth;
- XCBRenderPICTVISUALIter visual_iter;
+ XCBRenderPICTVISUALIter visual_iter;
XCBRenderPICTVISUAL *cvisual;
XCBRenderPICTFORMAT return_value;
-
+
screen_iter = XCBRenderQueryPictFormatsScreensIter (reply);
while (screen_iter.rem) {
cscreen = screen_iter.data;
-
+
depth_iter = XCBRenderPICTSCREENDepthsIter (cscreen);
while (depth_iter.rem) {
cdepth = depth_iter.data;
-
+
visual_iter = XCBRenderPICTDEPTHVisualsIter (cdepth);
while (visual_iter.rem) {
- cvisual = visual_iter.data;
-
- if (cvisual->visual.id == query.id)
- return cvisual->format;
-
- XCBRenderPICTVISUALNext (&visual_iter);
+ cvisual = visual_iter.data;
+
+ if (cvisual->visual.id == query.id)
+ return cvisual->format;
+
+ XCBRenderPICTVISUALNext (&visual_iter);
}
XCBRenderPICTDEPTHNext (&depth_iter);
}
XCBRenderPICTSCREENNext (&screen_iter);
}
return_value.xid = 0;
-
+
return return_value;
}
static render_surface_t *
_xcb_render_create_similar (render_surface_t *other,
- render_format_t render_format,
- int width,
- int height)
+ render_format_t render_format,
+ int width,
+ int height)
{
xcb_surface_t *other_surface = (xcb_surface_t *) other->surface;
render_surface_t *similar;
@@ -255,16 +255,6 @@
XCBRenderPICTFORMAT format;
int depth;
- similar = malloc (sizeof (render_surface_t));
- if (similar == NULL)
- return NULL;
-
- surface = malloc (sizeof (xcb_surface_t));
- if (surface == NULL) {
- free (similar);
- return NULL;
- }
-
switch (render_format) {
case RENDER_FORMAT_A1:
depth = 1;
@@ -276,33 +266,44 @@
depth = 24;
break;
case RENDER_FORMAT_ARGB32:
- default:
depth = 32;
break;
+ default:
+ return NULL;
+ }
+
+ similar = malloc (sizeof (render_surface_t));
+ if (similar == NULL)
+ return NULL;
+
+ surface = malloc (sizeof (xcb_surface_t));
+ if (surface == NULL) {
+ free (similar);
+ return NULL;
}
surface->c = other_surface->c;
-
+
surface->drawable.pixmap = XCBPIXMAPNew (surface->c);
XCBCreatePixmap (surface->c, depth,
- surface->drawable.pixmap, other_surface->drawable,
- width, height);
-
+ surface->drawable.pixmap, other_surface->drawable,
+ width, height);
+
similar->width = width;
similar->height = height;
similar->backend = other->backend;
similar->flags = 0;
surface->render_major = other_surface->render_major;
surface->render_minor = other_surface->render_minor;
-
+
format = _xcb_format (surface->c, render_format);
-
+
surface->picture = XCBRenderPICTURENew (surface->c);
XCBRenderCreatePicture (surface->c, surface->picture, surface->drawable,
- format, 0, NULL);
-
+ format, 0, NULL);
+
similar->surface = surface;
-
+
return similar;
}
@@ -310,7 +311,7 @@
_xcb_render_destroy (render_surface_t *surface)
{
xcb_surface_t *s = (xcb_surface_t *) surface->surface;
-
+
if (s->picture.xid)
XCBRenderFreePicture (s->c, s->picture);
@@ -322,45 +323,45 @@
static render_status_t
_xcb_render_composite (render_operator_t op,
- render_surface_t *src,
- render_surface_t *mask,
- render_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height)
+ render_surface_t *src,
+ render_surface_t *mask,
+ render_surface_t *dst,
+ int x_src,
+ int y_src,
+ int x_mask,
+ int y_mask,
+ int x_dst,
+ int y_dst,
+ int width,
+ int height)
{
xcb_surface_t *surface = (xcb_surface_t *) dst->surface;
XCBRenderPICTURE maskpict = { 0 };
if (mask)
maskpict = ((xcb_surface_t *) mask->surface)->picture;
-
+
XCBRenderComposite (surface->c,
- _xcb_operator (op),
- ((xcb_surface_t *) src->surface)->picture,
- maskpict,
- ((xcb_surface_t *) dst->surface)->picture,
- x_src,
- y_src,
- x_mask,
- y_mask,
- x_dst,
- y_dst,
- width,
- height);
-
+ _xcb_operator (op),
+ ((xcb_surface_t *) src->surface)->picture,
+ maskpict,
+ ((xcb_surface_t *) dst->surface)->picture,
+ x_src,
+ y_src,
+ x_mask,
+ y_mask,
+ x_dst,
+ y_dst,
+ width,
+ height);
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_xcb_render_set_pixels (render_surface_t *dst,
- render_format_t format,
- unsigned char *data)
+ render_format_t format,
+ unsigned char *data)
{
xcb_surface_t *s = (xcb_surface_t *) dst->surface;
XCBGCONTEXT gc;
@@ -390,14 +391,14 @@
XCBCreateGC (s->c, gc, s->drawable, 0, 0);
XCBPutImage (s->c, ZPixmap, s->drawable, gc,
- dst->width,
- dst->height,
- 0, 0, 0, depth,
- len, data);
-
+ dst->width,
+ dst->height,
+ 0, 0, 0, depth,
+ len, data);
+
XCBFreeGC (s->c, gc);
-
+
return RENDER_STATUS_SUCCESS;
}
@@ -411,14 +412,14 @@
gc = XCBGCONTEXTNew (s->c);
XCBCreateGC (s->c, gc, s->drawable, 0, 0);
-
+
XCBCopyArea (s->c,
- s->pixmap,
- s->drawable,
- gc,
- 0, 0, 0, 0,
- surface->width,
- surface->height);
+ s->pixmap,
+ s->drawable,
+ gc,
+ 0, 0, 0, 0,
+ surface->width,
+ surface->height);
XCBFreeGC (s->c, gc);
}
@@ -427,7 +428,7 @@
static render_status_t
_xcb_render_set_fill (render_surface_t *surface,
- render_fill_t fill)
+ render_fill_t fill)
{
xcb_surface_t *s = (xcb_surface_t *) surface->surface;
CARD32 mask = XCBRenderCPRepeat;
@@ -440,13 +441,13 @@
if (!XCB_RENDER_HAS_EXTENDED_REPEAT_ATTRIBUTES (s))
return RENDER_STATUS_NOT_SUPPORTED;
- pa = 2;
+ pa = 3;
break;
case RENDER_FILL_REFLECT:
if (!XCB_RENDER_HAS_EXTENDED_REPEAT_ATTRIBUTES (s))
return RENDER_STATUS_NOT_SUPPORTED;
- pa = 3;
+ pa = 2;
break;
case RENDER_FILL_REPEAT:
pa = 1;
@@ -456,15 +457,15 @@
default:
break;
}
-
+
XCBRenderChangePicture (s->c, s->picture, mask, &pa);
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_xcb_render_set_component_alpha (render_surface_t *surface,
- render_bool_t component_alpha)
+ render_bool_t component_alpha)
{
xcb_surface_t *s = (xcb_surface_t *) surface->surface;
CARD32 mask = XCBRenderCPComponentAlpha;
@@ -474,13 +475,13 @@
XCBRenderChangePicture (s->c, s->picture, mask, &pa);
else
return RENDER_STATUS_NOT_SUPPORTED;
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_xcb_render_set_transform (render_surface_t *surface,
- render_matrix_t *matrix)
+ render_matrix_t *matrix)
{
XCBRenderTRANSFORM transform;
xcb_surface_t *s = (xcb_surface_t *) surface->surface;
@@ -488,7 +489,7 @@
transform.matrix11 = DOUBLE_TO_FIXED (matrix->m[0][0]);
transform.matrix12 = DOUBLE_TO_FIXED (matrix->m[0][1]);
transform.matrix13 = DOUBLE_TO_FIXED (matrix->m[0][2]);
-
+
transform.matrix21 = DOUBLE_TO_FIXED (matrix->m[1][0]);
transform.matrix22 = DOUBLE_TO_FIXED (matrix->m[1][1]);
transform.matrix23 = DOUBLE_TO_FIXED (matrix->m[1][2]);
@@ -507,9 +508,9 @@
static render_status_t
_xcb_render_set_filter (render_surface_t *surface,
- render_filter_t filter,
- render_fixed16_16_t *params,
- int n_params)
+ render_filter_t filter,
+ render_fixed16_16_t *params,
+ int n_params)
{
char *render_filter = NULL;
xcb_surface_t *s = (xcb_surface_t *) surface->surface;
@@ -529,32 +530,32 @@
XCBGenericError *e;
XCBSTRIter iter;
int len;
-
+
reply =
- XCBRenderQueryFiltersReply (s->c,
- XCBRenderQueryFilters (s->c, s->drawable),
- &e);
-
+ XCBRenderQueryFiltersReply (s->c,
+ XCBRenderQueryFilters (s->c, s->drawable),
+ &e);
+
iter = XCBRenderQueryFiltersFiltersIter (reply);
len = XCBRenderQueryFiltersFiltersLength (reply);
-
+
while (iter.rem)
{
- XCBSTR *str;
-
- str = iter.data;
- if (XCBSTRNameLength (str))
- {
- if (strncmp ("convolution",
- XCBSTRName (str),
- XCBSTRNameLength (str)) == 0)
- {
- render_filter = "convolution";
- break;
- }
- }
+ XCBSTR *str;
- XCBSTRNext (&iter);
+ str = iter.data;
+ if (XCBSTRNameLength (str))
+ {
+ if (strncmp ("convolution",
+ XCBSTRName (str),
+ XCBSTRNameLength (str)) == 0)
+ {
+ render_filter = "convolution";
+ break;
+ }
+ }
+
+ XCBSTRNext (&iter);
}
} break;
default:
@@ -565,48 +566,48 @@
if (render_filter)
{
XCBRenderSetPictureFilter (s->c, s->picture,
- strlen (render_filter), render_filter,
- n_params, (XCBRenderFIXED *) params);
-
+ strlen (render_filter), render_filter,
+ n_params, (XCBRenderFIXED *) params);
+
return RENDER_STATUS_SUCCESS;
}
-
+
return RENDER_STATUS_NOT_SUPPORTED;
}
static render_status_t
_xcb_render_set_clip_rectangles (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_rectangle_t *rects,
- int n_rects)
+ int x_offset,
+ int y_offset,
+ render_rectangle_t *rects,
+ int n_rects)
{
xcb_surface_t *s = (xcb_surface_t *) surface->surface;
-
+
if (n_rects > 0) {
XCBRenderSetPictureClipRectangles (s->c, s->picture,
- x_offset, y_offset,
- n_rects, (XCBRECTANGLE *) rects);
+ x_offset, y_offset,
+ n_rects, (XCBRECTANGLE *) rects);
} else {
XCBRECTANGLE xr;
-
+
xr.x = 0;
xr.y = 0;
xr.width = surface->width;
xr.height = surface->height;
-
+
XCBRenderSetPictureClipRectangles (s->c, s->picture, 0, 0, 1, &xr);
}
-
+
return RENDER_STATUS_SUCCESS;
}
static render_status_t
_xcb_render_set_clip_trapezoids (render_surface_t *surface,
- int x_offset,
- int y_offset,
- render_trapezoid_t *traps,
- int n_traps)
+ int x_offset,
+ int y_offset,
+ render_trapezoid_t *traps,
+ int n_traps)
{
return RENDER_STATUS_NOT_SUPPORTED;
}
@@ -646,7 +647,7 @@
default:
return 1;
}
-
+
return 0;
}
@@ -671,11 +672,11 @@
state.pointer = &options;
if (render_parse_arguments (_parse_option,
- _xcb_options,
- &state,
- argc, argv))
+ _xcb_options,
+ &state,
+ argc, argv))
return 1;
-
+
surface.backend = &_xcb_render_backend;
surface.flags = 0;
@@ -684,18 +685,18 @@
fprintf (stderr, "Error: can't open display\n");
return 1;
}
-
+
win.render_major = -1;
win.render_minor = -1;
-
+
if (!XCBRenderInit (win.c)) {
fprintf (stderr, "Error: failed to initialize render extension\n");
return 1;
}
-
+
version_reply =
XCBRenderQueryVersionReply (win.c,
- XCBRenderQueryVersion (win.c, 0, 6), 0);
+ XCBRenderQueryVersion (win.c, 0, 6), 0);
if (!version_reply) {
fprintf (stderr, "Error: failed to query render extension version\n");
return 1;
@@ -715,13 +716,13 @@
win.drawable.window = XCBWINDOWNew (win.c);
XCBCreateWindow (win.c, 0, win.drawable.window, root->root,
- x, y, surface.width, surface.height, 0,
- InputOutput, root->root_visual,
- mask, values);
+ x, y, surface.width, surface.height, 0,
+ InputOutput, root->root_visual,
+ mask, values);
formats_reply =
XCBRenderQueryPictFormatsReply (win.c,
- XCBRenderQueryPictFormats (win.c), 0);
+ XCBRenderQueryPictFormats (win.c), 0);
if (!formats_reply) {
fprintf (stderr, "Error: failed to query picture formats\n");
return 1;
@@ -737,15 +738,15 @@
if (options.offscreen) {
win.pixmap.pixmap = XCBPIXMAPNew (win.c);
XCBCreatePixmap (win.c, root->root_depth,
- win.pixmap.pixmap, win.drawable,
- surface.width, surface.height);
+ win.pixmap.pixmap, win.drawable,
+ surface.width, surface.height);
win.picture = XCBRenderPICTURENew (win.c);
XCBRenderCreatePicture (win.c, win.picture, win.pixmap, format, 0, NULL);
} else {
win.picture = XCBRenderPICTURENew (win.c);
XCBRenderCreatePicture (win.c, win.picture, win.drawable, format, 0, NULL);
}
-
+
XCBMapWindow (win.c, win.drawable.window);
XCBSync (win.c, NULL);
@@ -755,7 +756,7 @@
break;
} while (xev);
- surface.surface = &win;
+ surface.surface = &win;
status = render_run (&surface, &state.settings);
@@ -764,7 +765,7 @@
if (win.pixmap.pixmap.xid)
XCBFreePixmap (win.c, win.pixmap.pixmap);
-
+
XCBRenderFreePicture (win.c, win.picture);
XCBDestroyWindow (win.c, win.drawable.window);
XCBDisconnect (win.c);
More information about the cairo-commit
mailing list