[cairo-commit] libpixman/src icimage.c, 1.24, 1.25 icimage.h, 1.21, 1.22 ictrap.c, 1.20, 1.21

Carl Worth commit at pdx.freedesktop.org
Thu Mar 3 14:27:33 PST 2005


Committed by: cworth

Update of /cvs/cairo/libpixman/src
In directory gabe:/tmp/cvs-serv14807/src

Modified Files:
	icimage.c icimage.h ictrap.c 
Log Message:

        * src/icimage.c (miIsSolidAlpha): Port from render/mipict.c.

        * src/ictrap.c (pixman_composite_trapezoids): Merge in
        optimization from render/mitrap.c for op==ADD and solid alpha src.


Index: icimage.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/icimage.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- icimage.c	2 Mar 2005 15:43:33 -0000	1.24
+++ icimage.c	3 Mar 2005 22:27:31 -0000	1.25
@@ -639,3 +639,34 @@
     return 1;
 }
 
+int
+miIsSolidAlpha (pixman_image_t *src)
+{
+    char	line[1];
+    
+    /* Alpha-only */
+    if (PICT_FORMAT_TYPE (src->format_code) != PICT_TYPE_A)
+	return 0;
+    /* repeat */
+    if (!src->repeat)
+	return 0;
+    /* 1x1 */
+    if (src->pixels->width != 1 || src->pixels->height != 1)
+	return 0;
+    line[0] = 1;
+    /* XXX: For the next line, fb has:
+	(*pScreen->GetImage) (src->pixels, 0, 0, 1, 1, ZPixmap, ~0L, line);
+       Is the following simple assignment sufficient?
+    */
+    line[0] = src->pixels->data[0];
+    switch (src->pixels->bpp) {
+    case 1:
+	return (uint8_t) line[0] == 1 || (uint8_t) line[0] == 0x80;
+    case 4:
+	return (uint8_t) line[0] == 0xf || (uint8_t) line[0] == 0xf0;
+    case 8:
+	return (uint8_t) line[0] == 0xff;
+    default:
+	return 0;
+    }
+}

Index: icimage.h
===================================================================
RCS file: /cvs/cairo/libpixman/src/icimage.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- icimage.h	2 Mar 2005 15:43:33 -0000	1.21
+++ icimage.h	3 Mar 2005 22:27:31 -0000	1.22
@@ -194,6 +194,9 @@
 			  uint16_t	width,
 			  uint16_t	height);
 
+int
+miIsSolidAlpha (pixman_image_t *src);
+
 /*
 pixman_private int
 IcPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);

Index: ictrap.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/ictrap.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ictrap.c	3 Mar 2005 21:52:49 -0000	1.20
+++ ictrap.c	3 Mar 2005 22:27:31 -0000	1.21
@@ -124,6 +124,13 @@
 
     if (ntraps == 0)
 	return;
+
+    if (op == PIXMAN_OPERATOR_ADD && miIsSolidAlpha (src))
+    {
+	for (; ntraps; ntraps--, traps++)
+	    fbRasterizeTrapezoid (dst, traps, 0, 0);
+	return;
+    }
     
     xDst = traps[0].left.p1.x >> 16;
     yDst = traps[0].left.p1.y >> 16;




More information about the cairo-commit mailing list