Remove X datatypes from public interface

This commit is contained in:
Carl Worth 2003-04-25 14:24:38 +00:00
parent c5b28ba63c
commit b2e30d233e
6 changed files with 65 additions and 34 deletions

View file

@ -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.

View file

@ -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 */

View file

@ -24,6 +24,8 @@
#ifndef _ICINT_H_
#define _ICINT_H_
#include "ic.h"
#include <stdlib.h>
#include <string.h>
#include <limits.h>
@ -758,7 +760,7 @@ IcPixelsDestroy (IcPixels *pixels);
void
IcRasterizeTrapezoid (IcImage *pMask,
const XTrapezoid *pTrap,
const IcTrapezoid *pTrap,
int x_off,
int y_off);

View file

@ -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;

View file

@ -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;

View file

@ -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;