[Commit] libic/src ic.h,1.9,1.10 iccompose.c,1.4,1.5 icimage.c,1.6,1.7 icimage.h,1.8,1.9 icint.h,1.9,1.10 ictransform.c,1.1,1.2

Carl Worth commit@keithp.com
Wed, 14 May 2003 18:09:12 -0700


Committed by: cworth

Update of /local/src/CVS/libic/src
In directory home.keithp.com:/tmp/cvs-serv9006/src

Modified Files:
	ic.h iccompose.c icimage.c icimage.h icint.h ictransform.c 
Log Message:
Fixed transform/filter support

Index: ic.h
===================================================================
RCS file: /local/src/CVS/libic/src/ic.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ic.h	25 Apr 2003 21:24:38 -0000	1.9
+++ ic.h	15 May 2003 01:09:10 -0000	1.10
@@ -128,10 +128,22 @@
     IcLineFixed	left, right;
 } IcTrapezoid;
 
+typedef struct _IcVector {
+    IcFixed16_16    vector[3];
+} IcVector;
+
 typedef struct _IcTransform {
     IcFixed16_16  matrix[3][3];
 } IcTransform;
 
+typedef enum {
+    IcFilterFast,
+    IcFilterGood,
+    IcFilterBest,
+    IcFilterNearest,
+    IcFilterBilinear
+} IcFilter;
+
 int
 IcImageSetTransform (IcImage		*image,
 		     IcTransform	*transform);
@@ -139,6 +151,10 @@
 void
 IcImageSetRepeat (IcImage	*image,
 		  int		repeat);
+
+void
+IcImageSetFilter (IcImage	*image,
+		  IcFilter	filter);
 
 /* iccolor.c */
 

