pixman: Branch 'master' - 5 commits

Andrea Canciani ranma42 at kemper.freedesktop.org
Mon Feb 28 01:39:17 PST 2011


 pixman/Makefile.win32   |    6 ++-
 pixman/pixman-general.c |    2 -
 pixman/pixman-image.c   |    1 
 test/Makefile.win32     |   73 ++++++++++++++++++++++++++++++++++++++++++++++++
 test/composite.c        |   30 +++++++++----------
 test/fetch-test.c       |   53 +++++++++++++++-------------------
 test/stress-test.c      |    2 -
 test/trap-crasher.c     |   20 ++++++-------
 8 files changed, 127 insertions(+), 60 deletions(-)

New commits:
commit 9ebde285fa990bfa1524f166fbfb1368c346b14a
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Thu Feb 24 12:53:39 2011 +0100

    test: Silence MSVC warnings
    
    MSVC does not notice non-returning functions (abort() / assert(0))
    and warns about paths which end with them in non-void functions:
    
    c:\cygwin\home\ranma42\code\fdo\pixman\test\fetch-test.c(114) :
    warning C4715: 'reader' : not all control paths return a value
    c:\cygwin\home\ranma42\code\fdo\pixman\test\stress-test.c(133) :
    warning C4715: 'real_reader' : not all control paths return a value
    c:\cygwin\home\ranma42\code\fdo\pixman\test\composite.c(431) :
    warning C4715: 'calc_op' : not all control paths return a value
    
    These warnings can be silenced by adding a return after the
    termination call.

diff --git a/test/composite.c b/test/composite.c
index 08c6689..a86e5ed 100644
--- a/test/composite.c
+++ b/test/composite.c
@@ -426,6 +426,7 @@ calc_op (pixman_op_t op, double src, double dst, double srca, double dsta)
     case PIXMAN_OP_HSL_LUMINOSITY:
     default:
 	abort();
+	return 0; /* silence MSVC */
     }
 #undef mult_chan
 }
diff --git a/test/fetch-test.c b/test/fetch-test.c
index 314a072..60bc765 100644
--- a/test/fetch-test.c
+++ b/test/fetch-test.c
@@ -110,6 +110,7 @@ reader (const void *src, int size)
 	return *(uint32_t *)src;
     default:
 	assert(0);
+	return 0; /* silence MSVC */
     }
 }
 
diff --git a/test/stress-test.c b/test/stress-test.c
index bcbc1f8..166dc6d 100644
--- a/test/stress-test.c
+++ b/test/stress-test.c
@@ -128,7 +128,7 @@ real_reader (const void *src, int size)
 	return *(uint32_t *)src;
     default:
 	assert (0);
-	break;
+	return 0; /* silence MSVC */
     }
 }
 
