diff options
author | marha <marha@users.sourceforge.net> | 2010-11-15 16:51:22 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-11-15 16:51:22 +0000 |
commit | f586b49ae23c573681b939ca44b3f418c83c84b2 (patch) | |
tree | ffafe2da4517c5121ab4a8c64966e72829147215 /xorg-server/fb | |
parent | 728ff03357b2dfd7048ab093183a239a0ba044c4 (diff) | |
parent | 3a82f8a35b2c6d094cf9d0d5a3ccb9dd9b85f626 (diff) | |
download | vcxsrv-f586b49ae23c573681b939ca44b3f418c83c84b2.tar.gz vcxsrv-f586b49ae23c573681b939ca44b3f418c83c84b2.tar.bz2 vcxsrv-f586b49ae23c573681b939ca44b3f418c83c84b2.zip |
svn merge "^/branches/released" .
Solved mouse motion bug in new version of dix/getevents.c
Diffstat (limited to 'xorg-server/fb')
-rw-r--r-- | xorg-server/fb/Makefile.am | 2 | ||||
-rw-r--r-- | xorg-server/fb/fb.h | 2 | ||||
-rw-r--r-- | xorg-server/fb/fbcmap.c | 586 | ||||
-rw-r--r-- | xorg-server/fb/fbpict.c | 125 | ||||
-rw-r--r-- | xorg-server/fb/fbpict.h | 552 | ||||
-rw-r--r-- | xorg-server/fb/fbtrap.c | 319 | ||||
-rw-r--r-- | xorg-server/fb/wfbrename.h | 17 |
7 files changed, 229 insertions, 1374 deletions
diff --git a/xorg-server/fb/Makefile.am b/xorg-server/fb/Makefile.am index 21ed7b624..0863d7c07 100644 --- a/xorg-server/fb/Makefile.am +++ b/xorg-server/fb/Makefile.am @@ -55,4 +55,4 @@ libfb_la_SOURCES = \ libwfb_la_SOURCES = $(libfb_la_SOURCES)
-EXTRA_DIST = fbcmap.c fbcmap_mi.c
+EXTRA_DIST = fbcmap_mi.c
diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h index 14c5ed137..cefd410dd 100644 --- a/xorg-server/fb/fb.h +++ b/xorg-server/fb/fb.h @@ -1262,7 +1262,7 @@ fbBltPlane (FbBits *src, Pixel planeMask);
/*
- * fbcmap.c
+ * fbcmap_mi.c
*/
extern _X_EXPORT int
fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
diff --git a/xorg-server/fb/fbcmap.c b/xorg-server/fb/fbcmap.c deleted file mode 100644 index 123b7f41d..000000000 --- a/xorg-server/fb/fbcmap.c +++ /dev/null @@ -1,586 +0,0 @@ -/*
- * Copyright © 1987 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "colormapst.h"
-#include "resource.h"
-#include "fb.h"
-
-#ifdef XFree86Server
-#error "You should be compiling fbcmap_mi.c instead of fbcmap.c!"
-#endif
-
-static DevPrivateKeyRec cmapScrPrivateKeyRec;
-#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
-
-#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
-#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
-
-int
-fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
-{
- /* By the time we are processing requests, we can guarantee that there
- * is always a colormap installed */
- *pmaps = GetInstalledColormap(pScreen)->mid;
- return 1;
-}
-
-
-void
-fbInstallColormap(ColormapPtr pmap)
-{
- ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);
-
- if(pmap != oldpmap)
- {
- /* Uninstall pInstalledMap. No hardware changes required, just
- * notify all interested parties. */
- if(oldpmap != (ColormapPtr)None)
- WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
- /* Install pmap */
- SetInstalledColormap(pmap->pScreen, pmap);
- WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
- }
-}
-
-void
-fbUninstallColormap(ColormapPtr pmap)
-{
- ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
-
- if(pmap == curpmap)
- {
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- dixLookupResourceByType((pointer *)&curpmap,
- pmap->pScreen->defColormap,
- RT_COLORMAP,
- serverClient, DixInstallAccess);
- (*pmap->pScreen->InstallColormap)(curpmap);
- }
- }
-}
-
-void
-fbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
-{
- int shift = 16 - pVisual->bitsPerRGBValue;
- unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1;
-
- if ((pVisual->class | DynamicClass) == GrayScale)
- {
- /* rescale to gray then rgb bits */
- *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
- *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
- }
- else
- {
- /* rescale to rgb bits */
- *pred = ((*pred >> shift) * 65535) / lim;
- *pgreen = ((*pgreen >> shift) * 65535) / lim;
- *pblue = ((*pblue >> shift) * 65535) / lim;
- }
-}
-
-Bool
-fbInitializeColormap(ColormapPtr pmap)
-{
- register unsigned i;
- register VisualPtr pVisual;
- unsigned lim, maxent, shift;
-
- pVisual = pmap->pVisual;
- lim = (1 << pVisual->bitsPerRGBValue) - 1;
- shift = 16 - pVisual->bitsPerRGBValue;
- maxent = pVisual->ColormapEntries - 1;
- if (pVisual->class == TrueColor)
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red =
- ((((i * 65535) / limr) >> shift) * 65535) / lim;
- pmap->green[i].co.local.green =
- ((((i * 65535) / limg) >> shift) * 65535) / lim;
- pmap->blue[i].co.local.blue =
- ((((i * 65535) / limb) >> shift) * 65535) / lim;
- }
- }
- else if (pVisual->class == StaticColor)
- {
- unsigned n;
- unsigned r, g, b;
- unsigned red, green, blue;
-
- for (n = 0; n*n*n < pVisual->ColormapEntries; n++)
- ;
- n--;
- i = 0;
- for (r = 0; r < n; r++)
- {
- red = (((r * 65535 / (n - 1)) >> shift) * 65535) / lim;
- for (g = 0; g < n; g++)
- {
- green = (((g * 65535 / (n - 1)) >> shift) * 65535) / lim;
- for (b = 0; b < n; b++)
- {
- blue = (((b * 65535 / (n - 1)) >> shift) * 65535) / lim;
- pmap->red[i].co.local.red = red;
- pmap->red[i].co.local.green = green;
- pmap->red[i].co.local.blue = blue;
- i++;
- }
- }
- }
- n = pVisual->ColormapEntries - i;
- for (r = 0; r < n; r++)
- {
- red = (((r * 65535 / (n - 1)) >> shift) * 65535) / lim;
- pmap->red[i].co.local.red = red;
- pmap->red[i].co.local.green = red;
- pmap->red[i].co.local.blue = red;
- i++;
- }
- }
- else if (pVisual->class == StaticGray)
- {
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift)
- * 65535) / lim;
- pmap->red[i].co.local.green = pmap->red[i].co.local.red;
- pmap->red[i].co.local.blue = pmap->red[i].co.local.red;
- }
- }
- return TRUE;
-}
-
-/* When simulating DirectColor on PseudoColor hardware, multiple
- entries of the colormap must be updated
- */
-
-#define AddElement(mask) { \
- pixel = red | green | blue; \
- for (i = 0; i < nresult; i++) \
- if (outdefs[i].pixel == pixel) \
- break; \
- if (i == nresult) \
- { \
- nresult++; \
- outdefs[i].pixel = pixel; \
- outdefs[i].flags = 0; \
- } \
- outdefs[i].flags |= (mask); \
- outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \
- outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \
- outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \
-}
-
-int
-fbExpandDirectColors (ColormapPtr pmap,
- int ndef,
- xColorItem *indefs,
- xColorItem *outdefs)
-{
- register int red, green, blue;
- int maxred, maxgreen, maxblue;
- int stepred, stepgreen, stepblue;
- VisualPtr pVisual;
- register int pixel;
- register int nresult;
- register int i;
-
- pVisual = pmap->pVisual;
-
- stepred = 1 << pVisual->offsetRed;
- stepgreen = 1 << pVisual->offsetGreen;
- stepblue = 1 << pVisual->offsetBlue;
- maxred = pVisual->redMask;
- maxgreen = pVisual->greenMask;
- maxblue = pVisual->blueMask;
- nresult = 0;
- for (;ndef--; indefs++)
- {
- if (indefs->flags & DoRed)
- {
- red = indefs->pixel & pVisual->redMask;
- for (green = 0; green <= maxgreen; green += stepgreen)
- {
- for (blue = 0; blue <= maxblue; blue += stepblue)
- {
- AddElement (DoRed)
- }
- }
- }
- if (indefs->flags & DoGreen)
- {
- green = indefs->pixel & pVisual->greenMask;
- for (red = 0; red <= maxred; red += stepred)
- {
- for (blue = 0; blue <= maxblue; blue += stepblue)
- {
- AddElement (DoGreen)
- }
- }
- }
- if (indefs->flags & DoBlue)
- {
- blue = indefs->pixel & pVisual->blueMask;
- for (red = 0; red <= maxred; red += stepred)
- {
- for (green = 0; green <= maxgreen; green += stepgreen)
- {
- AddElement (DoBlue)
- }
- }
- }
- }
- return nresult;
-}
-
-Bool
-fbCreateDefColormap(ScreenPtr pScreen)
-{
- unsigned short zero = 0, ones = 0xFFFF;
- VisualPtr pVisual;
- ColormapPtr cmap;
- Pixel wp, bp;
-
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++)
- ;
-
- if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap,
- (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
- 0)
- != Success)
- return FALSE;
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
- if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) !=
- Success) ||
- (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- return FALSE;
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
- (*pScreen->InstallColormap)(cmap);
- return TRUE;
-}
-
-extern int defaultColorVisualClass;
-
-#define _RZ(d) ((d + 2) / 3)
-#define _RS(d) 0
-#define _RM(d) ((1 << _RZ(d)) - 1)
-#define _GZ(d) ((d - _RZ(d) + 1) / 2)
-#define _GS(d) _RZ(d)
-#define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d))
-#define _BZ(d) (d - _RZ(d) - _GZ(d))
-#define _BS(d) (_RZ(d) + _GZ(d))
-#define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d))
-#define _CE(d) (1 << _RZ(d))
-
-#define MAX_PSEUDO_DEPTH 10 /* largest DAC size I know */
-
-#define StaticGrayMask (1 << StaticGray)
-#define GrayScaleMask (1 << GrayScale)
-#define StaticColorMask (1 << StaticColor)
-#define PseudoColorMask (1 << PseudoColor)
-#define TrueColorMask (1 << TrueColor)
-#define DirectColorMask (1 << DirectColor)
-
-#define ALL_VISUALS (StaticGrayMask|\
- GrayScaleMask|\
- StaticColorMask|\
- PseudoColorMask|\
- TrueColorMask|\
- DirectColorMask)
-
-#define LARGE_VISUALS (TrueColorMask|\
- DirectColorMask)
-
-typedef struct _fbVisuals {
- struct _fbVisuals *next;
- int depth;
- int bitsPerRGB;
- int visuals;
- int count;
- Pixel redMask, greenMask, blueMask;
-} fbVisualsRec, *fbVisualsPtr;
-
-static const int fbVisualPriority[] = {
- PseudoColor, DirectColor, GrayScale, StaticColor, TrueColor, StaticGray
-};
-
-#define NUM_PRIORITY 6
-
-static fbVisualsPtr fbVisuals;
-
-static int
-popCount (int i)
-{
- int count;
-
- count = (i >> 1) & 033333333333;
- count = i - count - ((count >> 1) & 033333333333);
- count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */
- return count;
-}
-
-/*
- * Distance to least significant one bit
- */
-static int
-maskShift (Pixel p)
-{
- int s;
-
- if (!p) return 0;
- s = 0;
- while (!(p & 1))
- {
- s++;
- p >>= 1;
- }
- return s;
-}
-
-Bool
-fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
- Pixel redMask, Pixel greenMask, Pixel blueMask)
-{
- fbVisualsPtr new, *prev, v;
-
- new = (fbVisualsPtr) malloc(sizeof *new);
- if (!new)
- return FALSE;
- if (!redMask || !greenMask || !blueMask)
- {
- redMask = _RM(depth);
- greenMask = _GM(depth);
- blueMask = _BM(depth);
- }
- new->next = 0;
- new->depth = depth;
- new->visuals = visuals;
- new->bitsPerRGB = bitsPerRGB;
- new->redMask = redMask;
- new->greenMask = greenMask;
- new->blueMask = blueMask;
- new->count = popCount (visuals);
- for (prev = &fbVisuals; (v = *prev); prev = &v->next);
- *prev = new;
- return TRUE;
-}
-
-Bool
-fbHasVisualTypes (int depth)
-{
- fbVisualsPtr v;
-
- for (v = fbVisuals; v; v = v->next)
- if (v->depth == depth)
- return TRUE;
- return FALSE;
-}
-
-Bool
-fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
-{
- return fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB,
- _RM(depth), _GM(depth), _BM(depth));
-}
-
-/*
- * Given a list of formats for a screen, create a list
- * of visuals and depths for the screen which coorespond to
- * the set which can be used with this version of fb.
- */
-
-Bool
-fbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB)
-{
- int i, j = 0, k;
- VisualPtr visual;
- DepthPtr depth;
- VisualID *vid;
- int d, b;
- int f;
- int ndepth, nvisual;
- int nvtype;
- int vtype;
- fbVisualsPtr visuals, nextVisuals;
-
- /* none specified, we'll guess from pixmap formats */
- if (!fbVisuals)
- {
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- d = screenInfo.formats[f].depth;
- b = screenInfo.formats[f].bitsPerPixel;
- if (sizes & (1 << (b - 1)))
- {
- if (d > MAX_PSEUDO_DEPTH)
- vtype = LARGE_VISUALS;
- else if (d == 1)
- vtype = StaticGrayMask;
- else
- vtype = ALL_VISUALS;
- }
- else
- vtype = 0;
- if (!fbSetVisualTypes (d, vtype, bitsPerRGB))
- return FALSE;
- }
- }
- nvisual = 0;
- ndepth = 0;
- for (visuals = fbVisuals; visuals; visuals = nextVisuals)
- {
- nextVisuals = visuals->next;
- ndepth++;
- nvisual += visuals->count;
- }
- depth = (DepthPtr) malloc(ndepth * sizeof (DepthRec));
- visual = (VisualPtr) malloc(nvisual * sizeof (VisualRec));
- if (!depth || !visual)
- {
- free(depth);
- free(visual);
- return FALSE;
- }
- *depthp = depth;
- *visualp = visual;
- *ndepthp = ndepth;
- *nvisualp = nvisual;
- for (visuals = fbVisuals; visuals; visuals = nextVisuals)
- {
- nextVisuals = visuals->next;
- d = visuals->depth;
- vtype = visuals->visuals;
- nvtype = visuals->count;
- vid = NULL;
- if (nvtype)
- {
- vid = (VisualID *) malloc(nvtype * sizeof (VisualID));
- if (!vid)
- return FALSE;
- }
- depth->depth = d;
- depth->numVids = nvtype;
- depth->vids = vid;
- depth++;
- for (i = 0; i < NUM_PRIORITY; i++) {
- if (! (vtype & (1 << fbVisualPriority[i])))
- continue;
- visual->class = fbVisualPriority[i];
- visual->bitsPerRGBValue = visuals->bitsPerRGB;
- visual->ColormapEntries = 1 << d;
- visual->nplanes = d;
- visual->vid = *vid = FakeClientID (0);
- switch (visual->class) {
- case PseudoColor:
- case GrayScale:
- case StaticGray:
- case StaticColor:
- visual->redMask = 0;
- visual->greenMask = 0;
- visual->blueMask = 0;
- visual->offsetRed = 0;
- visual->offsetGreen = 0;
- visual->offsetBlue = 0;
- break;
- case DirectColor:
- case TrueColor:
- visual->ColormapEntries = _CE(d);
- visual->redMask = visuals->redMask;
- visual->greenMask = visuals->greenMask;
- visual->blueMask = visuals->blueMask;
- visual->offsetRed = maskShift (visuals->redMask);
- visual->offsetGreen = maskShift (visuals->greenMask);
- visual->offsetBlue = maskShift (visuals->blueMask);
- }
- vid++;
- visual++;
- }
- free(visuals);
- }
- fbVisuals = NULL;
- visual = *visualp;
- depth = *depthp;
- for (i = 0; i < ndepth; i++)
- {
- if (*rootDepthp && *rootDepthp != depth[i].depth)
- continue;
- for (j = 0; j < depth[i].numVids; j++)
- {
- for (k = 0; k < nvisual; k++)
- if (visual[k].vid == depth[i].vids[j])
- break;
- if (k == nvisual)
- continue;
- if (defaultColorVisualClass < 0 ||
- visual[k].class == defaultColorVisualClass)
- break;
- }
- if (j != depth[i].numVids)
- break;
- }
- if (i == ndepth) {
- for (i = 0; i < ndepth; i++)
- {
- if (depth[i].numVids)
- break;
- }
- if (i == ndepth)
- return FALSE;
- j = 0;
- }
- *rootDepthp = depth[i].depth;
- *defaultVisp = depth[i].vids[j];
- return TRUE;
-}
diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c index 9e2c35c4b..c27fb4e20 100644 --- a/xorg-server/fb/fbpict.c +++ b/xorg-server/fb/fbpict.c @@ -35,112 +35,6 @@ #include "mipict.h"
#include "fbpict.h"
-#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
-void
-fbWalkCompositeRegion (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height,
- Bool srcRepeat,
- Bool maskRepeat,
- CompositeFunc compositeRect)
-{
- RegionRec region;
- int n;
- BoxPtr pbox;
- int w, h, w_this, h_this;
- int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- if (pSrc->pDrawable)
- {
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
- }
- if (pMask && pMask->pDrawable)
- {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- }
-
- if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height))
- return;
-
- n = RegionNumRects (®ion);
- pbox = RegionRects (®ion);
- while (n--)
- {
- 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 - pMask->pDrawable->y, pMask->pDrawable->height);
- if (h_this > pMask->pDrawable->height - y_msk)
- h_this = pMask->pDrawable->height - y_msk;
- y_msk += pMask->pDrawable->y;
- }
- if (srcRepeat)
- {
- y_src = mod (y_src - pSrc->pDrawable->y, pSrc->pDrawable->height);
- if (h_this > pSrc->pDrawable->height - y_src)
- h_this = pSrc->pDrawable->height - y_src;
- y_src += pSrc->pDrawable->y;
- }
- while (w)
- {
- w_this = w;
- if (maskRepeat)
- {
- x_msk = mod (x_msk - pMask->pDrawable->x, pMask->pDrawable->width);
- if (w_this > pMask->pDrawable->width - x_msk)
- w_this = pMask->pDrawable->width - x_msk;
- x_msk += pMask->pDrawable->x;
- }
- if (srcRepeat)
- {
- x_src = mod (x_src - pSrc->pDrawable->x, pSrc->pDrawable->width);
- if (w_this > pSrc->pDrawable->width - x_src)
- w_this = pSrc->pDrawable->width - x_src;
- x_src += pSrc->pDrawable->x;
- }
- (*compositeRect) (op, pSrc, pMask, pDst,
- 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++;
- }
- RegionUninit(®ion);
-}
-
void
fbComposite (CARD8 op,
PicturePtr pSrc,
@@ -182,25 +76,6 @@ fbComposite (CARD8 op, free_pixman_pict (pDst, dest);
}
-void
-fbCompositeGeneral (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- fbComposite (op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
-}
-
static pixman_image_t *
create_solid_fill_image (PicturePtr pict)
{
diff --git a/xorg-server/fb/fbpict.h b/xorg-server/fb/fbpict.h index b89f90ff1..e7daaa245 100644 --- a/xorg-server/fb/fbpict.h +++ b/xorg-server/fb/fbpict.h @@ -1,484 +1,68 @@ -/* - * - * Copyright © 2000 Keith Packard, member of The XFree86 Project, 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _FBPICT_H_ -#define _FBPICT_H_ - -#include "renderedge.h" - - -#if defined(__GNUC__) -#define INLINE __inline__ -#else -#define INLINE -#endif - -#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) -#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b)) - -#define FbGet8(v,i) ((CARD16) (CARD8) ((v) >> i)) - -/* - * There are two ways of handling alpha -- either as a single unified value or - * a separate value for each component, hence each macro must have two - * versions. The unified alpha version has a 'U' at the end of the name, - * the component version has a 'C'. Similarly, functions which deal with - * this difference will have two versions using the same convention. - */ - -#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) - -#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) - -#define FbInU(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),(a),(t)) << (i)) - -#define FbInC(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i)) - -#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \ - FbIntMult(FbGet8(x,i),ax,(v))),\ - (CARD32) ((CARD8) ((t) | \ - (0 - ((t) >> 8)))) << (i)) - -#define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) - - -#define Alpha(x) ((x) >> 24) -#define Red(x) (((x) >> 16) & 0xff) -#define Green(x) (((x) >> 8) & 0xff) -#define Blue(x) ((x) & 0xff) - -/** - * Returns TRUE if the fbComposeGetSolid can be used to get a single solid - * color representing every source sampling location of the picture. - */ -static INLINE Bool -fbCanGetSolid(PicturePtr pict) -{ - if (pict->pDrawable == NULL || - pict->pDrawable->width != 1 || - pict->pDrawable->height != 1) - { - return FALSE; - } - if (pict->repeat != RepeatNormal) - return FALSE; - - switch (pict->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - case PICT_b8g8r8a8: - case PICT_b8g8r8x8: - case PICT_r8g8b8: - case PICT_b8g8r8: - case PICT_r5g6b5: - case PICT_b5g6r5: - return TRUE; - default: - return FALSE; - } -} - -#define fbComposeGetSolid(pict, bits, fmt) { \ - FbBits *__bits__; \ - FbStride __stride__; \ - int __bpp__; \ - int __xoff__,__yoff__; \ -\ - fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ - switch (__bpp__) { \ - case 32: \ - (bits) = READ((CARD32 *) __bits__); \ - break; \ - case 24: \ - (bits) = Fetch24 ((CARD8 *) __bits__); \ - break; \ - case 16: \ - (bits) = READ((CARD16 *) __bits__); \ - (bits) = cvt0565to0888(bits); \ - break; \ - case 8: \ - (bits) = READ((CARD8 *) __bits__); \ - (bits) = (bits) << 24; \ - break; \ - case 1: \ - (bits) = READ((CARD32 *) __bits__); \ - (bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\ - break; \ - default: \ - return; \ - } \ - /* If necessary, convert RGB <--> BGR. */ \ - if (PICT_FORMAT_TYPE((pict)->format) != PICT_FORMAT_TYPE(fmt)) \ - { \ - (bits) = (((bits) & 0xff000000) | \ - (((bits) & 0x00ff0000) >> 16) | \ - (((bits) & 0x0000ff00) >> 0) | \ - (((bits) & 0x000000ff) << 16)); \ - } \ - /* manage missing src alpha */ \ - if ((pict)->pFormat->direct.alphaMask == 0) \ - (bits) |= 0xff000000; \ - fbFinishAccess ((pict)->pDrawable); \ -} - -#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ - FbBits *__bits__; \ - FbStride __stride__; \ - int __bpp__; \ - int __xoff__,__yoff__; \ -\ - fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ - (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ - (line) = ((type *) __bits__) + (stride) * ((y) + __yoff__) + (mul) * ((x) + __xoff__); \ -} -#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ - (((s) >> 5) & 0x07e0) | \ - (((s) >> 8) & 0xf800)) -#define cvt0565to0888(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 ? \ - ((READ(a) << 16) | READ((CARD16 *) ((a)+1))) : \ - ((READ((CARD16 *) (a)) << 8) | READ((a)+2))) -#define Store24(a,v) ((unsigned long) (a) & 1 ? \ - (WRITE(a, (CARD8) ((v) >> 16)), \ - WRITE((CARD16 *) ((a)+1), (CARD16) (v))) : \ - (WRITE((CARD16 *) (a), (CARD16) ((v) >> 8)), \ - WRITE((a)+2, (CARD8) (v)))) -#else -#define Fetch24(a) ((unsigned long) (a) & 1 ? \ - (READ(a) | (READ((CARD16 *) ((a)+1)) << 8)) : \ - (READ((CARD16 *) (a)) | (READ((a)+2) << 16))) -#define Store24(a,v) ((unsigned long) (a) & 1 ? \ - (WRITE(a, (CARD8) (v)), \ - WRITE((CARD16 *) ((a)+1), (CARD16) ((v) >> 8))) : \ - (WRITE((CARD16 *) (a), (CARD16) (v)),\ - WRITE((a)+2, (CARD8) ((v) >> 16)))) -#endif - -/* - The methods below use some tricks to be able to do two color - components at the same time. -*/ - -/* - x_c = (x_c * a) / 255 -*/ -#define FbByteMul(x, a) do { \ - CARD32 t = ((x & 0xff00ff) * a) + 0x800080; \ - t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ - t &= 0xff00ff; \ - \ - x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ - x = (x + ((x >> 8) & 0xff00ff)); \ - x &= 0xff00ff00; \ - x += t; \ - } while (0) - -/* - x_c = (x_c * a) / 255 + y -*/ -#define FbByteMulAdd(x, a, y) do { \ - CARD32 t = ((x & 0xff00ff) * a) + 0x800080; \ - t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ - t &= 0xff00ff; \ - t += y & 0xff00ff; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - \ - x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ - x = (x + ((x >> 8) & 0xff00ff)) >> 8; \ - x &= 0xff00ff; \ - x += (y >> 8) & 0xff00ff; \ - x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ - x &= 0xff00ff; \ - x <<= 8; \ - x += t; \ - } while (0) - -/* - x_c = (x_c * a + y_c * b) / 255 -*/ -#define FbByteAddMul(x, a, y, b) do { \ - CARD32 t; \ - CARD32 r = (x >> 24) * a + (y >> 24) * b + 0x80; \ - r += (r >> 8); \ - r >>= 8; \ - \ - t = (x & 0xff00) * a + (y & 0xff00) * b; \ - t += (t >> 8) + 0x8000; \ - t >>= 16; \ - \ - t |= r << 16; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - t <<= 8; \ - \ - r = ((x >> 16) & 0xff) * a + ((y >> 16) & 0xff) * b + 0x80; \ - r += (r >> 8); \ - r >>= 8; \ - \ - x = (x & 0xff) * a + (y & 0xff) * b + 0x80; \ - x += (x >> 8); \ - x >>= 8; \ - x |= r << 16; \ - x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ - x &= 0xff00ff; \ - x |= t; \ -} while (0) - -/* - x_c = (x_c * a + y_c *b) / 256 -*/ -#define FbByteAddMul_256(x, a, y, b) do { \ - CARD32 t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; \ - t >>= 8; \ - t &= 0xff00ff; \ - \ - x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; \ - x &= 0xff00ff00; \ - x += t; \ -} while (0) -/* - x_c = (x_c * a_c) / 255 -*/ -#define FbByteMulC(x, a) do { \ - CARD32 t; \ - CARD32 r = (x & 0xff) * (a & 0xff); \ - r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ - r += 0x800080; \ - r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ - r &= 0xff00ff; \ - \ - x >>= 8; \ - t = (x & 0xff) * ((a >> 8) & 0xff); \ - t |= (x & 0xff0000) * (a >> 24); \ - t += 0x800080; \ - t = t + ((t >> 8) & 0xff00ff); \ - x = r | (t & 0xff00ff00); \ - \ - } while (0) - -/* - x_c = (x_c * a) / 255 + y -*/ -#define FbByteMulAddC(x, a, y) do { \ - CARD32 t; \ - CARD32 r = (x & 0xff) * (a & 0xff); \ - r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ - r += 0x800080; \ - r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ - r &= 0xff00ff; \ - r += y & 0xff00ff; \ - r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ - r &= 0xff00ff; \ - \ - x >>= 8; \ - t = (x & 0xff) * ((a >> 8) & 0xff); \ - t |= (x & 0xff0000) * (a >> 24); \ - t += 0x800080; \ - t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ - t &= 0xff00ff; \ - t += (y >> 8) & 0xff00ff; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - x = r | (t << 8); \ - } while (0) - -/* - x_c = (x_c * a_c + y_c * b) / 255 -*/ -#define FbByteAddMulC(x, a, y, b) do { \ - CARD32 t; \ - CARD32 r = (x >> 24) * (a >> 24) + (y >> 24) * b; \ - r += (r >> 8) + 0x80; \ - r >>= 8; \ - \ - t = (x & 0xff00) * ((a >> 8) & 0xff) + (y & 0xff00) * b; \ - t += (t >> 8) + 0x8000; \ - t >>= 16; \ - \ - t |= r << 16; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - t <<= 8; \ - \ - r = ((x >> 16) & 0xff) * ((a >> 16) & 0xff) + ((y >> 16) & 0xff) * b + 0x80; \ - r += (r >> 8); \ - r >>= 8; \ - \ - x = (x & 0xff) * (a & 0xff) + (y & 0xff) * b + 0x80; \ - x += (x >> 8); \ - x >>= 8; \ - x |= r << 16; \ - x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ - x &= 0xff00ff; \ - x |= t; \ - } while (0) - -/* - x_c = min(x_c + y_c, 255) -*/ -#define FbByteAdd(x, y) do { \ - CARD32 t; \ - CARD32 r = (x & 0xff00ff) + (y & 0xff00ff); \ - r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ - r &= 0xff00ff; \ - \ - t = ((x >> 8) & 0xff00ff) + ((y >> 8) & 0xff00ff); \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - r |= (t & 0xff00ff) << 8; \ - x = r; \ - } while (0) - -#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) - -#if defined(__i386__) && defined(__GNUC__) -#define FASTCALL __attribute__((regparm(3))) -#else -#define FASTCALL -#endif - -typedef struct _FbComposeData { - CARD8 op; - PicturePtr src; - PicturePtr mask; - PicturePtr dest; - INT16 xSrc; - INT16 ySrc; - INT16 xMask; - INT16 yMask; - INT16 xDest; - INT16 yDest; - CARD16 width; - CARD16 height; -} FbComposeData; - -extern _X_EXPORT void -fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer); - -typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width); -typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width); -typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width); - -typedef struct _FbComposeFunctions { - CombineFuncU *combineU; - CombineFuncC *combineC; - CombineMaskU combineMaskU; -} FbComposeFunctions; - -/* fbcompose.c */ - -extern _X_EXPORT void -fbCompositeGeneral (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -/* fbpict.c */ -extern _X_EXPORT void -fbComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -typedef void (*CompositeFunc) (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -extern _X_EXPORT void -fbWalkCompositeRegion (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height, - Bool srcRepeat, - Bool maskRepeat, - CompositeFunc compositeRect); - -/* fbtrap.c */ - -extern _X_EXPORT void -fbAddTraps (PicturePtr pPicture, - INT16 xOff, - INT16 yOff, - int ntrap, - xTrap *traps); - -extern _X_EXPORT void -fbRasterizeTrapezoid (PicturePtr alpha, - xTrapezoid *trap, - int x_off, - int y_off); - -extern _X_EXPORT void -fbAddTriangles (PicturePtr pPicture, - INT16 xOff, - INT16 yOff, - int ntri, - xTriangle *tris); - -#endif /* _FBPICT_H_ */ +/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _FBPICT_H_
+#define _FBPICT_H_
+
+/* fbpict.c */
+extern _X_EXPORT void
+fbComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+/* fbtrap.c */
+
+extern _X_EXPORT void
+fbAddTraps (PicturePtr pPicture,
+ INT16 xOff,
+ INT16 yOff,
+ int ntrap,
+ xTrap *traps);
+
+extern _X_EXPORT void
+fbRasterizeTrapezoid (PicturePtr alpha,
+ xTrapezoid *trap,
+ int x_off,
+ int y_off);
+
+extern _X_EXPORT void
+fbAddTriangles (PicturePtr pPicture,
+ INT16 xOff,
+ INT16 yOff,
+ int ntri,
+ xTriangle *tris);
+
+#endif /* _FBPICT_H_ */
diff --git a/xorg-server/fb/fbtrap.c b/xorg-server/fb/fbtrap.c index 9f5c39f65..e52f84cd7 100644 --- a/xorg-server/fb/fbtrap.c +++ b/xorg-server/fb/fbtrap.c @@ -1,160 +1,159 @@ -/* - * Copyright © 2004 Keith Packard - * - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "fb.h" - -#include "picturestr.h" -#include "mipict.h" -#include "renderedge.h" -#include "fbpict.h" - -void -fbAddTraps (PicturePtr pPicture, - INT16 x_off, - INT16 y_off, - int ntrap, - xTrap *traps) -{ - int image_xoff, image_yoff; - pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff); - - if (!image) - return; - - pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps); - - free_pixman_pict (pPicture, image); -} - -void -fbRasterizeTrapezoid (PicturePtr pPicture, - xTrapezoid *trap, - int x_off, - int y_off) -{ - int mask_xoff, mask_yoff; - pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff); - - if (!image) - return; - - pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off); - - free_pixman_pict (pPicture, image); -} - -static int -_GreaterY (xPointFixed *a, xPointFixed *b) -{ - if (a->y == b->y) - return a->x > b->x; - return a->y > b->y; -} - -/* - * Note that the definition of this function is a bit odd because - * of the X coordinate space (y increasing downwards). - */ -static int -_Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b) -{ - xPointFixed ad, bd; - - ad.x = a->x - ref->x; - ad.y = a->y - ref->y; - bd.x = b->x - ref->x; - bd.y = b->y - ref->y; - - return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0; -} - -/* FIXME -- this could be made more efficient */ -void -fbAddTriangles (PicturePtr pPicture, - INT16 x_off, - INT16 y_off, - int ntri, - xTriangle *tris) -{ - xPointFixed *top, *left, *right, *tmp; - xTrapezoid trap; - - for (; ntri; ntri--, tris++) - { - top = &tris->p1; - left = &tris->p2; - right = &tris->p3; - if (_GreaterY (top, left)) { - tmp = left; left = top; top = tmp; - } - if (_GreaterY (top, right)) { - tmp = right; right = top; top = tmp; - } - if (_Clockwise (top, right, left)) { - tmp = right; right = left; left = tmp; - } - - /* - * Two cases: - * - * + + - * / \ / \ - * / \ / \ - * / + + \ - * / -- -- \ - * / -- -- \ - * / --- --- \ - * +-- --+ - */ - - trap.top = top->y; - trap.left.p1 = *top; - trap.left.p2 = *left; - trap.right.p1 = *top; - trap.right.p2 = *right; - if (right->y < left->y) - trap.bottom = right->y; - else - trap.bottom = left->y; - fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); - if (right->y < left->y) - { - trap.top = right->y; - trap.bottom = left->y; - trap.right.p1 = *right; - trap.right.p2 = *left; - } - else - { - trap.top = left->y; - trap.bottom = right->y; - trap.left.p1 = *left; - trap.left.p2 = *right; - } - fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); - } -} - +/*
+ * Copyright © 2004 Keith Packard
+ *
+ * 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "fb.h"
+
+#include "picturestr.h"
+#include "mipict.h"
+#include "fbpict.h"
+
+void
+fbAddTraps (PicturePtr pPicture,
+ INT16 x_off,
+ INT16 y_off,
+ int ntrap,
+ xTrap *traps)
+{
+ int image_xoff, image_yoff;
+ pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+
+ if (!image)
+ return;
+
+ pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
+
+ free_pixman_pict (pPicture, image);
+}
+
+void
+fbRasterizeTrapezoid (PicturePtr pPicture,
+ xTrapezoid *trap,
+ int x_off,
+ int y_off)
+{
+ int mask_xoff, mask_yoff;
+ pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+
+ if (!image)
+ return;
+
+ pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
+
+ free_pixman_pict (pPicture, image);
+}
+
+static int
+_GreaterY (xPointFixed *a, xPointFixed *b)
+{
+ if (a->y == b->y)
+ return a->x > b->x;
+ return a->y > b->y;
+}
+
+/*
+ * Note that the definition of this function is a bit odd because
+ * of the X coordinate space (y increasing downwards).
+ */
+static int
+_Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b)
+{
+ xPointFixed ad, bd;
+
+ ad.x = a->x - ref->x;
+ ad.y = a->y - ref->y;
+ bd.x = b->x - ref->x;
+ bd.y = b->y - ref->y;
+
+ return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0;
+}
+
+/* FIXME -- this could be made more efficient */
+void
+fbAddTriangles (PicturePtr pPicture,
+ INT16 x_off,
+ INT16 y_off,
+ int ntri,
+ xTriangle *tris)
+{
+ xPointFixed *top, *left, *right, *tmp;
+ xTrapezoid trap;
+
+ for (; ntri; ntri--, tris++)
+ {
+ top = &tris->p1;
+ left = &tris->p2;
+ right = &tris->p3;
+ if (_GreaterY (top, left)) {
+ tmp = left; left = top; top = tmp;
+ }
+ if (_GreaterY (top, right)) {
+ tmp = right; right = top; top = tmp;
+ }
+ if (_Clockwise (top, right, left)) {
+ tmp = right; right = left; left = tmp;
+ }
+
+ /*
+ * Two cases:
+ *
+ * + +
+ * / \ / \
+ * / \ / \
+ * / + + \
+ * / -- -- \
+ * / -- -- \
+ * / --- --- \
+ * +-- --+
+ */
+
+ trap.top = top->y;
+ trap.left.p1 = *top;
+ trap.left.p2 = *left;
+ trap.right.p1 = *top;
+ trap.right.p2 = *right;
+ if (right->y < left->y)
+ trap.bottom = right->y;
+ else
+ trap.bottom = left->y;
+ fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
+ if (right->y < left->y)
+ {
+ trap.top = right->y;
+ trap.bottom = left->y;
+ trap.right.p1 = *right;
+ trap.right.p2 = *left;
+ }
+ else
+ {
+ trap.top = left->y;
+ trap.bottom = right->y;
+ trap.left.p1 = *left;
+ trap.left.p2 = *right;
+ }
+ fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
+ }
+}
+
diff --git a/xorg-server/fb/wfbrename.h b/xorg-server/fb/wfbrename.h index 0d59811e1..d9aba7fb6 100644 --- a/xorg-server/fb/wfbrename.h +++ b/xorg-server/fb/wfbrename.h @@ -39,20 +39,6 @@ #define fbClearVisualTypes wfbClearVisualTypes
#define fbCloseScreen wfbCloseScreen
#define fbComposite wfbComposite
-#define fbCompositeGeneral wfbCompositeGeneral
-#define fbCompositeSolidMask_nx1xn wfbCompositeSolidMask_nx1xn
-#define fbCompositeSolidMask_nx8888x0565C wfbCompositeSolidMask_nx8888x0565C
-#define fbCompositeSolidMask_nx8888x8888C wfbCompositeSolidMask_nx8888x8888C
-#define fbCompositeSolidMask_nx8x0565 wfbCompositeSolidMask_nx8x0565
-#define fbCompositeSolidMask_nx8x0888 wfbCompositeSolidMask_nx8x0888
-#define fbCompositeSolidMask_nx8x8888 wfbCompositeSolidMask_nx8x8888
-#define fbCompositeSrc_0565x0565 wfbCompositeSrc_0565x0565
-#define fbCompositeSrc_8888x0565 wfbCompositeSrc_8888x0565
-#define fbCompositeSrc_8888x0888 wfbCompositeSrc_8888x0888
-#define fbCompositeSrc_8888x8888 wfbCompositeSrc_8888x8888
-#define fbCompositeSrcAdd_1000x1000 wfbCompositeSrcAdd_1000x1000
-#define fbCompositeSrcAdd_8000x8000 wfbCompositeSrcAdd_8000x8000
-#define fbCompositeSrcAdd_8888x8888 wfbCompositeSrcAdd_8888x8888
#define fbCopy1toN wfbCopy1toN
#define fbCopyArea wfbCopyArea
#define fbCopyNto1 wfbCopyNto1
@@ -149,7 +135,6 @@ #define fbPutXYImage wfbPutXYImage
#define fbPutZImage wfbPutZImage
#define fbQueryBestSize wfbQueryBestSize
-#define fbRasterizeEdges wfbRasterizeEdges
#define fbRasterizeTrapezoid wfbRasterizeTrapezoid
#define fbRealizeFont wfbRealizeFont
#define fbReduceRasterOp wfbReduceRasterOp
@@ -179,10 +164,8 @@ #define fbUnmapWindow wfbUnmapWindow
#define fbUnrealizeFont wfbUnrealizeFont
#define fbValidateGC wfbValidateGC
-#define fbWalkCompositeRegion wfbWalkCompositeRegion
#define fbWinPrivateKeyRec wfbWinPrivateKeyRec
#define fbZeroLine wfbZeroLine
#define fbZeroSegment wfbZeroSegment
#define free_pixman_pict wfb_free_pixman_pict
#define image_from_pict wfb_image_from_pict
-#define composeFunctions wfbComposeFunctions
|