summaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2003-02-21 13:34:50 +0000
committerCarl Worth <cworth@cworth.org>2003-02-21 13:34:50 +0000
commit8bb4eb1beb020ed679a7644579253bd21f8bc970 (patch)
tree2a6e208cce82da24ed4b1f3c2c098471af290b3d /pixman
parent18edad04edf860211260a1db4a7b58fd75715cf7 (diff)
Some reorganization and cruft removal
Diffstat (limited to 'pixman')
-rw-r--r--pixman/ChangeLog.libic5
-rw-r--r--pixman/src/ic.c1973
-rw-r--r--pixman/src/icbltone.c130
-rw-r--r--pixman/src/iccompose.c1
-rw-r--r--pixman/src/icformat.c20
-rw-r--r--pixman/src/icimage.c1639
-rw-r--r--pixman/src/icimage.h18
-rw-r--r--pixman/src/icint.h221
-rw-r--r--pixman/src/ictransform.c70
-rw-r--r--pixman/src/icutil.c81
10 files changed, 1351 insertions, 2807 deletions
diff --git a/pixman/ChangeLog.libic b/pixman/ChangeLog.libic
index ef18ae1b..d0105b79 100644
--- a/pixman/ChangeLog.libic
+++ b/pixman/ChangeLog.libic
@@ -1,3 +1,8 @@
+2003-02-21 Carl Worth <cworth@isi.edu>
+
+ * src/ic.h: Started cleaning up the public interface of
+ libic. Moved most of the cruft into icint.h.
+
2003-02-20 Carl Worth <cworth@isi.edu>
* AUTHORS: Added AUTHORS, NEWS, ChangeLog.
diff --git a/pixman/src/ic.c b/pixman/src/ic.c
index 6332a039..cd4cd834 100644
--- a/pixman/src/ic.c
+++ b/pixman/src/ic.c
@@ -44,1140 +44,1121 @@
#include "resource.h"
#include "servermd.h"
-int PictureScreenPrivateIndex = -1;
-int PictureWindowPrivateIndex;
-int PictureGeneration;
-RESTYPE PictureType;
-/* RESTYPE PictFormatType; */
-RESTYPE GlyphSetType;
-int PictureCmapPolicy = PictureCmapPolicyDefault;
-
-/* XXX: Do we need this?
-Bool
-PictureDestroyWindow (WindowPtr pWindow)
+
+#ifndef __GNUC__
+#define __inline
+#endif
+
+
+#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
+ (((s) >> 5) & 0x07e0) | \
+ (((s) >> 8) & 0xf800))
+#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
+ ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
+ ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
+
+#if IMAGE_BYTE_ORDER == MSBFirst
+#define Fetch24(a) ((unsigned long) (a) & 1 ? \
+ ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \
+ ((*((CARD16 *) (a)) << 8) | *((a)+2)))
+#define Store24(a,v) ((unsigned long) (a) & 1 ? \
+ ((*(a) = (CARD8) ((v) >> 16)), \
+ (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \
+ ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \
+ (*((a)+2) = (CARD8) (v))))
+#else
+#define Fetch24(a) ((unsigned long) (a) & 1 ? \
+ ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \
+ ((*((CARD16 *) (a))) | (*((a)+2) << 16)))
+#define Store24(a,v) ((unsigned long) (a) & 1 ? \
+ ((*(a) = (CARD8) (v)), \
+ (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \
+ ((*((CARD16 *) (a)) = (CARD16) (v)),\
+ (*((a)+2) = (CARD8) ((v) >> 16))))
+#endif
+
+CARD32
+IcOver (CARD32 x, CARD32 y)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- PicturePtr pPicture;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- Bool ret;
+ CARD16 a = ~x >> 24;
+ CARD16 t;
+ CARD32 m,n,o,p;
+
+ m = IcOverU(x,y,0,a,t);
+ n = IcOverU(x,y,8,a,t);
+ o = IcOverU(x,y,16,a,t);
+ p = IcOverU(x,y,24,a,t);
+ return m|n|o|p;
+}
- while ((pPicture = GetPictureWindow(pWindow)))
- {
- SetPictureWindow(pWindow, pPicture->pNext);
- if (pPicture->id)
- FreeResource (pPicture->id, PictureType);
- FreePicture ((pointer) pPicture, pPicture->id);
- }
- pScreen->DestroyWindow = ps->DestroyWindow;
- ret = (*pScreen->DestroyWindow) (pWindow);
- ps->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = PictureDestroyWindow;
- return ret;
+CARD32
+IcOver24 (CARD32 x, CARD32 y)
+{
+ CARD16 a = ~x >> 24;
+ CARD16 t;
+ CARD32 m,n,o;
+
+ m = IcOverU(x,y,0,a,t);
+ n = IcOverU(x,y,8,a,t);
+ o = IcOverU(x,y,16,a,t);
+ return m|n|o;
}
-Bool
-PictureCloseScreen (int index, ScreenPtr pScreen)
+CARD32
+IcIn (CARD32 x, CARD8 y)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- Bool ret;
- int n;
-
- pScreen->CloseScreen = ps->CloseScreen;
- ret = (*pScreen->CloseScreen) (index, pScreen);
- PictureResetFilters (pScreen);
- for (n = 0; n < ps->nformats; n++)
- if (ps->formats[n].type == PictTypeIndexed)
- (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
- SetPictureScreen(pScreen, 0);
- free (ps->formats);
- free (ps);
- return ret;
+ CARD16 a = y;
+ CARD16 t;
+ CARD32 m,n,o,p;
+
+ m = IcInU(x,0,a,t);
+ n = IcInU(x,8,a,t);
+ o = IcInU(x,16,a,t);
+ p = IcInU(x,24,a,t);
+ return m|n|o|p;
+}
+
+#define IcComposeGetSolid(image, bits) { \
+ IcBits *__bits__; \
+ IcStride __stride__; \
+ int __bpp__; \
+ int __xoff__,__yoff__; \
+\
+ IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \
+ switch (__bpp__) { \
+ case 32: \
+ (bits) = *(CARD32 *) __bits__; \
+ break; \
+ case 24: \
+ (bits) = Fetch24 ((CARD8 *) __bits__); \
+ break; \
+ case 16: \
+ (bits) = *(CARD16 *) __bits__; \
+ (bits) = cvt0565to8888(bits); \
+ break; \
+ default: \
+ return; \
+ } \
+ /* manage missing src alpha */ \
+ if ((image)->image_format->direct.alphaMask == 0) \
+ (bits) |= 0xff000000; \
+}
+
+#define IcComposeGetStart(image,x,y,type,stride,line,mul) {\
+ IcBits *__bits__; \
+ IcStride __stride__; \
+ int __bpp__; \
+ int __xoff__,__yoff__; \
+\
+ IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \
+ (stride) = __stride__ * sizeof (IcBits) / sizeof (type); \
+ (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \
}
-*/
/*
+ * Naming convention:
+ *
+ * opSRCxMASKxDST
+ */
+
void
-PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef)
+IcCompositeSolidMask_nx8x8888 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- ScreenPtr pScreen = pColormap->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- pScreen->StoreColors = ps->StoreColors;
- (*pScreen->StoreColors) (pColormap, ndef, pdef);
- ps->StoreColors = pScreen->StoreColors;
- pScreen->StoreColors = PictureStoreColors;
+ CARD32 src, srca;
+ CARD32 *dstLine, *dst, d, dstMask;
+ CARD8 *maskLine, *mask, m;
+ IcStride dstStride, maskStride;
+ CARD16 w;
- if (pColormap->class == PseudoColor || pColormap->class == GrayScale)
+ IcComposeGetSolid(iSrc, src);
+
+ dstMask = IcFullMask (iDst->pixels->depth);
+ srca = src >> 24;
+ if (src == 0)
+ return;
+
+ IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
+ IcComposeGetStart (iMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
+
+ while (height--)
{
- PictFormatPtr format = ps->formats;
- int nformats = ps->nformats;
+ dst = dstLine;
+ dstLine += dstStride;
+ mask = maskLine;
+ maskLine += maskStride;
+ w = width;
- while (nformats--)
+ while (w--)
{
- if (format->type == PictTypeIndexed &&
- format->index.pColormap == pColormap)
+ m = *mask++;
+ if (m == 0xff)
{
- (*ps->UpdateIndexed) (pScreen, format, ndef, pdef);
- break;
+ if (srca == 0xff)
+ *dst = src & dstMask;
+ else
+ *dst = IcOver (src, *dst) & dstMask;
}
- format++;
+ else if (m)
+ {
+ d = IcIn (src, m);
+ *dst = IcOver (d, *dst) & dstMask;
+ }
+ dst++;
}
}
}
-*/
-#ifdef XXX_DO_WE_NEED_ANY_OF_THESE_FUNCTIONS
-static int
-visualDepth (ScreenPtr pScreen, VisualPtr pVisual)
+void
+IcCompositeSolidMask_nx8888x8888C (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- int d, v;
- DepthPtr pDepth;
-
- for (d = 0; d < pScreen->numDepths; d++)
+ CARD32 src, srca;
+ CARD32 *dstLine, *dst, d, dstMask;
+ CARD32 *maskLine, *mask, ma;
+ IcStride dstStride, maskStride;
+ CARD16 w;
+ CARD32 m, n, o, p;
+
+ IcComposeGetSolid(iSrc, src);
+
+ dstMask = IcFullMask (iDst->pixels->depth);
+ srca = src >> 24;
+ if (src == 0)
+ return;
+
+ IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
+ IcComposeGetStart (iMask, xMask, yMask, CARD32, maskStride, maskLine, 1);
+
+ while (height--)
{
- pDepth = &pScreen->allowedDepths[d];
- for (v = 0; v < pDepth->numVids; v++)
- if (pDepth->vids[v] == pVisual->vid)
- return pDepth->depth;
- }
- return 0;
-}
-
-typedef struct _formatInit {
- CARD32 format;
- CARD8 depth;
-} FormatInitRec, *FormatInitPtr;
+ dst = dstLine;
+ dstLine += dstStride;
+ mask = maskLine;
+ maskLine += maskStride;
+ w = width;
-static int
-addFormat (FormatInitRec formats[256],
- int nformat,
- CARD32 format,
- CARD8 depth)
-{
- int n;
-
- for (n = 0; n < nformat; n++)
- if (formats[n].format == format && formats[n].depth == depth)
- return nformat;
- formats[nformat].format = format;
- formats[nformat].depth = depth;
- return ++nformat;
+ while (w--)
+ {
+ ma = *mask++;
+ if (ma == 0xffffffff)
+ {
+ if (srca == 0xff)
+ *dst = src & dstMask;
+ else
+ *dst = IcOver (src, *dst) & dstMask;
+ }
+ else if (ma)
+ {
+ d = *dst;
+#define IcInOverC(src,srca,msk,dst,i,result) { \
+ CARD16 __a = IcGet8(msk,i); \
+ CARD32 __t, __ta; \
+ CARD32 __i; \
+ __t = IcIntMult (IcGet8(src,i), __a,__i); \
+ __ta = (CARD8) ~IcIntMult (srca, __a,__i); \
+ __t = __t + IcIntMult(IcGet8(dst,i),__ta,__i); \
+ __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \
+ result = __t << (i); \
}
-
-#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1))
-
-IcFormat *
-IcCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
-{
- int nformats, f;
- PictFormatPtr pFormats;
- FormatInitRec formats[1024];
- CARD32 format;
- CARD8 depth;
- VisualPtr pVisual;
- int v;
- int bpp;
- int type;
- int r, g, b;
- int d;
- DepthPtr pDepth;
-
- nformats = 0;
- /* formats required by protocol */
- formats[nformats].format = PICT_a1;
- formats[nformats].depth = 1;
- nformats++;
- formats[nformats].format = PICT_a8;
- formats[nformats].depth = 8;
- nformats++;
- formats[nformats].format = PICT_a4;
- formats[nformats].depth = 4;
- nformats++;
- formats[nformats].format = PICT_a8r8g8b8;
- formats[nformats].depth = 32;
- nformats++;
- formats[nformats].format = PICT_x8r8g8b8;
- formats[nformats].depth = 32;
- nformats++;
-
- pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec));
- if (!pFormats)
- return 0;
- memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
- for (f = 0; f < nformats; f++)
- {
- pFormats[f].id = FakeClientID (0);
- pFormats[f].depth = formats[f].depth;
- format = formats[f].format;
- pFormats[f].format = format;
- switch (PICT_FORMAT_TYPE(format)) {
- case PICT_TYPE_ARGB:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_R(format) +
- PICT_FORMAT_G(format) +
- PICT_FORMAT_B(format));
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = (PICT_FORMAT_G(format) +
- PICT_FORMAT_B(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = PICT_FORMAT_B(format);
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = 0;
- break;
-
- case PICT_TYPE_ABGR:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_B(format) +
- PICT_FORMAT_G(format) +
- PICT_FORMAT_R(format));
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = (PICT_FORMAT_G(format) +
- PICT_FORMAT_R(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = PICT_FORMAT_R(format);
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = 0;
- break;
-
- case PICT_TYPE_A:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alpha = 0;
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
-
- /* remaining fields already set to zero */
- break;
-
-/* XXX: Supporting indexed formats will take a bit of thought...
- case PICT_TYPE_COLOR:
- case PICT_TYPE_GRAY:
- pFormats[f].type = PictTypeIndexed;
- pFormats[f].index.pVisual = &pScreen->visuals[PICT_FORMAT_VIS(format)];
- break;
-*/
+ IcInOverC (src, srca, ma, d, 0, m);
+ IcInOverC (src, srca, ma, d, 8, n);
+ IcInOverC (src, srca, ma, d, 16, o);
+ IcInOverC (src, srca, ma, d, 24, p);
+ *dst = m|n|o|p;
+ }
+ dst++;
}
}
- *nformatp = nformats;
- return pFormats;
}
-Bool
-PictureInitIndexedFormats (ScreenPtr pScreen)
+void
+IcCompositeSolidMask_nx8x0888 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
-
- if (!ps)
- return FALSE;
- format = ps->formats;
- nformat = ps->nformats;
- while (nformat--)
+ CARD32 src, srca;
+ CARD8 *dstLine, *dst;
+ CARD32 d;
+ CARD8 *maskLine, *mask, m;
+ IcStride dstStride, maskStride;
+ CARD16 w;
+
+ IcComposeGetSolid(iSrc, src);
+
+ srca = src >> 24;
+ if (src == 0)
+ return;
+
+ IcComposeGetStart (iDst, xDst, yDst, CARD8, dstStride, dstLine, 3);
+ IcComposeGetStart (iMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
+
+ while (height--)
{
- if (format->type == PictTypeIndexed && !format->index.pColormap)
+ dst = dstLine;
+ dstLine += dstStride;
+ mask = maskLine;
+ maskLine += maskStride;
+ w = width;
+
+ while (w--)
{
- if (format->index.pVisual->vid == pScreen->rootVisual)
- format->index.pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap,
- RT_COLORMAP);
- else
+ m = *mask++;
+ if (m == 0xff)
{
- if (CreateColormap (FakeClientID (0), pScreen,
- format->index.pVisual,
- &format->index.pColormap, AllocNone,
- 0) != Success)
+ if (srca == 0xff)
+ d = src;
+ else
{
- return FALSE;
+ d = Fetch24(dst);
+ d = IcOver24 (src, d);
}
+ Store24(dst,d);
+ }
+ else if (m)
+ {
+ d = IcOver24 (IcIn(src,m), Fetch24(dst));
+ Store24(dst,d);
}
- if (!(*ps->InitIndexed) (pScreen, format))
- return FALSE;
+ dst += 3;
}
- format++;
}
- return TRUE;
-}
-
-Bool
-PictureFinishInit (void)
-{
- int s;
-
- for (s = 0; s < screenInfo.numScreens; s++)
- {
- if (!PictureInitIndexedFormats (screenInfo.screens[s]))
- return FALSE;
- (void) AnimCurInit (screenInfo.screens[s]);
- p }
-
- return TRUE;
}
-Bool
-PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
+void
+IcCompositeSolidMask_nx8x0565 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- if (!ps)
- return FALSE;
- ps->subpixel = subpixel;
- return TRUE;
+ CARD32 src, srca;
+ CARD16 *dstLine, *dst;
+ CARD32 d;
+ CARD8 *maskLine, *mask, m;
+ IcStride dstStride, maskStride;
+ CARD16 w;
+
+ IcComposeGetSolid(iSrc, src);
-}
-
-int
-PictureGetSubpixelOrder (ScreenPtr pScreen)
-{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- if (!ps)
- return SubPixelUnknown;
- return ps->subpixel;
-}
+ srca = src >> 24;
+ if (src == 0)
+ return;
-PictFormatPtr
-PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
-{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
- int type;
-
- if (!ps)
- return 0;
- format = ps->formats;
- nformat = ps->nformats;
- switch (pVisual->class) {
- case StaticGray:
- case GrayScale:
- case StaticColor:
- case PseudoColor:
- type = PictTypeIndexed;
- break;
- case TrueColor:
- type = PictTypeDirect;
- break;
- case DirectColor:
- default:
- return 0;
- }
- while (nformat--)
+ IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
+ IcComposeGetStart (iMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
+
+ while (height--)
{
- if (format->depth == depth && format->type == type)
+ dst = dstLine;
+ dstLine += dstStride;
+ mask = maskLine;
+ maskLine += maskStride;
+ w = width;
+
+ while (w--)
{
- if (type == PictTypeIndexed)
+ m = *mask++;
+ if (m == 0xff)
{
- if (format->index.pVisual == pVisual)
- return format;
- }
- else
- {
- if (format->direct.redMask << format->direct.red ==
- pVisual->redMask &&
- format->direct.greenMask << format->direct.green ==
- pVisual->greenMask &&
- format->direct.blueMask << format->direct.blue ==
- pVisual->blueMask)
+ if (srca == 0xff)
+ d = src;
+ else
{
- return format;
+ d = *dst;
+ d = IcOver24 (src, cvt0565to8888(d));
}
+ *dst = cvt8888to0565(d);
}
+ else if (m)
+ {
+ d = *dst;
+ d = IcOver24 (IcIn(src,m), cvt0565to8888(d));
+ *dst = cvt8888to0565(d);
+ }
+ dst++;
}
- format++;
}
- return 0;
}
-PictFormatPtr
-PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 f)
-{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
-
- if (!ps)
- return 0;
- format = ps->formats;
- nformat = ps->nformats;
- while (nformat--)
- {
- if (format->depth == depth && format->format == (f & 0xffffff))
- return format;
- format++;
- }
- return 0;
-}
-
-int
-PictureParseCmapPolicy (const char *name)
-{
- if ( strcmp (name, "default" ) == 0)
- return PictureCmapPolicyDefault;
- else if ( strcmp (name, "mono" ) == 0)
- return PictureCmapPolicyMono;
- else if ( strcmp (name, "gray" ) == 0)
- return PictureCmapPolicyGray;
- else if ( strcmp (name, "color" ) == 0)
- return PictureCmapPolicyColor;
- else if ( strcmp (name, "all" ) == 0)
- return PictureCmapPolicyAll;
- else
- return PictureCmapPolicyInvalid;
-}
-
-Bool
-PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+void
+IcCompositeSolidMask_nx8888x0565C (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- PictureScreenPtr ps;
- int n;
- CARD32 type, a, r, g, b;
+ CARD32 src, srca;
+ CARD16 src16;
+ CARD16 *dstLine, *dst;
+ CARD32 d;
+ CARD32 *maskLine, *mask, ma;
+ IcStride dstStride, maskStride;
+ CARD16 w;
+ CARD32 m, n, o;
+
+ IcComposeGetSolid(iSrc, src);
- if (PictureGeneration != serverGeneration)
- {
- PictureType = CreateNewResourceType (FreePicture);
- if (!PictureType)
- return FALSE;
- PictFormatType = CreateNewResourceType (FreePictFormat);
- if (!PictFormatType)
- return FALSE;
- GlyphSetType = CreateNewResourceType (FreeGlyphSet);
- if (!GlyphSetType)
- return FALSE;
- PictureScreenPrivateIndex = AllocateScreenPrivateIndex();
- if (PictureScreenPrivateIndex < 0)
- return FALSE;
- PictureWindowPrivateIndex = AllocateWindowPrivateIndex();
- PictureGeneration = serverGeneration;
-#ifdef XResExtension
- RegisterResourceName (PictureType, "PICTURE");
- RegisterResourceName (PictFormatType, "PICTFORMAT");
- RegisterResourceName (GlyphSetType, "GLYPHSET");
-#endif
- }
- if (!AllocateWindowPrivate (pScreen, PictureWindowPrivateIndex, 0))
- return FALSE;
+ srca = src >> 24;
+ if (src == 0)
+ return;
- if (!formats)
- {
- formats = PictureCreateDefaultFormats (pScreen, &nformats);
- if (!formats)
- return FALSE;
- }
- for (n = 0; n < nformats; n++)
- {
- if (!AddResource (formats[n].id, PictFormatType, (pointer) (formats+n)))
- {
- free (formats);
- return FALSE;
- }
- if (formats[n].type == PictTypeIndexed)
- {
- if ((formats[n].index.pVisual->class | DynamicClass) == PseudoColor)
- type = PICT_TYPE_COLOR;
- else
- type = PICT_TYPE_GRAY;
- a = r = g = b = 0;
- }
- else
- {
- if ((formats[n].direct.redMask|
- formats[n].direct.blueMask|
- formats[n].direct.greenMask) == 0)
- type = PICT_TYPE_A;
- else if (formats[n].direct.red > formats[n].direct.blue)
- type = PICT_TYPE_ARGB;
- else
- type = PICT_TYPE_ABGR;
- a = Ones (formats[n].direct.alphaMask);
- r = Ones (formats[n].direct.redMask);
- g = Ones (formats[n].direct.greenMask);
- b = Ones (formats[n].direct.blueMask);
- }
- formats[n].format = PICT_FORMAT(0,type,a,r,g,b);
- }
- ps = (PictureScreenPtr) xalloc (sizeof (PictureScreenRec));
- if (!ps)
- {
- free (formats);
- return FALSE;
- }
- SetPictureScreen(pScreen, ps);
- if (!GlyphInit (pScreen))
- {
- SetPictureScreen(pScreen, 0);
- free (formats);
- free (ps);
- return FALSE;
- }
-
- ps->totalPictureSize = sizeof (PictureRec);
- ps->PicturePrivateSizes = 0;
- ps->PicturePrivateLen = 0;
+ src16 = cvt8888to0565(src);
- ps->formats = formats;
- ps->fallback = formats;
- ps->nformats = nformats;
+ IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
+ IcComposeGetStart (iMask, xMask, yMask, CARD32, maskStride, maskLine, 1);
- ps->filters = 0;
- ps->nfilters = 0;
- ps->filterAliases = 0;
- ps->nfilterAliases = 0;
-
- ps->CloseScreen = pScreen->CloseScreen;
- ps->DestroyWindow = pScreen->DestroyWindow;
- ps->StoreColors = pScreen->StoreColors;
- pScreen->DestroyWindow = PictureDestroyWindow;
- pScreen->CloseScreen = PictureCloseScreen;
- pScreen->StoreColors = PictureStoreColors;
-
- if (!PictureSetDefaultFilters (pScreen))
+ while (height--)
{
- PictureResetFilters (pScreen);
- SetPictureScreen(pScreen, 0);
- free (formats);
- free (ps);
- return FALSE;
- }
+ dst = dstLine;
+ dstLine += dstStride;
+ mask = maskLine;
+ maskLine += maskStride;
+ w = width;
- return TRUE;
+ while (w--)
+ {
+ ma = *mask++;
+ if (ma == 0xffffffff)
+ {
+ if (srca == 0xff)
+ {
+ *dst = src16;
+ }
+ else
+ {
+ d = *dst;
+ d = IcOver24 (src, cvt0565to8888(d));
+ *dst = cvt8888to0565(d);
+ }
+ }
+ else if (ma)
+ {
+ d = *dst;
+ d = cvt0565to8888(d);
+ IcInOverC (src, srca, ma, d, 0, m);
+ IcInOverC (src, srca, ma, d, 8, n);
+ IcInOverC (src, srca, ma, d, 16, o);
+ d = m|n|o;
+ *dst = cvt8888to0565(d);
+ }
+ dst++;
+ }
+ }
}
-#endif /* DO_WE_NEED_THESE_FUNCTIONS */
void
-IcImageInit (IcImage *image)
+IcCompositeSrc_8888x8888 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- XRectangle rect;
-
- image->refcnt = 1;
- image->repeat = 0;
- image->graphicsExposures = FALSE;
- image->subWindowMode = ClipByChildren;
- image->polyEdge = PolyEdgeSharp;
- image->polyMode = PolyModePrecise;
- image->freeCompClip = FALSE;
- image->clientClipType = CT_NONE;
- image->componentAlpha = FALSE;
-
- image->alphaMap = 0;
- image->alphaOrigin.x = 0;
- image->alphaOrigin.y = 0;
-
- image->clipOrigin.x = 0;
- image->clipOrigin.y = 0;
- image->clientClip = 0;
-
- image->dither = None;
-
- image->stateChanges = (1 << (CPLastBit+1)) - 1;
-/* XXX: What to lodge here?
- image->serialNumber = GC_CHANGE_SERIAL_BIT;
-*/
-
- image->pCompositeClip = XCreateRegion();
- rect.x = 0;
- rect.y = 0;
- rect.width = image->pixels->width;
- rect.height = image->pixels->height;
- XUnionRectWithRegion (&rect, image->pCompositeClip, image->pCompositeClip);
-
- image->transform = NULL;
-
-/* XXX: Need to track down and include this function
- image->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
-*/
- image->filter_params = 0;
- image->filter_nparams = 0;
-
-
- image->owns_pixels = 0;
-}
+ CARD32 *dstLine, *dst, dstMask;
+ CARD32 *srcLine, *src, s;
+ IcStride dstStride, srcStride;
+ CARD8 a;
+ CARD16 w;
+
+ IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
+ IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
+
+ dstMask = IcFullMask (iDst->pixels->depth);
-/* XXX: Do we need this?
-PicturePtr
-AllocatePicture (ScreenPtr pScreen)
-{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- PicturePtr pPicture;
- char *ptr;
- DevUnion *ppriv;
- unsigned int *sizes;
- unsigned int size;
- int i;
-
- pPicture = (PicturePtr) xalloc (ps->totalPictureSize);
- if (!pPicture)
- return 0;
- ppriv = (DevUnion *)(pPicture + 1);
- pPicture->devPrivates = ppriv;
- sizes = ps->PicturePrivateSizes;
- ptr = (char *)(ppriv + ps->PicturePrivateLen);
- for (i = ps->PicturePrivateLen; --i >= 0; ppriv++, sizes++)
+ while (height--)
{
- if ( (size = *sizes) )
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
+
+ while (w--)
{
- ppriv->ptr = (pointer)ptr;
- ptr += size;
+ s = *src++;
+ a = s >> 24;
+ if (a == 0xff)
+ *dst = s & dstMask;
+ else if (a)
+ *dst = IcOver (s, *dst) & dstMask;
+ dst++;
}
- else
- ppriv->ptr = (pointer)NULL;
}
- return pPicture;
}
-*/
-IcImage *
-IcImageCreate (IcFormat *format,
- int width,
- int height,
- Mask vmask,
- XID *vlist,
- int *error,
- int *error_value)
+void
+IcCompositeSrc_8888x0888 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- IcImage *image;
- IcPixels *pixels;
-
- pixels = IcPixelsCreate (width, height, format->depth);
- if (pixels == NULL) {
- *error = BadAlloc;
- *error_value = 0; /* XXX: What should this be? */
- return NULL;
- }
+ CARD8 *dstLine, *dst;
+ CARD32 d;
+ CARD32 *srcLine, *src, s;
+ CARD8 a;
+ IcStride dstStride, srcStride;
+ CARD16 w;
- image = IcImageCreateForPixels (pixels, format, vmask, vlist, error, error_value);
-
- image->owns_pixels = 1;
-
- return image;
-}
-
-IcImage *
-IcImageCreateForPixels (IcPixels *pixels,
- IcFormat *format,
- Mask vmask,
- XID *vlist,
- int *error,
- int *error_value)
-{
- IcImage *image;
-
- image = malloc (sizeof (IcImage));
- if (!image)
- {
- *error = BadAlloc;
- *error_value = 0; /* XXX: What should this be? */
- return NULL;
- }
-
- image->pixels = pixels;
- image->image_format = format;
- image->format = format->format;
-/* XXX: What's all this about?
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- ++((PixmapPtr)pDrawable)->refcnt;
- image->pNext = 0;
- }
- else
- {
- image->pNext = GetPictureWindow(((WindowPtr) pDrawable));
- SetPictureWindow(((WindowPtr) pDrawable), image);
- }
-*/
-
- IcImageInit (image);
+ IcComposeGetStart (iDst, xDst, yDst, CARD8, dstStride, dstLine, 3);
+ IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
- if (vmask)
- ;
- /* XXX: Need to finish porting this function
- *error = IcImageChange (image, vmask, vlist, 0, error_value);
- */
- else
- *error = Success;
- if (*error != Success)
+ while (height--)
{
- IcImageDestroy (image);
- image = 0;
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
+
+ while (w--)
+ {
+ s = *src++;
+ a = s >> 24;
+ if (a)
+ {
+ if (a == 0xff)
+ d = s;
+ else
+ d = IcOver24 (s, Fetch24(dst));
+ Store24(dst,d);
+ }
+ dst += 3;
+ }
}
- return image;
}
-/* XXX: Need to decide what to do with this
-#define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val)
-
-#define NEXT_PTR(_type) ((_type) ulist++->ptr)
-
-int
-IcImageChange (IcImage *image,
- Mask vmask,
- XID *vlist,
- DevUnion *ulist,
- int *error_value)
+void
+IcCompositeSrc_8888x0565 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- BITS32 index2;
- int error = 0;
- BITS32 maskQ;
+ CARD16 *dstLine, *dst;
+ CARD32 d;
+ CARD32 *srcLine, *src, s;
+ CARD8 a;
+ IcStride dstStride, srcStride;
+ CARD16 w;
- maskQ = vmask;
- while (vmask && !error)
+ IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
+ IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
+
+ while (height--)
{
- index2 = (BITS32) lowbit (vmask);
- vmask &= ~index2;
- image->stateChanges |= index2;
- switch (index2)
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
+
+ while (w--)
{
- case CPRepeat:
+ s = *src++;
+ a = s >> 24;
+ if (a)
{
- unsigned int newr;
- newr = NEXT_VAL(unsigned int);
- if (newr <= xTrue)
- image->repeat = newr;
+ if (a == 0xff)
+ d = s;
else
{
- *error_value = newr;
- error = BadValue;
+ d = *dst;
+ d = IcOver24 (s, cvt0565to8888(d));
}
+ *dst = cvt8888to0565(d);
}
- break;
- case CPAlphaMap:
- {
- IcImage *iAlpha;
-
- iAlpha = NEXT_PTR(IcImage *);
- if (iAlpha)
- iAlpha->refcnt++;
- if (image->alphaMap)
- IcImageDestroy ((pointer) image->alphaMap);
- image->alphaMap = iAlpha;
- }
- break;
- case CPAlphaXOrigin:
- image->alphaOrigin.x = NEXT_VAL(INT16);
- break;
- case CPAlphaYOrigin:
- image->alphaOrigin.y = NEXT_VAL(INT16);
- break;
- case CPClipXOrigin:
- image->clipOrigin.x = NEXT_VAL(INT16);
- break;
- case CPClipYOrigin:
- image->clipOrigin.y = NEXT_VAL(INT16);
- break;
- case CPClipMask:
- {
- IcImage *mask;
- int clipType;
-
- mask = NEXT_PTR(IcImage *);
- if (mask) {
- clipType = CT_PIXMAP;
- mask->refcnt++;
- } else {
- clipType = CT_NONE;
- }
- error = IcImageChangeClip (image, clipType,
- (pointer)mask, 0);
- break;
- }
- case CPGraphicsExposure:
- {
- unsigned int newe;
- newe = NEXT_VAL(unsigned int);
- if (newe <= xTrue)
- image->graphicsExposures = newe;
- else
- {
- *error_value = newe;
- error = BadValue;
- }
- }
- break;
- case CPSubwindowMode:
- {
- unsigned int news;
- news = NEXT_VAL(unsigned int);
- if (news == ClipByChildren || news == IncludeInferiors)
- image->subWindowMode = news;
- else
- {
- *error_value = news;
- error = BadValue;
- }
- }
- break;
- case CPPolyEdge:
- {
- unsigned int newe;
- newe = NEXT_VAL(unsigned int);
- if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth)
- image->polyEdge = newe;
- else
- {
- *error_value = newe;
- error = BadValue;
- }
- }
- break;
- case CPPolyMode:
- {
- unsigned int newm;
- newm = NEXT_VAL(unsigned int);
- if (newm == PolyModePrecise || newm == PolyModeImprecise)
- image->polyMode = newm;
- else
- {
- *error_value = newm;
- error = BadValue;
- }
- }
- break;
- case CPDither:
- image->dither = NEXT_VAL(Atom);
- break;
- case CPComponentAlpha:
- {
- unsigned int newca;
-
- newca = NEXT_VAL (unsigned int);
- if (newca <= xTrue)
- image->componentAlpha = newca;
- else
- {
- *error_value = newca;
- error = BadValue;
- }
- }
- break;
- default:
- *error_value = maskQ;
- error = BadValue;
- break;
+ dst++;
}
}
- return error;
}
-*/
-/* XXX: Do we need this?
-int
-SetPictureClipRects (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- int nRect,
- xRectangle *rects)
+void
+IcCompositeSrc_0565x0565 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- RegionPtr clientClip;
- int result;
-
- clientClip = RECTS_TO_REGION(pScreen,
- nRect, rects, CT_UNSORTED);
- if (!clientClip)
- return BadAlloc;
- result =(*ps->ChangePictureClip) (pPicture, CT_REGION,
- (pointer) clientClip, 0);
- if (result == Success)
+ CARD16 *dstLine, *dst;
+ CARD16 *srcLine, *src;
+ IcStride dstStride, srcStride;
+ CARD16 w;
+
+ IcComposeGetStart (iSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1);
+
+ IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
+
+ while (height--)
{
- pPicture->clipOrigin.x = xOrigin;
- pPicture->clipOrigin.y = yOrigin;
- pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
- pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
+
+ while (w--)
+ *dst++ = *src++;
}
- return result;
}
-*/
-int
-IcImageSetTransform (IcImage *image,
- IcTransform *transform)
+void
+IcCompositeSrcAdd_8000x8000 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- static const IcTransform identity = { {
- { xFixed1, 0x00000, 0x00000 },
- { 0x00000, xFixed1, 0x00000 },
- { 0x00000, 0x00000, xFixed1 },
- } };
-
- if (transform && memcmp (transform, &identity, sizeof (IcTransform)) == 0)
- transform = 0;
+ CARD8 *dstLine, *dst;
+ CARD8 *srcLine, *src;
+ IcStride dstStride, srcStride;
+ CARD8 w;
+ CARD8 s, d;
+ CARD16 t;
- if (transform)
- {
- if (!image->transform)
- {
- image->transform = malloc (sizeof (IcTransform));
- if (!image->transform)
- return BadAlloc;
- }
- *image->transform = *transform;
- }
- else
- {
- if (image->transform)
- {
- free (image->transform);
- image->transform = 0;
- }
- }
- return Success;
-}
+ IcComposeGetStart (iSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1);
+ IcComposeGetStart (iDst, xDst, yDst, CARD8, dstStride, dstLine, 1);
-/* XXX: Do we need this?
-static void
-ValidateOnePicture (IcImage *image)
-{
- if (image->serialNumber != image->pDrawable->serialNumber)
+ while (height--)
{
- PictureScreenPtr ps = GetPictureScreen(image->pDrawable->pScreen);
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
- (*ps->ValidatePicture) (image, image->stateChanges);
- image->stateChanges = 0;
- image->serialNumber = image->pDrawable->serialNumber;
+ while (w--)
+ {
+ s = *src++;
+ if (s != 0xff)
+ {
+ d = *dst;
+ t = d + s;
+ s = t | (0 - (t >> 8));
+ }
+ *dst++ = s;
+ }
}
}
void
-ValidatePicture(PicturePtr pPicture)
-{
- ValidateOnePicture (pPicture);
- if (pPicture->alphaMap)
- ValidateOnePicture (pPicture->alphaMap);
-}
-
-int
-FreePicture (pointer value,
- XID pid)
+IcCompositeSrcAdd_8888x8888 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- PicturePtr pPicture = (PicturePtr) value;
+ CARD32 *dstLine, *dst;
+ CARD32 *srcLine, *src;
+ IcStride dstStride, srcStride;
+ CARD16 w;
+ CARD32 s, d;
+ CARD16 t;
+ CARD32 m,n,o,p;
+
+ IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
+ IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
- if (--pPicture->refcnt == 0)
+ while (height--)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- if (pPicture->alphaMap)
- FreePicture ((pointer) pPicture->alphaMap, (XID) 0);
- (*ps->DestroyPicture) (pPicture);
- (*ps->DestroyPictureClip) (pPicture);
- if (pPicture->transform)
- free (pPicture->transform);
- if (pPicture->pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
- PicturePtr *pPrev;
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
- for (pPrev = (PicturePtr *) &((pWindow)->devPrivates[PictureWindowPrivateIndex].ptr);
- *pPrev;
- pPrev = &(*pPrev)->pNext)
+ while (w--)
+ {
+ s = *src++;
+ if (s != 0xffffffff)
{
- if (*pPrev == pPicture)
+ d = *dst;
+ if (d)
{
- *pPrev = pPicture->pNext;
- break;
+ m = IcAdd(s,d,0,t);
+ n = IcAdd(s,d,8,t);
+ o = IcAdd(s,d,16,t);
+ p = IcAdd(s,d,24,t);
+ s = m|n|o|p;
}
}
+ *dst++ = s;
}
- else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP)
- {
- (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable);
- }
- free (pPicture);
}
- return Success;
-}
-
-int
-FreePictFormat (pointer pPictFormat,
- XID pid)
-{
- return Success;
}
void
-CompositePicture (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+IcCompositeSrcAdd_1000x1000 (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+ IcBits *dstBits, *srcBits;
+ IcStride dstStride, srcStride;
+ int dstBpp, srcBpp;
+ int dstXoff, dstYoff;
+ int srcXoff, srcYoff;
- ValidatePicture (pSrc);
- if (pMask)
- ValidatePicture (pMask);
- ValidatePicture (pDst);
- (*ps->Composite) (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
-}
+ IcGetPixels(iSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
-void
-CompositeGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr lists,
- GlyphPtr *glyphs)
-{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs);
-}
+ IcGetPixels(iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
-void
-CompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects)
-{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pDst);
- (*ps->CompositeRects) (op, pDst, color, nRect, rects);
-}
+ IcBlt (srcBits + srcStride * (ySrc + srcYoff),
+ srcStride,
+ xSrc + srcXoff,
-void
-CompositeTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
-{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps);
-}
+ dstBits + dstStride * (yDst + dstYoff),
+ dstStride,
+ xDst + dstXoff,
-void
-CompositeTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntriangles,
- xTriangle *triangles)
-{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles, triangles);
-}
+ width,
+ height,
-void
-CompositeTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
-{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->TriStrip) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points);
+ GXor,
+ IC_ALLONES,
+ srcBpp,
+
+ FALSE,
+ FALSE);
}
void
-CompositeTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+IcCompositeSolidMask_nx1xn (CARD8 op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+ IcBits *dstBits;
+ IcStip *maskBits;
+ IcStride dstStride, maskStride;
+ int dstBpp, maskBpp;
+ int dstXoff, dstYoff;
+ int maskXoff, maskYoff;
+ IcBits src;
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->TriFan) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points);
-}
-*/
+ IcComposeGetSolid(iSrc, src);
+
+ if ((src & 0xff000000) != 0xff000000)
+ {
+ IcCompositeGeneral (op, iSrc, iMask, iDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+ return;
+ }
+ IcGetStipPixels (iMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff);
+ IcGetPixels (iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+
+ switch (dstBpp) {
+ case 32:
+ break;
+ case 24:
+ break;
+ case 16:
+ src = cvt8888to0565(src);
+ break;
+ }
-typedef xFixed_32_32 xFixed_48_16;
+ src = IcReplicatePixel (src, dstBpp);
-#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff)
-#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31))
+ IcBltOne (maskBits + maskStride * (yMask + maskYoff),
+ maskStride,
+ xMask + maskXoff,
-/* XXX: Still need to port this
-Bool
-IcTransformPoint (IcTransform *transform,
- PictVectorPtr vector)
-{
- PictVector result;
- int i, j;
- xFixed_32_32 partial;
- xFixed_48_16 v;
+ dstBits + dstStride * (yDst + dstYoff),
+ dstStride,
+ (xDst + dstXoff) * dstBpp,
+ dstBpp,
+
+ width * dstBpp,
+ height,
+
+ 0x0,
+ src,
+ IC_ALLONES,
+ 0x0);
+}
- for (j = 0; j < 3; j++)
+# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+
+void
+IcComposite (char op,
+ IcImage *iSrc,
+ IcImage *iMask,
+ IcImage *iDst,
+ int xSrc,
+ int ySrc,
+ int xMask,
+ int yMask,
+ int xDst,
+ int yDst,
+ int width,
+ int height)
+{
+ Region region;
+ int n;
+ BoxPtr pbox;
+ CompositeFunc func;
+ Bool srcRepeat = iSrc->repeat;
+ Bool maskRepeat = FALSE;
+ Bool srcAlphaMap = iSrc->alphaMap != 0;
+ Bool maskAlphaMap = FALSE;
+ Bool dstAlphaMap = iDst->alphaMap != 0;
+ int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
+ int w, h, w_this, h_this;
+ XRectangle rect;
+
+ xDst += iDst->pixels->x;
+ yDst += iDst->pixels->y;
+ xSrc += iSrc->pixels->x;
+ ySrc += iSrc->pixels->y;
+ if (iMask)
{
- v = 0;
- for (i = 0; i < 3; i++)
+ xMask += iMask->pixels->x;
+ yMask += iMask->pixels->y;
+ maskRepeat = iMask->repeat;
+ maskAlphaMap = iMask->alphaMap != 0;
+ }
+
+ region = XCreateRegion();
+ rect.x = xDst;
+ rect.y = yDst;
+ rect.width = width;
+ rect.height = height;
+ XUnionRectWithRegion (&rect, region, region);
+
+ if (!IcComputeCompositeRegion (region,
+ iSrc,
+ iMask,
+ iDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height))
+ return;
+
+ func = IcCompositeGeneral;
+ if (!iSrc->transform && !(iMask && iMask->transform))
+ if (!maskAlphaMap && !srcAlphaMap && !dstAlphaMap)
+ switch (op) {
+ case PictOpOver:
+ if (iMask)
+ {
+ if (srcRepeat &&
+ iSrc->pixels->width == 1 &&
+ iSrc->pixels->height == 1)
+ {
+ srcRepeat = FALSE;
+ if (PICT_FORMAT_COLOR(iSrc->format)) {
+ switch (iMask->format) {
+ case PICT_a8:
+ switch (iDst->format) {
+ case PICT_r5g6b5:
+ case PICT_b5g6r5:
+ func = IcCompositeSolidMask_nx8x0565;
+ break;
+ case PICT_r8g8b8:
+ case PICT_b8g8r8:
+ func = IcCompositeSolidMask_nx8x0888;
+ break;
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ func = IcCompositeSolidMask_nx8x8888;
+ break;
+ }
+ break;
+ case PICT_a8r8g8b8:
+ if (iMask->componentAlpha) {
+ switch (iDst->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ func = IcCompositeSolidMask_nx8888x8888C;
+ break;
+ case PICT_r5g6b5:
+ func = IcCompositeSolidMask_nx8888x0565C;
+ break;
+ }
+ }
+ break;
+ case PICT_a8b8g8r8:
+ if (iMask->componentAlpha) {
+ switch (iDst->format) {
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ func = IcCompositeSolidMask_nx8888x8888C;
+ break;
+ case PICT_b5g6r5:
+ func = IcCompositeSolidMask_nx8888x0565C;
+ break;
+ }
+ }
+ break;
+ case PICT_a1:
+ switch (iDst->format) {
+ case PICT_r5g6b5:
+ case PICT_b5g6r5:
+ case PICT_r8g8b8:
+ case PICT_b8g8r8:
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ func = IcCompositeSolidMask_nx1xn;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ switch (iSrc->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ switch (iDst->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ func = IcCompositeSrc_8888x8888;
+ break;
+ case PICT_r8g8b8:
+ func = IcCompositeSrc_8888x0888;
+ break;
+ case PICT_r5g6b5:
+ func = IcCompositeSrc_8888x0565;
+ break;
+ }
+ break;
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ switch (iDst->format) {
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ func = IcCompositeSrc_8888x8888;
+ break;
+ case PICT_b8g8r8:
+ func = IcCompositeSrc_8888x0888;
+ break;
+ case PICT_b5g6r5:
+ func = IcCompositeSrc_8888x0565;
+ break;
+ }
+ break;
+ case PICT_r5g6b5:
+ switch (iDst->format) {
+ case PICT_r5g6b5:
+ func = IcCompositeSrc_0565x0565;
+ break;
+ }
+ break;
+ case PICT_b5g6r5:
+ switch (iDst->format) {
+ case PICT_b5g6r5:
+ func = IcCompositeSrc_0565x0565;
+ break;
+ }
+ break;
+ }
+ }
+ break;
+ case PictOpAdd:
+ if (iMask == 0)
{
- partial = ((xFixed_48_16) transform->matrix[j][i] *
- (xFixed_48_16) vector->vector[i]);
- v += partial >> 16;
+ switch (iSrc->format) {
+ case PICT_a8r8g8b8:
+ switch (iDst->format) {
+ case PICT_a8r8g8b8:
+ func = IcCompositeSrcAdd_8888x8888;
+ break;
+ }
+ break;
+ case PICT_a8b8g8r8:
+ switch (iDst->format) {
+ case PICT_a8b8g8r8:
+ func = IcCompositeSrcAdd_8888x8888;
+ break;
+ }
+ break;
+ case PICT_a8:
+ switch (iDst->format) {
+ case PICT_a8:
+ func = IcCompositeSrcAdd_8000x8000;
+ break;
+ }
+ break;
+ case PICT_a1:
+ switch (iDst->format) {
+ case PICT_a1:
+ func = IcCompositeSrcAdd_1000x1000;
+ break;
+ }
+ break;
+ }
}
- if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
- return FALSE;
- result.vector[j] = (xFixed) v;
+ break;
}
- if (!result.vector[2])
- return FALSE;
- for (j = 0; j < 2; j++)
+ n = region->numRects;
+ pbox = region->rects;
+ while (n--)
{
- partial = (xFixed_48_16) result.vector[j] << 16;
- v = partial / result.vector[2];
- if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
- return FALSE;
- vector->vector[j] = (xFixed) v;
+ h = pbox->y2 - pbox->y1;
+ y_src = pbox->y1 - yDst + ySrc;
+ y_msk = pbox->y1 - yDst + yMask;
+ y_dst = pbox->y1;
+ while (h)
+ {
+ h_this = h;
+ w = pbox->x2 - pbox->x1;
+ x_src = pbox->x1 - xDst + xSrc;
+ x_msk = pbox->x1 - xDst + xMask;
+ x_dst = pbox->x1;
+ if (maskRepeat)
+ {
+ y_msk = mod (y_msk, iMask->pixels->height);
+ if (h_this > iMask->pixels->height - y_msk)
+ h_this = iMask->pixels->height - y_msk;
+ }
+ if (srcRepeat)
+ {
+ y_src = mod (y_src, iSrc->pixels->height);
+ if (h_this > iSrc->pixels->height - y_src)
+ h_this = iSrc->pixels->height - y_src;
+ }
+ while (w)
+ {
+ w_this = w;
+ if (maskRepeat)
+ {
+ x_msk = mod (x_msk, iMask->pixels->width);
+ if (w_this > iMask->pixels->width - x_msk)
+ w_this = iMask->pixels->width - x_msk;
+ }
+ if (srcRepeat)
+ {
+ x_src = mod (x_src, iSrc->pixels->width);
+ if (w_this > iSrc->pixels->width - x_src)
+ w_this = iSrc->pixels->width - x_src;
+ }
+ (*func) (op, iSrc, iMask, iDst,
+ x_src, y_src, x_msk, y_msk, x_dst, y_dst,
+ w_this, h_this);
+ w -= w_this;
+ x_src += w_this;
+ x_msk += w_this;
+ x_dst += w_this;
+ }
+ h -= h_this;
+ y_src += h_this;
+ y_msk += h_this;
+ y_dst += h_this;
+ }
+ pbox++;
}
- vector->vector[2] = xFixed1;
- return TRUE;
+ XDestroyRegion (region);
}
-*/
diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c
index f3f55cc4..475f38ec 100644
--- a/pixman/src/icbltone.c
+++ b/pixman/src/icbltone.c
@@ -735,133 +735,3 @@ IcBltOne24 (IcStip *srcLine,
}
#endif
-/*
- * Not very efficient, but simple -- copy a single plane
- * from an N bit image to a 1 bit image
- */
-
-/* XXX: Do we need this?
-void
-IcBltPlane (IcBits *src,
- IcStride srcStride,
- int srcX,
- int srcBpp,
-
- IcStip *dst,
- IcStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- IcStip fgand,
- IcStip fgxor,
- IcStip bgand,
- IcStip bgxor,
- Pixel planeMask)
-{
- IcBits *s;
- IcBits pm;
- IcBits srcMask;
- IcBits srcMaskFirst;
- IcBits srcMask0 = 0;
- IcBits srcBits;
-
- IcStip dstBits;
- IcStip *d;
- IcStip dstMask;
- IcStip dstMaskFirst;
- IcStip dstUnion;
- int w;
- int wt;
- int rot0;
-
- if (!width)
- return;
-
- src += srcX >> IC_SHIFT;
- srcX &= IC_MASK;
-
- dst += dstX >> IC_STIP_SHIFT;
- dstX &= IC_STIP_MASK;
-
- w = width / srcBpp;
-
- pm = IcReplicatePixel (planeMask, srcBpp);
-#ifdef IC_24BIT
- if (srcBpp == 24)
- {
- int w = 24;
-
- rot0 = IcFirst24Rot (srcX);
- if (srcX + w > IC_UNIT)
- w = IC_UNIT - srcX;
- srcMaskFirst = IcRot24(pm,rot0) & IcBitsMask(srcX,w);
- }
- else
-#endif
- {
- rot0 = 0;
- srcMaskFirst = pm & IcBitsMask(srcX, srcBpp);
- srcMask0 = pm & IcBitsMask(0, srcBpp);
- }
-
- dstMaskFirst = IcStipMask(dstX,1);
- while (height--)
- {
- d = dst;
- dst += dstStride;
- s = src;
- src += srcStride;
-
- srcMask = srcMaskFirst;
-#ifdef IC_24BIT
- if (srcBpp == 24)
- srcMask0 = IcRot24(pm,rot0) & IcBitsMask(0, srcBpp);
-#endif
- srcBits = *s++;
-
- dstMask = dstMaskFirst;
- dstUnion = 0;
- dstBits = 0;
-
- wt = w;
-
- while (wt--)
- {
- if (!srcMask)
- {
- srcBits = *s++;
-#ifdef IC_24BIT
- if (srcBpp == 24)
- srcMask0 = IcNext24Pix(srcMask0) & IcBitsMask(0,24);
-#endif
- srcMask = srcMask0;
- }
- if (!dstMask)
- {
- *d = IcStippleRRopMask(*d, dstBits,
- fgand, fgxor, bgand, bgxor,
- dstUnion);
- d++;
- dstMask = IcStipMask(0,1);
- dstUnion = 0;
- dstBits = 0;
- }
- if (srcBits & srcMask)
- dstBits |= dstMask;
- dstUnion |= dstMask;
- if (srcBpp == IC_UNIT)
- srcMask = 0;
- else
- srcMask = IcScrRight(srcMask,srcBpp);
- dstMask = IcStipRight(dstMask,1);
- }
- if (dstUnion)
- *d = IcStippleRRopMask(*d,dstBits,
- fgand, fgxor, bgand, bgxor,
- dstUnion);
- }
-}
-*/
-
diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c
index 391fe28c..f50b8e19 100644
--- a/pixman/src/iccompose.c
+++ b/pixman/src/iccompose.c
@@ -2898,3 +2898,4 @@ IcCompositeGeneral (CARD8 op,
(*pmsk->down) (pmsk);
}
}
+
diff --git a/pixman/src/icformat.c b/pixman/src/icformat.c
index 2c2dcf50..4cf9e9d8 100644
--- a/pixman/src/icformat.c
+++ b/pixman/src/icformat.c
@@ -24,26 +24,6 @@
*/
#include "icint.h"
-#include "icimage.h"
-
-/* XXX: Need to trim down (eliminate?) these includes. */
-
-#include "misc.h"
-/*
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "validate.h"
-#include "windowstr.h"
-#include "input.h"
-#include "colormapst.h"
-#include "cursorstr.h"
-#include "dixstruct.h"
-#include "gcstruct.h"
-#include "picturestr.h"
-*/
-#include "os.h"
-#include "resource.h"
-#include "servermd.h"
void
IcFormatInit (IcFormat *format, IcFormatName name);
diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c
index 62814f44..a30ff98d 100644
--- a/pixman/src/icimage.c
+++ b/pixman/src/icimage.c
@@ -23,1155 +23,167 @@
* Author: Keith Packard, SuSE, Inc.
*/
-/* XXX: Do we really need all of these includes? */
-
#include "icint.h"
-#include "icimage.h"
-
-#include "pixmapstr.h"
-
-/*
-#include "mipict.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "scrnintstr.h"
-*/
-
-#ifndef __GNUC__
-#define __inline
-#endif
-
-
-#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
- (((s) >> 5) & 0x07e0) | \
- (((s) >> 8) & 0xf800))
-#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
- ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
- ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
-
-#if IMAGE_BYTE_ORDER == MSBFirst
-#define Fetch24(a) ((unsigned long) (a) & 1 ? \
- ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \
- ((*((CARD16 *) (a)) << 8) | *((a)+2)))
-#define Store24(a,v) ((unsigned long) (a) & 1 ? \
- ((*(a) = (CARD8) ((v) >> 16)), \
- (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \
- ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \
- (*((a)+2) = (CARD8) (v))))
-#else
-#define Fetch24(a) ((unsigned long) (a) & 1 ? \
- ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \
- ((*((CARD16 *) (a))) | (*((a)+2) << 16)))
-#define Store24(a,v) ((unsigned long) (a) & 1 ? \
- ((*(a) = (CARD8) (v)), \
- (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \
- ((*((CARD16 *) (a)) = (CARD16) (v)),\
- (*((a)+2) = (CARD8) ((v) >> 16))))
-#endif
-
-CARD32
-IcOver (CARD32 x, CARD32 y)
-{
- CARD16 a = ~x >> 24;
- CARD16 t;
- CARD32 m,n,o,p;
-
- m = IcOverU(x,y,0,a,t);
- n = IcOverU(x,y,8,a,t);
- o = IcOverU(x,y,16,a,t);
- p = IcOverU(x,y,24,a,t);
- return m|n|o|p;
-}
-
-CARD32
-IcOver24 (CARD32 x, CARD32 y)
-{
- CARD16 a = ~x >> 24;
- CARD16 t;
- CARD32 m,n,o;
-
- m = IcOverU(x,y,0,a,t);
- n = IcOverU(x,y,8,a,t);
- o = IcOverU(x,y,16,a,t);
- return m|n|o;
-}
-CARD32
-IcIn (CARD32 x, CARD8 y)
+IcImage *
+IcImageCreate (IcFormat *format,
+ int width,
+ int height,
+ Mask vmask,
+ XID *vlist,
+ int *error,
+ int *error_value)
{
- CARD16 a = y;
- CARD16 t;
- CARD32 m,n,o,p;
-
- m = IcInU(x,0,a,t);
- n = IcInU(x,8,a,t);
- o = IcInU(x,16,a,t);
- p = IcInU(x,24,a,t);
- return m|n|o|p;
-}
-
-#define IcComposeGetSolid(image, bits) { \
- IcBits *__bits__; \
- IcStride __stride__; \
- int __bpp__; \
- int __xoff__,__yoff__; \
-\
- IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \
- switch (__bpp__) { \
- case 32: \
- (bits) = *(CARD32 *) __bits__; \
- break; \
- case 24: \
- (bits) = Fetch24 ((CARD8 *) __bits__); \
- break; \
- case 16: \
- (bits) = *(CARD16 *) __bits__; \
- (bits) = cvt0565to8888(bits); \
- break; \
- default: \
- return; \
- } \
- /* manage missing src alpha */ \
- if ((image)->image_format->direct.alphaMask == 0) \
- (bits) |= 0xff000000; \
-}
-
-#define IcComposeGetStart(image,x,y,type,stride,line,mul) {\
- IcBits *__bits__; \
- IcStride __stride__; \
- int __bpp__; \
- int __xoff__,__yoff__; \
-\
- IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \
- (stride) = __stride__ * sizeof (IcBits) / sizeof (type); \
- (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \
-}
-
-/*
- * Naming convention:
- *
- * opSRCxMASKxDST
- */
+ IcImage *image;
+ IcPixels *pixels;
-void
-IcCompositeSolidMask_nx8x8888 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD32 src, srca;
- CARD32 *dstLine, *dst, d, dstMask;
- CARD8 *maskLine, *mask, m;
- IcStride dstStride, maskStride;
- CARD16 w;
-
- IcComposeGetSolid(iSrc, src);
-
- dstMask = IcFullMask (iDst->pixels->depth);
- srca = src >> 24;
- if (src == 0)
- return;
-
- IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
- IcComposeGetStart (iMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- mask = maskLine;
- maskLine += maskStride;
- w = width;
-
- while (w--)
- {
- m = *mask++;
- if (m == 0xff)
- {
- if (srca == 0xff)
- *dst = src & dstMask;
- else
- *dst = IcOver (src, *dst) & dstMask;
- }
- else if (m)
- {
- d = IcIn (src, m);
- *dst = IcOver (d, *dst) & dstMask;
- }
- dst++;
- }
+ pixels = IcPixelsCreate (width, height, format->depth);
+ if (pixels == NULL) {
+ *error = BadAlloc;
+ *error_value = 0; /* XXX: What should this be? */
+ return NULL;
}
-}
-
-void
-IcCompositeSolidMask_nx8888x8888C (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD32 src, srca;
- CARD32 *dstLine, *dst, d, dstMask;
- CARD32 *maskLine, *mask, ma;
- IcStride dstStride, maskStride;
- CARD16 w;
- CARD32 m, n, o, p;
-
- IcComposeGetSolid(iSrc, src);
-
- dstMask = IcFullMask (iDst->pixels->depth);
- srca = src >> 24;
- if (src == 0)
- return;
-
- IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
- IcComposeGetStart (iMask, xMask, yMask, CARD32, maskStride, maskLine, 1);
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- mask = maskLine;
- maskLine += maskStride;
- w = width;
+ image = IcImageCreateForPixels (pixels, format, vmask, vlist, error, error_value);
- while (w--)
- {
- ma = *mask++;
- if (ma == 0xffffffff)
- {
- if (srca == 0xff)
- *dst = src & dstMask;
- else
- *dst = IcOver (src, *dst) & dstMask;
- }
- else if (ma)
- {
- d = *dst;
-#define IcInOverC(src,srca,msk,dst,i,result) { \
- CARD16 __a = IcGet8(msk,i); \
- CARD32 __t, __ta; \
- CARD32 __i; \
- __t = IcIntMult (IcGet8(src,i), __a,__i); \
- __ta = (CARD8) ~IcIntMult (srca, __a,__i); \
- __t = __t + IcIntMult(IcGet8(dst,i),__ta,__i); \
- __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \
- result = __t << (i); \
-}
- IcInOverC (src, srca, ma, d, 0, m);
- IcInOverC (src, srca, ma, d, 8, n);
- IcInOverC (src, srca, ma, d, 16, o);
- IcInOverC (src, srca, ma, d, 24, p);
- *dst = m|n|o|p;
- }
- dst++;
- }
- }
-}
-
-void
-IcCompositeSolidMask_nx8x0888 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD32 src, srca;
- CARD8 *dstLine, *dst;
- CARD32 d;
- CARD8 *maskLine, *mask, m;
- IcStride dstStride, maskStride;
- CARD16 w;
+ image->owns_pixels = 1;
- IcComposeGetSolid(iSrc, src);
-
- srca = src >> 24;
- if (src == 0)
- return;
-
- IcComposeGetStart (iDst, xDst, yDst, CARD8, dstStride, dstLine, 3);
- IcComposeGetStart (iMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- mask = maskLine;
- maskLine += maskStride;
- w = width;
-
- while (w--)
- {
- m = *mask++;
- if (m == 0xff)
- {
- if (srca == 0xff)
- d = src;
- else
- {
- d = Fetch24(dst);
- d = IcOver24 (src, d);
- }
- Store24(dst,d);
- }
- else if (m)
- {
- d = IcOver24 (IcIn(src,m), Fetch24(dst));
- Store24(dst,d);
- }
- dst += 3;
- }
- }
+ return image;
}
-void
-IcCompositeSolidMask_nx8x0565 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+IcImage *
+IcImageCreateForPixels (IcPixels *pixels,
+ IcFormat *format,
+ Mask vmask,
+ XID *vlist,
+ int *error,
+ int *error_value)
{
- CARD32 src, srca;
- CARD16 *dstLine, *dst;
- CARD32 d;
- CARD8 *maskLine, *mask, m;
- IcStride dstStride, maskStride;
- CARD16 w;
+ IcImage *image;
- IcComposeGetSolid(iSrc, src);
-
- srca = src >> 24;
- if (src == 0)
- return;
-
- IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
- IcComposeGetStart (iMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-
- while (height--)
+ image = malloc (sizeof (IcImage));
+ if (!image)
{
- dst = dstLine;
- dstLine += dstStride;
- mask = maskLine;
- maskLine += maskStride;
- w = width;
-
- while (w--)
- {
- m = *mask++;
- if (m == 0xff)
- {
- if (srca == 0xff)
- d = src;
- else
- {
- d = *dst;
- d = IcOver24 (src, cvt0565to8888(d));
- }
- *dst = cvt8888to0565(d);
- }
- else if (m)
- {
- d = *dst;
- d = IcOver24 (IcIn(src,m), cvt0565to8888(d));
- *dst = cvt8888to0565(d);
- }
- dst++;
- }
+ *error = BadAlloc;
+ *error_value = 0; /* XXX: What should this be? */
+ return NULL;
}
-}
-
-void
-IcCompositeSolidMask_nx8888x0565C (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD32 src, srca;
- CARD16 src16;
- CARD16 *dstLine, *dst;
- CARD32 d;
- CARD32 *maskLine, *mask, ma;
- IcStride dstStride, maskStride;
- CARD16 w;
- CARD32 m, n, o;
- IcComposeGetSolid(iSrc, src);
-
- srca = src >> 24;
- if (src == 0)
- return;
-
- src16 = cvt8888to0565(src);
-
- IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
- IcComposeGetStart (iMask, xMask, yMask, CARD32, maskStride, maskLine, 1);
-
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- mask = maskLine;
- maskLine += maskStride;
- w = width;
-
- while (w--)
- {
- ma = *mask++;
- if (ma == 0xffffffff)
- {
- if (srca == 0xff)
- {
- *dst = src16;
- }
- else
- {
- d = *dst;
- d = IcOver24 (src, cvt0565to8888(d));
- *dst = cvt8888to0565(d);
- }
- }
- else if (ma)
- {
- d = *dst;
- d = cvt0565to8888(d);
- IcInOverC (src, srca, ma, d, 0, m);
- IcInOverC (src, srca, ma, d, 8, n);
- IcInOverC (src, srca, ma, d, 16, o);
- d = m|n|o;
- *dst = cvt8888to0565(d);
- }
- dst++;
- }
- }
-}
-
-void
-IcCompositeSrc_8888x8888 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD32 *dstLine, *dst, dstMask;
- CARD32 *srcLine, *src, s;
- IcStride dstStride, srcStride;
- CARD8 a;
- CARD16 w;
-
- IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
- IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-
- dstMask = IcFullMask (iDst->pixels->depth);
-
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- src = srcLine;
- srcLine += srcStride;
- w = width;
-
- while (w--)
- {
- s = *src++;
- a = s >> 24;
- if (a == 0xff)
- *dst = s & dstMask;
- else if (a)
- *dst = IcOver (s, *dst) & dstMask;
- dst++;
- }
- }
-}
-
-void
-IcCompositeSrc_8888x0888 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD8 *dstLine, *dst;
- CARD32 d;
- CARD32 *srcLine, *src, s;
- CARD8 a;
- IcStride dstStride, srcStride;
- CARD16 w;
-
- IcComposeGetStart (iDst, xDst, yDst, CARD8, dstStride, dstLine, 3);
- IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- src = srcLine;
- srcLine += srcStride;
- w = width;
-
- while (w--)
- {
- s = *src++;
- a = s >> 24;
- if (a)
- {
- if (a == 0xff)
- d = s;
- else
- d = IcOver24 (s, Fetch24(dst));
- Store24(dst,d);
- }
- dst += 3;
- }
- }
-}
-
-void
-IcCompositeSrc_8888x0565 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD16 *dstLine, *dst;
- CARD32 d;
- CARD32 *srcLine, *src, s;
- CARD8 a;
- IcStride dstStride, srcStride;
- CARD16 w;
-
- IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
- IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-
- while (height--)
- {
- dst = dstLine;
- dstLine += dstStride;
- src = srcLine;
- srcLine += srcStride;
- w = width;
-
- while (w--)
- {
- s = *src++;
- a = s >> 24;
- if (a)
- {
- if (a == 0xff)
- d = s;
- else
- {
- d = *dst;
- d = IcOver24 (s, cvt0565to8888(d));
- }
- *dst = cvt8888to0565(d);
- }
- dst++;
- }
- }
-}
-
-void
-IcCompositeSrc_0565x0565 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD16 *dstLine, *dst;
- CARD16 *srcLine, *src;
- IcStride dstStride, srcStride;
- CARD16 w;
-
- IcComposeGetStart (iSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1);
-
- IcComposeGetStart (iDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-
- while (height--)
+ image->pixels = pixels;
+ image->image_format = format;
+ image->format = format->format;
+/* XXX: What's all this about?
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- dst = dstLine;
- dstLine += dstStride;
- src = srcLine;
- srcLine += srcStride;
- w = width;
-
- while (w--)
- *dst++ = *src++;
+ ++((PixmapPtr)pDrawable)->refcnt;
+ image->pNext = 0;
}
-}
-
-void
-IcCompositeSrcAdd_8000x8000 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD8 *dstLine, *dst;
- CARD8 *srcLine, *src;
- IcStride dstStride, srcStride;
- CARD8 w;
- CARD8 s, d;
- CARD16 t;
-
- IcComposeGetStart (iSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1);
- IcComposeGetStart (iDst, xDst, yDst, CARD8, dstStride, dstLine, 1);
-
- while (height--)
+ else
{
- dst = dstLine;
- dstLine += dstStride;
- src = srcLine;
- srcLine += srcStride;
- w = width;
-
- while (w--)
- {
- s = *src++;
- if (s != 0xff)
- {
- d = *dst;
- t = d + s;
- s = t | (0 - (t >> 8));
- }
- *dst++ = s;
- }
+ image->pNext = GetPictureWindow(((WindowPtr) pDrawable));
+ SetPictureWindow(((WindowPtr) pDrawable), image);
}
-}
+*/
-void
-IcCompositeSrcAdd_8888x8888 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- CARD32 *dstLine, *dst;
- CARD32 *srcLine, *src;
- IcStride dstStride, srcStride;
- CARD16 w;
- CARD32 s, d;
- CARD16 t;
- CARD32 m,n,o,p;
+ IcImageInit (image);
- IcComposeGetStart (iSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
- IcComposeGetStart (iDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-
- while (height--)
+ if (vmask)
+ ;
+ /* XXX: Need to finish porting this function
+ *error = IcImageChange (image, vmask, vlist, 0, error_value);
+ */
+ else
+ *error = Success;
+ if (*error != Success)
{
- dst = dstLine;
- dstLine += dstStride;
- src = srcLine;
- srcLine += srcStride;
- w = width;
-
- while (w--)
- {
- s = *src++;
- if (s != 0xffffffff)
- {
- d = *dst;
- if (d)
- {
- m = IcAdd(s,d,0,t);
- n = IcAdd(s,d,8,t);
- o = IcAdd(s,d,16,t);
- p = IcAdd(s,d,24,t);
- s = m|n|o|p;
- }
- }
- *dst++ = s;
- }
+ IcImageDestroy (image);
+ image = 0;
}
+ return image;
}
void
-IcCompositeSrcAdd_1000x1000 (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+IcImageInit (IcImage *image)
{
- IcBits *dstBits, *srcBits;
- IcStride dstStride, srcStride;
- int dstBpp, srcBpp;
- int dstXoff, dstYoff;
- int srcXoff, srcYoff;
-
- IcGetPixels(iSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
-
- IcGetPixels(iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
-
- IcBlt (srcBits + srcStride * (ySrc + srcYoff),
- srcStride,
- xSrc + srcXoff,
-
- dstBits + dstStride * (yDst + dstYoff),
- dstStride,
- xDst + dstXoff,
-
- width,
- height,
-
- GXor,
- IC_ALLONES,
- srcBpp,
+ XRectangle rect;
+
+ image->refcnt = 1;
+ image->repeat = 0;
+ image->graphicsExposures = FALSE;
+ image->subWindowMode = ClipByChildren;
+ image->polyEdge = PolyEdgeSharp;
+ image->polyMode = PolyModePrecise;
+ image->freeCompClip = FALSE;
+ image->clientClipType = CT_NONE;
+ image->componentAlpha = FALSE;
- FALSE,
- FALSE);
-}
+ image->alphaMap = 0;
+ image->alphaOrigin.x = 0;
+ image->alphaOrigin.y = 0;
-void
-IcCompositeSolidMask_nx1xn (CARD8 op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- IcBits *dstBits;
- IcStip *maskBits;
- IcStride dstStride, maskStride;
- int dstBpp, maskBpp;
- int dstXoff, dstYoff;
- int maskXoff, maskYoff;
- IcBits src;
-
- IcComposeGetSolid(iSrc, src);
+ image->clipOrigin.x = 0;
+ image->clipOrigin.y = 0;
+ image->clientClip = 0;
- if ((src & 0xff000000) != 0xff000000)
- {
- IcCompositeGeneral (op, iSrc, iMask, iDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
- return;
- }
- IcGetStipPixels (iMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff);
- IcGetPixels (iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ image->dither = None;
- switch (dstBpp) {
- case 32:
- break;
- case 24:
- break;
- case 16:
- src = cvt8888to0565(src);
- break;
- }
+ image->stateChanges = (1 << (CPLastBit+1)) - 1;
+/* XXX: What to lodge here?
+ image->serialNumber = GC_CHANGE_SERIAL_BIT;
+*/
- src = IcReplicatePixel (src, dstBpp);
+ image->pCompositeClip = XCreateRegion();
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = image->pixels->width;
+ rect.height = image->pixels->height;
+ XUnionRectWithRegion (&rect, image->pCompositeClip, image->pCompositeClip);
- IcBltOne (maskBits + maskStride * (yMask + maskYoff),
- maskStride,
- xMask + maskXoff,
+ image->transform = NULL;
- dstBits + dstStride * (yDst + dstYoff),
- dstStride,
- (xDst + dstXoff) * dstBpp,
- dstBpp,
+/* XXX: Need to track down and include this function
+ image->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
+*/
+ image->filter_params = 0;
+ image->filter_nparams = 0;
- width * dstBpp,
- height,
- 0x0,
- src,
- IC_ALLONES,
- 0x0);
+ image->owns_pixels = 0;
}
-# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
-void
-IcComposite (char op,
- IcImage *iSrc,
- IcImage *iMask,
- IcImage *iDst,
- int xSrc,
- int ySrc,
- int xMask,
- int yMask,
- int xDst,
- int yDst,
- int width,
- int height)
+int
+IcImageSetTransform (IcImage *image,
+ IcTransform *transform)
{
- Region region;
- int n;
- BoxPtr pbox;
- CompositeFunc func;
- Bool srcRepeat = iSrc->repeat;
- Bool maskRepeat = FALSE;
- Bool srcAlphaMap = iSrc->alphaMap != 0;
- Bool maskAlphaMap = FALSE;
- Bool dstAlphaMap = iDst->alphaMap != 0;
- int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
- int w, h, w_this, h_this;
- XRectangle rect;
+ static const IcTransform identity = { {
+ { xFixed1, 0x00000, 0x00000 },
+ { 0x00000, xFixed1, 0x00000 },
+ { 0x00000, 0x00000, xFixed1 },
+ } };
+
+ if (transform && memcmp (transform, &identity, sizeof (IcTransform)) == 0)
+ transform = 0;
- xDst += iDst->pixels->x;
- yDst += iDst->pixels->y;
- xSrc += iSrc->pixels->x;
- ySrc += iSrc->pixels->y;
- if (iMask)
+ if (transform)
{
- xMask += iMask->pixels->x;
- yMask += iMask->pixels->y;
- maskRepeat = iMask->repeat;
- maskAlphaMap = iMask->alphaMap != 0;
- }
-
- region = XCreateRegion();
- rect.x = xDst;
- rect.y = yDst;
- rect.width = width;
- rect.height = height;
- XUnionRectWithRegion (&rect, region, region);
-
- if (!IcComputeCompositeRegion (region,
- iSrc,
- iMask,
- iDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height))
- return;
-
- func = IcCompositeGeneral;
- if (!iSrc->transform && !(iMask && iMask->transform))
- if (!maskAlphaMap && !srcAlphaMap && !dstAlphaMap)
- switch (op) {
- case PictOpOver:
- if (iMask)
+ if (!image->transform)
{
- if (srcRepeat &&
- iSrc->pixels->width == 1 &&
- iSrc->pixels->height == 1)
- {
- srcRepeat = FALSE;
- if (PICT_FORMAT_COLOR(iSrc->format)) {
- switch (iMask->format) {
- case PICT_a8:
- switch (iDst->format) {
- case PICT_r5g6b5:
- case PICT_b5g6r5:
- func = IcCompositeSolidMask_nx8x0565;
- break;
- case PICT_r8g8b8:
- case PICT_b8g8r8:
- func = IcCompositeSolidMask_nx8x0888;
- break;
- case PICT_a8r8g8b8:
- case PICT_x8r8g8b8:
- case PICT_a8b8g8r8:
- case PICT_x8b8g8r8:
- func = IcCompositeSolidMask_nx8x8888;
- break;
- }
- break;
- case PICT_a8r8g8b8:
- if (iMask->componentAlpha) {
- switch (iDst->format) {
- case PICT_a8r8g8b8:
- case PICT_x8r8g8b8:
- func = IcCompositeSolidMask_nx8888x8888C;
- break;
- case PICT_r5g6b5:
- func = IcCompositeSolidMask_nx8888x0565C;
- break;
- }
- }
- break;
- case PICT_a8b8g8r8:
- if (iMask->componentAlpha) {
- switch (iDst->format) {
- case PICT_a8b8g8r8:
- case PICT_x8b8g8r8:
- func = IcCompositeSolidMask_nx8888x8888C;
- break;
- case PICT_b5g6r5:
- func = IcCompositeSolidMask_nx8888x0565C;
- break;
- }
- }
- break;
- case PICT_a1:
- switch (iDst->format) {
- case PICT_r5g6b5:
- case PICT_b5g6r5:
- case PICT_r8g8b8:
- case PICT_b8g8r8:
- case PICT_a8r8g8b8:
- case PICT_x8r8g8b8:
- case PICT_a8b8g8r8:
- case PICT_x8b8g8r8:
- func = IcCompositeSolidMask_nx1xn;
- break;
- }
- }
- }
- }
+ image->transform = malloc (sizeof (IcTransform));
+ if (!image->transform)
+ return BadAlloc;
}
- else
- {
- switch (iSrc->format) {
- case PICT_a8r8g8b8:
- case PICT_x8r8g8b8:
- switch (iDst->format) {
- case PICT_a8r8g8b8:
- case PICT_x8r8g8b8:
- func = IcCompositeSrc_8888x8888;
- break;
- case PICT_r8g8b8:
- func = IcCompositeSrc_8888x0888;
- break;
- case PICT_r5g6b5:
- func = IcCompositeSrc_8888x0565;
- break;
- }
- break;
- case PICT_a8b8g8r8:
- case PICT_x8b8g8r8:
- switch (iDst->format) {
- case PICT_a8b8g8r8:
- case PICT_x8b8g8r8:
- func = IcCompositeSrc_8888x8888;
- break;
- case PICT_b8g8r8:
- func = IcCompositeSrc_8888x0888;
- break;
- case PICT_b5g6r5:
- func = IcCompositeSrc_8888x0565;
- break;
- }
- break;
- case PICT_r5g6b5:
- switch (iDst->format) {
- case PICT_r5g6b5:
- func = IcCompositeSrc_0565x0565;
- break;
- }
- break;
- case PICT_b5g6r5:
- switch (iDst->format) {
- case PICT_b5g6r5:
- func = IcCompositeSrc_0565x0565;
- break;
- }
- break;
- }
- }
- break;
- case PictOpAdd:
- if (iMask == 0)
- {
- switch (iSrc->format) {
- case PICT_a8r8g8b8:
- switch (iDst->format) {
- case PICT_a8r8g8b8:
- func = IcCompositeSrcAdd_8888x8888;
- break;
- }
- break;
- case PICT_a8b8g8r8:
- switch (iDst->format) {
- case PICT_a8b8g8r8:
- func = IcCompositeSrcAdd_8888x8888;
- break;
- }
- break;
- case PICT_a8:
- switch (iDst->format) {
- case PICT_a8:
- func = IcCompositeSrcAdd_8000x8000;
- break;
- }
- break;
- case PICT_a1:
- switch (iDst->format) {
- case PICT_a1:
- func = IcCompositeSrcAdd_1000x1000;
- break;
- }
- break;
- }
- }
- break;
+ *image->transform = *transform;
}
- n = region->numRects;
- pbox = region->rects;
- while (n--)
+ else
{
- h = pbox->y2 - pbox->y1;
- y_src = pbox->y1 - yDst + ySrc;
- y_msk = pbox->y1 - yDst + yMask;
- y_dst = pbox->y1;
- while (h)
+ if (image->transform)
{
- h_this = h;
- w = pbox->x2 - pbox->x1;
- x_src = pbox->x1 - xDst + xSrc;
- x_msk = pbox->x1 - xDst + xMask;
- x_dst = pbox->x1;
- if (maskRepeat)
- {
- y_msk = mod (y_msk, iMask->pixels->height);
- if (h_this > iMask->pixels->height - y_msk)
- h_this = iMask->pixels->height - y_msk;
- }
- if (srcRepeat)
- {
- y_src = mod (y_src, iSrc->pixels->height);
- if (h_this > iSrc->pixels->height - y_src)
- h_this = iSrc->pixels->height - y_src;
- }
- while (w)
- {
- w_this = w;
- if (maskRepeat)
- {
- x_msk = mod (x_msk, iMask->pixels->width);
- if (w_this > iMask->pixels->width - x_msk)
- w_this = iMask->pixels->width - x_msk;
- }
- if (srcRepeat)
- {
- x_src = mod (x_src, iSrc->pixels->width);
- if (w_this > iSrc->pixels->width - x_src)
- w_this = iSrc->pixels->width - x_src;
- }
- (*func) (op, iSrc, iMask, iDst,
- x_src, y_src, x_msk, y_msk, x_dst, y_dst,
- w_this, h_this);
- w -= w_this;
- x_src += w_this;
- x_msk += w_this;
- x_dst += w_this;
- }
- h -= h_this;
- y_src += h_this;
- y_msk += h_this;
- y_dst += h_this;
+ free (image->transform);
+ image->transform = 0;
}
- pbox++;
}
- XDestroyRegion (region);
-}
-
-/* XXX: Still need to port this
-Bool
-IcImageInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
-{
-
- PictureScreenPtr ps;
-
- if (!miPictureInit (pScreen, formats, nformats))
- return FALSE;
- ps = GetPictureScreen(pScreen);
- ps->Composite = IcComposite;
- ps->Glyphs = miGlyphs;
- ps->CompositeRects = miCompositeRects;
- ps->RasterizeTrapezoid = IcRasterizeTrapezoid;
-
- return TRUE;
+ return Success;
}
-*/
void
IcImageDestroy (IcImage *image)
@@ -1245,133 +257,6 @@ IcImageChangeClip (IcImage *image,
return Success;
}
-#ifdef XXX_STILL_NEED_TO_PORT_THIS
-void
-miValidatePicture (PicturePtr pPicture,
- Mask mask)
-{
- DrawablePtr pDrawable = pPicture->pDrawable;
-
- if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) ||
- (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS)))
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWin = (WindowPtr) pDrawable;
- RegionPtr pregWin;
- Bool freeTmpClip, freeCompClip;
-
- if (pPicture->subWindowMode == IncludeInferiors)
- {
- pregWin = NotClippedByChildren(pWin);
- freeTmpClip = TRUE;
- }
- else
- {
- pregWin = &pWin->clipList;
- freeTmpClip = FALSE;
- }
- freeCompClip = pPicture->freeCompClip;
-
- /*
- * if there is no client clip, we can get by with just keeping the
- * pointer we got, and remembering whether or not should destroy
- * (or maybe re-use) it later. this way, we avoid unnecessary
- * copying of regions. (this wins especially if many clients clip
- * by children and have no client clip.)
- */
- if (pPicture->clientClipType == CT_NONE)
- {
- if (freeCompClip)
- REGION_DESTROY(pScreen, pPicture->pCompositeClip);
- pPicture->pCompositeClip = pregWin;
- pPicture->freeCompClip = freeTmpClip;
- }
- else
- {
- /*
- * we need one 'real' region to put into the composite clip. if
- * pregWin the current composite clip are real, we can get rid of
- * one. if pregWin is real and the current composite clip isn't,
- * use pregWin for the composite clip. if the current composite
- * clip is real and pregWin isn't, use the current composite
- * clip. if neither is real, create a new region.
- */
-
- REGION_TRANSLATE(pScreen, pPicture->clientClip,
- pDrawable->x + pPicture->clipOrigin.x,
- pDrawable->y + pPicture->clipOrigin.y);
-
- if (freeCompClip)
- {
- REGION_INTERSECT(pScreen, pPicture->pCompositeClip,
- pregWin, pPicture->clientClip);
- if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
- }
- else if (freeTmpClip)
- {
- REGION_INTERSECT(pScreen, pregWin, pregWin, pPicture->clientClip);
- pPicture->pCompositeClip = pregWin;
- }
- else
- {
- pPicture->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, pPicture->pCompositeClip,
- pregWin, pPicture->clientClip);
- }
- pPicture->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pPicture->clientClip,
- -(pDrawable->x + pPicture->clipOrigin.x),
- -(pDrawable->y + pPicture->clipOrigin.y));
- }
- } /* end of composite clip for a window */
- else
- {
- BoxRec pixbounds;
-
- /* XXX should we translate by drawable.x/y here ? */
- /* If you want pixmaps in offscreen memory, yes */
- pixbounds.x1 = pDrawable->x;
- pixbounds.y1 = pDrawable->y;
- pixbounds.x2 = pDrawable->x + pDrawable->width;
- pixbounds.y2 = pDrawable->y + pDrawable->height;
-
- if (pPicture->freeCompClip)
- {
- REGION_RESET(pScreen, pPicture->pCompositeClip, &pixbounds);
- }
- else
- {
- pPicture->freeCompClip = TRUE;
- pPicture->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
- }
-
- if (pPicture->clientClipType == CT_REGION)
- {
- if(pDrawable->x || pDrawable->y) {
- REGION_TRANSLATE(pScreen, pPicture->clientClip,
- pDrawable->x + pPicture->clipOrigin.x,
- pDrawable->y + pPicture->clipOrigin.y);
- REGION_INTERSECT(pScreen, pPicture->pCompositeClip,
- pPicture->pCompositeClip, pPicture->clientClip);
- REGION_TRANSLATE(pScreen, pPicture->clientClip,
- -(pDrawable->x + pPicture->clipOrigin.x),
- -(pDrawable->y + pPicture->clipOrigin.y));
- } else {
- REGION_TRANSLATE(pScreen, pPicture->pCompositeClip,
- -pPicture->clipOrigin.x, -pPicture->clipOrigin.y);
- REGION_INTERSECT(pScreen, pPicture->pCompositeClip,
- pPicture->pCompositeClip, pPicture->clientClip);
- REGION_TRANSLATE(pScreen, pPicture->pCompositeClip,
- pPicture->clipOrigin.x, pPicture->clipOrigin.y);
- }
- }
- } /* end of composite clip for pixmap */
- }
-}
-#endif
-
#define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v))
static __inline Bool
@@ -1443,6 +328,192 @@ IcClipImageSrc (Region region,
return TRUE;
}
+/* XXX: Need to decide what to do with this
+#define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val)
+
+#define NEXT_PTR(_type) ((_type) ulist++->ptr)
+
+int
+IcImageChange (IcImage *image,
+ Mask vmask,
+ XID *vlist,
+ DevUnion *ulist,
+ int *error_value)
+{
+ BITS32 index2;
+ int error = 0;
+ BITS32 maskQ;
+
+ maskQ = vmask;
+ while (vmask && !error)
+ {
+ index2 = (BITS32) lowbit (vmask);
+ vmask &= ~index2;
+ image->stateChanges |= index2;
+ switch (index2)
+ {
+ case CPRepeat:
+ {
+ unsigned int newr;
+ newr = NEXT_VAL(unsigned int);
+ if (newr <= xTrue)
+ image->repeat = newr;
+ else
+ {
+ *error_value = newr;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPAlphaMap:
+ {
+ IcImage *iAlpha;
+
+ iAlpha = NEXT_PTR(IcImage *);
+ if (iAlpha)
+ iAlpha->refcnt++;
+ if (image->alphaMap)
+ IcImageDestroy ((pointer) image->alphaMap);
+ image->alphaMap = iAlpha;
+ }
+ break;
+ case CPAlphaXOrigin:
+ image->alphaOrigin.x = NEXT_VAL(INT16);
+ break;
+ case CPAlphaYOrigin:
+ image->alphaOrigin.y = NEXT_VAL(INT16);
+ break;
+ case CPClipXOrigin:
+ image->clipOrigin.x = NEXT_VAL(INT16);
+ break;
+ case CPClipYOrigin:
+ image->clipOrigin.y = NEXT_VAL(INT16);
+ break;
+ case CPClipMask:
+ {
+ IcImage *mask;
+ int clipType;
+
+ mask = NEXT_PTR(IcImage *);
+ if (mask) {
+ clipType = CT_PIXMAP;
+ mask->refcnt++;
+ } else {
+ clipType = CT_NONE;
+ }
+ error = IcImageChangeClip (image, clipType,
+ (pointer)mask, 0);
+ break;
+ }
+ case CPGraphicsExposure:
+ {
+ unsigned int newe;
+ newe = NEXT_VAL(unsigned int);
+ if (newe <= xTrue)
+ image->graphicsExposures = newe;
+ else
+ {
+ *error_value = newe;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPSubwindowMode:
+ {
+ unsigned int news;
+ news = NEXT_VAL(unsigned int);
+ if (news == ClipByChildren || news == IncludeInferiors)
+ image->subWindowMode = news;
+ else
+ {
+ *error_value = news;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPPolyEdge:
+ {
+ unsigned int newe;
+ newe = NEXT_VAL(unsigned int);
+ if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth)
+ image->polyEdge = newe;
+ else
+ {
+ *error_value = newe;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPPolyMode:
+ {
+ unsigned int newm;
+ newm = NEXT_VAL(unsigned int);
+ if (newm == PolyModePrecise || newm == PolyModeImprecise)
+ image->polyMode = newm;
+ else
+ {
+ *error_value = newm;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPDither:
+ image->dither = NEXT_VAL(Atom);
+ break;
+ case CPComponentAlpha:
+ {
+ unsigned int newca;
+
+ newca = NEXT_VAL (unsigned int);
+ if (newca <= xTrue)
+ image->componentAlpha = newca;
+ else
+ {
+ *error_value = newca;
+ error = BadValue;
+ }
+ }
+ break;
+ default:
+ *error_value = maskQ;
+ error = BadValue;
+ break;
+ }
+ }
+ return error;
+}
+*/
+
+/* XXX: Do we need this?
+int
+SetPictureClipRects (PicturePtr pPicture,
+ int xOrigin,
+ int yOrigin,
+ int nRect,
+ xRectangle *rects)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ RegionPtr clientClip;
+ int result;
+
+ clientClip = RECTS_TO_REGION(pScreen,
+ nRect, rects, CT_UNSORTED);
+ if (!clientClip)
+ return BadAlloc;
+ result =(*ps->ChangePictureClip) (pPicture, CT_REGION,
+ (pointer) clientClip, 0);
+ if (result == Success)
+ {
+ pPicture->clipOrigin.x = xOrigin;
+ pPicture->clipOrigin.y = yOrigin;
+ pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
+ pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ }
+ return result;
+}
+*/
+
Bool
IcComputeCompositeRegion (Region region,
IcImage *iSrc,
@@ -1525,117 +596,3 @@ IcComputeCompositeRegion (Region region,
return TRUE;
}
-/* XXX: Do we need these functions?
-void
-miRenderColorToPixel (PictFormatPtr format,
- xRenderColor *color,
- CARD32 *pixel)
-{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
-
- switch (format->type) {
- case PictTypeDirect:
- r = color->red >> (16 - Ones (format->direct.redMask));
- g = color->green >> (16 - Ones (format->direct.greenMask));
- b = color->blue >> (16 - Ones (format->direct.blueMask));
- a = color->alpha >> (16 - Ones (format->direct.alphaMask));
- r = r << format->direct.red;
- g = g << format->direct.green;
- b = b << format->direct.blue;
- a = a << format->direct.alpha;
- *pixel = r|g|b|a;
- break;
- case PictTypeIndexed:
- pIndexed = (miIndexedPtr) (format->index.devPrivate);
- if (pIndexed->color)
- {
- r = color->red >> 11;
- g = color->green >> 11;
- b = color->blue >> 11;
- *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b);
- }
- else
- {
- r = color->red >> 8;
- g = color->green >> 8;
- b = color->blue >> 8;
- *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b);
- }
- break;
- }
-}
-
-static CARD16
-miFillColor (CARD32 pixel, int bits)
-{
- while (bits < 16)
- {
- pixel |= pixel << bits;
- bits <<= 1;
- }
- return (CARD16) pixel;
-}
-
-void
-miRenderPixelToColor (PictFormatPtr format,
- CARD32 pixel,
- xRenderColor *color)
-{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
-
- switch (format->type) {
- case PictTypeDirect:
- r = (pixel >> format->direct.red) & format->direct.redMask;
- g = (pixel >> format->direct.green) & format->direct.greenMask;
- b = (pixel >> format->direct.blue) & format->direct.blueMask;
- a = (pixel >> format->direct.alpha) & format->direct.alphaMask;
- color->red = miFillColor (r, Ones (format->direct.redMask));
- color->green = miFillColor (r, Ones (format->direct.greenMask));
- color->blue = miFillColor (r, Ones (format->direct.blueMask));
- color->alpha = miFillColor (r, Ones (format->direct.alphaMask));
- break;
- case PictTypeIndexed:
- pIndexed = (miIndexedPtr) (format->index.devPrivate);
- pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)];
- r = (pixel >> 16) & 0xff;
- g = (pixel >> 8) & 0xff;
- b = (pixel ) & 0xff;
- color->red = miFillColor (r, 8);
- color->green = miFillColor (g, 8);
- color->blue = miFillColor (b, 8);
- color->alpha = 0xffff;
- break;
- }
-}
-
-Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
-{
- PictureScreenPtr ps;
-
- if (!PictureInit (pScreen, formats, nformats))
- return FALSE;
- ps = GetPictureScreen(pScreen);
- ps->CreatePicture = miCreatePicture;
- ps->DestroyPicture = miDestroyPicture;
- ps->ChangePictureClip = miChangePictureClip;
- ps->DestroyPictureClip = miDestroyPictureClip;
- ps->ChangePicture = miChangePicture;
- ps->ValidatePicture = miValidatePicture;
- ps->InitIndexed = miInitIndexed;
- ps->CloseIndexed = miCloseIndexed;
- ps->UpdateIndexed = miUpdateIndexed;
-
- ps->Composite = 0;
- ps->Glyphs = miGlyphs;
- ps->CompositeRects = miCompositeRects;
- ps->Trapezoids = miTrapezoids;
- ps->Triangles = miTriangles;
- ps->TriStrip = miTriStrip;
- ps->TriFan = miTriFan;
-
- return TRUE;
-}
-*/
diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h
index 34970c67..0ff1dcb4 100644
--- a/pixman/src/icimage.h
+++ b/pixman/src/icimage.h
@@ -88,8 +88,6 @@ typedef union _DevUnion {
/* XXX: I'm not sure about several things here:
Do we want data to be IcBits * or unsigned char *?
-
- I don't think I'm currently initializing depth or bpp anywhere...
*/
typedef struct _DirectFormat {
CARD16 red, redMask;
@@ -324,22 +322,6 @@ IcCreateAlphaPicture (IcImage *dst,
CARD16 width,
CARD16 height);
-/* XXX: Do we need these?
-Bool
-IcInitIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-void
-IcCloseIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-void
-IcUpdateIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef);
-*/
-
typedef void (*CompositeFunc) (CARD8 op,
IcImage *iSrc,
IcImage *iMask,
diff --git a/pixman/src/icint.h b/pixman/src/icint.h
index 85c6b18c..18d5d892 100644
--- a/pixman/src/icint.h
+++ b/pixman/src/icint.h
@@ -163,10 +163,6 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data);
#define IcPatternOffsetBits (sizeof (IcBits) - 1)
#endif
-/* XXX: Don't think we need this
- #include "micoord.h"
-*/
-
#define IcStipLeft(x,n) IcScrLeft(x,n)
#define IcStipRight(x,n) IcScrRight(x,n)
@@ -522,100 +518,6 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data);
/* Whether 24-bit specific code is needed for this filled pixel value */
#define IcCheck24Pix(p) ((p) == IcNext24Pix(p))
-/* Macros for dealing with dashing */
-
-#define IcDashDeclare \
- unsigned char *__dash, *__firstDash, *__lastDash
-
-#define IcDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
- (even) = TRUE; \
- __firstDash = (pGC)->dash; \
- __lastDash = __firstDash + (pGC)->numInDashList; \
- (dashOffset) %= (pPriv)->dashLength; \
- \
- __dash = __firstDash; \
- while ((dashOffset) >= ((dashlen) = *__dash)) \
- { \
- (dashOffset) -= (dashlen); \
- (even) = 1-(even); \
- if (++__dash == __lastDash) \
- __dash = __firstDash; \
- } \
- (dashlen) -= (dashOffset); \
-}
-
-#define IcDashNext(dashlen) { \
- if (++__dash == __lastDash) \
- __dash = __firstDash; \
- (dashlen) = *__dash; \
-}
-
-/* as numInDashList is always even, this case can skip a test */
-
-#define IcDashNextEven(dashlen) { \
- (dashlen) = *++__dash; \
-}
-
-#define IcDashNextOdd(dashlen) IcDashNext(dashlen)
-
-#define IcDashStep(dashlen,even) { \
- if (!--(dashlen)) { \
- IcDashNext(dashlen); \
- (even) = 1-(even); \
- } \
-}
-
-extern int IcGCPrivateIndex;
-#ifndef IC_NO_WINDOW_PIXMAPS
-extern int IcWinPrivateIndex;
-#endif
-
-#ifdef TEKX11
-#define IC_OLD_GC
-#define IC_OLD_SCREEN
-#endif
-
-#ifdef IC_OLD_SCREEN
-extern WindowPtr *WindowTable;
-#endif
-
-#ifdef IC_24_32BIT
-#define IC_SCREEN_PRIVATE
-#endif
-
-#ifdef IC_SCREEN_PRIVATE
-extern int IcScreenPrivateIndex;
-
-/* private field of a screen */
-typedef struct {
- unsigned char win32bpp; /* window bpp for 32-bpp images */
- unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
-} IcScreenPrivRec, *IcScreenPrivPtr;
-
-#define IcGetScreenPrivate(pScreen) ((icScreenPrivPtr) \
- (pScreen)->devPrivates[icScreenPrivateIndex].ptr)
-#endif
-
-/* private field of GC */
-typedef struct {
-#ifdef IC_OLD_GC
- unsigned char pad1;
- unsigned char pad2;
- unsigned char pad3;
- unsigned fExpose:1;
- unsigned freeCompClip:1;
- PixmapPtr pRotatedPixmap;
- RegionPtr pCompositeClip;
-#endif
- IcBits and, xor; /* reduced rop values */
- IcBits bgand, bgxor; /* for stipples */
- IcBits fg, bg, pm; /* expanded and filled */
- unsigned int dashLength; /* total of all dash elements */
- unsigned char oneRect; /* clip list is single rectangle */
- unsigned char evenStipple; /* stipple is even */
- unsigned char bpp; /* current drawable bpp */
-} IcGCPrivRec, *IcGCPrivPtr;
-
#define IcGetPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \
(pointer) = icpixels->data; \
(_stride_) = icpixels->stride / sizeof(IcBits); \
@@ -757,67 +659,6 @@ IcBltOne24 (IcStip *src,
IcBits bgxor);
#endif
-/* XXX: Do we need this?
-void
-IcBltPlane (IcBits *src,
- IcStride srcStride,
- int srcX,
- int srcBpp,
-
- IcStip *dst,
- IcStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- IcStip fgand,
- IcStip fgxor,
- IcStip bgand,
- IcStip bgxor,
- Pixel planeMask);
-*/
-
-/*
- * icpict.c
- */
-
-/* XXX: Name clash...
-Bool
-IcImageInit (ScreenPtr pScreen,
- PictFormatPtr formats,
- int nformats);
-*/
-
-/*
- * icsolid.c
- */
-
-void
-IcSolid (IcBits *dst,
- IcStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
-
- IcBits and,
- IcBits xor);
-
-#ifdef IC_24BIT
-void
-IcSolid24 (IcBits *dst,
- IcStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- IcBits and,
- IcBits xor);
-#endif
-
/*
* icstipple.c
*/
@@ -894,68 +735,6 @@ IcStipple (IcBits *dst,
int xRot,
int yRot);
-/*
- * ictile.c
- */
-
-/* XXX: I screwed this up somehow in the fb->Ic rename
-void
-IcEvenTile (IcBits *dst,
- IcStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- IcBits *tile,
- int tileHeight,
-
- int alu,
- IcBits pm,
- int xRot,
- int yRot);
-*/
-
-void
-IcOddTile (IcBits *dst,
- IcStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- IcBits *tile,
- IcStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- IcBits pm,
- int bpp,
-
- int xRot,
- int yRot);
-
-void
-IcTile (IcBits *dst,
- IcStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- IcBits *tile,
- IcStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- IcBits pm,
- int bpp,
-
- int xRot,
- int yRot);
-
struct _IcPixels {
IcBits *data;
unsigned int width;
diff --git a/pixman/src/ictransform.c b/pixman/src/ictransform.c
new file mode 100644
index 00000000..ab74f4d1
--- /dev/null
+++ b/pixman/src/ictransform.c
@@ -0,0 +1,70 @@
+/*
+ * $XFree86: $
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#include "icint.h"
+
+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)
+{
+ PictVector result;
+ int i, j;
+ xFixed_32_32 partial;
+ xFixed_48_16 v;
+
+ for (j = 0; j < 3; j++)
+ {
+ v = 0;
+ for (i = 0; i < 3; i++)
+ {
+ partial = ((xFixed_48_16) transform->matrix[j][i] *
+ (xFixed_48_16) vector->vector[i]);
+ v += partial >> 16;
+ }
+ if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
+ return FALSE;
+ result.vector[j] = (xFixed) v;
+ }
+ if (!result.vector[2])
+ return FALSE;
+ for (j = 0; j < 2; j++)
+ {
+ partial = (xFixed_48_16) result.vector[j] << 16;
+ v = partial / result.vector[2];
+ if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
+ return FALSE;
+ vector->vector[j] = (xFixed) v;
+ }
+ vector->vector[2] = xFixed1;
+ return TRUE;
+}
+
+*/
diff --git a/pixman/src/icutil.c b/pixman/src/icutil.c
index 9d12fa6e..9d035c36 100644
--- a/pixman/src/icutil.c
+++ b/pixman/src/icutil.c
@@ -39,87 +39,6 @@ IcReplicatePixel (Pixel p, int bpp)
return b;
}
-#ifdef XXX_DO_WE_NEED_THIS
-void
-IcReduceRasterOp (int rop, IcBits fg, IcBits pm, IcBits *andp, IcBits *xorp)
-{
- IcBits and, xor;
-
- switch (rop)
- {
- default:
- case GXclear: /* 0 0 0 0 */
- and = 0;
- xor = 0;
- break;
- case GXand: /* 0 0 0 1 */
- and = fg;
- xor = 0;
- break;
- case GXandReverse: /* 0 0 1 0 */
- and = fg;
- xor = fg;
- break;
- case GXcopy: /* 0 0 1 1 */
- and = 0;
- xor = fg;
- break;
- case GXandInverted: /* 0 1 0 0 */
- and = ~fg;
- xor = 0;
- break;
- case GXnoop: /* 0 1 0 1 */
- and = IC_ALLONES;
- xor = 0;
- break;
- case GXxor: /* 0 1 1 0 */
- and = IC_ALLONES;
- xor = fg;
- break;
- case GXor: /* 0 1 1 1 */
- and = ~fg;
- xor = fg;
- break;
- case GXnor: /* 1 0 0 0 */
- and = ~fg;
- xor = ~fg;
- break;
- case GXequiv: /* 1 0 0 1 */
- and = IC_ALLONES;
- xor = ~fg;
- break;
- case GXinvert: /* 1 0 1 0 */
- and = IC_ALLONES;
- xor = IC_ALLONES;
- break;
- case GXorReverse: /* 1 0 1 1 */
- and = ~fg;
- xor = IC_ALLONES;
- break;
- case GXcopyInverted: /* 1 1 0 0 */
- and = 0;
- xor = ~fg;
- break;
- case GXorInverted: /* 1 1 0 1 */
- and = fg;
- xor = ~fg;
- break;
- case GXnand: /* 1 1 1 0 */
- and = fg;
- xor = IC_ALLONES;
- break;
- case GXset: /* 1 1 1 1 */
- and = 0;
- xor = IC_ALLONES;
- break;
- }
- and |= ~pm;
- xor &= pm;
- *andp = and;
- *xorp = xor;
-}
-#endif /* XXX_DO_WE_NEED_THIS */
-
#define O 0
#define I IC_ALLONES