commit 8868778ea1fdc8e70da76b3b00ea78106c5840d8
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Feb 22 22:43:48 2011 +0100

    Do not include unused headers
    
    pixman-combine32.h is included without being used both in
    pixman-image.c and in pixman-general.c.

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 16ea3a4..872fb7e 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -36,8 +36,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include "pixman-private.h"
-#include "pixman-combine32.h"
-#include "pixman-private.h"
 
 static void
 general_src_iter_init (pixman_implementation_t *imp,
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 9103ca6..84bacf8 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -30,7 +30,6 @@
 #include <assert.h>
 
 #include "pixman-private.h"
-#include "pixman-combine32.h"
 
 pixman_bool_t
 _pixman_init_gradient (gradient_t *                  gradient,
commit 72f5e5f608506c18c484bc5bc3e58bd83aeb7691
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Feb 22 22:04:49 2011 +0100

    test: Add Makefile for Win32

diff --git a/test/Makefile.win32 b/test/Makefile.win32
new file mode 100644
index 0000000..c71afe1
--- /dev/null
+++ b/test/Makefile.win32
@@ -0,0 +1,73 @@
+CC   = cl
+LINK = link
+
+CFG_VAR = $(CFG)
+ifeq ($(CFG_VAR),)
+CFG_VAR=release
+endif
+
+CFLAGS     = -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_BIND_TO_CURRENT_VCLIBS_VERSION -D_MT -I../pixman -I. -I../
+TEST_LDADD = ../pixman/$(CFG_VAR)/pixman-1.lib
+INCLUDES = -I../pixman -I$(top_builddir)/pixman
+
+# optimization flags
+ifeq ($(CFG_VAR),debug)
+CFLAGS += -Od -Zi
+else
+CFLAGS += -O2
+endif
+
+SOURCES =			\
+	a1-trap-test.c		\
+	pdf-op-test.c		\
+	region-test.c		\
+	region-translate-test.c	\
+	fetch-test.c		\
+	oob-test.c		\
+	trap-crasher.c		\
+	alpha-loop.c		\
+	scaling-crash-test.c	\
+	gradient-crash-test.c	\
+	alphamap.c		\
+	stress-test.c		\
+	composite-traps-test.c	\
+	blitters-test.c		\
+	scaling-test.c		\
+	affine-test.c		\
+	composite.c		\
+	utils.c
+
+TESTS =						\
+	$(CFG_VAR)/a1-trap-test.exe		\
+	$(CFG_VAR)/pdf-op-test.exe		\
+	$(CFG_VAR)/region-test.exe		\
+	$(CFG_VAR)/region-translate-test.exe	\
+	$(CFG_VAR)/fetch-test.exe		\
+	$(CFG_VAR)/oob-test.exe			\
+	$(CFG_VAR)/trap-crasher.exe		\
+	$(CFG_VAR)/alpha-loop.exe		\
+	$(CFG_VAR)/scaling-crash-test.exe	\
+	$(CFG_VAR)/gradient-crash-test.exe	\
+	$(CFG_VAR)/alphamap.exe			\
+	$(CFG_VAR)/stress-test.exe		\
+	$(CFG_VAR)/composite-traps-test.exe	\
+	$(CFG_VAR)/blitters-test.exe		\
+	$(CFG_VAR)/scaling-test.exe		\
+	$(CFG_VAR)/affine-test.exe		\
+	$(CFG_VAR)/composite.exe
+
+
+OBJECTS     = $(patsubst %.c, $(CFG_VAR)/%.obj, $(SOURCES))
+
+$(CFG_VAR)/%.obj: %.c
+	@mkdir -p $(CFG_VAR)
+	@$(CC) -c $(CFLAGS) -Fo"$@" $<
+
+$(CFG_VAR)/%.exe: $(CFG_VAR)/%.obj
+	$(LINK) /NOLOGO /OUT:$@ $< $(CFG_VAR)/utils.obj $(TEST_LDADD)
+
+all: $(OBJECTS) $(TESTS)
+	@exit 0
+
+clean:
+	@rm -f $(CFG_VAR)/*.obj $(CFG_VAR)/*.pdb || exit 0
commit 11305b4ecdd36a17592c5c75de9157874853ab20
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Feb 22 21:46:37 2011 +0100

    test: Fix tests for compilation on Windows
    
    The Microsoft C compiler cannot handle subobject initialization and
    Win32 does not provide snprintf.
    
    Work around these limitations by using normal struct initialization
    and using sprintf (a manual check shows that the buffer size is
    sufficient).

diff --git a/test/composite.c b/test/composite.c
index e14f954..08c6689 100644
--- a/test/composite.c
+++ b/test/composite.c
@@ -617,18 +617,18 @@ eval_diff (color_t *expected, color_t *test, pixman_format_code_t format)
 }
 
 static char *
-describe_image (image_t *info, char *buf, int buflen)
+describe_image (image_t *info, char *buf)
 {
     if (info->size)
     {
-	snprintf (buf, buflen, "%s %dx%d%s",
-		  info->format->name,
-		  info->size, info->size,
-		  info->repeat ? "R" :"");
+	sprintf (buf, "%s %dx%d%s",
+		 info->format->name,
+		 info->size, info->size,
+		 info->repeat ? "R" :"");
     }
     else
     {
-	snprintf (buf, buflen, "solid");
+	sprintf (buf, "solid");
     }
 
     return buf;
@@ -710,10 +710,9 @@ composite_test (image_t *dst,
     {
 	char buf[40];
 
-	snprintf (buf, sizeof (buf),
-		  "%s %scomposite",
-		  op->name,
-		  component_alpha ? "CA " : "");
+	sprintf (buf, "%s %scomposite",
+		 op->name,
+		 component_alpha ? "CA " : "");
 
 	printf ("%s test error of %.4f --\n"
 		"           R    G    B    A\n"
@@ -735,9 +734,9 @@ composite_test (image_t *dst,
 		    mask->color->b, mask->color->a,
 		    dst->color->r, dst->color->g,
 		    dst->color->b, dst->color->a);
-	    printf ("src: %s, ", describe_image (src, buf, sizeof (buf)));
-	    printf ("mask: %s, ", describe_image (mask, buf, sizeof (buf)));
-	    printf ("dst: %s\n\n", describe_image (dst, buf, sizeof (buf)));
+	    printf ("src: %s, ", describe_image (src, buf));
+	    printf ("mask: %s, ", describe_image (mask, buf));
+	    printf ("dst: %s\n\n", describe_image (dst, buf));
 	}
 	else
 	{
@@ -747,8 +746,8 @@ composite_test (image_t *dst,
 		    src->color->b, src->color->a,
 		    dst->color->r, dst->color->g,
 		    dst->color->b, dst->color->a);
-	    printf ("src: %s, ", describe_image (src, buf, sizeof (buf)));
-	    printf ("dst: %s\n\n", describe_image (dst, buf, sizeof (buf)));
+	    printf ("src: %s, ", describe_image (src, buf));
+	    printf ("dst: %s\n\n", describe_image (dst, buf));
 	}
 
 	success = FALSE;
diff --git a/test/fetch-test.c b/test/fetch-test.c
index 2ca16dd..314a072 100644
--- a/test/fetch-test.c
+++ b/test/fetch-test.c
@@ -8,7 +8,7 @@
 
 static pixman_indexed_t mono_palette =
 {
-    .rgba = { 0x00000000, 0x00ffffff },
+    0, { 0x00000000, 0x00ffffff },
 };
 
 
@@ -24,57 +24,53 @@ typedef struct {
 static testcase_t testcases[] =
 {
     {
-	.format = PIXMAN_a8r8g8b8,
-	.width = 2, .height = 2,
-	.stride = 8,
-	.src = { 0x00112233, 0x44556677,
-	         0x8899aabb, 0xccddeeff },
-	.dst = { 0x00112233, 0x44556677,
-	         0x8899aabb, 0xccddeeff },
-	.indexed = NULL,
+	PIXMAN_a8r8g8b8,
+	2, 2,
+	8,
+	{ 0x00112233, 0x44556677,
+	  0x8899aabb, 0xccddeeff },
+	{ 0x00112233, 0x44556677,
+	  0x8899aabb, 0xccddeeff },
+	NULL,
     },
     {
-	.format = PIXMAN_g1,
-	.width = 8, .height = 2,
-	.stride = 4,
+	PIXMAN_g1,
+	8, 2,
+	4,
 #ifdef WORDS_BIGENDIAN
-	.src =
 	{
 	    0xaa000000,
 	    0x55000000
 	},
 #else
-	.src =
 	{
 	    0x00000055,
 	    0x000000aa
 	},
 #endif
-	.dst =
 	{
 	    0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000,
 	    0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff
 	},
-	.indexed = &mono_palette,
+	&mono_palette,
     },
 #if 0
     {
-	.format = PIXMAN_g8,
-	.width = 4, .height = 2,
-	.stride = 4,
-	.src = { 0x01234567,
-	         0x89abcdef },
-	.dst = { 0x00010101, 0x00232323, 0x00454545, 0x00676767,
-	         0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, },
+	PIXMAN_g8,
+	4, 2,
+	4,
+	{ 0x01234567,
+	  0x89abcdef },
+	{ 0x00010101, 0x00232323, 0x00454545, 0x00676767,
+	  0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, },
     },
 #endif
     /* FIXME: make this work on big endian */
     {
-	.format = PIXMAN_yv12,
-	.width = 8, .height = 2,
-	.stride = 8,
+	PIXMAN_yv12,
+	8, 2,
+	8,
 #ifdef WORDS_BIGENDIAN
-	.src =
 	{
 	    0x00ff00ff, 0x00ff00ff,
 	    0xff00ff00, 0xff00ff00,
@@ -82,7 +78,6 @@ static testcase_t testcases[] =
 	    0x800080ff
 	},
 #else
-	.src =
 	{
 	    0xff00ff00, 0xff00ff00,
 	    0x00ff00ff, 0x00ff00ff,
@@ -90,7 +85,6 @@ static testcase_t testcases[] =
 	    0xff800080
 	},
 #endif
-	.dst =
 	{
 	    0xff000000, 0xffffffff, 0xffb80000, 0xffffe113,
 	    0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff,
diff --git a/test/trap-crasher.c b/test/trap-crasher.c
index 42b82f6..7485e62 100644
--- a/test/trap-crasher.c
+++ b/test/trap-crasher.c
@@ -7,21 +7,21 @@ main()
     pixman_image_t *dst;
     pixman_trapezoid_t traps[1] = {
 	{
-	    .top = 2147483646,
-	    .bottom = 2147483647,
-	    .left = {
-		.p1 = { .x = 0, .y = 0 },
-		.p2 = { .x = 0, .y = 2147483647 }
+	    2147483646,
+	    2147483647,
+	    {
+		{ 0, 0 },
+		{ 0, 2147483647 }
 	    },
-	    .right = {
-		.p1 = { .x = 65536, .y = 0 },
-		.p2 = { .x = 0, .y = 2147483647 }
+	    {
+		{ 65536, 0 },
+		{ 0, 2147483647 }
 	    }
 	},
     };
-    
+
     dst = pixman_image_create_bits (PIXMAN_a8, 1, 1, NULL, -1);
-    
+
     pixman_add_trapezoids (dst, 0, 0, sizeof (traps)/sizeof (traps[0]), traps);
     return (0);
 }
commit 20ed723a5a42fb8636bc9a5f32974dec1b66a785
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Thu Feb 24 10:44:04 2011 +0100

    Fix compilation on Win32
    
    Makefile.win32 contained a typo and was missing the dependency from
    the built sources.

diff --git a/pixman/Makefile.win32 b/pixman/Makefile.win32
index 775fb5e..b5f9397 100644
--- a/pixman/Makefile.win32
+++ b/pixman/Makefile.win32
@@ -56,6 +56,8 @@ SOURCES =				\
 	pixman-general.c		\
 	$(NULL)
 
+BUILT_SOURCES = pixman-combine32.h pixman-combine32.c pixman-combine64.h pixman-combine64.c
+
 # MMX compilation flags
 ifeq ($(MMX_VAR),on)
 CFLAGS += $(MMX_CFLAGS)
@@ -122,7 +124,7 @@ endif
 endif
 
 # pixman compilation and linking
-$(CFG_VAR)/%.obj: %.c
+$(CFG_VAR)/%.obj: %.c $(BUILT_SOURCES)
 	@mkdir -p $(CFG_VAR)
 	@$(CC) -c $(CFLAGS) -Fo"$@" $<
 
@@ -141,4 +143,4 @@ pixman-combine64.h: pixman-combine.h.template make-combine.pl
 
 clean_r:
 	@rm -f $(CFG_VAR)/*.obj $(CFG_VAR)/*.lib $(CFG_VAR)/*.pdb $(CFG)/*.ilk || exit 0
-	@rm -f $(CFG)/*.obj $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk pixman-combine32.c pixman-combine64.c pixman-combine64.c pixman-combine64.h || exit 0
+	@rm -f $(CFG)/*.obj $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk $(BUILT_SOURCES) || exit 0


More information about the xorg-commit mailing list