diff --git a/pixman/ChangeLog.libic b/pixman/ChangeLog.libic index dc0238920..4bda08441 100644 --- a/pixman/ChangeLog.libic +++ b/pixman/ChangeLog.libic @@ -1,3 +1,7 @@ +2003-05-14 Carl Worth + + * src/ic.h: Add IcImageSetFilter. Fixed transform support. + 2003-05-05 Carl Worth * src/ictrap.c (IcCompositeTrapezoids): Avoid crash if there's diff --git a/pixman/src/ic.h b/pixman/src/ic.h index a0a0e903d..7e4b69ba7 100644 --- a/pixman/src/ic.h +++ b/pixman/src/ic.h @@ -128,10 +128,22 @@ typedef struct _IcTrapezoid { 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); @@ -140,6 +152,10 @@ void IcImageSetRepeat (IcImage *image, int repeat); +void +IcImageSetFilter (IcImage *image, + IcFilter filter); + /* iccolor.c */ /* XXX: Do we really need a struct here? Only IcRectangles uses this. */ diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index 9ffbfdc3d..3d86ced4d 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -2439,26 +2439,26 @@ IcStore_external (IcCompositeOperand *op, CARD32 value) 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 @@ IcFetch_transform (IcCompositeOperand *op) 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 @@ IcFetch_transform (IcCompositeOperand *op) 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 @@ IcFetch_transform (IcCompositeOperand *op) 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 @@ IcFetcha_transform (IcCompositeOperand *op) 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 @@ IcFetcha_transform (IcCompositeOperand *op) 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 @@ IcFetcha_transform (IcCompositeOperand *op) break; } return bits; -*/ } IcAccessMap icAccessMap[] = { diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c index b2f93a8f4..0a3293292 100644 --- a/pixman/src/icimage.c +++ b/pixman/src/icimage.c @@ -137,9 +137,7 @@ IcImageInit (IcImage *image) 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; @@ -189,6 +187,14 @@ IcImageSetRepeat (IcImage *image, image->repeat = repeat; } +void +IcImageSetFilter (IcImage *image, + IcFilter filter) +{ + if (image) + image->filter = filter; +} + void IcImageDestroy (IcImage *image) { diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h index 7fac64cbd..b41abbb67 100644 --- a/pixman/src/icimage.h +++ b/pixman/src/icimage.h @@ -140,7 +140,7 @@ struct _IcImage { IcTransform *transform; - int filter; + IcFilter filter; IcFixed16_16 *filter_params; int filter_nparams; @@ -300,7 +300,7 @@ struct _IcCompositeOperand { int x; int y; IcTransform *transform; - int filter; + IcFilter filter; } transform; } u; IcCompositeFetch fetch; diff --git a/pixman/src/icint.h b/pixman/src/icint.h index a92ff4f7d..1ca225276 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -753,6 +753,12 @@ IcPixelsCreateForData (IcBits *data, int width, int height, int depth, int bpp, void IcPixelsDestroy (IcPixels *pixels); +/* ictransform.c */ + +Bool +IcTransformPoint (IcTransform *transform, + IcVector *vector); + /* ictrap.c */ void diff --git a/pixman/src/ictransform.c b/pixman/src/ictransform.c index ab74f4d14..506b1ef62 100644 --- a/pixman/src/ictransform.c +++ b/pixman/src/ictransform.c @@ -30,12 +30,11 @@ typedef xFixed_32_32 xFixed_48_16; #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 @@ IcTransformPoint (IcTransform *transform, return TRUE; } -*/