Rootless: Kill off rlAccel
This commit is contained in:
parent
d3d00d9258
commit
587c010a1c
|
@ -2134,7 +2134,6 @@ miext/damage/Makefile
|
|||
miext/shadow/Makefile
|
||||
miext/cw/Makefile
|
||||
miext/rootless/Makefile
|
||||
miext/rootless/accel/Makefile
|
||||
os/Makefile
|
||||
randr/Makefile
|
||||
render/Makefile
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support
|
||||
|
||||
SUBDIRS = accel
|
||||
|
||||
noinst_LTLIBRARIES = librootless.la
|
||||
librootless_la_SOURCES = \
|
||||
rootlessCommon.c \
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
|
||||
AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
|
||||
|
||||
noinst_LTLIBRARIES = librlAccel.la
|
||||
librlAccel_la_SOURCES = \
|
||||
rlAccel.c \
|
||||
rlBlt.c \
|
||||
rlCopy.c \
|
||||
rlFill.c \
|
||||
rlFillRect.c \
|
||||
rlFillSpans.c \
|
||||
rlGlyph.c \
|
||||
rlSolid.c
|
||||
|
||||
EXTRA_DIST = rlAccel.h
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Support for accelerated rootless code
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2004 Torrey T. Lyons. 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 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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.
|
||||
*
|
||||
* Except as contained in this notice, the name(s) of the above copyright
|
||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The accelerated rootless code replaces some GC operations from fb with
|
||||
* versions that call the rootless acceleration functions where appropriate.
|
||||
* To work properly, this must be wrapped directly on top of fb. Nothing
|
||||
* underneath this layer besides fb will get called.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "rootless.h"
|
||||
#include "rlAccel.h"
|
||||
|
||||
typedef struct _rlAccelScreenRec {
|
||||
CreateGCProcPtr CreateGC;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
} rlAccelScreenRec, *rlAccelScreenPtr;
|
||||
|
||||
static DevPrivateKey rlAccelScreenPrivateKey = &rlAccelScreenPrivateKey;
|
||||
|
||||
#define RLACCELREC(pScreen) ((rlAccelScreenRec *) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey))
|
||||
|
||||
#define SETRLACCELREC(pScreen, v) \
|
||||
dixSetPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey, v)
|
||||
|
||||
/* This is mostly identical to fbGCOps. */
|
||||
static GCOps rlAccelOps = {
|
||||
rlFillSpans,
|
||||
fbSetSpans,
|
||||
fbPutImage,
|
||||
rlCopyArea,
|
||||
fbCopyPlane,
|
||||
fbPolyPoint,
|
||||
fbPolyLine,
|
||||
fbPolySegment,
|
||||
fbPolyRectangle,
|
||||
fbPolyArc,
|
||||
miFillPolygon,
|
||||
rlPolyFillRect,
|
||||
fbPolyFillArc,
|
||||
miPolyText8,
|
||||
miPolyText16,
|
||||
miImageText8,
|
||||
miImageText16,
|
||||
rlImageGlyphBlt,
|
||||
fbPolyGlyphBlt,
|
||||
fbPushPixels
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Screen function to create a graphics context
|
||||
*/
|
||||
static Bool
|
||||
rlCreateGC(GCPtr pGC)
|
||||
{
|
||||
ScreenPtr pScreen = pGC->pScreen;
|
||||
rlAccelScreenRec *s = RLACCELREC(pScreen);
|
||||
Bool result;
|
||||
|
||||
// Unwrap and call
|
||||
pScreen->CreateGC = s->CreateGC;
|
||||
result = s->CreateGC(pGC);
|
||||
|
||||
// Accelerated GC ops replace some fb GC ops
|
||||
pGC->ops = &rlAccelOps;
|
||||
|
||||
// Rewrap
|
||||
s->CreateGC = pScreen->CreateGC;
|
||||
pScreen->CreateGC = rlCreateGC;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Clean up when closing a screen on server reset
|
||||
*/
|
||||
static Bool
|
||||
rlCloseScreen (int iScreen, ScreenPtr pScreen)
|
||||
{
|
||||
rlAccelScreenRec *s = RLACCELREC(pScreen);
|
||||
Bool result;
|
||||
|
||||
// Unwrap
|
||||
pScreen->CloseScreen = s->CloseScreen;
|
||||
result = pScreen->CloseScreen(iScreen, pScreen);
|
||||
|
||||
xfree(s);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* RootlessAccelInit
|
||||
* Called by the rootless implementation to initialize accelerated
|
||||
* rootless drawing.
|
||||
*/
|
||||
Bool
|
||||
RootlessAccelInit(ScreenPtr pScreen)
|
||||
{
|
||||
rlAccelScreenRec *s;
|
||||
|
||||
s = xalloc(sizeof(rlAccelScreenRec));
|
||||
if (!s) return FALSE;
|
||||
SETRLACCELREC(pScreen, s);
|
||||
|
||||
// Wrap the screen functions we need
|
||||
s->CreateGC = pScreen->CreateGC;
|
||||
pScreen->CreateGC = rlCreateGC;
|
||||
s->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = rlCloseScreen;
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* Rootless Acceleration Code
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2003 Torrey T. Lyons. 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 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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.
|
||||
*
|
||||
* Except as contained in this notice, the name(s) of the above copyright
|
||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
/*
|
||||
* rlBlt.c
|
||||
*/
|
||||
void
|
||||
rlBlt (FbBits *srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
|
||||
ScreenPtr pDstScreen,
|
||||
FbBits *dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
|
||||
int width,
|
||||
int height,
|
||||
|
||||
int alu,
|
||||
FbBits pm,
|
||||
int bpp,
|
||||
|
||||
Bool reverse,
|
||||
Bool upsidedown);
|
||||
|
||||
/*
|
||||
* rlCopy.c
|
||||
*/
|
||||
RegionPtr
|
||||
rlCopyArea (DrawablePtr pSrcDrawable,
|
||||
DrawablePtr pDstDrawable,
|
||||
GCPtr pGC,
|
||||
int xIn,
|
||||
int yIn,
|
||||
int widthSrc,
|
||||
int heightSrc,
|
||||
int xOut,
|
||||
int yOut);
|
||||
|
||||
/*
|
||||
* rlFill.c
|
||||
*/
|
||||
void
|
||||
rlFill (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void
|
||||
rlSolidBoxClipped (DrawablePtr pDrawable,
|
||||
RegionPtr pClip,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
FbBits and,
|
||||
FbBits xor);
|
||||
|
||||
/*
|
||||
* rlFillRect.c
|
||||
*/
|
||||
void
|
||||
rlPolyFillRect(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int nrect,
|
||||
xRectangle *prect);
|
||||
|
||||
/*
|
||||
* rlFillSpans.c
|
||||
*/
|
||||
void
|
||||
rlFillSpans (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int n,
|
||||
DDXPointPtr ppt,
|
||||
int *pwidth,
|
||||
int fSorted);
|
||||
|
||||
/*
|
||||
* rlGlyph.c
|
||||
*/
|
||||
void
|
||||
rlImageGlyphBlt (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppciInit,
|
||||
pointer pglyphBase);
|
||||
|
||||
/*
|
||||
* rlSolid.c
|
||||
*/
|
||||
void
|
||||
rlSolid (ScreenPtr pScreen,
|
||||
FbBits *dst,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
int bpp,
|
||||
|
||||
int width,
|
||||
int height,
|
||||
|
||||
FbBits and,
|
||||
FbBits xor);
|
|
@ -1,408 +0,0 @@
|
|||
/*
|
||||
* Accelerated rootless blit
|
||||
*/
|
||||
/*
|
||||
* This code is largely copied from fbBlt.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 <stddef.h> /* For NULL */
|
||||
#include <string.h>
|
||||
#include "fb.h"
|
||||
#include "rootlessCommon.h"
|
||||
#include "rlAccel.h"
|
||||
|
||||
#define InitializeShifts(sx,dx,ls,rs) { \
|
||||
if (sx != dx) { \
|
||||
if (sx > dx) { \
|
||||
ls = sx - dx; \
|
||||
rs = FB_UNIT - ls; \
|
||||
} else { \
|
||||
rs = dx - sx; \
|
||||
ls = FB_UNIT - rs; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
void
|
||||
rlBlt (FbBits *srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
|
||||
ScreenPtr pDstScreen,
|
||||
FbBits *dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
|
||||
int width,
|
||||
int height,
|
||||
|
||||
int alu,
|
||||
FbBits pm,
|
||||
int bpp,
|
||||
|
||||
Bool reverse,
|
||||
Bool upsidedown)
|
||||
{
|
||||
FbBits *src, *dst;
|
||||
int leftShift, rightShift;
|
||||
FbBits startmask, endmask;
|
||||
FbBits bits, bits1;
|
||||
int n, nmiddle;
|
||||
Bool destInvarient;
|
||||
int startbyte, endbyte;
|
||||
FbDeclareMergeRop ();
|
||||
|
||||
#ifdef FB_24BIT
|
||||
if (bpp == 24 && !FbCheck24Pix (pm))
|
||||
{
|
||||
fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX,
|
||||
width, height, alu, pm, reverse, upsidedown);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (alu == GXcopy && pm == FB_ALLONES && !reverse &&
|
||||
!(srcX & 7) && !(dstX & 7) && !(width & 7)) {
|
||||
int i;
|
||||
CARD8 *src = (CARD8 *) srcLine;
|
||||
CARD8 *dst = (CARD8 *) dstLine;
|
||||
|
||||
srcStride *= sizeof(FbBits);
|
||||
dstStride *= sizeof(FbBits);
|
||||
width >>= 3;
|
||||
src += (srcX >> 3);
|
||||
dst += (dstX >> 3);
|
||||
|
||||
if (!upsidedown)
|
||||
for (i = 0; i < height; i++)
|
||||
memcpy(dst + i * dstStride, src + i * srcStride, width);
|
||||
else
|
||||
for (i = height - 1; i >= 0; i--)
|
||||
memcpy(dst + i * dstStride, src + i * srcStride, width);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
FbInitializeMergeRop(alu, pm);
|
||||
destInvarient = FbDestInvarientMergeRop();
|
||||
if (upsidedown)
|
||||
{
|
||||
srcLine += (height - 1) * (srcStride);
|
||||
dstLine += (height - 1) * (dstStride);
|
||||
srcStride = -srcStride;
|
||||
dstStride = -dstStride;
|
||||
}
|
||||
FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte,
|
||||
nmiddle, endmask, endbyte);
|
||||
|
||||
/*
|
||||
* Beginning of the rootless acceleration code
|
||||
*/
|
||||
if (!startmask && !endmask && alu == GXcopy &&
|
||||
height * nmiddle * sizeof(*dst) > rootless_CopyBytes_threshold)
|
||||
{
|
||||
if (pm == FB_ALLONES && SCREENREC(pDstScreen)->imp->CopyBytes)
|
||||
{
|
||||
SCREENREC(pDstScreen)->imp->CopyBytes(
|
||||
nmiddle * sizeof(*dst), height,
|
||||
(char *) srcLine + (srcX >> 3),
|
||||
srcStride * sizeof (*src),
|
||||
(char *) dstLine + (dstX >> 3),
|
||||
dstStride * sizeof (*dst));
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME: the pm test here isn't super-wonderful - just because
|
||||
we don't care about the top eight bits doesn't necessarily
|
||||
mean we want them set to 255. But doing this does give a
|
||||
factor of two performance improvement when copying from a
|
||||
pixmap to a window, which is pretty common.. */
|
||||
|
||||
else if (bpp == 32 && sizeof(FbBits) == 4 &&
|
||||
pm == 0x00FFFFFFUL && !reverse &&
|
||||
SCREENREC(pDstScreen)->imp->CompositePixels)
|
||||
{
|
||||
/* need to copy XRGB to ARGB. */
|
||||
|
||||
void *src[2], *dest[2];
|
||||
unsigned int src_rowbytes[2], dest_rowbytes[2];
|
||||
unsigned int fn;
|
||||
|
||||
src[0] = (char *) srcLine + (srcX >> 3);
|
||||
src[1] = NULL;
|
||||
src_rowbytes[0] = srcStride * sizeof(*src);
|
||||
src_rowbytes[1] = 0;
|
||||
|
||||
dest[0] = (char *) dstLine + (dstX >> 3);
|
||||
dest[1] = dest[0];
|
||||
dest_rowbytes[0] = dstStride * sizeof(*dst);
|
||||
dest_rowbytes[1] = dest_rowbytes[0];
|
||||
|
||||
fn = RL_COMPOSITE_FUNCTION(RL_COMPOSITE_SRC, RL_DEPTH_ARGB8888,
|
||||
RL_DEPTH_NIL, RL_DEPTH_ARGB8888);
|
||||
|
||||
if (SCREENREC(pDstScreen)->imp->CompositePixels(
|
||||
nmiddle, height,
|
||||
fn, src, src_rowbytes,
|
||||
NULL, 0, dest, dest_rowbytes) == Success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of the rootless acceleration code */
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1;
|
||||
dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1;
|
||||
srcX = (srcX + width - 1) & FB_MASK;
|
||||
dstX = (dstX + width - 1) & FB_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
srcLine += srcX >> FB_SHIFT;
|
||||
dstLine += dstX >> FB_SHIFT;
|
||||
srcX &= FB_MASK;
|
||||
dstX &= FB_MASK;
|
||||
}
|
||||
if (srcX == dstX)
|
||||
{
|
||||
while (height--)
|
||||
{
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
dst = dstLine;
|
||||
dstLine += dstStride;
|
||||
if (reverse)
|
||||
{
|
||||
if (endmask)
|
||||
{
|
||||
bits = *--src;
|
||||
--dst;
|
||||
FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
|
||||
}
|
||||
n = nmiddle;
|
||||
if (destInvarient)
|
||||
{
|
||||
while (n--)
|
||||
*--dst = FbDoDestInvarientMergeRop(*--src);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
bits = *--src;
|
||||
--dst;
|
||||
*dst = FbDoMergeRop (bits, *dst);
|
||||
}
|
||||
}
|
||||
if (startmask)
|
||||
{
|
||||
bits = *--src;
|
||||
--dst;
|
||||
FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (startmask)
|
||||
{
|
||||
bits = *src++;
|
||||
FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
|
||||
dst++;
|
||||
}
|
||||
n = nmiddle;
|
||||
if (destInvarient)
|
||||
{
|
||||
#if 0
|
||||
/*
|
||||
* This provides some speedup on screen->screen blts
|
||||
* over the PCI bus, usually about 10%. But fb
|
||||
* isn't usually used for this operation...
|
||||
*/
|
||||
if (_ca2 + 1 == 0 && _cx2 == 0)
|
||||
{
|
||||
FbBits t1, t2, t3, t4;
|
||||
while (n >= 4)
|
||||
{
|
||||
t1 = *src++;
|
||||
t2 = *src++;
|
||||
t3 = *src++;
|
||||
t4 = *src++;
|
||||
*dst++ = t1;
|
||||
*dst++ = t2;
|
||||
*dst++ = t3;
|
||||
*dst++ = t4;
|
||||
n -= 4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
while (n--)
|
||||
*dst++ = FbDoDestInvarientMergeRop(*src++);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
bits = *src++;
|
||||
*dst = FbDoMergeRop (bits, *dst);
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
if (endmask)
|
||||
{
|
||||
bits = *src;
|
||||
FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srcX > dstX)
|
||||
{
|
||||
leftShift = srcX - dstX;
|
||||
rightShift = FB_UNIT - leftShift;
|
||||
}
|
||||
else
|
||||
{
|
||||
rightShift = dstX - srcX;
|
||||
leftShift = FB_UNIT - rightShift;
|
||||
}
|
||||
while (height--)
|
||||
{
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
dst = dstLine;
|
||||
dstLine += dstStride;
|
||||
|
||||
bits1 = 0;
|
||||
if (reverse)
|
||||
{
|
||||
if (srcX < dstX)
|
||||
bits1 = *--src;
|
||||
if (endmask)
|
||||
{
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
if (FbScrRight(endmask, leftShift))
|
||||
{
|
||||
bits1 = *--src;
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
}
|
||||
--dst;
|
||||
FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
|
||||
}
|
||||
n = nmiddle;
|
||||
if (destInvarient)
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
bits1 = *--src;
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
--dst;
|
||||
*dst = FbDoDestInvarientMergeRop(bits);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
bits1 = *--src;
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
--dst;
|
||||
*dst = FbDoMergeRop(bits, *dst);
|
||||
}
|
||||
}
|
||||
if (startmask)
|
||||
{
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
if (FbScrRight(startmask, leftShift))
|
||||
{
|
||||
bits1 = *--src;
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
}
|
||||
--dst;
|
||||
FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srcX > dstX)
|
||||
bits1 = *src++;
|
||||
if (startmask)
|
||||
{
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
if (FbScrLeft(startmask, rightShift))
|
||||
{
|
||||
bits1 = *src++;
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
}
|
||||
FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
|
||||
dst++;
|
||||
}
|
||||
n = nmiddle;
|
||||
if (destInvarient)
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
bits1 = *src++;
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
*dst = FbDoDestInvarientMergeRop(bits);
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
bits1 = *src++;
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
*dst = FbDoMergeRop(bits, *dst);
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
if (endmask)
|
||||
{
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
if (FbScrLeft(endmask, rightShift))
|
||||
{
|
||||
bits1 = *src;
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
}
|
||||
FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* This code is largely copied from fbcopy.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 "rlAccel.h"
|
||||
|
||||
|
||||
void
|
||||
rlCopyNtoN (DrawablePtr pSrcDrawable,
|
||||
DrawablePtr pDstDrawable,
|
||||
GCPtr pGC,
|
||||
BoxPtr pbox,
|
||||
int nbox,
|
||||
int dx,
|
||||
int dy,
|
||||
Bool reverse,
|
||||
Bool upsidedown,
|
||||
Pixel bitplane,
|
||||
void *closure)
|
||||
{
|
||||
CARD8 alu = pGC ? pGC->alu : GXcopy;
|
||||
FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
|
||||
FbBits *src;
|
||||
FbStride srcStride;
|
||||
int srcBpp;
|
||||
int srcXoff, srcYoff;
|
||||
FbBits *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
|
||||
fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
|
||||
fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
rlBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
|
||||
srcStride,
|
||||
(pbox->x1 + dx + srcXoff) * srcBpp,
|
||||
|
||||
pDstDrawable->pScreen,
|
||||
dst + (pbox->y1 + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(pbox->x1 + dstXoff) * dstBpp,
|
||||
|
||||
(pbox->x2 - pbox->x1) * dstBpp,
|
||||
(pbox->y2 - pbox->y1),
|
||||
|
||||
alu,
|
||||
pm,
|
||||
dstBpp,
|
||||
|
||||
reverse,
|
||||
upsidedown);
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
|
||||
RegionPtr
|
||||
rlCopyArea (DrawablePtr pSrcDrawable,
|
||||
DrawablePtr pDstDrawable,
|
||||
GCPtr pGC,
|
||||
int xIn,
|
||||
int yIn,
|
||||
int widthSrc,
|
||||
int heightSrc,
|
||||
int xOut,
|
||||
int yOut)
|
||||
{
|
||||
fbCopyProc copy;
|
||||
|
||||
#ifdef FB_24_32BIT
|
||||
if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
|
||||
copy = fb24_32CopyMtoN;
|
||||
else
|
||||
#endif
|
||||
copy = rlCopyNtoN;
|
||||
return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
|
||||
widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
|
||||
}
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
* This code is largely copied from fbfill.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 "rlAccel.h"
|
||||
|
||||
|
||||
void
|
||||
rlFill (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
FbBits *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
|
||||
|
||||
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
|
||||
switch (pGC->fillStyle) {
|
||||
case FillSolid:
|
||||
rlSolid (pDrawable->pScreen,
|
||||
dst + (y + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(x + dstXoff) * dstBpp,
|
||||
dstBpp,
|
||||
width * dstBpp, height,
|
||||
pPriv->and, pPriv->xor);
|
||||
break;
|
||||
case FillStippled:
|
||||
case FillOpaqueStippled: {
|
||||
PixmapPtr pStip = pGC->stipple;
|
||||
int stipWidth = pStip->drawable.width;
|
||||
int stipHeight = pStip->drawable.height;
|
||||
|
||||
if (dstBpp == 1)
|
||||
{
|
||||
int alu;
|
||||
FbBits *stip;
|
||||
FbStride stipStride;
|
||||
int stipBpp;
|
||||
int stipXoff, stipYoff; /* XXX assumed to be zero */
|
||||
|
||||
if (pGC->fillStyle == FillStippled)
|
||||
alu = FbStipple1Rop(pGC->alu,pGC->fgPixel);
|
||||
else
|
||||
alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel);
|
||||
fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
|
||||
fbTile (dst + (y + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
x + dstXoff,
|
||||
width, height,
|
||||
stip,
|
||||
stipStride,
|
||||
stipWidth,
|
||||
stipHeight,
|
||||
alu,
|
||||
pPriv->pm,
|
||||
dstBpp,
|
||||
|
||||
(pGC->patOrg.x + pDrawable->x + dstXoff),
|
||||
pGC->patOrg.y + pDrawable->y - y);
|
||||
}
|
||||
else
|
||||
{
|
||||
FbStip *stip;
|
||||
FbStride stipStride;
|
||||
int stipBpp;
|
||||
int stipXoff, stipYoff; /* XXX assumed to be zero */
|
||||
FbBits fgand, fgxor, bgand, bgxor;
|
||||
|
||||
fgand = pPriv->and;
|
||||
fgxor = pPriv->xor;
|
||||
if (pGC->fillStyle == FillStippled)
|
||||
{
|
||||
bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES);
|
||||
bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES);
|
||||
}
|
||||
else
|
||||
{
|
||||
bgand = pPriv->bgand;
|
||||
bgxor = pPriv->bgxor;
|
||||
}
|
||||
|
||||
fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
|
||||
fbStipple (dst + (y + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(x + dstXoff) * dstBpp,
|
||||
dstBpp,
|
||||
width * dstBpp, height,
|
||||
stip,
|
||||
stipStride,
|
||||
stipWidth,
|
||||
stipHeight,
|
||||
pPriv->evenStipple,
|
||||
fgand, fgxor,
|
||||
bgand, bgxor,
|
||||
pGC->patOrg.x + pDrawable->x + dstXoff,
|
||||
pGC->patOrg.y + pDrawable->y - y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FillTiled: {
|
||||
PixmapPtr pTile = pGC->tile.pixmap;
|
||||
FbBits *tile;
|
||||
FbStride tileStride;
|
||||
int tileBpp;
|
||||
int tileWidth;
|
||||
int tileHeight;
|
||||
int tileXoff, tileYoff; /* XXX assumed to be zero */
|
||||
|
||||
fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
|
||||
tileWidth = pTile->drawable.width;
|
||||
tileHeight = pTile->drawable.height;
|
||||
fbTile (dst + (y + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(x + dstXoff) * dstBpp,
|
||||
width * dstBpp, height,
|
||||
tile,
|
||||
tileStride,
|
||||
tileWidth * tileBpp,
|
||||
tileHeight,
|
||||
pGC->alu,
|
||||
pPriv->pm,
|
||||
dstBpp,
|
||||
(pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
|
||||
pGC->patOrg.y + pDrawable->y - y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fbValidateDrawable (pDrawable);
|
||||
}
|
||||
|
||||
void
|
||||
rlSolidBoxClipped (DrawablePtr pDrawable,
|
||||
RegionPtr pClip,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
FbBits and,
|
||||
FbBits xor)
|
||||
{
|
||||
FbBits *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
BoxPtr pbox;
|
||||
int nbox;
|
||||
int partX1, partX2, partY1, partY2;
|
||||
|
||||
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
|
||||
for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
|
||||
nbox--;
|
||||
pbox++)
|
||||
{
|
||||
partX1 = pbox->x1;
|
||||
if (partX1 < x1)
|
||||
partX1 = x1;
|
||||
|
||||
partX2 = pbox->x2;
|
||||
if (partX2 > x2)
|
||||
partX2 = x2;
|
||||
|
||||
if (partX2 <= partX1)
|
||||
continue;
|
||||
|
||||
partY1 = pbox->y1;
|
||||
if (partY1 < y1)
|
||||
partY1 = y1;
|
||||
|
||||
partY2 = pbox->y2;
|
||||
if (partY2 > y2)
|
||||
partY2 = y2;
|
||||
|
||||
if (partY2 <= partY1)
|
||||
continue;
|
||||
|
||||
rlSolid (pDrawable->pScreen,
|
||||
dst + (partY1 + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(partX1 + dstXoff) * dstBpp,
|
||||
dstBpp,
|
||||
|
||||
(partX2 - partX1) * dstBpp,
|
||||
(partY2 - partY1),
|
||||
and, xor);
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
* This code is largely copied from fbfillrect.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 "rlAccel.h"
|
||||
|
||||
|
||||
void
|
||||
rlPolyFillRect(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int nrect,
|
||||
xRectangle *prect)
|
||||
{
|
||||
RegionPtr pClip = fbGetCompositeClip(pGC);
|
||||
register BoxPtr pbox;
|
||||
BoxPtr pextent;
|
||||
int extentX1, extentX2, extentY1, extentY2;
|
||||
int fullX1, fullX2, fullY1, fullY2;
|
||||
int partX1, partX2, partY1, partY2;
|
||||
int xorg, yorg;
|
||||
int n;
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
|
||||
pextent = REGION_EXTENTS(pGC->pScreen, pClip);
|
||||
extentX1 = pextent->x1;
|
||||
extentY1 = pextent->y1;
|
||||
extentX2 = pextent->x2;
|
||||
extentY2 = pextent->y2;
|
||||
while (nrect--)
|
||||
{
|
||||
fullX1 = prect->x + xorg;
|
||||
fullY1 = prect->y + yorg;
|
||||
fullX2 = fullX1 + (int) prect->width;
|
||||
fullY2 = fullY1 + (int) prect->height;
|
||||
prect++;
|
||||
|
||||
if (fullX1 < extentX1)
|
||||
fullX1 = extentX1;
|
||||
|
||||
if (fullY1 < extentY1)
|
||||
fullY1 = extentY1;
|
||||
|
||||
if (fullX2 > extentX2)
|
||||
fullX2 = extentX2;
|
||||
|
||||
if (fullY2 > extentY2)
|
||||
fullY2 = extentY2;
|
||||
|
||||
if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
|
||||
continue;
|
||||
n = REGION_NUM_RECTS (pClip);
|
||||
if (n == 1)
|
||||
{
|
||||
rlFill (pDrawable,
|
||||
pGC,
|
||||
fullX1, fullY1, fullX2-fullX1, fullY2-fullY1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pbox = REGION_RECTS(pClip);
|
||||
/*
|
||||
* clip the rectangle to each box in the clip region
|
||||
* this is logically equivalent to calling Intersect()
|
||||
*/
|
||||
while(n--)
|
||||
{
|
||||
partX1 = pbox->x1;
|
||||
if (partX1 < fullX1)
|
||||
partX1 = fullX1;
|
||||
partY1 = pbox->y1;
|
||||
if (partY1 < fullY1)
|
||||
partY1 = fullY1;
|
||||
partX2 = pbox->x2;
|
||||
if (partX2 > fullX2)
|
||||
partX2 = fullX2;
|
||||
partY2 = pbox->y2;
|
||||
if (partY2 > fullY2)
|
||||
partY2 = fullY2;
|
||||
|
||||
pbox++;
|
||||
|
||||
if (partX1 < partX2 && partY1 < partY2)
|
||||
rlFill (pDrawable, pGC,
|
||||
partX1, partY1,
|
||||
partX2 - partX1, partY2 - partY1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* This code is largely copied from fbfillsp.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 "rlAccel.h"
|
||||
|
||||
|
||||
void
|
||||
rlFillSpans (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int n,
|
||||
DDXPointPtr ppt,
|
||||
int *pwidth,
|
||||
int fSorted)
|
||||
{
|
||||
RegionPtr pClip = fbGetCompositeClip(pGC);
|
||||
BoxPtr pextent, pbox;
|
||||
int nbox;
|
||||
int extentX1, extentX2, extentY1, extentY2;
|
||||
int fullX1, fullX2, fullY1;
|
||||
int partX1, partX2;
|
||||
|
||||
pextent = REGION_EXTENTS(pGC->pScreen, pClip);
|
||||
extentX1 = pextent->x1;
|
||||
extentY1 = pextent->y1;
|
||||
extentX2 = pextent->x2;
|
||||
extentY2 = pextent->y2;
|
||||
while (n--)
|
||||
{
|
||||
fullX1 = ppt->x;
|
||||
fullY1 = ppt->y;
|
||||
fullX2 = fullX1 + (int) *pwidth;
|
||||
ppt++;
|
||||
pwidth++;
|
||||
|
||||
if (fullY1 < extentY1 || extentY2 <= fullY1)
|
||||
continue;
|
||||
|
||||
if (fullX1 < extentX1)
|
||||
fullX1 = extentX1;
|
||||
|
||||
if (fullX2 > extentX2)
|
||||
fullX2 = extentX2;
|
||||
|
||||
if (fullX1 >= fullX2)
|
||||
continue;
|
||||
|
||||
nbox = REGION_NUM_RECTS (pClip);
|
||||
if (nbox == 1)
|
||||
{
|
||||
rlFill (pDrawable,
|
||||
pGC,
|
||||
fullX1, fullY1, fullX2-fullX1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pbox = REGION_RECTS(pClip);
|
||||
while(nbox--)
|
||||
{
|
||||
if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
|
||||
{
|
||||
partX1 = pbox->x1;
|
||||
if (partX1 < fullX1)
|
||||
partX1 = fullX1;
|
||||
partX2 = pbox->x2;
|
||||
if (partX2 > fullX2)
|
||||
partX2 = fullX2;
|
||||
if (partX2 > partX1)
|
||||
{
|
||||
rlFill (pDrawable, pGC,
|
||||
partX1, fullY1,
|
||||
partX2 - partX1, 1);
|
||||
}
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
/*
|
||||
* This code is largely copied from fbglyph.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "rlAccel.h"
|
||||
|
||||
|
||||
void
|
||||
rlImageGlyphBlt (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppciInit,
|
||||
pointer pglyphBase)
|
||||
{
|
||||
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
|
||||
CharInfoPtr *ppci;
|
||||
CharInfoPtr pci;
|
||||
unsigned char *pglyph; /* pointer bits in glyph */
|
||||
int gWidth, gHeight; /* width and height of glyph */
|
||||
FbStride gStride; /* stride of glyph */
|
||||
Bool opaque;
|
||||
int n;
|
||||
int gx, gy;
|
||||
#ifndef FBNOPIXADDR
|
||||
void (*glyph) (FbBits *,
|
||||
FbStride,
|
||||
int,
|
||||
FbStip *,
|
||||
FbBits,
|
||||
int,
|
||||
int);
|
||||
FbBits *dst = 0;
|
||||
FbStride dstStride = 0;
|
||||
int dstBpp = 0;
|
||||
int dstXoff = 0, dstYoff = 0;
|
||||
|
||||
glyph = 0;
|
||||
if (pPriv->and == 0)
|
||||
{
|
||||
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
switch (dstBpp) {
|
||||
case 8: glyph = fbGlyph8; break;
|
||||
case 16: glyph = fbGlyph16; break;
|
||||
#ifdef FB_24BIT
|
||||
case 24: glyph = fbGlyph24; break;
|
||||
#endif
|
||||
case 32: glyph = fbGlyph32; break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
x += pDrawable->x;
|
||||
y += pDrawable->y;
|
||||
|
||||
if (TERMINALFONT (pGC->font)
|
||||
#ifndef FBNOPIXADDR
|
||||
&& !glyph
|
||||
#endif
|
||||
)
|
||||
{
|
||||
opaque = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int xBack, widthBack;
|
||||
int yBack, heightBack;
|
||||
|
||||
ppci = ppciInit;
|
||||
n = nglyph;
|
||||
widthBack = 0;
|
||||
while (n--)
|
||||
widthBack += (*ppci++)->metrics.characterWidth;
|
||||
|
||||
xBack = x;
|
||||
if (widthBack < 0)
|
||||
{
|
||||
xBack += widthBack;
|
||||
widthBack = -widthBack;
|
||||
}
|
||||
yBack = y - FONTASCENT(pGC->font);
|
||||
heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
|
||||
rlSolidBoxClipped (pDrawable,
|
||||
fbGetCompositeClip(pGC),
|
||||
xBack,
|
||||
yBack,
|
||||
xBack + widthBack,
|
||||
yBack + heightBack,
|
||||
fbAnd(GXcopy,pPriv->bg,pPriv->pm),
|
||||
fbXor(GXcopy,pPriv->bg,pPriv->pm));
|
||||
opaque = FALSE;
|
||||
}
|
||||
|
||||
ppci = ppciInit;
|
||||
while (nglyph--)
|
||||
{
|
||||
pci = *ppci++;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
gWidth = GLYPHWIDTHPIXELS(pci);
|
||||
gHeight = GLYPHHEIGHTPIXELS(pci);
|
||||
if (gWidth && gHeight)
|
||||
{
|
||||
gx = x + pci->metrics.leftSideBearing;
|
||||
gy = y - pci->metrics.ascent;
|
||||
#ifndef FBNOPIXADDR
|
||||
if (glyph && gWidth <= sizeof (FbStip) * 8 &&
|
||||
fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
|
||||
{
|
||||
(*glyph) (dst + (gy + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
dstBpp,
|
||||
(FbStip *) pglyph,
|
||||
pPriv->fg,
|
||||
gx + dstXoff,
|
||||
gHeight);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
|
||||
fbPutXYImage (pDrawable,
|
||||
fbGetCompositeClip(pGC),
|
||||
pPriv->fg,
|
||||
pPriv->bg,
|
||||
pPriv->pm,
|
||||
GXcopy,
|
||||
opaque,
|
||||
|
||||
gx,
|
||||
gy,
|
||||
gWidth, gHeight,
|
||||
|
||||
(FbStip *) pglyph,
|
||||
gStride,
|
||||
0);
|
||||
}
|
||||
}
|
||||
x += pci->metrics.characterWidth;
|
||||
}
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
* Accelerated rootless fill
|
||||
*/
|
||||
/*
|
||||
* This code is largely copied from fbsolid.c.
|
||||
*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
|
||||
* Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* 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 "rootlessCommon.h"
|
||||
|
||||
|
||||
void
|
||||
rlSolid (ScreenPtr pScreen,
|
||||
FbBits *dst,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
int bpp,
|
||||
|
||||
int width,
|
||||
int height,
|
||||
|
||||
FbBits and,
|
||||
FbBits xor)
|
||||
{
|
||||
FbBits startmask, endmask;
|
||||
int n, nmiddle;
|
||||
int startbyte, endbyte;
|
||||
|
||||
#ifdef FB_24BIT
|
||||
if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor)))
|
||||
{
|
||||
fbSolid24 (dst, dstStride, dstX, width, height, and, xor);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
dst += dstX >> FB_SHIFT;
|
||||
dstX &= FB_MASK;
|
||||
FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
|
||||
nmiddle, endmask, endbyte);
|
||||
|
||||
/*
|
||||
* Beginning of the rootless acceleration code
|
||||
*/
|
||||
if (!startmask && !endmask && !and &&
|
||||
height * nmiddle * sizeof (*dst) > rootless_FillBytes_threshold &&
|
||||
SCREENREC(pScreen)->imp->FillBytes)
|
||||
{
|
||||
if (bpp <= 8)
|
||||
xor |= xor << 8;
|
||||
if (bpp <= 16)
|
||||
xor |= xor << 16;
|
||||
|
||||
SCREENREC(pScreen)->imp->FillBytes(nmiddle * sizeof (*dst), height,
|
||||
xor, (char *) dst + (dstX >> 3),
|
||||
dstStride * sizeof (*dst));
|
||||
return;
|
||||
}
|
||||
/* End of the rootless acceleration code */
|
||||
|
||||
if (startmask)
|
||||
dstStride--;
|
||||
dstStride -= nmiddle;
|
||||
while (height--)
|
||||
{
|
||||
if (startmask)
|
||||
{
|
||||
FbDoLeftMaskByteRRop(dst,startbyte,startmask,and,xor);
|
||||
dst++;
|
||||
}
|
||||
n = nmiddle;
|
||||
if (!and)
|
||||
while (n--)
|
||||
*dst++ = xor;
|
||||
else
|
||||
while (n--)
|
||||
{
|
||||
*dst = FbDoRRop (*dst, and, xor);
|
||||
dst++;
|
||||
}
|
||||
if (endmask)
|
||||
FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor);
|
||||
dst += dstStride;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user