From b2e30d233eafd0d3bb26d2db45ef1d3505327e81 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 25 Apr 2003 14:24:38 +0000 Subject: [PATCH] Remove X datatypes from public interface --- pixman/ChangeLog.libic | 3 +++ pixman/src/ic.h | 37 +++++++++++++++++++++++++++++++------ pixman/src/icint.h | 4 +++- pixman/src/icrect.c | 6 +++--- pixman/src/ictrap.c | 23 ++++++++++++----------- pixman/src/ictri.c | 26 +++++++++++++------------- 6 files changed, 65 insertions(+), 34 deletions(-) diff --git a/pixman/ChangeLog.libic b/pixman/ChangeLog.libic index b1839e4d0..fa3e7b484 100644 --- a/pixman/ChangeLog.libic +++ b/pixman/ChangeLog.libic @@ -2,6 +2,9 @@ * src/ic.h (IC_REVISION): Added #defines for version. Don't reference undefined XFixed datatype. + Added IcFixed16_16, IcPointFixed, IcLineFixed, IcRectangle, + IcTriangle, and IcTrapzezoid to eliminate X datatypes in public + interface. * configure.in: Fixed libtool versioning. diff --git a/pixman/src/ic.h b/pixman/src/ic.h index 010029cc1..a0a0e903d 100644 --- a/pixman/src/ic.h +++ b/pixman/src/ic.h @@ -103,8 +103,33 @@ IcImageSetClipRegion (IcImage *image, typedef int IcFixed16_16; +typedef struct _IcPointFixed { + IcFixed16_16 x, y; +} IcPointFixed; + +typedef struct _IcLineFixed { + IcPointFixed p1, p2; +} IcLineFixed; + +/* XXX: It's goofy that IcRectangle has integers while all the other + datatypes have fixed-point values. (Though by design, + IcFillRectangles is designed to fill only whole pixels) */ +typedef struct _IcRectangle { + int x, y; + int width, height; +} IcRectangle; + +typedef struct _IcTriangle { + IcPointFixed p1, p2, p3; +} IcTriangle; + +typedef struct _IcTrapezoid { + IcFixed16_16 top, bottom; + IcLineFixed left, right; +} IcTrapezoid; + typedef struct _IcTransform { - IcFixed16_16 matrix[3][3]; + IcFixed16_16 matrix[3][3]; } IcTransform; int @@ -148,7 +173,7 @@ void IcFillRectangles (char op, IcImage *dst, const IcColor *color, - const XRectangle *rects, + const IcRectangle *rects, int nRects); /* ictrap.c */ @@ -160,7 +185,7 @@ IcCompositeTrapezoids (char op, IcImage *dst, int xSrc, int ySrc, - const XTrapezoid *traps, + const IcTrapezoid *traps, int ntrap); /* ictri.c */ @@ -171,7 +196,7 @@ IcCompositeTriangles (char op, IcImage *dst, int xSrc, int ySrc, - const XTriangle *tris, + const IcTriangle *tris, int ntris); void @@ -180,7 +205,7 @@ IcCompositeTriStrip (char op, IcImage *dst, int xSrc, int ySrc, - const XPointFixed *points, + const IcPointFixed *points, int npoints); @@ -190,7 +215,7 @@ IcCompositeTriFan (char op, IcImage *dst, int xSrc, int ySrc, - const XPointFixed *points, + const IcPointFixed *points, int npoints); /* ic.c */ diff --git a/pixman/src/icint.h b/pixman/src/icint.h index 4293852b3..f76dcf9b1 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -24,6 +24,8 @@ #ifndef _ICINT_H_ #define _ICINT_H_ +#include "ic.h" + #include #include #include @@ -758,7 +760,7 @@ IcPixelsDestroy (IcPixels *pixels); void IcRasterizeTrapezoid (IcImage *pMask, - const XTrapezoid *pTrap, + const IcTrapezoid *pTrap, int x_off, int y_off); diff --git a/pixman/src/icrect.c b/pixman/src/icrect.c index 48de3acb5..ae736ca12 100644 --- a/pixman/src/icrect.c +++ b/pixman/src/icrect.c @@ -30,7 +30,7 @@ IcColorRects (IcImage *dst, IcImage *clipPict, IcColor *color, int nRect, - xRectangle *rects, + IcRectangle *rects, int xoff, int yoff) { @@ -82,7 +82,7 @@ void IcFillRectangle (char op, unsigned int width, unsigned int height) { - XRectangle rect; + IcRectangle rect; rect.x = x; rect.y = y; @@ -96,7 +96,7 @@ void IcFillRectangles (char op, IcImage *dst, const IcColor *color, - const XRectangle *rects, + const IcRectangle *rects, int nRects) { IcColor color_s = *color; diff --git a/pixman/src/ictrap.c b/pixman/src/ictrap.c index d5f46b73a..160e1965c 100644 --- a/pixman/src/ictrap.c +++ b/pixman/src/ictrap.c @@ -63,19 +63,19 @@ IcCreateAlphaPicture (IcImage *dst, return image; } -static XFixed -IcLineFixedX (const XLineFixed *l, XFixed y, Bool ceil) +static IcFixed16_16 +IcLineFixedX (const IcLineFixed *l, IcFixed16_16 y, Bool ceil) { - XFixed dx = l->p2.x - l->p1.x; + IcFixed16_16 dx = l->p2.x - l->p1.x; xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; - XFixed dy = l->p2.y - l->p1.y; + IcFixed16_16 dy = l->p2.y - l->p1.y; if (ceil) ex += (dy - 1); - return l->p1.x + (XFixed) (ex / dy); + return l->p1.x + (IcFixed16_16) (ex / dy); } static void -IcTrapezoidBounds (int ntrap, const XTrapezoid *traps, PixRegionBox *box) +IcTrapezoidBounds (int ntrap, const IcTrapezoid *traps, PixRegionBox *box) { box->y1 = MAXSHORT; box->y2 = MINSHORT; @@ -113,7 +113,7 @@ IcCompositeTrapezoids (char op, IcImage *dst, int xSrc, int ySrc, - const XTrapezoid *traps, + const IcTrapezoid *traps, int ntraps) { IcImage *image = NULL; @@ -803,10 +803,11 @@ pixelWalkFirstPixel (PixelWalk *pw) } static void -pixelWalkInit (PixelWalk *pw, XLineFixed *line, XFixed top_y, XFixed bottom_y) +pixelWalkInit (PixelWalk *pw, IcLineFixed *line, + IcFixed16_16 top_y, IcFixed16_16 bottom_y) { xFixed_32_32 dy_inc, dx_inc; - XPointFixed *top, *bot; + IcPointFixed *top, *bot; /* * Orient lines top down @@ -1138,11 +1139,11 @@ PixelAlpha(xFixed pixel_x, void IcRasterizeTrapezoid (IcImage *pMask, - const XTrapezoid *pTrap, + const IcTrapezoid *pTrap, int x_off, int y_off) { - XTrapezoid trap = *pTrap; + IcTrapezoid trap = *pTrap; int alpha, temp; IcCompositeOperand mask; diff --git a/pixman/src/ictri.c b/pixman/src/ictri.c index e369d1c71..43a30fbc4 100644 --- a/pixman/src/ictri.c +++ b/pixman/src/ictri.c @@ -26,12 +26,12 @@ void IcRasterizeTriangle (IcImage *image, - const XTriangle *tri, + const IcTriangle *tri, int x_off, int y_off); static void -IcPointFixedBounds (int npoint, const XPointFixed *points, PixRegionBox *bounds) +IcPointFixedBounds (int npoint, const IcPointFixed *points, PixRegionBox *bounds) { bounds->x1 = xFixedToInt (points->x); bounds->x2 = xFixedToInt (xFixedCeil (points->x)); @@ -59,19 +59,19 @@ IcPointFixedBounds (int npoint, const XPointFixed *points, PixRegionBox *bounds) } static void -IcTriangleBounds (int ntri, const XTriangle *tris, PixRegionBox *bounds) +IcTriangleBounds (int ntri, const IcTriangle *tris, PixRegionBox *bounds) { - IcPointFixedBounds (ntri * 3, (XPointFixed *) tris, bounds); + IcPointFixedBounds (ntri * 3, (IcPointFixed *) tris, bounds); } void IcRasterizeTriangle (IcImage *image, - const XTriangle *tri, + const IcTriangle *tri, int x_off, int y_off) { - const XPointFixed *top, *left, *right, *t; - XTrapezoid trap[2]; + const IcPointFixed *top, *left, *right, *t; + IcTrapezoid trap[2]; top = &tri->p1; left = &tri->p2; @@ -148,7 +148,7 @@ IcCompositeTriangles (char op, IcImage *dst, int xSrc, int ySrc, - const XTriangle *tris, + const IcTriangle *tris, int ntris) { PixRegionBox bounds; @@ -219,10 +219,10 @@ IcCompositeTriStrip (char op, IcImage *dst, int xSrc, int ySrc, - const XPointFixed *points, + const IcPointFixed *points, int npoints) { - XTriangle tri; + IcTriangle tri; PixRegionBox bounds; IcImage *image = NULL; int xDst, yDst; @@ -295,13 +295,13 @@ IcCompositeTriFan (char op, IcImage *dst, int xSrc, int ySrc, - const XPointFixed *points, + const IcPointFixed *points, int npoints) { - XTriangle tri; + IcTriangle tri; PixRegionBox bounds; IcImage *image = NULL; - const XPointFixed *first; + const IcPointFixed *first; int xDst, yDst; int xRel, yRel; IcFormat *format;