aboutsummaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
Diffstat (limited to 'pixman')
-rw-r--r--pixman/.gitignore7
-rw-r--r--pixman/README110
-rw-r--r--pixman/demos/Makefile.am2
-rw-r--r--pixman/pixman/Makefile.am2
-rw-r--r--pixman/test/Makefile.am2
-rw-r--r--pixman/test/affine-test.c6
-rw-r--r--pixman/test/alphamap.c19
-rw-r--r--pixman/test/blitters-test.c6
-rw-r--r--pixman/test/composite.c221
-rw-r--r--pixman/test/scaling-test.c7
-rw-r--r--pixman/test/utils.c162
-rw-r--r--pixman/test/utils.h6
12 files changed, 392 insertions, 158 deletions
diff --git a/pixman/.gitignore b/pixman/.gitignore
index 2d089fc5e..648699bf2 100644
--- a/pixman/.gitignore
+++ b/pixman/.gitignore
@@ -31,12 +31,15 @@ demos/checkerboard
demos/clip-in
demos/clip-test
demos/composite-test
+demos/conical-test
demos/convolution-test
demos/gradient-test
demos/quad2quad
demos/radial-test
+demos/scale
demos/screen-test
demos/srgb-test
+demos/srgb-trap-test
demos/trap-test
demos/tri-test
pixman/pixman-srgb.c
@@ -49,6 +52,7 @@ test/alpha-test
test/blitters-test
test/clip-in
test/clip-test
+test/combiner-test
test/composite
test/composite-test
test/composite-traps-test
@@ -57,13 +61,16 @@ test/fetch-test
test/glyph-test
test/gradient-crash-test
test/gradient-test
+test/infinite-loop
test/lowlevel-blt-bench
test/oob-test
test/pdf-op-test
+test/prng-test
test/region-contains-test
test/region-test
test/region-translate
test/region-translate-test
+test/rotate-test
test/scaling-crash-test
test/scaling-helpers-test
test/scaling-test
diff --git a/pixman/README b/pixman/README
index 3cfbc5053..6d8cfd8ad 100644
--- a/pixman/README
+++ b/pixman/README
@@ -1,22 +1,116 @@
-pixman is a library that provides low-level pixel manipulation
+Pixman is a library that provides low-level pixel manipulation
features such as image compositing and trapezoid rasterization.
-All questions regarding this software should be directed to the pixman
+Questions, bug reports and patches should be directed to the pixman
mailing list:
http://lists.freedesktop.org/mailman/listinfo/pixman
-Please send patches and bug reports either to the mailing list above,
-or file them at the freedesktop bug tracker:
+You can also file bugs at
https://bugs.freedesktop.org/enter_bug.cgi?product=pixman
-The master development code repository can be found at:
+For real time discussions about pixman, feel free to join the IRC
+channels #cairo and #xorg-devel on the FreeNode IRC network.
+
+
+Contributing
+------------
+
+In order to contribute to pixman, you will need a working knowledge of
+the git version control system. For a quick getting started guide,
+there is the "Everyday Git With 20 Commands Or So guide"
+
+ http://www.kernel.org/pub/software/scm/git/docs/everyday.html
+
+from the Git homepage. For more in depth git documentation, see the
+resources on the Git community documentation page:
+
+ http://git-scm.com/documentation
+
+Pixman uses the infrastructure from the freedesktop.org umbrella
+project. For instructions about how to use the git service on
+freedesktop.org, see:
+
+ http://www.freedesktop.org/wiki/Infrastructure/git/Developers
+
+The Pixman master repository can be found at:
git://anongit.freedesktop.org/git/pixman
- http://gitweb.freedesktop.org/?p=pixman;a=summary
+and browsed on the web here:
+
+ http://cgit.freedesktop.org/pixman/
+
+
+Sending patches
+---------------
+
+The general workflow for sending patches is to first make sure that
+git can send mail on your system. Then,
+
+ - create a branch off of master in your local git repository
+
+ - make your changes as one or more commits
+
+ - use the
+
+ git send-email
+
+ command to send the patch series to pixman@lists.freedesktop.org.
+
+In order for your patches to be accepted, please consider the
+following guidelines:
+
+ - This link:
+
+ http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#patch-series
+
+ describes how what a good patch series is, and to create one with
+ git.
+
+ - At each point in the series, pixman should compile and the test
+ suite should pass.
+
+ The exception here is if you are changing the test suite to
+ demonstrate a bug. In this case, make one commit that makes the
+ test suite fail due to the bug, and then another commit that fixes
+ the bug.
+
+ You can run the test suite with
+
+ make check
+
+ It will take around two minutes to run on a modern PC.
+
+ - Follow the coding style described in the CODING_STYLE file
+
+ - For bug fixes, include an update to the test suite to make sure
+ the bug doesn't reappear.
+
+ - For new features, add tests of the feature to the test
+ suite. Also, add a program demonstrating the new feature to the
+ demos/ directory.
+
+ - Write descriptive commit messages. Useful information to include:
+ - Benchmark results, before and after
+ - Description of the bug that was fixed
+ - Detailed rationale for any new API
+ - Alternative approaches that were rejected (and why they
+ don't work)
+ - If review comments were incorporated, a brief version
+ history describing what those changes were.
+
+ - For big patch series, send an introductory email with an overall
+ description of the patch series, including benchmarks and
+ motivation. Each commit message should still be descriptive and
+ include enough information to understand why this particular commit
+ was necessary.
-For more information on the git code manager, see:
+Pixman has high standards for code quality and so almost everybody
+should expect to have the first versions of their patches rejected.
- http://wiki.x.org/wiki/GitPage
+If you think that the reviewers are wrong about something, or that the
+guidelines above are wrong, feel free to discuss the issue on the
+list. The purpose of the guidelines and code review is to ensure high
+code quality; it is not an exercise in compliance.
diff --git a/pixman/demos/Makefile.am b/pixman/demos/Makefile.am
index 3f2a3fad6..5f53407b0 100644
--- a/pixman/demos/Makefile.am
+++ b/pixman/demos/Makefile.am
@@ -4,7 +4,7 @@ AM_CFLAGS = $(OPENMP_CFLAGS)
AM_LDFLAGS = $(OPENMP_CFLAGS)
LDADD = $(top_builddir)/pixman/libpixman-1.la -lm $(GTK_LIBS) $(PNG_LIBS)
-INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(GTK_CFLAGS) $(PNG_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(GTK_CFLAGS) $(PNG_CFLAGS)
GTK_UTILS = gtk-utils.c gtk-utils.h ../test/utils.c ../test/utils.h \
../test/utils-prng.c ../test/utils-prng.h
diff --git a/pixman/pixman/Makefile.am b/pixman/pixman/Makefile.am
index cbed0855a..beebdd086 100644
--- a/pixman/pixman/Makefile.am
+++ b/pixman/pixman/Makefile.am
@@ -85,7 +85,7 @@ noinst_LTLIBRARIES += libpixman-iwmmxt.la
libpixman_1_la_LIBADD += libpixman-iwmmxt.la
libpixman_iwmmxt_la-pixman-mmx.lo: pixman-mmx.c
- $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(IWMMXT_CFLAGS) -MT libpixman_iwmmxt_la-pixman-mmx.lo -MD -MP -MF $(DEPDIR)/libpixman_iwmmxt_la-pixman-mmx.Tpo -c -o libpixman_iwmmxt_la-pixman-mmx.lo `test -f 'pixman-mmx.c' || echo '$(srcdir)/'`pixman-mmx.c
+ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(IWMMXT_CFLAGS) -MT libpixman_iwmmxt_la-pixman-mmx.lo -MD -MP -MF $(DEPDIR)/libpixman_iwmmxt_la-pixman-mmx.Tpo -c -o libpixman_iwmmxt_la-pixman-mmx.lo `test -f 'pixman-mmx.c' || echo '$(srcdir)/'`pixman-mmx.c
$(AM_V_at)$(am__mv) $(DEPDIR)/libpixman_iwmmxt_la-pixman-mmx.Tpo $(DEPDIR)/libpixman_iwmmxt_la-pixman-mmx.Plo
libpixman_iwmmxt_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
diff --git a/pixman/test/Makefile.am b/pixman/test/Makefile.am
index eeb3679f0..ca87f4ef4 100644
--- a/pixman/test/Makefile.am
+++ b/pixman/test/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/test/Makefile.sources
AM_CFLAGS = $(OPENMP_CFLAGS)
AM_LDFLAGS = $(OPENMP_CFLAGS) $(TESTPROGS_EXTRA_LDFLAGS)
LDADD = libutils.la $(top_builddir)/pixman/libpixman-1.la -lm $(PNG_LIBS)
-INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS)
libutils_la_SOURCES = $(libutils_sources) $(libutils_headers)
diff --git a/pixman/test/affine-test.c b/pixman/test/affine-test.c
index f60ec14eb..678fbe844 100644
--- a/pixman/test/affine-test.c
+++ b/pixman/test/affine-test.c
@@ -200,9 +200,9 @@ test_composite (int testnum,
#define M(r,c) \
transform.matrix[r][c]
- printf ("src_fmt=%08X, dst_fmt=%08X\n", src_fmt, dst_fmt);
- printf ("op=%d, repeat=%d, transform=\n",
- op, repeat);
+ printf ("src_fmt=%s, dst_fmt=%s\n", format_name (src_fmt), format_name (dst_fmt));
+ printf ("op=%s, repeat=%d, transform=\n",
+ operator_name (op), repeat);
printf (" { { { 0x%08x, 0x%08x, 0x%08x },\n"
" { 0x%08x, 0x%08x, 0x%08x },\n"
" { 0x%08x, 0x%08x, 0x%08x },\n"
diff --git a/pixman/test/alphamap.c b/pixman/test/alphamap.c
index 1a6fca55a..4d09076fb 100644
--- a/pixman/test/alphamap.c
+++ b/pixman/test/alphamap.c
@@ -26,25 +26,6 @@ static const int origins[] =
0, 10, -100
};
-static const char *
-format_name (pixman_format_code_t format)
-{
- if (format == PIXMAN_a8)
- return "a8";
- else if (format == PIXMAN_a2r10g10b10)
- return "a2r10g10b10";
- else if (format == PIXMAN_a8r8g8b8)
- return "a8r8g8b8";
- else if (format == PIXMAN_a4r4g4b4)
- return "a4r4g4b4";
- else if (format == PIXMAN_null)
- return "none";
- else
- assert (0);
-
- return "<unknown - bug in alphamap.c>";
-}
-
static void
on_destroy (pixman_image_t *image, void *data)
{
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c
index 9bde99c62..8766fa800 100644
--- a/pixman/test/blitters-test.c
+++ b/pixman/test/blitters-test.c
@@ -329,8 +329,10 @@ test_composite (int testnum, int verbose)
if (verbose)
{
- printf ("op=%d, src_fmt=%08X, dst_fmt=%08X, mask_fmt=%08X\n",
- op, src_fmt, dst_fmt, mask_fmt);
+ printf ("op=%s\n", operator_name (op));
+ printf ("src_fmt=%s, dst_fmt=%s, mask_fmt=%s\n",
+ format_name (src_fmt), format_name (dst_fmt),
+ format_name (mask_fmt));
printf ("src_width=%d, src_height=%d, dst_width=%d, dst_height=%d\n",
src_width, src_height, dst_width, dst_height);
printf ("src_x=%d, src_y=%d, dst_x=%d, dst_y=%d\n",
diff --git a/pixman/test/composite.c b/pixman/test/composite.c
index 09752c5c7..b107b1106 100644
--- a/pixman/test/composite.c
+++ b/pixman/test/composite.c
@@ -28,15 +28,7 @@
#include <time.h>
#include "utils.h"
-typedef struct format_t format_t;
typedef struct image_t image_t;
-typedef struct operator_t operator_t;
-
-struct format_t
-{
- pixman_format_code_t format;
- const char *name;
-};
static const color_t colors[] =
{
@@ -82,122 +74,111 @@ static const int sizes[] =
10
};
-static const format_t formats[] =
+static const pixman_format_code_t formats[] =
{
-#define P(x) { PIXMAN_##x, #x }
-
/* 32 bpp formats */
- P(a8r8g8b8),
- P(x8r8g8b8),
- P(a8b8g8r8),
- P(x8b8g8r8),
- P(b8g8r8a8),
- P(b8g8r8x8),
- P(r8g8b8a8),
- P(r8g8b8x8),
- P(x2r10g10b10),
- P(x2b10g10r10),
- P(a2r10g10b10),
- P(a2b10g10r10),
+ PIXMAN_a8r8g8b8,
+ PIXMAN_x8r8g8b8,
+ PIXMAN_a8b8g8r8,
+ PIXMAN_x8b8g8r8,
+ PIXMAN_b8g8r8a8,
+ PIXMAN_b8g8r8x8,
+ PIXMAN_r8g8b8a8,
+ PIXMAN_r8g8b8x8,
+ PIXMAN_x2r10g10b10,
+ PIXMAN_x2b10g10r10,
+ PIXMAN_a2r10g10b10,
+ PIXMAN_a2b10g10r10,
/* sRGB formats */
- P(a8r8g8b8_sRGB),
+ PIXMAN_a8r8g8b8_sRGB,
/* 24 bpp formats */
- P(r8g8b8),
- P(b8g8r8),
- P(r5g6b5),
- P(b5g6r5),
+ PIXMAN_r8g8b8,
+ PIXMAN_b8g8r8,
+ PIXMAN_r5g6b5,
+ PIXMAN_b5g6r5,
/* 16 bpp formats */
- P(x1r5g5b5),
- P(x1b5g5r5),
- P(a1r5g5b5),
- P(a1b5g5r5),
- P(a4b4g4r4),
- P(x4b4g4r4),
- P(a4r4g4b4),
- P(x4r4g4b4),
+ PIXMAN_x1r5g5b5,
+ PIXMAN_x1b5g5r5,
+ PIXMAN_a1r5g5b5,
+ PIXMAN_a1b5g5r5,
+ PIXMAN_a4b4g4r4,
+ PIXMAN_x4b4g4r4,
+ PIXMAN_a4r4g4b4,
+ PIXMAN_x4r4g4b4,
/* 8 bpp formats */
- P(a8),
- P(r3g3b2),
- P(b2g3r3),
- P(a2r2g2b2),
- P(a2b2g2r2),
- P(x4a4),
+ PIXMAN_a8,
+ PIXMAN_r3g3b2,
+ PIXMAN_b2g3r3,
+ PIXMAN_a2r2g2b2,
+ PIXMAN_a2b2g2r2,
+ PIXMAN_x4a4,
/* 4 bpp formats */
- P(a4),
- P(r1g2b1),
- P(b1g2r1),
- P(a1r1g1b1),
- P(a1b1g1r1),
+ PIXMAN_a4,
+ PIXMAN_r1g2b1,
+ PIXMAN_b1g2r1,
+ PIXMAN_a1r1g1b1,
+ PIXMAN_a1b1g1r1,
/* 1 bpp formats */
- P(a1)
-#undef P
+ PIXMAN_a1,
};
struct image_t
{
pixman_image_t *image;
- const format_t *format;
+ pixman_format_code_t format;
const color_t *color;
pixman_repeat_t repeat;
int size;
};
-struct operator_t
+static const pixman_op_t operators[] =
{
- pixman_op_t op;
- const char *name;
-};
-
-static const operator_t operators[] =
-{
-#define P(x) { PIXMAN_OP_##x, #x }
- P(CLEAR),
- P(SRC),
- P(DST),
- P(OVER),
- P(OVER_REVERSE),
- P(IN),
- P(IN_REVERSE),
- P(OUT),
- P(OUT_REVERSE),
- P(ATOP),
- P(ATOP_REVERSE),
- P(XOR),
- P(ADD),
- P(SATURATE),
-
- P(DISJOINT_CLEAR),
- P(DISJOINT_SRC),
- P(DISJOINT_DST),
- P(DISJOINT_OVER),
- P(DISJOINT_OVER_REVERSE),
- P(DISJOINT_IN),
- P(DISJOINT_IN_REVERSE),
- P(DISJOINT_OUT),
- P(DISJOINT_OUT_REVERSE),
- P(DISJOINT_ATOP),
- P(DISJOINT_ATOP_REVERSE),
- P(DISJOINT_XOR),
-
- P(CONJOINT_CLEAR),
- P(CONJOINT_SRC),
- P(CONJOINT_DST),
- P(CONJOINT_OVER),
- P(CONJOINT_OVER_REVERSE),
- P(CONJOINT_IN),
- P(CONJOINT_IN_REVERSE),
- P(CONJOINT_OUT),
- P(CONJOINT_OUT_REVERSE),
- P(CONJOINT_ATOP),
- P(CONJOINT_ATOP_REVERSE),
- P(CONJOINT_XOR),
-#undef P
+ PIXMAN_OP_CLEAR,
+ PIXMAN_OP_SRC,
+ PIXMAN_OP_DST,
+ PIXMAN_OP_OVER,
+ PIXMAN_OP_OVER_REVERSE,
+ PIXMAN_OP_IN,
+ PIXMAN_OP_IN_REVERSE,
+ PIXMAN_OP_OUT,
+ PIXMAN_OP_OUT_REVERSE,
+ PIXMAN_OP_ATOP,
+ PIXMAN_OP_ATOP_REVERSE,
+ PIXMAN_OP_XOR,
+ PIXMAN_OP_ADD,
+ PIXMAN_OP_SATURATE,
+
+ PIXMAN_OP_DISJOINT_CLEAR,
+ PIXMAN_OP_DISJOINT_SRC,
+ PIXMAN_OP_DISJOINT_DST,
+ PIXMAN_OP_DISJOINT_OVER,
+ PIXMAN_OP_DISJOINT_OVER_REVERSE,
+ PIXMAN_OP_DISJOINT_IN,
+ PIXMAN_OP_DISJOINT_IN_REVERSE,
+ PIXMAN_OP_DISJOINT_OUT,
+ PIXMAN_OP_DISJOINT_OUT_REVERSE,
+ PIXMAN_OP_DISJOINT_ATOP,
+ PIXMAN_OP_DISJOINT_ATOP_REVERSE,
+ PIXMAN_OP_DISJOINT_XOR,
+
+ PIXMAN_OP_CONJOINT_CLEAR,
+ PIXMAN_OP_CONJOINT_SRC,
+ PIXMAN_OP_CONJOINT_DST,
+ PIXMAN_OP_CONJOINT_OVER,
+ PIXMAN_OP_CONJOINT_OVER_REVERSE,
+ PIXMAN_OP_CONJOINT_IN,
+ PIXMAN_OP_CONJOINT_IN_REVERSE,
+ PIXMAN_OP_CONJOINT_OUT,
+ PIXMAN_OP_CONJOINT_OUT_REVERSE,
+ PIXMAN_OP_CONJOINT_ATOP,
+ PIXMAN_OP_CONJOINT_ATOP_REVERSE,
+ PIXMAN_OP_CONJOINT_XOR,
};
static double
@@ -498,7 +479,7 @@ describe_image (image_t *info, char *buf)
if (info->size)
{
sprintf (buf, "%s, %dx%d%s",
- info->format->name,
+ format_name (info->format),
info->size, info->size,
info->repeat ? " R" :"");
}
@@ -521,7 +502,7 @@ describe_color (const color_t *color, char *buf)
static pixman_bool_t
composite_test (image_t *dst,
- const operator_t *op,
+ pixman_op_t op,
image_t *src,
image_t *mask,
pixman_bool_t component_alpha,
@@ -534,12 +515,12 @@ composite_test (image_t *dst,
{
pixman_image_set_component_alpha (mask->image, component_alpha);
- pixman_image_composite (op->op, src->image, mask->image, dst->image,
+ pixman_image_composite (op, src->image, mask->image, dst->image,
0, 0, 0, 0, 0, 0, dst->size, dst->size);
}
else
{
- pixman_image_composite (op->op, src->image, NULL, dst->image,
+ pixman_image_composite (op, src->image, NULL, dst->image,
0, 0,
0, 0,
0, 0,
@@ -561,43 +542,43 @@ composite_test (image_t *dst,
*/
if (src->size)
{
- if (PIXMAN_FORMAT_TYPE (src->format->format) == PIXMAN_TYPE_ARGB_SRGB)
+ if (PIXMAN_FORMAT_TYPE (src->format) == PIXMAN_TYPE_ARGB_SRGB)
{
tsrc.r = convert_linear_to_srgb (tsrc.r);
tsrc.g = convert_linear_to_srgb (tsrc.g);
tsrc.b = convert_linear_to_srgb (tsrc.b);
- round_color (src->format->format, &tsrc);
+ round_color (src->format, &tsrc);
tsrc.r = convert_srgb_to_linear (tsrc.r);
tsrc.g = convert_srgb_to_linear (tsrc.g);
tsrc.b = convert_srgb_to_linear (tsrc.b);
}
else
{
- round_color (src->format->format, &tsrc);
+ round_color (src->format, &tsrc);
}
}
if (mask && mask->size)
{
- if (PIXMAN_FORMAT_TYPE (mask->format->format) == PIXMAN_TYPE_ARGB_SRGB)
+ if (PIXMAN_FORMAT_TYPE (mask->format) == PIXMAN_TYPE_ARGB_SRGB)
{
tmsk.r = convert_linear_to_srgb (tmsk.r);
tmsk.g = convert_linear_to_srgb (tmsk.g);
tmsk.b = convert_linear_to_srgb (tmsk.b);
- round_color (mask->format->format, &tmsk);
+ round_color (mask->format, &tmsk);
tmsk.r = convert_srgb_to_linear (tmsk.r);
tmsk.g = convert_srgb_to_linear (tmsk.g);
tmsk.b = convert_srgb_to_linear (tmsk.b);
}
else
{
- round_color (mask->format->format, &tmsk);
+ round_color (mask->format, &tmsk);
}
}
if (mask)
{
- if (component_alpha && PIXMAN_FORMAT_R (mask->format->format) == 0)
+ if (component_alpha && PIXMAN_FORMAT_R (mask->format) == 0)
{
/* Ax component-alpha masks expand alpha into
* all color channels.
@@ -606,29 +587,29 @@ composite_test (image_t *dst,
}
}
- if (PIXMAN_FORMAT_TYPE (dst->format->format) == PIXMAN_TYPE_ARGB_SRGB)
+ if (PIXMAN_FORMAT_TYPE (dst->format) == PIXMAN_TYPE_ARGB_SRGB)
{
tdst.r = convert_linear_to_srgb (tdst.r);
tdst.g = convert_linear_to_srgb (tdst.g);
tdst.b = convert_linear_to_srgb (tdst.b);
- round_color (dst->format->format, &tdst);
+ round_color (dst->format, &tdst);
tdst.r = convert_srgb_to_linear (tdst.r);
tdst.g = convert_srgb_to_linear (tdst.g);
tdst.b = convert_srgb_to_linear (tdst.b);
}
else
{
- round_color (dst->format->format, &tdst);
+ round_color (dst->format, &tdst);
}
- do_composite (op->op,
+ do_composite (op,
&tsrc,
mask? &tmsk : NULL,
&tdst,
&expected,
component_alpha);
- pixel_checker_init (&checker, dst->format->format);
+ pixel_checker_init (&checker, dst->format);
if (!pixel_checker_check (&checker, get_value (dst->image), &expected))
{
@@ -638,7 +619,7 @@ composite_test (image_t *dst,
printf ("---- Test %d failed ----\n", testno);
printf ("Operator: %s %s\n",
- op->name, component_alpha ? "CA" : "");
+ operator_name (op), component_alpha ? "CA" : "");
printf ("Source: %s\n", describe_image (src, buf));
if (mask != NULL)
@@ -687,7 +668,7 @@ image_init (image_t *info,
info->color = &colors[color];
compute_pixman_color (info->color, &fill);
- info->format = &formats[format];
+ info->format = formats[format];
info->size = sizes[size] & ~FLAGS;
info->repeat = PIXMAN_REPEAT_NONE;
@@ -695,7 +676,7 @@ image_init (image_t *info,
{
pixman_image_t *solid;
- info->image = pixman_image_create_bits (info->format->format,
+ info->image = pixman_image_create_bits (info->format,
info->size, info->size,
NULL, 0);
@@ -744,7 +725,7 @@ static pixman_bool_t
run_test (uint32_t seed)
{
image_t src, mask, dst;
- const operator_t *op;
+ pixman_op_t op;
int ca;
int ok;
@@ -754,7 +735,7 @@ run_test (uint32_t seed)
image_init (&src, random_color(), random_format(), random_size());
image_init (&mask, random_color(), random_format(), random_size());
- op = &(operators [prng_rand_n (ARRAY_LENGTH (operators))]);
+ op = operators [prng_rand_n (ARRAY_LENGTH (operators))];
ca = prng_rand_n (3);
diff --git a/pixman/test/scaling-test.c b/pixman/test/scaling-test.c
index 64c12dd7c..a8cb4c47b 100644
--- a/pixman/test/scaling-test.c
+++ b/pixman/test/scaling-test.c
@@ -239,9 +239,10 @@ test_composite (int testnum,
if (verbose)
{
- printf ("src_fmt=%08X, dst_fmt=%08X\n", src_fmt, dst_fmt);
- printf ("op=%d, scale_x=%d, scale_y=%d, repeat=%d\n",
- op, scale_x, scale_y, repeat);
+ printf ("src_fmt=%s, dst_fmt=%s\n",
+ format_name (src_fmt), format_name (dst_fmt));
+ printf ("op=%s, scale_x=%d, scale_y=%d, repeat=%d\n",
+ operator_name (op), scale_x, scale_y, repeat);
printf ("translate_x=%d, translate_y=%d\n",
translate_x, translate_y);
printf ("src_width=%d, src_height=%d, dst_width=%d, dst_height=%d\n",
diff --git a/pixman/test/utils.c b/pixman/test/utils.c
index 08eaabbf6..ba7e35335 100644
--- a/pixman/test/utils.c
+++ b/pixman/test/utils.c
@@ -870,6 +870,168 @@ initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb)
}
}
+const char *
+operator_name (pixman_op_t op)
+{
+ switch (op)
+ {
+ case PIXMAN_OP_CLEAR: return "PIXMAN_OP_CLEAR";
+ case PIXMAN_OP_SRC: return "PIXMAN_OP_SRC";
+ case PIXMAN_OP_DST: return "PIXMAN_OP_DST";
+ case PIXMAN_OP_OVER: return "PIXMAN_OP_OVER";
+ case PIXMAN_OP_OVER_REVERSE: return "PIXMAN_OP_OVER_REVERSE";
+ case PIXMAN_OP_IN: return "PIXMAN_OP_IN";
+ case PIXMAN_OP_IN_REVERSE: return "PIXMAN_OP_IN_REVERSE";
+ case PIXMAN_OP_OUT: return "PIXMAN_OP_OUT";
+ case PIXMAN_OP_OUT_REVERSE: return "PIXMAN_OP_OUT_REVERSE";
+ case PIXMAN_OP_ATOP: return "PIXMAN_OP_ATOP";
+ case PIXMAN_OP_ATOP_REVERSE: return "PIXMAN_OP_ATOP_REVERSE";
+ case PIXMAN_OP_XOR: return "PIXMAN_OP_XOR";
+ case PIXMAN_OP_ADD: return "PIXMAN_OP_ADD";
+ case PIXMAN_OP_SATURATE: return "PIXMAN_OP_SATURATE";
+
+ case PIXMAN_OP_DISJOINT_CLEAR: return "PIXMAN_OP_DISJOINT_CLEAR";
+ case PIXMAN_OP_DISJOINT_SRC: return "PIXMAN_OP_DISJOINT_SRC";
+ case PIXMAN_OP_DISJOINT_DST: return "PIXMAN_OP_DISJOINT_DST";
+ case PIXMAN_OP_DISJOINT_OVER: return "PIXMAN_OP_DISJOINT_OVER";
+ case PIXMAN_OP_DISJOINT_OVER_REVERSE: return "PIXMAN_OP_DISJOINT_OVER_REVERSE";
+ case PIXMAN_OP_DISJOINT_IN: return "PIXMAN_OP_DISJOINT_IN";
+ case PIXMAN_OP_DISJOINT_IN_REVERSE: return "PIXMAN_OP_DISJOINT_IN_REVERSE";
+ case PIXMAN_OP_DISJOINT_OUT: return "PIXMAN_OP_DISJOINT_OUT";
+ case PIXMAN_OP_DISJOINT_OUT_REVERSE: return "PIXMAN_OP_DISJOINT_OUT_REVERSE";
+ case PIXMAN_OP_DISJOINT_ATOP: return "PIXMAN_OP_DISJOINT_ATOP";
+ case PIXMAN_OP_DISJOINT_ATOP_REVERSE: return "PIXMAN_OP_DISJOINT_ATOP_REVERSE";
+ case PIXMAN_OP_DISJOINT_XOR: return "PIXMAN_OP_DISJOINT_XOR";
+
+ case PIXMAN_OP_CONJOINT_CLEAR: return "PIXMAN_OP_CONJOINT_CLEAR";
+ case PIXMAN_OP_CONJOINT_SRC: return "PIXMAN_OP_CONJOINT_SRC";
+ case PIXMAN_OP_CONJOINT_DST: return "PIXMAN_OP_CONJOINT_DST";
+ case PIXMAN_OP_CONJOINT_OVER: return "PIXMAN_OP_CONJOINT_OVER";
+ case PIXMAN_OP_CONJOINT_OVER_REVERSE: return "PIXMAN_OP_CONJOINT_OVER_REVERSE";
+ case PIXMAN_OP_CONJOINT_IN: return "PIXMAN_OP_CONJOINT_IN";
+ case PIXMAN_OP_CONJOINT_IN_REVERSE: return "PIXMAN_OP_CONJOINT_IN_REVERSE";
+ case PIXMAN_OP_CONJOINT_OUT: return "PIXMAN_OP_CONJOINT_OUT";
+ case PIXMAN_OP_CONJOINT_OUT_REVERSE: return "PIXMAN_OP_CONJOINT_OUT_REVERSE";
+ case PIXMAN_OP_CONJOINT_ATOP: return "PIXMAN_OP_CONJOINT_ATOP";
+ case PIXMAN_OP_CONJOINT_ATOP_REVERSE: return "PIXMAN_OP_CONJOINT_ATOP_REVERSE";
+ case PIXMAN_OP_CONJOINT_XOR: return "PIXMAN_OP_CONJOINT_XOR";
+
+ case PIXMAN_OP_MULTIPLY: return "PIXMAN_OP_MULTIPLY";
+ case PIXMAN_OP_SCREEN: return "PIXMAN_OP_SCREEN";
+ case PIXMAN_OP_OVERLAY: return "PIXMAN_OP_OVERLAY";
+ case PIXMAN_OP_DARKEN: return "PIXMAN_OP_DARKEN";
+ case PIXMAN_OP_LIGHTEN: return "PIXMAN_OP_LIGHTEN";
+ case PIXMAN_OP_COLOR_DODGE: return "PIXMAN_OP_COLOR_DODGE";
+ case PIXMAN_OP_COLOR_BURN: return "PIXMAN_OP_COLOR_BURN";
+ case PIXMAN_OP_HARD_LIGHT: return "PIXMAN_OP_HARD_LIGHT";
+ case PIXMAN_OP_SOFT_LIGHT: return "PIXMAN_OP_SOFT_LIGHT";
+ case PIXMAN_OP_DIFFERENCE: return "PIXMAN_OP_DIFFERENCE";
+ case PIXMAN_OP_EXCLUSION: return "PIXMAN_OP_EXCLUSION";
+ case PIXMAN_OP_HSL_HUE: return "PIXMAN_OP_HSL_HUE";
+ case PIXMAN_OP_HSL_SATURATION: return "PIXMAN_OP_HSL_SATURATION";
+ case PIXMAN_OP_HSL_COLOR: return "PIXMAN_OP_HSL_COLOR";
+ case PIXMAN_OP_HSL_LUMINOSITY: return "PIXMAN_OP_HSL_LUMINOSITY";
+
+ case PIXMAN_OP_NONE:
+ return "<invalid operator 'none'>";
+ };
+
+ return "<unknown operator>";
+}
+
+const char *
+format_name (pixman_format_code_t format)
+{
+ switch (format)
+ {
+/* 32bpp formats */
+ case PIXMAN_a8r8g8b8: return "a8r8g8b8";
+ case PIXMAN_x8r8g8b8: return "x8r8g8b8";
+ case PIXMAN_a8b8g8r8: return "a8b8g8r8";
+ case PIXMAN_x8b8g8r8: return "x8b8g8r8";
+ case PIXMAN_b8g8r8a8: return "b8g8r8a8";
+ case PIXMAN_b8g8r8x8: return "b8g8r8x8";
+ case PIXMAN_r8g8b8a8: return "r8g8b8a8";
+ case PIXMAN_r8g8b8x8: return "r8g8b8x8";
+ case PIXMAN_x14r6g6b6: return "x14r6g6b6";
+ case PIXMAN_x2r10g10b10: return "x2r10g10b10";
+ case PIXMAN_a2r10g10b10: return "a2r10g10b10";
+ case PIXMAN_x2b10g10r10: return "x2b10g10r10";
+ case PIXMAN_a2b10g10r10: return "a2b10g10r10";
+
+/* sRGB formats */
+ case PIXMAN_a8r8g8b8_sRGB: return "a8r8g8b8_sRGB";
+
+/* 24bpp formats */
+ case PIXMAN_r8g8b8: return "r8g8b8";
+ case PIXMAN_b8g8r8: return "b8g8r8";
+
+/* 16bpp formats */
+ case PIXMAN_r5g6b5: return "r5g6b5";
+ case PIXMAN_b5g6r5: return "b5g6r5";
+
+ case PIXMAN_a1r5g5b5: return "a1r5g5b5";
+ case PIXMAN_x1r5g5b5: return "x1r5g5b5";
+ case PIXMAN_a1b5g5r5: return "a1b5g5r5";
+ case PIXMAN_x1b5g5r5: return "x1b5g5r5";
+ case PIXMAN_a4r4g4b4: return "a4r4g4b4";
+ case PIXMAN_x4r4g4b4: return "x4r4g4b4";
+ case PIXMAN_a4b4g4r4: return "a4b4g4r4";
+ case PIXMAN_x4b4g4r4: return "x4b4g4r4";
+
+/* 8bpp formats */
+ case PIXMAN_a8: return "a8";
+ case PIXMAN_r3g3b2: return "r3g3b2";
+ case PIXMAN_b2g3r3: return "b2g3r3";
+ case PIXMAN_a2r2g2b2: return "a2r2g2b2";
+ case PIXMAN_a2b2g2r2: return "a2b2g2r2";
+
+#if 0
+ case PIXMAN_x4c4: return "x4c4";
+ case PIXMAN_g8: return "g8";
+#endif
+ case PIXMAN_c8: return "x4c4 / c8";
+ case PIXMAN_x4g4: return "x4g4 / g8";
+
+ case PIXMAN_x4a4: return "x4a4";
+
+/* 4bpp formats */
+ case PIXMAN_a4: return "a4";
+ case PIXMAN_r1g2b1: return "r1g2b1";
+ case PIXMAN_b1g2r1: return "b1g2r1";
+ case PIXMAN_a1r1g1b1: return "a1r1g1b1";
+ case PIXMAN_a1b1g1r1: return "a1b1g1r1";
+
+ case PIXMAN_c4: return "c4";
+ case PIXMAN_g4: return "g4";
+
+/* 1bpp formats */
+ case PIXMAN_a1: return "a1";
+
+ case PIXMAN_g1: return "g1";
+
+/* YUV formats */
+ case PIXMAN_yuy2: return "yuy2";
+ case PIXMAN_yv12: return "yv12";
+ };
+
+ /* Fake formats.
+ *
+ * This is separate switch to prevent GCC from complaining
+ * that the values are not in the pixman_format_code_t enum.
+ */
+ switch ((uint32_t)format)
+ {
+ case PIXMAN_null: return "null";
+ case PIXMAN_solid: return "solid";
+ case PIXMAN_pixbuf: return "pixbuf";
+ case PIXMAN_rpixbuf: return "rpixbuf";
+ case PIXMAN_unknown: return "unknown";
+ };
+
+ return "<unknown format>";
+};
+
static double
round_channel (double p, int m)
{
diff --git a/pixman/test/utils.h b/pixman/test/utils.h
index 45b457ead..498831433 100644
--- a/pixman/test/utils.h
+++ b/pixman/test/utils.h
@@ -177,6 +177,12 @@ convert_linear_to_srgb (double component);
void
initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb);
+const char *
+operator_name (pixman_op_t op);
+
+const char *
+format_name (pixman_format_code_t format);
+
typedef struct
{
double r, g, b, a;