Index: iccompose.c
===================================================================
RCS file: /local/src/CVS/libic/src/iccompose.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- iccompose.c	17 Apr 2003 15:48:22 -0000	1.4
+++ iccompose.c	15 May 2003 01:09:10 -0000	1.5
@@ -2439,26 +2439,26 @@
 CARD32
 IcFetch_transform (IcCompositeOperand *op)
 {
-    return 0;
-/* XXX: Still need to port this function
-    PictVector	v;
+    IcVector	v;
     int		x, y;
     int		minx, maxx, miny, maxy;
     int		n;
     CARD32	rtot, gtot, btot, atot;
     CARD32	xerr, yerr;
     CARD32	bits;
+    PixRegionBox	box;
 
     v.vector[0] = IntToxFixed(op->u.transform.x);
     v.vector[1] = IntToxFixed(op->u.transform.y);
     v.vector[2] = xFixed1;
-    if (!PictureTransformPoint (op->u.transform.transform, &v))
+    if (!IcTransformPoint (op->u.transform.transform, &v))
 	return 0;
     switch (op->u.transform.filter) {
-    case PictFilterNearest:
+    case IcFilterFast:
+    case IcFilterNearest:
 	y = xFixedToInt (v.vector[1]) + op->u.transform.top_y;
 	x = xFixedToInt (v.vector[0]) + op->u.transform.left_x;
-	if (PixRegionPointInRegion (op->clip, x, y))
+	if (PixRegionPointInRegion (op->clip, x, y, &box))
 	{
 	    (*op[1].set) (&op[1], x, y);
 	    bits = (*op[1].fetch) (&op[1]);
@@ -2466,7 +2466,9 @@
 	else
 	    bits = 0;
 	break;
-    case PictFilterBilinear:
+    case IcFilterGood:
+    case IcFilterBest:
+    case IcFilterBilinear:
 	rtot = gtot = btot = atot = 0;
 	miny = xFixedToInt (v.vector[1]) + op->u.transform.top_y;
 	maxy = xFixedToInt (xFixedCeil (v.vector[1])) + op->u.transform.top_y;
@@ -2482,7 +2484,7 @@
 	    xerr = xFixed1 - xFixedFrac (v.vector[0]);
 	    for (x = minx; x <= maxx; x++)
 	    {
-		if (PixRegionPointInRegion (op->clip, x, y))
+		if (PixRegionPointInRegion (op->clip, x, y, &box))
 		{
 		    (*op[1].set) (&op[1], x, y);
 		    bits = (*op[1].fetch) (&op[1]);
@@ -2517,32 +2519,31 @@
 	break;
     }
     return bits;
-*/
 }
 
 CARD32
 IcFetcha_transform (IcCompositeOperand *op)
 {
-    return 0;
-/* XXX: Still need to port this function
-    PictVector	v;
+    IcVector	v;
     int		x, y;
     int		minx, maxx, miny, maxy;
     int		n;
     CARD32	rtot, gtot, btot, atot;
     CARD32	xerr, yerr;
     CARD32	bits;
+    PixRegionBox	box;
 
     v.vector[0] = IntToxFixed(op->u.transform.x);
     v.vector[1] = IntToxFixed(op->u.transform.y);
     v.vector[2] = xFixed1;
-    if (!PictureTransformPoint (op->u.transform.transform, &v))
+    if (!IcTransformPoint (op->u.transform.transform, &v))
 	return 0;
     switch (op->u.transform.filter) {
-    case PictFilterNearest:
+    case IcFilterFast:
+    case IcFilterNearest:
 	y = xFixedToInt (v.vector[1]) + op->u.transform.left_x;
 	x = xFixedToInt (v.vector[0]) + op->u.transform.top_y;
-	if (PixRegionPointInRegion (op->clip, x, y))
+	if (PixRegionPointInRegion (op->clip, x, y, &box))
 	{
 	    (*op[1].set) (&op[1], x, y);
 	    bits = (*op[1].fetcha) (&op[1]);
@@ -2550,7 +2551,9 @@
 	else
 	    bits = 0;
 	break;
-    case PictFilterBilinear:
+    case IcFilterGood:
+    case IcFilterBest:
+    case IcFilterBilinear:
 	rtot = gtot = btot = atot = 0;
 	
 	miny = xFixedToInt (v.vector[1]) + op->u.transform.top_y;
@@ -2566,7 +2569,7 @@
 	    xerr = xFixed1 - xFixedFrac (v.vector[0]);
 	    for (x = minx; x <= maxx; x++)
 	    {
-		if (PixRegionPointInRegion (op->clip, x, y))
+		if (PixRegionPointInRegion (op->clip, x, y, &box))
 		{
 		    (*op[1].set) (&op[1], x, y);
 		    bits = (*op[1].fetcha) (&op[1]);
@@ -2603,7 +2606,6 @@
 	break;
     }
     return bits;
-*/
 }
 
 IcAccessMap icAccessMap[] = {

Index: icimage.c
===================================================================
RCS file: /local/src/CVS/libic/src/icimage.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- icimage.c	26 Apr 2003 16:57:54 -0000	1.6
+++ icimage.c	15 May 2003 01:09:10 -0000	1.7
@@ -137,9 +137,7 @@
 
     image->transform = NULL;
 
-/* XXX: Need to track down and include this function
-    image->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
-*/
+    image->filter = IcFilterNearest;
     image->filter_params = 0;
     image->filter_nparams = 0;
 
@@ -187,6 +185,14 @@
 {
     if (image)
 	image->repeat = repeat;
+}
+
+void
+IcImageSetFilter (IcImage	*image,
+		  IcFilter	filter)
+{
+    if (image)
+	image->filter = filter;
 }
 
 void

Index: icimage.h
===================================================================
RCS file: /local/src/CVS/libic/src/icimage.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- icimage.h	28 Apr 2003 23:00:40 -0000	1.8
+++ icimage.h	15 May 2003 01:09:10 -0000	1.9
@@ -140,7 +140,7 @@
     
     IcTransform     *transform;
 
-    int		    filter;
+    IcFilter	    filter;
     IcFixed16_16    *filter_params;
     int		    filter_nparams;
 
@@ -300,7 +300,7 @@
 	    int			x;
 	    int			y;
 	    IcTransform		*transform;
-	    int			filter;
+	    IcFilter		filter;
 	} transform;
     } u;
     IcCompositeFetch	fetch;

Index: icint.h
===================================================================
RCS file: /local/src/CVS/libic/src/icint.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- icint.h	28 Apr 2003 23:00:40 -0000	1.9
+++ icint.h	15 May 2003 01:09:10 -0000	1.10
@@ -753,6 +753,12 @@
 void
 IcPixelsDestroy (IcPixels *pixels);
 
+/* ictransform.c */
+
+Bool
+IcTransformPoint (IcTransform	*transform,
+		  IcVector	*vector);
+
 /* ictrap.c */
 
 void

Index: ictransform.c
===================================================================
RCS file: /local/src/CVS/libic/src/ictransform.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ictransform.c	21 Feb 2003 21:38:11 -0000	1.1
+++ ictransform.c	15 May 2003 01:09:10 -0000	1.2
@@ -30,12 +30,11 @@
 #define MAX_FIXED_48_16	    ((xFixed_48_16) 0x7fffffff)
 #define MIN_FIXED_48_16	    (-((xFixed_48_16) 1 << 31))
 
-/* XXX: Still need to port this
 Bool
 IcTransformPoint (IcTransform	*transform,
-		  PictVectorPtr	vector)
+		  IcVector	*vector)
 {
-    PictVector	    result;
+    IcVector	    result;
     int		    i, j;
     xFixed_32_32    partial;
     xFixed_48_16    v;
@@ -67,4 +66,3 @@
     return TRUE;
 }
 
-*/