fb: Remove 24bpp support (v3)
v2: - Require power-of-two bpp in ScreenInit - Eliminate fbCreatePixmapBpp v3 - Squash in the exa and glamor changes so we can remove pRotatedPixmap in the same stroke. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
e33be78e2a
commit
0803918e64
25
exa/exa.c
25
exa/exa.c
|
@ -505,29 +505,14 @@ exaValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
|
|||
ExaScreenPriv(pScreen);
|
||||
ExaGCPriv(pGC);
|
||||
PixmapPtr pTile = NULL;
|
||||
Bool finish_current_tile = FALSE;
|
||||
|
||||
/* Either of these conditions is enough to trigger access to a tile pixmap. */
|
||||
/* With pGC->tileIsPixel == 1, you run the risk of dereferencing an invalid tile pixmap pointer. */
|
||||
/* Either of these conditions is enough to trigger access to a tile pixmap.
|
||||
* With pGC->tileIsPixel == 1, you run the risk of dereferencing an invalid
|
||||
* tile pixmap pointer.
|
||||
*/
|
||||
if (pGC->fillStyle == FillTiled ||
|
||||
((changes & GCTile) && !pGC->tileIsPixel)) {
|
||||
pTile = pGC->tile.pixmap;
|
||||
|
||||
/* Sometimes tile pixmaps are swapped, you need access to:
|
||||
* - The current tile if it depth matches.
|
||||
* - Or the rotated tile if that one matches depth and !(changes & GCTile).
|
||||
* - Or the current tile pixmap and a newly created one.
|
||||
*/
|
||||
if (pTile && pTile->drawable.depth != pDrawable->depth &&
|
||||
!(changes & GCTile)) {
|
||||
PixmapPtr pRotatedTile = fbGetRotatedPixmap(pGC);
|
||||
|
||||
if (pRotatedTile &&
|
||||
pRotatedTile->drawable.depth == pDrawable->depth)
|
||||
pTile = pRotatedTile;
|
||||
else
|
||||
finish_current_tile = TRUE; /* CreatePixmap will be called. */
|
||||
}
|
||||
}
|
||||
|
||||
if (pGC->stipple)
|
||||
|
@ -544,8 +529,6 @@ exaValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
|
|||
|
||||
if (pTile)
|
||||
exaFinishAccess(&pTile->drawable, EXA_PREPARE_SRC);
|
||||
if (finish_current_tile && pGC->tile.pixmap)
|
||||
exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_AUX_DEST);
|
||||
if (pGC->stipple)
|
||||
exaFinishAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@ libwfb_la_LIBADD = $(PIXMAN_LIBS)
|
|||
|
||||
libfb_la_SOURCES = \
|
||||
fb.h \
|
||||
fb24_32.c \
|
||||
fb24_32.h \
|
||||
fballpriv.c \
|
||||
fbarc.c \
|
||||
fbbits.c \
|
||||
|
|
166
fb/fb.h
166
fb/fb.h
|
@ -89,9 +89,6 @@
|
|||
#if GLYPHPADBYTES != 4
|
||||
#error "GLYPHPADBYTES must be 4"
|
||||
#endif
|
||||
/* for driver compat - intel UXA needs the second one at least */
|
||||
#define FB_24BIT
|
||||
#define FB_24_32BIT
|
||||
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
|
||||
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
|
||||
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
|
||||
|
@ -331,32 +328,6 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
|
|||
|
||||
#define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0)
|
||||
|
||||
/* Rotate a filled pixel value to the specified alignement */
|
||||
#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
|
||||
#define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b)))
|
||||
|
||||
/* step a filled pixel value to the next/previous FB_UNIT alignment */
|
||||
#define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24)))
|
||||
#define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24))
|
||||
#define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24)))
|
||||
#define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24))
|
||||
|
||||
/* step a rotation value to the next/previous rotation value */
|
||||
#define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8)
|
||||
#define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8)
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define FbFirst24Rot(x) (((x) + 16) % 24)
|
||||
#else
|
||||
#define FbFirst24Rot(x) ((x) % 24)
|
||||
#endif
|
||||
|
||||
#define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8)
|
||||
#define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8)
|
||||
|
||||
/* Whether 24-bit specific code is needed for this filled pixel value */
|
||||
#define FbCheck24Pix(p) ((p) == FbNext24Pix(p))
|
||||
|
||||
/* Macros for dealing with dashing */
|
||||
|
||||
#define FbDashDeclare \
|
||||
|
@ -433,8 +404,6 @@ fbGetScreenPrivateKey(void);
|
|||
|
||||
/* 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 */
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
|
||||
FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
|
||||
|
@ -452,7 +421,6 @@ typedef struct {
|
|||
FbBits bgand, bgxor; /* for stipples */
|
||||
FbBits fg, bg, pm; /* expanded and filled */
|
||||
unsigned int dashLength; /* total of all dash elements */
|
||||
unsigned char bpp; /* current drawable bpp */
|
||||
} FbGCPrivRec, *FbGCPrivPtr;
|
||||
|
||||
#define fbGetGCPrivateKey(pGC) (&fbGetScreenPrivate((pGC)->pScreen)->gcPrivateKeyRec)
|
||||
|
@ -462,7 +430,6 @@ typedef struct {
|
|||
|
||||
#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
|
||||
#define fbGetExpose(pGC) ((pGC)->fExpose)
|
||||
#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
|
||||
|
||||
#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
|
||||
|
||||
|
@ -539,64 +506,6 @@ typedef struct {
|
|||
*/
|
||||
#define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w))
|
||||
|
||||
/*
|
||||
* fb24_32.c
|
||||
*/
|
||||
extern _X_EXPORT void
|
||||
|
||||
fb24_32GetSpans(DrawablePtr pDrawable,
|
||||
int wMax,
|
||||
DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fb24_32SetSpans(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
char *src,
|
||||
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fb24_32PutZImage(DrawablePtr pDrawable,
|
||||
RegionPtr pClip,
|
||||
int alu,
|
||||
FbBits pm,
|
||||
int x,
|
||||
int y, int width, int height, CARD8 *src, FbStride srcStride);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fb24_32GetImage(DrawablePtr pDrawable,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h, unsigned int format, unsigned long planeMask, char *d);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fb24_32CopyMtoN(DrawablePtr pSrcDrawable,
|
||||
DrawablePtr pDstDrawable,
|
||||
GCPtr pGC,
|
||||
BoxPtr pbox,
|
||||
int nbox,
|
||||
int dx,
|
||||
int dy,
|
||||
Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
|
||||
|
||||
extern _X_EXPORT PixmapPtr
|
||||
fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
fb24_32CreateScreenResources(ScreenPtr pScreen);
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
|
||||
fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int bitsPerPixel, int devKind, void *pPixData);
|
||||
|
||||
/*
|
||||
* fballpriv.c
|
||||
*/
|
||||
|
@ -711,47 +620,6 @@ extern _X_EXPORT void
|
|||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbBresSolid24(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int dashOffset,
|
||||
int signdx,
|
||||
int signdy,
|
||||
int axis, int x, int y, int e, int e1, int e3, int len);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbBresDash24(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int dashOffset,
|
||||
int signdx,
|
||||
int signdy,
|
||||
int axis, int x, int y, int e, int e1, int e3, int len);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbDots24(FbBits * dst,
|
||||
FbStride dstStride,
|
||||
int dstBpp,
|
||||
BoxPtr pBox,
|
||||
xPoint * pts,
|
||||
int npt,
|
||||
int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbArc24(FbBits * dst,
|
||||
FbStride dstStride,
|
||||
int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
|
||||
|
||||
extern _X_EXPORT void
|
||||
fbPolyline24(DrawablePtr pDrawable,
|
||||
GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
|
||||
|
||||
extern _X_EXPORT void
|
||||
fbPolySegment24(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbBresSolid32(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int dashOffset,
|
||||
|
@ -811,17 +679,6 @@ fbBlt(FbBits * src,
|
|||
int width,
|
||||
int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbBlt24(FbBits * srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
FbBits * dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
int width,
|
||||
int height, int alu, FbBits pm, Bool reverse, Bool upsidedown);
|
||||
|
||||
extern _X_EXPORT void
|
||||
fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
|
||||
int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
|
||||
|
@ -842,17 +699,6 @@ fbBltOne(FbStip * src,
|
|||
int width,
|
||||
int height, FbBits fgand, FbBits fbxor, FbBits bgand, FbBits bgxor);
|
||||
|
||||
extern _X_EXPORT void
|
||||
fbBltOne24(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
|
||||
int srcX, /* bit position of source */
|
||||
FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
|
||||
int dstX, /* bit position of dest */
|
||||
int dstBpp, /* bits per destination unit */
|
||||
int width, /* width in bits of destination */
|
||||
int height, /* height in scanlines */
|
||||
FbBits fgand, /* rrop values */
|
||||
FbBits fgxor, FbBits bgand, FbBits bgxor);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbBltPlane(FbBits * src,
|
||||
|
@ -1114,12 +960,6 @@ fbDestroyGlyphCache(void);
|
|||
*/
|
||||
|
||||
extern _X_EXPORT PixmapPtr
|
||||
|
||||
fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
|
||||
unsigned usage_hint);
|
||||
|
||||
extern _X_EXPORT PixmapPtr
|
||||
|
||||
fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
|
||||
unsigned usage_hint);
|
||||
|
||||
|
@ -1257,12 +1097,6 @@ fbSolid(FbBits * dst,
|
|||
FbStride dstStride,
|
||||
int dstX, int bpp, int width, int height, FbBits and, FbBits xor);
|
||||
|
||||
extern _X_EXPORT void
|
||||
|
||||
fbSolid24(FbBits * dst,
|
||||
FbStride dstStride,
|
||||
int dstX, int width, int height, FbBits and, FbBits xor);
|
||||
|
||||
/*
|
||||
* fbutil.c
|
||||
*/
|
||||
|
|
548
fb/fb24_32.c
548
fb/fb24_32.c
|
@ -1,548 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
/* X apps don't like 24bpp images, this code exposes 32bpp images */
|
||||
|
||||
/*
|
||||
* These two functions do a full CopyArea while reformatting
|
||||
* the data between 24 and 32bpp. They try to go a bit faster
|
||||
* by reading/writing aligned CARD32s where it's easy
|
||||
*/
|
||||
|
||||
#define Get8(a) ((CARD32) READ(a))
|
||||
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
#define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
|
||||
#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \
|
||||
(WRITE((a+1), (CARD8) ((p) >> 8))), \
|
||||
(WRITE((a+2), (CARD8) (p))))
|
||||
#else
|
||||
#define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
|
||||
#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \
|
||||
(WRITE((a+1), (CARD8) ((p) >> 8))), \
|
||||
(WRITE((a+2), (CARD8) ((p) >> 16))))
|
||||
#endif
|
||||
|
||||
typedef void (*fb24_32BltFunc) (CARD8 *srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
CARD8 *dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
int width, int height, int alu, FbBits pm);
|
||||
|
||||
static void
|
||||
fb24_32BltDown(CARD8 *srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
CARD8 *dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX, int width, int height, int alu, FbBits pm)
|
||||
{
|
||||
CARD32 *src;
|
||||
CARD8 *dst;
|
||||
int w;
|
||||
Bool destInvarient;
|
||||
CARD32 pixel, dpixel;
|
||||
|
||||
FbDeclareMergeRop();
|
||||
|
||||
srcLine += srcX * 4;
|
||||
dstLine += dstX * 3;
|
||||
|
||||
FbInitializeMergeRop(alu, (pm | ~(FbBits) 0xffffff));
|
||||
destInvarient = FbDestInvarientMergeRop();
|
||||
|
||||
while (height--) {
|
||||
src = (CARD32 *) srcLine;
|
||||
dst = dstLine;
|
||||
srcLine += srcStride;
|
||||
dstLine += dstStride;
|
||||
w = width;
|
||||
if (destInvarient) {
|
||||
while (((long) dst & 3) && w) {
|
||||
w--;
|
||||
pixel = READ(src++);
|
||||
pixel = FbDoDestInvarientMergeRop(pixel);
|
||||
Put24(dst, pixel);
|
||||
dst += 3;
|
||||
}
|
||||
/* Do four aligned pixels at a time */
|
||||
while (w >= 4) {
|
||||
CARD32 s0, s1;
|
||||
|
||||
s0 = READ(src++);
|
||||
s0 = FbDoDestInvarientMergeRop(s0);
|
||||
s1 = READ(src++);
|
||||
s1 = FbDoDestInvarientMergeRop(s1);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
WRITE((CARD32 *) dst, (s0 & 0xffffff) | (s1 << 24));
|
||||
#else
|
||||
WRITE((CARD32 *) dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
|
||||
#endif
|
||||
s0 = READ(src++);
|
||||
s0 = FbDoDestInvarientMergeRop(s0);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
WRITE((CARD32 *) (dst + 4),
|
||||
((s1 & 0xffffff) >> 8) | (s0 << 16));
|
||||
#else
|
||||
WRITE((CARD32 *) (dst + 4),
|
||||
(s1 << 16) | ((s0 & 0xffffff) >> 8));
|
||||
#endif
|
||||
s1 = READ(src++);
|
||||
s1 = FbDoDestInvarientMergeRop(s1);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
WRITE((CARD32 *) (dst + 8),
|
||||
((s0 & 0xffffff) >> 16) | (s1 << 8));
|
||||
#else
|
||||
WRITE((CARD32 *) (dst + 8), (s0 << 24) | (s1 & 0xffffff));
|
||||
#endif
|
||||
dst += 12;
|
||||
w -= 4;
|
||||
}
|
||||
while (w--) {
|
||||
pixel = READ(src++);
|
||||
pixel = FbDoDestInvarientMergeRop(pixel);
|
||||
Put24(dst, pixel);
|
||||
dst += 3;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (w--) {
|
||||
pixel = READ(src++);
|
||||
dpixel = Get24(dst);
|
||||
pixel = FbDoMergeRop(pixel, dpixel);
|
||||
Put24(dst, pixel);
|
||||
dst += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fb24_32BltUp(CARD8 *srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
CARD8 *dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX, int width, int height, int alu, FbBits pm)
|
||||
{
|
||||
CARD8 *src;
|
||||
CARD32 *dst;
|
||||
int w;
|
||||
Bool destInvarient;
|
||||
CARD32 pixel;
|
||||
|
||||
FbDeclareMergeRop();
|
||||
|
||||
FbInitializeMergeRop(alu, (pm | (~(FbBits) 0xffffff)));
|
||||
destInvarient = FbDestInvarientMergeRop();
|
||||
|
||||
srcLine += srcX * 3;
|
||||
dstLine += dstX * 4;
|
||||
|
||||
while (height--) {
|
||||
w = width;
|
||||
src = srcLine;
|
||||
dst = (CARD32 *) dstLine;
|
||||
srcLine += srcStride;
|
||||
dstLine += dstStride;
|
||||
if (destInvarient) {
|
||||
while (((long) src & 3) && w) {
|
||||
w--;
|
||||
pixel = Get24(src);
|
||||
src += 3;
|
||||
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
|
||||
}
|
||||
/* Do four aligned pixels at a time */
|
||||
while (w >= 4) {
|
||||
CARD32 s0, s1;
|
||||
|
||||
s0 = READ((CARD32 *) src);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
pixel = s0 & 0xffffff;
|
||||
#else
|
||||
pixel = s0 >> 8;
|
||||
#endif
|
||||
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
|
||||
s1 = READ((CARD32 *) (src + 4));
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
|
||||
#else
|
||||
pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
|
||||
#endif
|
||||
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
|
||||
s0 = READ((CARD32 *) (src + 8));
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
|
||||
#else
|
||||
pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
|
||||
#endif
|
||||
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
pixel = s0 >> 8;
|
||||
#else
|
||||
pixel = s0 & 0xffffff;
|
||||
#endif
|
||||
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
|
||||
src += 12;
|
||||
w -= 4;
|
||||
}
|
||||
while (w) {
|
||||
w--;
|
||||
pixel = Get24(src);
|
||||
src += 3;
|
||||
WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (w--) {
|
||||
pixel = Get24(src);
|
||||
src += 3;
|
||||
WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Spans functions; probably unused.
|
||||
*/
|
||||
void
|
||||
fb24_32GetSpans(DrawablePtr pDrawable,
|
||||
int wMax,
|
||||
DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart)
|
||||
{
|
||||
FbBits *srcBits;
|
||||
CARD8 *src;
|
||||
FbStride srcStride;
|
||||
int srcBpp;
|
||||
int srcXoff, srcYoff;
|
||||
CARD8 *dst;
|
||||
|
||||
fbGetDrawable(pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
|
||||
src = (CARD8 *) srcBits;
|
||||
srcStride *= sizeof(FbBits);
|
||||
|
||||
while (nspans--) {
|
||||
dst = (CARD8 *) pchardstStart;
|
||||
fb24_32BltUp(src + (ppt->y + srcYoff) * srcStride, srcStride,
|
||||
ppt->x + srcXoff,
|
||||
dst, 1, 0, *pwidth, 1, GXcopy, FB_ALLONES);
|
||||
|
||||
pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
|
||||
ppt++;
|
||||
pwidth++;
|
||||
}
|
||||
|
||||
fbFinishAccess(pDrawable);
|
||||
}
|
||||
|
||||
void
|
||||
fb24_32SetSpans(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
char *src,
|
||||
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
|
||||
{
|
||||
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
|
||||
RegionPtr pClip = fbGetCompositeClip(pGC);
|
||||
FbBits *dstBits;
|
||||
CARD8 *dst, *d, *s;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
BoxPtr pbox;
|
||||
int n;
|
||||
int x1, x2;
|
||||
|
||||
fbGetDrawable(pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
dst = (CARD8 *) dstBits;
|
||||
dstStride *= sizeof(FbBits);
|
||||
while (nspans--) {
|
||||
d = dst + (ppt->y + dstYoff) * dstStride;
|
||||
s = (CARD8 *) src;
|
||||
n = RegionNumRects(pClip);
|
||||
pbox = RegionRects(pClip);
|
||||
while (n--) {
|
||||
if (pbox->y1 > ppt->y)
|
||||
break;
|
||||
if (pbox->y2 > ppt->y) {
|
||||
x1 = ppt->x;
|
||||
x2 = x1 + *pwidth;
|
||||
if (pbox->x1 > x1)
|
||||
x1 = pbox->x1;
|
||||
if (pbox->x2 < x2)
|
||||
x2 = pbox->x2;
|
||||
if (x1 < x2)
|
||||
fb24_32BltDown(s,
|
||||
0,
|
||||
(x1 - ppt->x),
|
||||
d,
|
||||
dstStride,
|
||||
x1 + dstXoff,
|
||||
(x2 - x1), 1, pGC->alu, pPriv->pm);
|
||||
}
|
||||
}
|
||||
src += PixmapBytePad(*pwidth, pDrawable->depth);
|
||||
ppt++;
|
||||
pwidth++;
|
||||
}
|
||||
|
||||
fbFinishAccess(pDrawable);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clip and put 32bpp Z-format images to a 24bpp drawable
|
||||
*/
|
||||
void
|
||||
fb24_32PutZImage(DrawablePtr pDrawable,
|
||||
RegionPtr pClip,
|
||||
int alu,
|
||||
FbBits pm,
|
||||
int x,
|
||||
int y, int width, int height, CARD8 *src, FbStride srcStride)
|
||||
{
|
||||
FbBits *dstBits;
|
||||
CARD8 *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
fbGetDrawable(pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
dstStride *= sizeof(FbBits);
|
||||
dst = (CARD8 *) dstBits;
|
||||
|
||||
for (nbox = RegionNumRects(pClip),
|
||||
pbox = RegionRects(pClip); nbox--; pbox++) {
|
||||
x1 = x;
|
||||
y1 = y;
|
||||
x2 = x + width;
|
||||
y2 = y + height;
|
||||
if (x1 < pbox->x1)
|
||||
x1 = pbox->x1;
|
||||
if (y1 < pbox->y1)
|
||||
y1 = pbox->y1;
|
||||
if (x2 > pbox->x2)
|
||||
x2 = pbox->x2;
|
||||
if (y2 > pbox->y2)
|
||||
y2 = pbox->y2;
|
||||
if (x1 >= x2 || y1 >= y2)
|
||||
continue;
|
||||
fb24_32BltDown(src + (y1 - y) * srcStride,
|
||||
srcStride,
|
||||
(x1 - x),
|
||||
dst + (y1 + dstYoff) * dstStride,
|
||||
dstStride, x1 + dstXoff, (x2 - x1), (y2 - y1), alu, pm);
|
||||
}
|
||||
|
||||
fbFinishAccess(pDrawable);
|
||||
}
|
||||
|
||||
void
|
||||
fb24_32GetImage(DrawablePtr pDrawable,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h, unsigned int format, unsigned long planeMask, char *d)
|
||||
{
|
||||
FbBits *srcBits;
|
||||
CARD8 *src;
|
||||
FbStride srcStride;
|
||||
int srcBpp;
|
||||
int srcXoff, srcYoff;
|
||||
FbStride dstStride;
|
||||
FbBits pm;
|
||||
|
||||
fbGetDrawable(pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
|
||||
src = (CARD8 *) srcBits;
|
||||
srcStride *= sizeof(FbBits);
|
||||
|
||||
x += pDrawable->x;
|
||||
y += pDrawable->y;
|
||||
|
||||
pm = fbReplicatePixel(planeMask, 32);
|
||||
dstStride = PixmapBytePad(w, pDrawable->depth);
|
||||
if (pm != FB_ALLONES)
|
||||
memset(d, 0, dstStride * h);
|
||||
fb24_32BltUp(src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
|
||||
(CARD8 *) d, dstStride, 0, w, h, GXcopy, pm);
|
||||
|
||||
fbFinishAccess(pDrawable);
|
||||
}
|
||||
|
||||
void
|
||||
fb24_32CopyMtoN(DrawablePtr pSrcDrawable,
|
||||
DrawablePtr pDstDrawable,
|
||||
GCPtr pGC,
|
||||
BoxPtr pbox,
|
||||
int nbox,
|
||||
int dx,
|
||||
int dy,
|
||||
Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
|
||||
{
|
||||
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
|
||||
FbBits *srcBits;
|
||||
CARD8 *src;
|
||||
FbStride srcStride;
|
||||
int srcBpp;
|
||||
FbBits *dstBits;
|
||||
CARD8 *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
fb24_32BltFunc blt;
|
||||
int srcXoff, srcYoff;
|
||||
int dstXoff, dstYoff;
|
||||
|
||||
fbGetDrawable(pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
|
||||
src = (CARD8 *) srcBits;
|
||||
srcStride *= sizeof(FbBits);
|
||||
fbGetDrawable(pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
dst = (CARD8 *) dstBits;
|
||||
dstStride *= sizeof(FbBits);
|
||||
if (srcBpp == 24)
|
||||
blt = fb24_32BltUp;
|
||||
else
|
||||
blt = fb24_32BltDown;
|
||||
|
||||
while (nbox--) {
|
||||
(*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride,
|
||||
srcStride,
|
||||
(pbox->x1 + dx + srcXoff),
|
||||
dst + (pbox->y1 + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(pbox->x1 + dstXoff),
|
||||
(pbox->x2 - pbox->x1),
|
||||
(pbox->y2 - pbox->y1), pGC->alu, pPriv->pm);
|
||||
pbox++;
|
||||
}
|
||||
|
||||
fbFinishAccess(pSrcDrawable);
|
||||
fbFinishAccess(pDstDrawable);
|
||||
}
|
||||
|
||||
PixmapPtr
|
||||
fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
|
||||
{
|
||||
ScreenPtr pScreen = pOldTile->drawable.pScreen;
|
||||
PixmapPtr pNewTile;
|
||||
FbBits *old, *new;
|
||||
FbStride oldStride, newStride;
|
||||
int oldBpp, newBpp;
|
||||
fb24_32BltFunc blt;
|
||||
_X_UNUSED int oldXoff, oldYoff;
|
||||
_X_UNUSED int newXoff, newYoff;
|
||||
|
||||
pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
|
||||
pOldTile->drawable.height,
|
||||
pOldTile->drawable.depth,
|
||||
pOldTile->usage_hint);
|
||||
if (!pNewTile)
|
||||
return 0;
|
||||
fbGetDrawable(&pOldTile->drawable,
|
||||
old, oldStride, oldBpp, oldXoff, oldYoff);
|
||||
fbGetDrawable(&pNewTile->drawable,
|
||||
new, newStride, newBpp, newXoff, newYoff);
|
||||
if (oldBpp == 24)
|
||||
blt = fb24_32BltUp;
|
||||
else
|
||||
blt = fb24_32BltDown;
|
||||
|
||||
(*blt) ((CARD8 *) old,
|
||||
oldStride * sizeof(FbBits),
|
||||
0,
|
||||
(CARD8 *) new,
|
||||
newStride * sizeof(FbBits),
|
||||
0,
|
||||
pOldTile->drawable.width,
|
||||
pOldTile->drawable.height, GXcopy, FB_ALLONES);
|
||||
|
||||
fbFinishAccess(&pOldTile->drawable);
|
||||
fbFinishAccess(&pNewTile->drawable);
|
||||
|
||||
return pNewTile;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
void *pbits;
|
||||
int width;
|
||||
} miScreenInitParmsRec, *miScreenInitParmsPtr;
|
||||
|
||||
Bool
|
||||
fb24_32CreateScreenResources(ScreenPtr pScreen)
|
||||
{
|
||||
miScreenInitParmsPtr pScrInitParms;
|
||||
int pitch;
|
||||
Bool retval;
|
||||
|
||||
/* get the pitch before mi destroys it */
|
||||
pScrInitParms = (miScreenInitParmsPtr) pScreen->devPrivate;
|
||||
pitch = BitmapBytePad(pScrInitParms->width * 24);
|
||||
|
||||
if ((retval = miCreateScreenResources(pScreen))) {
|
||||
/* fix the screen pixmap */
|
||||
PixmapPtr pPix = (PixmapPtr) pScreen->devPrivate;
|
||||
|
||||
pPix->drawable.bitsPerPixel = 24;
|
||||
pPix->devKind = pitch;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Bool
|
||||
fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int bitsPerPixel, int devKind, void *pPixData)
|
||||
{
|
||||
int bpp, w;
|
||||
|
||||
if (!pPixmap)
|
||||
return FALSE;
|
||||
bpp = bitsPerPixel;
|
||||
if (bpp <= 0)
|
||||
bpp = pPixmap->drawable.bitsPerPixel;
|
||||
if (bpp == 24) {
|
||||
if (devKind < 0) {
|
||||
w = width;
|
||||
if (w <= 0)
|
||||
w = pPixmap->drawable.width;
|
||||
devKind = BitmapBytePad(w * 24);
|
||||
}
|
||||
}
|
||||
return miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
|
||||
devKind, pPixData);
|
||||
}
|
44
fb/fb24_32.h
44
fb/fb24_32.h
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _FB24_32_H_
|
||||
#define _FB24_32_H_
|
||||
|
||||
Bool
|
||||
|
||||
fb24_32FinishScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize,
|
||||
int ysize, int dpix, int dpiy, int width, int bpp);
|
||||
|
||||
Bool
|
||||
|
||||
fb24_32ScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
|
||||
|
||||
#endif
|
|
@ -48,9 +48,6 @@ fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
|
|||
case 16:
|
||||
arc = fbArc16;
|
||||
break;
|
||||
case 24:
|
||||
arc = fbArc24;
|
||||
break;
|
||||
case 32:
|
||||
arc = fbArc32;
|
||||
break;
|
||||
|
|
58
fb/fbbits.c
58
fb/fbbits.c
|
@ -83,64 +83,6 @@
|
|||
#undef BITS
|
||||
#undef BITS2
|
||||
|
||||
#define BRESSOLID fbBresSolid24
|
||||
#define BRESDASH fbBresDash24
|
||||
#define DOTS fbDots24
|
||||
#define ARC fbArc24
|
||||
#define POLYLINE fbPolyline24
|
||||
#define POLYSEGMENT fbPolySegment24
|
||||
|
||||
#define BITS CARD32
|
||||
#define BITSUNIT BYTE
|
||||
#define BITSMUL 3
|
||||
|
||||
#define FbDoTypeStore(b,t,x,s) WRITE(((t *) (b)), (x) >> (s))
|
||||
#define FbDoTypeRRop(b,t,a,x,s) WRITE((t *) (b), FbDoRRop(READ((t *) (b)),\
|
||||
(a) >> (s), \
|
||||
(x) >> (s)))
|
||||
#define FbDoTypeMaskRRop(b,t,a,x,m,s) WRITE((t *) (b), FbDoMaskRRop(READ((t *) (b)),\
|
||||
(a) >> (s), \
|
||||
(x) >> (s), \
|
||||
(m) >> (s)))
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
#define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \
|
||||
(FbDoTypeStore (b, CARD8, x, 0), \
|
||||
FbDoTypeStore ((b) + 1, CARD16, x, 8)) : \
|
||||
(FbDoTypeStore (b, CARD16, x, 0), \
|
||||
FbDoTypeStore ((b) + 2, CARD8, x, 16)))
|
||||
#define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \
|
||||
(FbDoTypeRRop(b,CARD8,a,x,0), \
|
||||
FbDoTypeRRop((b)+1,CARD16,a,x,8)) : \
|
||||
(FbDoTypeRRop(b,CARD16,a,x,0), \
|
||||
FbDoTypeRRop((b)+2,CARD8,a,x,16)))
|
||||
#else
|
||||
#define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \
|
||||
(FbDoTypeStore (b, CARD8, x, 16), \
|
||||
FbDoTypeStore ((b) + 1, CARD16, x, 0)) : \
|
||||
(FbDoTypeStore (b, CARD16, x, 8), \
|
||||
FbDoTypeStore ((b) + 2, CARD8, x, 0)))
|
||||
#define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \
|
||||
(FbDoTypeRRop (b, CARD8, a, x, 16), \
|
||||
FbDoTypeRRop ((b) + 1, CARD16, a, x, 0)) : \
|
||||
(FbDoTypeRRop (b, CARD16, a, x, 8), \
|
||||
FbDoTypeRRop ((b) + 2, CARD8, a, x, 0)))
|
||||
#endif
|
||||
|
||||
#include "fbbits.h"
|
||||
|
||||
#undef BITSSTORE
|
||||
#undef BITSRROP
|
||||
#undef BITSMUL
|
||||
#undef BITSUNIT
|
||||
#undef BITS
|
||||
|
||||
#undef BRESSOLID
|
||||
#undef BRESDASH
|
||||
#undef DOTS
|
||||
#undef ARC
|
||||
#undef POLYLINE
|
||||
#undef POLYSEGMENT
|
||||
|
||||
#define BRESSOLID fbBresSolid32
|
||||
#define BRESDASH fbBresDash32
|
||||
#define DOTS fbDots32
|
||||
|
|
133
fb/fbbits.h
133
fb/fbbits.h
|
@ -31,12 +31,6 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifdef BITSMUL
|
||||
#define MUL BITSMUL
|
||||
#else
|
||||
#define MUL 1
|
||||
#endif
|
||||
|
||||
#ifdef BITSSTORE
|
||||
#define STORE(b,x) BITSSTORE(b,x)
|
||||
#else
|
||||
|
@ -86,17 +80,17 @@ BRESSOLID(DrawablePtr pDrawable,
|
|||
|
||||
fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
bits =
|
||||
((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
|
||||
((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff);
|
||||
bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
|
||||
if (signdy < 0)
|
||||
bitsStride = -bitsStride;
|
||||
if (axis == X_AXIS) {
|
||||
majorStep = signdx * MUL;
|
||||
majorStep = signdx;
|
||||
minorStep = bitsStride;
|
||||
}
|
||||
else {
|
||||
majorStep = bitsStride;
|
||||
minorStep = signdx * MUL;
|
||||
minorStep = signdx;
|
||||
}
|
||||
while (len--) {
|
||||
STORE(bits, xor);
|
||||
|
@ -143,17 +137,17 @@ BRESDASH(DrawablePtr pDrawable,
|
|||
FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
|
||||
|
||||
bits =
|
||||
((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
|
||||
((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff);
|
||||
bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
|
||||
if (signdy < 0)
|
||||
bitsStride = -bitsStride;
|
||||
if (axis == X_AXIS) {
|
||||
majorStep = signdx * MUL;
|
||||
majorStep = signdx;
|
||||
minorStep = bitsStride;
|
||||
}
|
||||
else {
|
||||
majorStep = bitsStride;
|
||||
minorStep = signdx * MUL;
|
||||
minorStep = signdx;
|
||||
}
|
||||
if (dashlen >= len)
|
||||
dashlen = len;
|
||||
|
@ -260,13 +254,13 @@ DOTS(FbBits * dst,
|
|||
ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg);
|
||||
lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1);
|
||||
|
||||
bits += bitsStride * (yorg + yoff) + (xorg + xoff) * MUL;
|
||||
bits += bitsStride * (yorg + yoff) + (xorg + xoff);
|
||||
|
||||
if (and == 0) {
|
||||
while (npt--) {
|
||||
pt = *pts++;
|
||||
if (!isClipped(pt, ul, lr)) {
|
||||
point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
|
||||
point = bits + intToY(pt) * bitsStride + intToX(pt);
|
||||
STORE(point, bxor);
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +269,7 @@ DOTS(FbBits * dst,
|
|||
while (npt--) {
|
||||
pt = *pts++;
|
||||
if (!isClipped(pt, ul, lr)) {
|
||||
point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
|
||||
point = bits + intToY(pt) * bitsStride + intToX(pt);
|
||||
RROP(point, band, bxor);
|
||||
}
|
||||
}
|
||||
|
@ -311,8 +305,8 @@ ARC(FbBits * dst,
|
|||
do360 = miZeroArcSetup(arc, &info, TRUE);
|
||||
yorgp = bits + ((info.yorg + drawY) * bitsStride);
|
||||
yorgop = bits + ((info.yorgo + drawY) * bitsStride);
|
||||
info.xorg = (info.xorg + drawX) * MUL;
|
||||
info.xorgo = (info.xorgo + drawX) * MUL;
|
||||
info.xorg = (info.xorg + drawX);
|
||||
info.xorgo = (info.xorgo + drawX);
|
||||
MIARCSETUP();
|
||||
yoffset = y ? bitsStride : 0;
|
||||
dyoffset = 0;
|
||||
|
@ -339,37 +333,37 @@ ARC(FbBits * dst,
|
|||
if (do360 && (arc->width == arc->height) && !(arc->width & 1)) {
|
||||
int xoffset = bitsStride;
|
||||
UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg;
|
||||
UNIT *yorgohb = yorghb - info.h * MUL;
|
||||
UNIT *yorgohb = yorghb - info.h;
|
||||
|
||||
yorgp += info.xorg;
|
||||
yorgop += info.xorg;
|
||||
yorghb += info.h * MUL;
|
||||
yorghb += info.h;
|
||||
while (1) {
|
||||
if (andBits == 0) {
|
||||
ARCCOPY(yorgp + yoffset + x * MUL);
|
||||
ARCCOPY(yorgp + yoffset - x * MUL);
|
||||
ARCCOPY(yorgop - yoffset - x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + x);
|
||||
ARCCOPY(yorgp + yoffset - x);
|
||||
ARCCOPY(yorgop - yoffset - x);
|
||||
ARCCOPY(yorgop - yoffset + x);
|
||||
}
|
||||
else {
|
||||
ARCRROP(yorgp + yoffset + x * MUL);
|
||||
ARCRROP(yorgp + yoffset - x * MUL);
|
||||
ARCRROP(yorgop - yoffset - x * MUL);
|
||||
ARCRROP(yorgop - yoffset + x * MUL);
|
||||
ARCRROP(yorgp + yoffset + x);
|
||||
ARCRROP(yorgp + yoffset - x);
|
||||
ARCRROP(yorgop - yoffset - x);
|
||||
ARCRROP(yorgop - yoffset + x);
|
||||
}
|
||||
if (a < 0)
|
||||
break;
|
||||
if (andBits == 0) {
|
||||
ARCCOPY(yorghb - xoffset - y * MUL);
|
||||
ARCCOPY(yorgohb - xoffset + y * MUL);
|
||||
ARCCOPY(yorgohb + xoffset + y * MUL);
|
||||
ARCCOPY(yorghb + xoffset - y * MUL);
|
||||
ARCCOPY(yorghb - xoffset - y);
|
||||
ARCCOPY(yorgohb - xoffset + y);
|
||||
ARCCOPY(yorgohb + xoffset + y);
|
||||
ARCCOPY(yorghb + xoffset - y);
|
||||
}
|
||||
else {
|
||||
ARCRROP(yorghb - xoffset - y * MUL);
|
||||
ARCRROP(yorgohb - xoffset + y * MUL);
|
||||
ARCRROP(yorgohb + xoffset + y * MUL);
|
||||
ARCRROP(yorghb + xoffset - y * MUL);
|
||||
ARCRROP(yorghb - xoffset - y);
|
||||
ARCRROP(yorgohb - xoffset + y);
|
||||
ARCRROP(yorgohb + xoffset + y);
|
||||
ARCRROP(yorghb + xoffset - y);
|
||||
}
|
||||
xoffset += bitsStride;
|
||||
MIARCCIRCLESTEP(yoffset += bitsStride;
|
||||
|
@ -385,16 +379,16 @@ ARC(FbBits * dst,
|
|||
MIARCOCTANTSHIFT(dyoffset = bitsStride;
|
||||
);
|
||||
if (andBits == 0) {
|
||||
ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + info.xorg + x);
|
||||
ARCCOPY(yorgp + yoffset + info.xorgo - x);
|
||||
ARCCOPY(yorgop - yoffset + info.xorgo - x);
|
||||
ARCCOPY(yorgop - yoffset + info.xorg + x);
|
||||
}
|
||||
else {
|
||||
ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
|
||||
ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
|
||||
ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
|
||||
ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
|
||||
ARCRROP(yorgp + yoffset + info.xorg + x);
|
||||
ARCRROP(yorgp + yoffset + info.xorgo - x);
|
||||
ARCRROP(yorgop - yoffset + info.xorgo - x);
|
||||
ARCRROP(yorgop - yoffset + info.xorg + x);
|
||||
}
|
||||
MIARCSTEP(yoffset += dyoffset;
|
||||
, yoffset += bitsStride;
|
||||
|
@ -411,23 +405,23 @@ ARC(FbBits * dst,
|
|||
}
|
||||
if (andBits == 0) {
|
||||
if (mask & 1)
|
||||
ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + info.xorg + x);
|
||||
if (mask & 2)
|
||||
ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + info.xorgo - x);
|
||||
if (mask & 4)
|
||||
ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + info.xorgo - x);
|
||||
if (mask & 8)
|
||||
ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + info.xorg + x);
|
||||
}
|
||||
else {
|
||||
if (mask & 1)
|
||||
ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
|
||||
ARCRROP(yorgp + yoffset + info.xorg + x);
|
||||
if (mask & 2)
|
||||
ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
|
||||
ARCRROP(yorgp + yoffset + info.xorgo - x);
|
||||
if (mask & 4)
|
||||
ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
|
||||
ARCRROP(yorgop - yoffset + info.xorgo - x);
|
||||
if (mask & 8)
|
||||
ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
|
||||
ARCRROP(yorgop - yoffset + info.xorg + x);
|
||||
}
|
||||
if ((x == info.end.x) || (y == info.end.y)) {
|
||||
mask = info.end.mask;
|
||||
|
@ -442,26 +436,26 @@ ARC(FbBits * dst,
|
|||
mask = info.start.mask;
|
||||
if (andBits == 0) {
|
||||
if (mask & 1)
|
||||
ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + info.xorg + x);
|
||||
if (mask & 4)
|
||||
ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + info.xorgo - x);
|
||||
if (arc->height & 1) {
|
||||
if (mask & 2)
|
||||
ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
|
||||
ARCCOPY(yorgp + yoffset + info.xorgo - x);
|
||||
if (mask & 8)
|
||||
ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
|
||||
ARCCOPY(yorgop - yoffset + info.xorg + x);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mask & 1)
|
||||
ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
|
||||
ARCRROP(yorgp + yoffset + info.xorg + x);
|
||||
if (mask & 4)
|
||||
ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
|
||||
ARCRROP(yorgop - yoffset + info.xorgo - x);
|
||||
if (arc->height & 1) {
|
||||
if (mask & 2)
|
||||
ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
|
||||
ARCRROP(yorgp + yoffset + info.xorgo - x);
|
||||
if (mask & 8)
|
||||
ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
|
||||
ARCRROP(yorgop - yoffset + info.xorg + x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -626,7 +620,7 @@ POLYLINE(DrawablePtr pDrawable,
|
|||
fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
|
||||
bitsBase =
|
||||
((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
|
||||
((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff);
|
||||
ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
|
||||
lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
|
||||
|
||||
|
@ -649,13 +643,12 @@ POLYLINE(DrawablePtr pDrawable,
|
|||
npt--;
|
||||
}
|
||||
else {
|
||||
bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
|
||||
bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1);
|
||||
for (;;) {
|
||||
CalcLineDeltas(intToX(pt1), intToY(pt1),
|
||||
intToX(pt2), intToY(pt2),
|
||||
len, e1, stepmajor, stepminor, 1, bitsStride,
|
||||
octant);
|
||||
stepmajor *= MUL;
|
||||
if (len < e1) {
|
||||
e3 = len;
|
||||
len = e1;
|
||||
|
@ -747,7 +740,7 @@ POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
|
|||
fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
|
||||
bitsBase =
|
||||
((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
|
||||
((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff);
|
||||
ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
|
||||
lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
|
||||
|
||||
|
@ -767,11 +760,7 @@ POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
|
|||
intToX(pt2), intToY(pt2),
|
||||
len, e1, stepmajor, stepminor, 1, bitsStride,
|
||||
octant);
|
||||
if (e1 == 0 && len > 3
|
||||
#if MUL != 1
|
||||
&& FbCheck24Pix(and) && FbCheck24Pix(xor)
|
||||
#endif
|
||||
) {
|
||||
if (e1 == 0 && len > 3) {
|
||||
int x1, x2;
|
||||
FbBits *dstLine;
|
||||
int dstX, width;
|
||||
|
@ -790,8 +779,8 @@ POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
|
|||
if (!capNotLast)
|
||||
x2++;
|
||||
}
|
||||
dstX = (x1 + xoff + dstXoff) * (sizeof(UNIT) * 8 * MUL);
|
||||
width = (x2 - x1) * (sizeof(UNIT) * 8 * MUL);
|
||||
dstX = (x1 + xoff + dstXoff) * (sizeof(UNIT) * 8);
|
||||
width = (x2 - x1) * (sizeof(UNIT) * 8);
|
||||
|
||||
dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride;
|
||||
dstLine += dstX >> FB_SHIFT;
|
||||
|
@ -818,8 +807,7 @@ POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
|
|||
endmask));
|
||||
}
|
||||
else {
|
||||
stepmajor *= MUL;
|
||||
bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
|
||||
bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1);
|
||||
if (len < e1) {
|
||||
e3 = len;
|
||||
len = e1;
|
||||
|
@ -866,7 +854,6 @@ POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
|
|||
}
|
||||
#endif
|
||||
|
||||
#undef MUL
|
||||
#undef STORE
|
||||
#undef RROP
|
||||
#undef UNIT
|
||||
|
|
228
fb/fbblt.c
228
fb/fbblt.c
|
@ -92,12 +92,6 @@ fbBlt(FbBits * srcLine,
|
|||
}
|
||||
}
|
||||
|
||||
if (bpp == 24 && !FbCheck24Pix(pm)) {
|
||||
fbBlt24(srcLine, srcStride, srcX, dstLine, dstStride, dstX,
|
||||
width, height, alu, pm, reverse, upsidedown);
|
||||
return;
|
||||
}
|
||||
|
||||
FbInitializeMergeRop(alu, pm);
|
||||
destInvarient = FbDestInvarientMergeRop();
|
||||
if (upsidedown) {
|
||||
|
@ -298,228 +292,6 @@ fbBlt(FbBits * srcLine,
|
|||
}
|
||||
}
|
||||
|
||||
#undef DEBUG_BLT24
|
||||
#ifdef DEBUG_BLT24
|
||||
|
||||
static unsigned long
|
||||
getPixel(char *src, int x)
|
||||
{
|
||||
unsigned long l;
|
||||
|
||||
l = 0;
|
||||
memcpy(&l, src + x * 3, 3);
|
||||
return l;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
fbBlt24Line(FbBits * src,
|
||||
int srcX,
|
||||
FbBits * dst, int dstX, int width, int alu, FbBits pm, Bool reverse)
|
||||
{
|
||||
#ifdef DEBUG_BLT24
|
||||
char *origDst = (char *) dst;
|
||||
FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1);
|
||||
int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3;
|
||||
int origX = dstX / 24;
|
||||
#endif
|
||||
|
||||
int leftShift, rightShift;
|
||||
FbBits startmask, endmask;
|
||||
int n;
|
||||
|
||||
FbBits bits, bits1;
|
||||
FbBits mask;
|
||||
|
||||
int rot;
|
||||
|
||||
FbDeclareMergeRop();
|
||||
|
||||
FbInitializeMergeRop(alu, FB_ALLONES);
|
||||
FbMaskBits(dstX, width, startmask, n, endmask);
|
||||
#ifdef DEBUG_BLT24
|
||||
ErrorF("dstX %d width %d reverse %d\n", dstX, width, reverse);
|
||||
#endif
|
||||
if (reverse) {
|
||||
src += ((srcX + width - 1) >> FB_SHIFT) + 1;
|
||||
dst += ((dstX + width - 1) >> FB_SHIFT) + 1;
|
||||
rot = FbFirst24Rot(((dstX + width - 8) & FB_MASK));
|
||||
rot = FbPrev24Rot(rot);
|
||||
#ifdef DEBUG_BLT24
|
||||
ErrorF("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK,
|
||||
rot);
|
||||
#endif
|
||||
srcX = (srcX + width - 1) & FB_MASK;
|
||||
dstX = (dstX + width - 1) & FB_MASK;
|
||||
}
|
||||
else {
|
||||
src += srcX >> FB_SHIFT;
|
||||
dst += dstX >> FB_SHIFT;
|
||||
srcX &= FB_MASK;
|
||||
dstX &= FB_MASK;
|
||||
rot = FbFirst24Rot(dstX);
|
||||
#ifdef DEBUG_BLT24
|
||||
ErrorF("dstX: %d rot: %d\n", dstX, rot);
|
||||
#endif
|
||||
}
|
||||
mask = FbRot24(pm, rot);
|
||||
#ifdef DEBUG_BLT24
|
||||
ErrorF("pm 0x%x mask 0x%x\n", pm, mask);
|
||||
#endif
|
||||
if (srcX == dstX) {
|
||||
if (reverse) {
|
||||
if (endmask) {
|
||||
bits = READ(--src);
|
||||
--dst;
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
|
||||
mask = FbPrev24Pix(mask);
|
||||
}
|
||||
while (n--) {
|
||||
bits = READ(--src);
|
||||
--dst;
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
|
||||
mask = FbPrev24Pix(mask);
|
||||
}
|
||||
if (startmask) {
|
||||
bits = READ(--src);
|
||||
--dst;
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (startmask) {
|
||||
bits = READ(src++);
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
|
||||
dst++;
|
||||
mask = FbNext24Pix(mask);
|
||||
}
|
||||
while (n--) {
|
||||
bits = READ(src++);
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
|
||||
dst++;
|
||||
mask = FbNext24Pix(mask);
|
||||
}
|
||||
if (endmask) {
|
||||
bits = READ(src);
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (srcX > dstX) {
|
||||
leftShift = srcX - dstX;
|
||||
rightShift = FB_UNIT - leftShift;
|
||||
}
|
||||
else {
|
||||
rightShift = dstX - srcX;
|
||||
leftShift = FB_UNIT - rightShift;
|
||||
}
|
||||
|
||||
bits1 = 0;
|
||||
if (reverse) {
|
||||
if (srcX < dstX)
|
||||
bits1 = READ(--src);
|
||||
if (endmask) {
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
if (FbScrRight(endmask, leftShift)) {
|
||||
bits1 = READ(--src);
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
}
|
||||
--dst;
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
|
||||
mask = FbPrev24Pix(mask);
|
||||
}
|
||||
while (n--) {
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
bits1 = READ(--src);
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
--dst;
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
|
||||
mask = FbPrev24Pix(mask);
|
||||
}
|
||||
if (startmask) {
|
||||
bits = FbScrRight(bits1, rightShift);
|
||||
if (FbScrRight(startmask, leftShift)) {
|
||||
bits1 = READ(--src);
|
||||
bits |= FbScrLeft(bits1, leftShift);
|
||||
}
|
||||
--dst;
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (srcX > dstX)
|
||||
bits1 = READ(src++);
|
||||
if (startmask) {
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
bits1 = READ(src++);
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
|
||||
dst++;
|
||||
mask = FbNext24Pix(mask);
|
||||
}
|
||||
while (n--) {
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
bits1 = READ(src++);
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
|
||||
dst++;
|
||||
mask = FbNext24Pix(mask);
|
||||
}
|
||||
if (endmask) {
|
||||
bits = FbScrLeft(bits1, leftShift);
|
||||
if (FbScrLeft(endmask, rightShift)) {
|
||||
bits1 = READ(src);
|
||||
bits |= FbScrRight(bits1, rightShift);
|
||||
}
|
||||
WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_BLT24
|
||||
{
|
||||
int firstx, lastx, x;
|
||||
|
||||
firstx = origX;
|
||||
if (firstx)
|
||||
firstx--;
|
||||
lastx = origX + width / 24 + 1;
|
||||
for (x = firstx; x <= lastx; x++)
|
||||
ErrorF("%06x ", getPixel(origDst, x));
|
||||
ErrorF("\n");
|
||||
while (origNlw--)
|
||||
ErrorF("%08x ", *origLine++);
|
||||
ErrorF("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
fbBlt24(FbBits * srcLine,
|
||||
FbStride srcStride,
|
||||
int srcX,
|
||||
FbBits * dstLine,
|
||||
FbStride dstStride,
|
||||
int dstX,
|
||||
int width,
|
||||
int height, int alu, FbBits pm, Bool reverse, Bool upsidedown)
|
||||
{
|
||||
if (upsidedown) {
|
||||
srcLine += (height - 1) * srcStride;
|
||||
dstLine += (height - 1) * dstStride;
|
||||
srcStride = -srcStride;
|
||||
dstStride = -dstStride;
|
||||
}
|
||||
while (height--) {
|
||||
fbBlt24Line(srcLine, srcX, dstLine, dstX, width, alu, pm, reverse);
|
||||
srcLine += srcStride;
|
||||
dstLine += dstStride;
|
||||
}
|
||||
#ifdef DEBUG_BLT24
|
||||
ErrorF("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
|
||||
int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
|
||||
|
|
283
fb/fbbltone.c
283
fb/fbbltone.c
|
@ -187,13 +187,6 @@ fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
|
|||
Bool endNeedsLoad = FALSE; /* need load for endmask */
|
||||
int startbyte, endbyte;
|
||||
|
||||
if (dstBpp == 24) {
|
||||
fbBltOne24(src, srcStride, srcX,
|
||||
dst, dstStride, dstX, dstBpp,
|
||||
width, height, fgand, fgxor, bgand, bgxor);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not read past the end of the buffer!
|
||||
*/
|
||||
|
@ -376,266 +369,6 @@ fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Crufty macros to initialize the mask array, most of this
|
||||
* is to avoid compile-time warnings about shift overflow
|
||||
*/
|
||||
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
#define Mask24Pos(x,r) ((x)*24-(r))
|
||||
#else
|
||||
#define Mask24Pos(x,r) ((x)*24-((r) ? 24 - (r) : 0))
|
||||
#endif
|
||||
|
||||
#define Mask24Neg(x,r) (Mask24Pos(x,r) < 0 ? -Mask24Pos(x,r) : 0)
|
||||
#define Mask24Check(x,r) (Mask24Pos(x,r) < 0 ? 0 : \
|
||||
Mask24Pos(x,r) >= FB_UNIT ? 0 : Mask24Pos(x,r))
|
||||
|
||||
#define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \
|
||||
(Mask24Pos(x,r) < 0 ? \
|
||||
0xffffffU >> Mask24Neg (x,r) : \
|
||||
0xffffffU << Mask24Check(x,r)) : 0)
|
||||
|
||||
#define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r))
|
||||
|
||||
#define C2_24(b,r) \
|
||||
(SelMask24(b,0,r) | \
|
||||
SelMask24(b,1,r))
|
||||
|
||||
#define FbStip24Len 2
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
#define FbStip24New(rot) (1 + (rot == 0))
|
||||
#else
|
||||
#define FbStip24New(rot) (1 + (rot == 8))
|
||||
#endif
|
||||
|
||||
const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
|
||||
/* rotate 0 */
|
||||
{
|
||||
C2_24(0, 0), C2_24(1, 0), C2_24(2, 0), C2_24(3, 0),
|
||||
},
|
||||
/* rotate 8 */
|
||||
{
|
||||
C2_24(0, 8), C2_24(1, 8), C2_24(2, 8), C2_24(3, 8),
|
||||
},
|
||||
/* rotate 16 */
|
||||
{
|
||||
C2_24(0, 16), C2_24(1, 16), C2_24(2, 16), C2_24(3, 16),
|
||||
}
|
||||
};
|
||||
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
|
||||
#define FbMergeStip24Bits(left, right, new) \
|
||||
(FbStipLeft (left, new) | FbStipRight ((right), (FbStip24Len - (new))))
|
||||
|
||||
#define FbMergePartStip24Bits(left, right, llen, rlen) \
|
||||
(left | FbStipRight(right, llen))
|
||||
|
||||
#else
|
||||
|
||||
#define FbMergeStip24Bits(left, right, new) \
|
||||
((FbStipLeft (left, new) & ((1 << FbStip24Len) - 1)) | right)
|
||||
|
||||
#define FbMergePartStip24Bits(left, right, llen, rlen) \
|
||||
(FbStipLeft(left, rlen) | right)
|
||||
|
||||
#endif
|
||||
|
||||
#define fbFirstStipBits(len,stip) {\
|
||||
int __len = (len); \
|
||||
if (len <= remain) { \
|
||||
stip = FbLeftStipBits(bits, len); \
|
||||
} else { \
|
||||
stip = FbLeftStipBits(bits, remain); \
|
||||
bits = (src < srcEnd ? READ(src++) : 0); \
|
||||
__len = (len) - remain; \
|
||||
stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \
|
||||
remain, __len); \
|
||||
remain = FB_STIP_UNIT; \
|
||||
} \
|
||||
bits = FbStipLeft (bits, __len); \
|
||||
remain -= __len; \
|
||||
}
|
||||
|
||||
#define fbInitStipBits(offset,len,stip) {\
|
||||
bits = FbStipLeft (READ(src++),offset); \
|
||||
remain = FB_STIP_UNIT - offset; \
|
||||
fbFirstStipBits(len,stip); \
|
||||
stip = FbMergeStip24Bits (0, stip, len); \
|
||||
}
|
||||
|
||||
#define fbNextStipBits(rot,stip) {\
|
||||
int __new = FbStip24New(rot); \
|
||||
FbStip __right; \
|
||||
fbFirstStipBits(__new, __right); \
|
||||
stip = FbMergeStip24Bits (stip, __right, __new); \
|
||||
rot = FbNext24Rot (rot); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Use deep mask tables that incorporate rotation, pull
|
||||
* a variable number of bits out of the stipple and
|
||||
* reuse the right bits as needed for the next write
|
||||
*
|
||||
* Yes, this is probably too much code, but most 24-bpp screens
|
||||
* have no acceleration so this code is used for stipples, copyplane
|
||||
* and text
|
||||
*/
|
||||
void
|
||||
fbBltOne24(FbStip * srcLine, FbStride srcStride, /* FbStip units per scanline */
|
||||
int srcX, /* bit position of source */
|
||||
FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
|
||||
int dstX, /* bit position of dest */
|
||||
int dstBpp, /* bits per destination unit */
|
||||
int width, /* width in bits of destination */
|
||||
int height, /* height in scanlines */
|
||||
FbBits fgand, /* rrop values */
|
||||
FbBits fgxor, FbBits bgand, FbBits bgxor)
|
||||
{
|
||||
FbStip *src, *srcEnd;
|
||||
FbBits leftMask, rightMask, mask;
|
||||
int nlMiddle, nl;
|
||||
FbStip stip, bits;
|
||||
int remain;
|
||||
int dstS;
|
||||
int firstlen;
|
||||
int rot0, rot;
|
||||
int nDst;
|
||||
|
||||
/*
|
||||
* Do not read past the end of the buffer!
|
||||
*/
|
||||
srcEnd = srcLine + height * srcStride;
|
||||
|
||||
srcLine += srcX >> FB_STIP_SHIFT;
|
||||
dst += dstX >> FB_SHIFT;
|
||||
srcX &= FB_STIP_MASK;
|
||||
dstX &= FB_MASK;
|
||||
rot0 = FbFirst24Rot(dstX);
|
||||
|
||||
FbMaskBits(dstX, width, leftMask, nlMiddle, rightMask);
|
||||
|
||||
dstS = (dstX + 23) / 24;
|
||||
firstlen = FbStip24Len - dstS;
|
||||
|
||||
nDst = nlMiddle;
|
||||
if (leftMask)
|
||||
nDst++;
|
||||
dstStride -= nDst;
|
||||
|
||||
/* opaque copy */
|
||||
if (bgand == 0 && fgand == 0) {
|
||||
while (height--) {
|
||||
rot = rot0;
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
fbInitStipBits(srcX, firstlen, stip);
|
||||
if (leftMask) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst, (READ(dst) & ~leftMask) |
|
||||
(FbOpaqueStipple(mask,
|
||||
FbRot24(fgxor, rot), FbRot24(bgxor, rot))
|
||||
& leftMask));
|
||||
dst++;
|
||||
fbNextStipBits(rot, stip);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
while (nl--) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst, FbOpaqueStipple(mask,
|
||||
FbRot24(fgxor, rot),
|
||||
FbRot24(bgxor, rot)));
|
||||
dst++;
|
||||
fbNextStipBits(rot, stip);
|
||||
}
|
||||
if (rightMask) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst, (READ(dst) & ~rightMask) |
|
||||
(FbOpaqueStipple(mask,
|
||||
FbRot24(fgxor, rot), FbRot24(bgxor, rot))
|
||||
& rightMask));
|
||||
}
|
||||
dst += dstStride;
|
||||
src += srcStride;
|
||||
}
|
||||
}
|
||||
/* transparent copy */
|
||||
else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) {
|
||||
while (height--) {
|
||||
rot = rot0;
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
fbInitStipBits(srcX, firstlen, stip);
|
||||
if (leftMask) {
|
||||
if (stip) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
|
||||
WRITE(dst,
|
||||
(READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
||||
}
|
||||
dst++;
|
||||
fbNextStipBits(rot, stip);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
while (nl--) {
|
||||
if (stip) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst,
|
||||
(READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
||||
}
|
||||
dst++;
|
||||
fbNextStipBits(rot, stip);
|
||||
}
|
||||
if (rightMask) {
|
||||
if (stip) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
|
||||
WRITE(dst,
|
||||
(READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
||||
}
|
||||
}
|
||||
dst += dstStride;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (height--) {
|
||||
rot = rot0;
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
fbInitStipBits(srcX, firstlen, stip);
|
||||
if (leftMask) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst, FbStippleRRopMask(READ(dst), mask,
|
||||
FbRot24(fgand, rot),
|
||||
FbRot24(fgxor, rot),
|
||||
FbRot24(bgand, rot),
|
||||
FbRot24(bgxor, rot), leftMask));
|
||||
dst++;
|
||||
fbNextStipBits(rot, stip);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
while (nl--) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst, FbStippleRRop(READ(dst), mask,
|
||||
FbRot24(fgand, rot),
|
||||
FbRot24(fgxor, rot),
|
||||
FbRot24(bgand, rot),
|
||||
FbRot24(bgxor, rot)));
|
||||
dst++;
|
||||
fbNextStipBits(rot, stip);
|
||||
}
|
||||
if (rightMask) {
|
||||
mask = fbStipple24Bits[rot >> 3][stip];
|
||||
WRITE(dst, FbStippleRRopMask(READ(dst), mask,
|
||||
FbRot24(fgand, rot),
|
||||
FbRot24(fgxor, rot),
|
||||
FbRot24(bgand, rot),
|
||||
FbRot24(bgxor, rot), rightMask));
|
||||
}
|
||||
dst += dstStride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Not very efficient, but simple -- copy a single plane
|
||||
* from an N bit image to a 1 bit image
|
||||
|
@ -668,7 +401,6 @@ fbBltPlane(FbBits * src,
|
|||
FbStip dstUnion;
|
||||
int w;
|
||||
int wt;
|
||||
int rot0;
|
||||
|
||||
if (!width)
|
||||
return;
|
||||
|
@ -682,19 +414,8 @@ fbBltPlane(FbBits * src,
|
|||
w = width / srcBpp;
|
||||
|
||||
pm = fbReplicatePixel(planeMask, srcBpp);
|
||||
if (srcBpp == 24) {
|
||||
int tmpw = 24;
|
||||
|
||||
rot0 = FbFirst24Rot(srcX);
|
||||
if (srcX + tmpw > FB_UNIT)
|
||||
tmpw = FB_UNIT - srcX;
|
||||
srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, tmpw);
|
||||
}
|
||||
else {
|
||||
rot0 = 0;
|
||||
srcMaskFirst = pm & FbBitsMask(srcX, srcBpp);
|
||||
srcMask0 = pm & FbBitsMask(0, srcBpp);
|
||||
}
|
||||
|
||||
dstMaskFirst = FbStipMask(dstX, 1);
|
||||
while (height--) {
|
||||
|
@ -704,8 +425,6 @@ fbBltPlane(FbBits * src,
|
|||
src += srcStride;
|
||||
|
||||
srcMask = srcMaskFirst;
|
||||
if (srcBpp == 24)
|
||||
srcMask0 = FbRot24(pm, rot0) & FbBitsMask(0, srcBpp);
|
||||
srcBits = READ(s++);
|
||||
|
||||
dstMask = dstMaskFirst;
|
||||
|
@ -717,8 +436,6 @@ fbBltPlane(FbBits * src,
|
|||
while (wt--) {
|
||||
if (!srcMask) {
|
||||
srcBits = READ(s++);
|
||||
if (srcBpp == 24)
|
||||
srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0, 24);
|
||||
srcMask = srcMask0;
|
||||
}
|
||||
if (!dstMask) {
|
||||
|
|
|
@ -241,14 +241,8 @@ fbCopyArea(DrawablePtr pSrcDrawable,
|
|||
GCPtr pGC,
|
||||
int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
|
||||
{
|
||||
miCopyProc copy;
|
||||
|
||||
if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
|
||||
copy = fb24_32CopyMtoN;
|
||||
else
|
||||
copy = fbCopyNtoN;
|
||||
return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
|
||||
widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
|
||||
widthSrc, heightSrc, xOut, yOut, fbCopyNtoN, 0, 0);
|
||||
}
|
||||
|
||||
RegionPtr
|
||||
|
|
30
fb/fbgc.c
30
fb/fbgc.c
|
@ -71,7 +71,6 @@ fbCreateGC(GCPtr pGC)
|
|||
pGC->miTranslate = 1;
|
||||
pGC->fExpose = 1;
|
||||
|
||||
fbGetGCPrivate(pGC)->bpp = BitsPerPixel(pGC->depth);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -129,35 +128,6 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
|
|||
miComputeCompositeClip(pGC, pDrawable);
|
||||
}
|
||||
|
||||
if (pPriv->bpp != pDrawable->bitsPerPixel) {
|
||||
changes |= GCStipple | GCForeground | GCBackground | GCPlaneMask;
|
||||
pPriv->bpp = pDrawable->bitsPerPixel;
|
||||
}
|
||||
if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) {
|
||||
(*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
|
||||
fbGetRotatedPixmap(pGC) = 0;
|
||||
}
|
||||
|
||||
if (pGC->fillStyle == FillTiled) {
|
||||
PixmapPtr pOldTile, pNewTile;
|
||||
|
||||
pOldTile = pGC->tile.pixmap;
|
||||
if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
|
||||
pNewTile = fbGetRotatedPixmap(pGC);
|
||||
if (!pNewTile ||
|
||||
pNewTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
|
||||
if (pNewTile)
|
||||
(*pGC->pScreen->DestroyPixmap) (pNewTile);
|
||||
pNewTile =
|
||||
fb24_32ReformatTile(pOldTile, pDrawable->bitsPerPixel);
|
||||
}
|
||||
if (pNewTile) {
|
||||
fbGetRotatedPixmap(pGC) = pOldTile;
|
||||
pGC->tile.pixmap = pNewTile;
|
||||
changes |= GCTile;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changes & GCTile) {
|
||||
if (!pGC->tileIsPixel &&
|
||||
FbEvenTile(pGC->tile.pixmap->drawable.width *
|
||||
|
|
|
@ -44,11 +44,6 @@ fbGetSpans(DrawablePtr pDrawable,
|
|||
if (!fbDrawableEnabled(pDrawable))
|
||||
return;
|
||||
|
||||
if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
|
||||
fb24_32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
|
||||
return;
|
||||
}
|
||||
|
||||
fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
|
||||
|
||||
while (nspans--) {
|
||||
|
|
185
fb/fbglyph.c
185
fb/fbglyph.c
|
@ -53,185 +53,6 @@ fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height)
|
|||
return RegionContainsRect(pRegion, &box) == rgnIN;
|
||||
}
|
||||
|
||||
#define WRITE1(d,n,fg) WRITE((d) + (n), (CARD8) fg)
|
||||
#define WRITE2(d,n,fg) WRITE((CARD16 *) &(d[n]), (CARD16) fg)
|
||||
#define WRITE4(d,n,fg) WRITE((CARD32 *) &(d[n]), (CARD32) fg)
|
||||
#define WRITE8(d) WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB)
|
||||
|
||||
/*
|
||||
* This is a bit tricky, but it's brief. Write 12 bytes worth
|
||||
* of dest, which is four pixels, at a time. This gives constant
|
||||
* code for each pattern as they're always aligned the same
|
||||
*
|
||||
* a b c d a b c d a b c d bytes
|
||||
* A B C A B C A B C A B C pixels
|
||||
*
|
||||
* f0 f1 f2
|
||||
* A B C A B C A B C A B C pixels LSB
|
||||
* C A B C A B C A B C A B pixels MSB
|
||||
*
|
||||
* LSB MSB
|
||||
* A f0 f1
|
||||
* B f1 f2
|
||||
* C f2 f0
|
||||
* A B f0 f2
|
||||
* B C f1 f0
|
||||
* C A f2 f1
|
||||
* A B C A f0 f1
|
||||
* B C A B f1 f2
|
||||
* C A B C f2 f0
|
||||
*/
|
||||
|
||||
#undef _A
|
||||
#undef _B
|
||||
#undef _C
|
||||
#undef _AB
|
||||
#undef _BC
|
||||
#undef _CA
|
||||
#undef _ABCA
|
||||
#undef _BCAB
|
||||
#undef _CABC
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define _A f1
|
||||
#define _B f2
|
||||
#define _C f0
|
||||
#define _AB f2
|
||||
#define _BC f0
|
||||
#define _CA f1
|
||||
#define _ABCA f1
|
||||
#define _BCAB f2
|
||||
#define _CABC f0
|
||||
#define CASE(a,b,c,d) ((a << 3) | (b << 2) | (c << 1) | d)
|
||||
#else
|
||||
#define _A f0
|
||||
#define _B f1
|
||||
#define _C f2
|
||||
#define _AB f0
|
||||
#define _BC f1
|
||||
#define _CA f2
|
||||
#define _ABCA f0
|
||||
#define _BCAB f1
|
||||
#define _CABC f2
|
||||
#define CASE(a,b,c,d) (a | (b << 1) | (c << 2) | (d << 3))
|
||||
#endif
|
||||
|
||||
static void
|
||||
fbGlyph24(FbBits * dstBits,
|
||||
FbStride dstStride,
|
||||
int dstBpp, FbStip * stipple, FbBits fg, int x, int height)
|
||||
{
|
||||
int lshift;
|
||||
FbStip bits;
|
||||
CARD8 *dstLine;
|
||||
CARD8 *dst;
|
||||
FbStip f0, f1, f2;
|
||||
int n;
|
||||
int shift;
|
||||
|
||||
f0 = fg;
|
||||
f1 = FbRot24(f0, 16);
|
||||
f2 = FbRot24(f0, 8);
|
||||
|
||||
dstLine = (CARD8 *) dstBits;
|
||||
dstLine += (x & ~3) * 3;
|
||||
dstStride *= (sizeof(FbBits) / sizeof(CARD8));
|
||||
shift = x & 3;
|
||||
lshift = 4 - shift;
|
||||
while (height--) {
|
||||
bits = READ(stipple++);
|
||||
n = lshift;
|
||||
dst = dstLine;
|
||||
while (bits) {
|
||||
switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) {
|
||||
case CASE(0, 0, 0, 0):
|
||||
break;
|
||||
case CASE(1, 0, 0, 0):
|
||||
WRITE2(dst, 0, _AB);
|
||||
WRITE1(dst, 2, _C);
|
||||
break;
|
||||
case CASE(0, 1, 0, 0):
|
||||
WRITE1(dst, 3, _A);
|
||||
WRITE2(dst, 4, _BC);
|
||||
break;
|
||||
case CASE(1, 1, 0, 0):
|
||||
WRITE4(dst, 0, _ABCA);
|
||||
WRITE2(dst, 4, _BC);
|
||||
break;
|
||||
case CASE(0, 0, 1, 0):
|
||||
WRITE2(dst, 6, _AB);
|
||||
WRITE1(dst, 8, _C);
|
||||
break;
|
||||
case CASE(1, 0, 1, 0):
|
||||
WRITE2(dst, 0, _AB);
|
||||
WRITE1(dst, 2, _C);
|
||||
|
||||
WRITE2(dst, 6, _AB);
|
||||
WRITE1(dst, 8, _C);
|
||||
break;
|
||||
case CASE(0, 1, 1, 0):
|
||||
WRITE1(dst, 3, _A);
|
||||
WRITE4(dst, 4, _BCAB);
|
||||
WRITE1(dst, 8, _C);
|
||||
break;
|
||||
case CASE(1, 1, 1, 0):
|
||||
WRITE8(dst);
|
||||
WRITE1(dst, 8, _C);
|
||||
break;
|
||||
case CASE(0, 0, 0, 1):
|
||||
WRITE1(dst, 9, _A);
|
||||
WRITE2(dst, 10, _BC);
|
||||
break;
|
||||
case CASE(1, 0, 0, 1):
|
||||
WRITE2(dst, 0, _AB);
|
||||
WRITE1(dst, 2, _C);
|
||||
|
||||
WRITE1(dst, 9, _A);
|
||||
WRITE2(dst, 10, _BC);
|
||||
break;
|
||||
case CASE(0, 1, 0, 1):
|
||||
WRITE1(dst, 3, _A);
|
||||
WRITE2(dst, 4, _BC);
|
||||
|
||||
WRITE1(dst, 9, _A);
|
||||
WRITE2(dst, 10, _BC);
|
||||
break;
|
||||
case CASE(1, 1, 0, 1):
|
||||
WRITE4(dst, 0, _ABCA);
|
||||
WRITE2(dst, 4, _BC);
|
||||
|
||||
WRITE1(dst, 9, _A);
|
||||
WRITE2(dst, 10, _BC);
|
||||
break;
|
||||
case CASE(0, 0, 1, 1):
|
||||
WRITE2(dst, 6, _AB);
|
||||
WRITE4(dst, 8, _CABC);
|
||||
break;
|
||||
case CASE(1, 0, 1, 1):
|
||||
WRITE2(dst, 0, _AB);
|
||||
WRITE1(dst, 2, _C);
|
||||
|
||||
WRITE2(dst, 6, _AB);
|
||||
WRITE4(dst, 8, _CABC);
|
||||
break;
|
||||
case CASE(0, 1, 1, 1):
|
||||
WRITE1(dst, 3, _A);
|
||||
WRITE4(dst, 4, _BCAB);
|
||||
WRITE4(dst, 8, _CABC);
|
||||
break;
|
||||
case CASE(1, 1, 1, 1):
|
||||
WRITE8(dst);
|
||||
WRITE4(dst, 8, _CABC);
|
||||
break;
|
||||
}
|
||||
bits = FbStipLeft(bits, n);
|
||||
n = 4;
|
||||
dst += 12;
|
||||
}
|
||||
dstLine += dstStride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbPolyGlyphBlt(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
|
@ -261,9 +82,6 @@ fbPolyGlyphBlt(DrawablePtr pDrawable,
|
|||
case 16:
|
||||
glyph = fbGlyph16;
|
||||
break;
|
||||
case 24:
|
||||
glyph = fbGlyph24;
|
||||
break;
|
||||
case 32:
|
||||
glyph = fbGlyph32;
|
||||
break;
|
||||
|
@ -332,9 +150,6 @@ fbImageGlyphBlt(DrawablePtr pDrawable,
|
|||
case 16:
|
||||
glyph = fbGlyph16;
|
||||
break;
|
||||
case 24:
|
||||
glyph = fbGlyph24;
|
||||
break;
|
||||
case 32:
|
||||
glyph = fbGlyph32;
|
||||
break;
|
||||
|
|
19
fb/fbimage.c
19
fb/fbimage.c
|
@ -68,21 +68,10 @@ fbPutImage(DrawablePtr pDrawable,
|
|||
}
|
||||
break;
|
||||
case ZPixmap:
|
||||
if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
|
||||
srcStride = PixmapBytePad(w, pDrawable->depth);
|
||||
fb24_32PutZImage(pDrawable,
|
||||
fbGetCompositeClip(pGC),
|
||||
pGC->alu,
|
||||
(FbBits) pGC->planemask,
|
||||
x, y, w, h, (CARD8 *) pImage, srcStride);
|
||||
}
|
||||
else {
|
||||
srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof(FbStip);
|
||||
fbPutZImage(pDrawable,
|
||||
fbGetCompositeClip(pGC),
|
||||
fbPutZImage(pDrawable, fbGetCompositeClip(pGC),
|
||||
pGC->alu, pPriv->pm, x, y, w, h, src, srcStride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -233,12 +222,6 @@ fbGetImage(DrawablePtr pDrawable,
|
|||
if (!fbDrawableEnabled(pDrawable))
|
||||
return;
|
||||
|
||||
if (format == ZPixmap &&
|
||||
pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
|
||||
fb24_32GetImage(pDrawable, x, y, w, h, format, planeMask, d);
|
||||
return;
|
||||
}
|
||||
|
||||
fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
|
||||
|
||||
x += pDrawable->x;
|
||||
|
|
|
@ -104,9 +104,6 @@ fbPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
|
|||
case 16:
|
||||
line = fbPolyline16;
|
||||
break;
|
||||
case 24:
|
||||
line = fbPolyline24;
|
||||
break;
|
||||
case 32:
|
||||
line = fbPolyline32;
|
||||
break;
|
||||
|
@ -139,9 +136,6 @@ fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
|
|||
case 16:
|
||||
seg = fbPolySegment16;
|
||||
break;
|
||||
case 24:
|
||||
seg = fbPolySegment24;
|
||||
break;
|
||||
case 32:
|
||||
seg = fbPolySegment32;
|
||||
break;
|
||||
|
|
|
@ -56,10 +56,6 @@ fbOverlayCreateWindow(WindowPtr pWin)
|
|||
if (pWin->drawable.class != InputOutput)
|
||||
return TRUE;
|
||||
|
||||
if (pWin->drawable.bitsPerPixel == 32)
|
||||
pWin->drawable.bitsPerPixel =
|
||||
fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
|
||||
|
||||
for (i = 0; i < pScrPriv->nlayers; i++) {
|
||||
pPixmap = pScrPriv->layer[i].u.run.pixmap;
|
||||
if (pWin->drawable.depth == pPixmap->drawable.depth) {
|
||||
|
@ -260,30 +256,6 @@ fbOverlaySetupScreen(ScreenPtr pScreen,
|
|||
pbits1, xsize, ysize, dpix, dpiy, width1, bpp1);
|
||||
}
|
||||
|
||||
static Bool
|
||||
fb24_32OverlayCreateScreenResources(ScreenPtr pScreen)
|
||||
{
|
||||
FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
|
||||
int pitch;
|
||||
Bool retval;
|
||||
int i;
|
||||
|
||||
if ((retval = fbOverlayCreateScreenResources(pScreen))) {
|
||||
for (i = 0; i < pScrPriv->nlayers; i++) {
|
||||
/* fix the screen pixmap */
|
||||
PixmapPtr pPix = (PixmapPtr) pScrPriv->layer[i].u.run.pixmap;
|
||||
|
||||
if (pPix->drawable.bitsPerPixel == 32) {
|
||||
pPix->drawable.bitsPerPixel = 24;
|
||||
pitch = BitmapBytePad(pPix->drawable.width * 24);
|
||||
pPix->devKind = pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
||||
void *pbits1,
|
||||
|
@ -300,7 +272,6 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
DepthPtr depths;
|
||||
int nvisuals;
|
||||
int ndepths;
|
||||
int bpp = 0, imagebpp = 32;
|
||||
VisualID defaultVisual;
|
||||
FbOverlayScrPrivPtr pScrPriv;
|
||||
|
||||
|
@ -312,35 +283,8 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
if (!pScrPriv)
|
||||
return FALSE;
|
||||
|
||||
if (bpp1 == 32 || bpp2 == 32)
|
||||
bpp = 32;
|
||||
else if (bpp1 == 24 || bpp2 == 24)
|
||||
bpp = 24;
|
||||
|
||||
if (bpp == 24) {
|
||||
int f;
|
||||
|
||||
imagebpp = 32;
|
||||
/*
|
||||
* Check to see if we're advertising a 24bpp image format,
|
||||
* in which case windows will use it in preference to a 32 bit
|
||||
* format.
|
||||
*/
|
||||
for (f = 0; f < screenInfo.numPixmapFormats; f++) {
|
||||
if (screenInfo.formats[f].bitsPerPixel == 24) {
|
||||
imagebpp = 24;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (imagebpp == 32) {
|
||||
fbGetScreenPrivate(pScreen)->win32bpp = bpp;
|
||||
fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
|
||||
}
|
||||
else {
|
||||
fbGetScreenPrivate(pScreen)->win32bpp = 32;
|
||||
fbGetScreenPrivate(pScreen)->pix32bpp = 32;
|
||||
}
|
||||
if (bpp1 == 24 || bpp2 == 24)
|
||||
return FALSE;
|
||||
|
||||
if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &depth1,
|
||||
&defaultVisual, ((unsigned long) 1 << (bpp1 - 1)) |
|
||||
|
@ -379,10 +323,6 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
pScreen->CreateWindow = fbOverlayCreateWindow;
|
||||
pScreen->WindowExposures = fbOverlayWindowExposures;
|
||||
pScreen->CopyWindow = fbOverlayCopyWindow;
|
||||
if (bpp == 24 && imagebpp == 32) {
|
||||
pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
|
||||
pScreen->CreateScreenResources = fb24_32OverlayCreateScreenResources;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "fb.h"
|
||||
|
||||
PixmapPtr
|
||||
fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
|
||||
fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
|
||||
unsigned usage_hint)
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
|
@ -37,6 +37,7 @@ fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
|
|||
size_t paddedWidth;
|
||||
int adjust;
|
||||
int base;
|
||||
int bpp = BitsPerPixel(depth);
|
||||
|
||||
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
|
||||
if (paddedWidth / 4 > 32767 || height > 32767)
|
||||
|
@ -85,18 +86,6 @@ fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
|
|||
return pPixmap;
|
||||
}
|
||||
|
||||
PixmapPtr
|
||||
fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
|
||||
unsigned usage_hint)
|
||||
{
|
||||
int bpp;
|
||||
|
||||
bpp = BitsPerPixel(depth);
|
||||
if (bpp == 32 && depth <= 24)
|
||||
bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
|
||||
return fbCreatePixmapBpp(pScreen, width, height, depth, bpp, usage_hint);
|
||||
}
|
||||
|
||||
Bool
|
||||
fbDestroyPixmap(PixmapPtr pPixmap)
|
||||
{
|
||||
|
|
25
fb/fbpoint.c
25
fb/fbpoint.c
|
@ -61,35 +61,15 @@ fbDots(FbBits * dstOrig,
|
|||
y = pts->y + yorg;
|
||||
pts++;
|
||||
if (x1 <= x && x < x2 && y1 <= y && y < y2) {
|
||||
FbStip mask;
|
||||
x = (x + xoff) * dstBpp;
|
||||
d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT);
|
||||
x &= FB_STIP_MASK;
|
||||
if (dstBpp == 24) {
|
||||
FbStip leftMask, rightMask;
|
||||
int n, rot;
|
||||
FbStip andT, xorT;
|
||||
|
||||
rot = FbFirst24Rot(x);
|
||||
andT = FbRot24Stip(and, rot);
|
||||
xorT = FbRot24Stip(xor, rot);
|
||||
FbMaskStip(x, 24, leftMask, n, rightMask);
|
||||
if (leftMask) {
|
||||
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
|
||||
andT = FbNext24Stip(andT);
|
||||
xorT = FbNext24Stip(xorT);
|
||||
d++;
|
||||
}
|
||||
if (rightMask)
|
||||
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
|
||||
}
|
||||
else {
|
||||
FbStip mask;
|
||||
|
||||
mask = FbStipMask(x, dstBpp);
|
||||
WRITE(d, FbDoMaskRRop(READ(d), and, xor, mask));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -131,9 +111,6 @@ fbPolyPoint(DrawablePtr pDrawable,
|
|||
case 16:
|
||||
dots = fbDots16;
|
||||
break;
|
||||
case 24:
|
||||
dots = fbDots24;
|
||||
break;
|
||||
case 32:
|
||||
dots = fbDots32;
|
||||
break;
|
||||
|
|
|
@ -135,20 +135,13 @@ fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */
|
|||
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
Bool
|
||||
wfbFinishScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize,
|
||||
int ysize,
|
||||
int dpix,
|
||||
int dpiy,
|
||||
int width,
|
||||
int bpp,
|
||||
wfbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize,
|
||||
int dpix, int dpiy, int width, int bpp,
|
||||
SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
|
||||
#else
|
||||
Bool
|
||||
fbFinishScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
|
||||
fbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize,
|
||||
int dpix, int dpiy, int width, int bpp)
|
||||
#endif
|
||||
{
|
||||
VisualPtr visuals;
|
||||
|
@ -157,7 +150,6 @@ fbFinishScreenInit(ScreenPtr pScreen,
|
|||
int ndepths;
|
||||
int rootdepth;
|
||||
VisualID defaultVisual;
|
||||
int imagebpp = bpp;
|
||||
|
||||
#ifdef FB_DEBUG
|
||||
int stride;
|
||||
|
@ -169,43 +161,16 @@ fbFinishScreenInit(ScreenPtr pScreen,
|
|||
fbSetBits((FbStip *) ((char *) pbits + stride * ysize),
|
||||
stride / sizeof(FbStip), FB_TAIL_BITS);
|
||||
#endif
|
||||
/*
|
||||
* By default, a 24bpp screen will use 32bpp images, this avoids
|
||||
* problems with many applications which just can't handle packed
|
||||
* pixels. If you want real 24bit images, include a 24bpp
|
||||
* format in the pixmap formats
|
||||
*/
|
||||
if (bpp == 24) {
|
||||
int f;
|
||||
|
||||
imagebpp = 32;
|
||||
/*
|
||||
* Check to see if we're advertising a 24bpp image format,
|
||||
* in which case windows will use it in preference to a 32 bit
|
||||
* format.
|
||||
*/
|
||||
for (f = 0; f < screenInfo.numPixmapFormats; f++) {
|
||||
if (screenInfo.formats[f].bitsPerPixel == 24) {
|
||||
imagebpp = 24;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (imagebpp == 32) {
|
||||
fbGetScreenPrivate(pScreen)->win32bpp = bpp;
|
||||
fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
|
||||
}
|
||||
else {
|
||||
fbGetScreenPrivate(pScreen)->win32bpp = 32;
|
||||
fbGetScreenPrivate(pScreen)->pix32bpp = 32;
|
||||
}
|
||||
/* fb requires power-of-two bpp */
|
||||
if (Ones(bpp) != 1)
|
||||
return FALSE;
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
fbGetScreenPrivate(pScreen)->setupWrap = setupWrap;
|
||||
fbGetScreenPrivate(pScreen)->finishWrap = finishWrap;
|
||||
#endif
|
||||
rootdepth = 0;
|
||||
if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
||||
&defaultVisual, ((unsigned long) 1 << (imagebpp - 1)),
|
||||
&defaultVisual, ((unsigned long) 1 << (bpp - 1)),
|
||||
8))
|
||||
return FALSE;
|
||||
if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
|
||||
|
@ -214,24 +179,15 @@ fbFinishScreenInit(ScreenPtr pScreen,
|
|||
return FALSE;
|
||||
/* overwrite miCloseScreen with our own */
|
||||
pScreen->CloseScreen = fbCloseScreen;
|
||||
if (bpp == 24 && imagebpp == 32) {
|
||||
pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
|
||||
pScreen->CreateScreenResources = fb24_32CreateScreenResources;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
Bool
|
||||
wfbScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize,
|
||||
int ysize,
|
||||
int dpix,
|
||||
int dpiy,
|
||||
int width,
|
||||
int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
|
||||
wfbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize,
|
||||
int dpix, int dpiy, int width, int bpp,
|
||||
SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
|
||||
{
|
||||
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
|
||||
return FALSE;
|
||||
|
@ -242,9 +198,8 @@ wfbScreenInit(ScreenPtr pScreen,
|
|||
}
|
||||
#else
|
||||
Bool
|
||||
fbScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
|
||||
fbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize,
|
||||
int dpix, int dpiy, int width, int bpp)
|
||||
{
|
||||
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
|
||||
return FALSE;
|
||||
|
|
161
fb/fbseg.c
161
fb/fbseg.c
|
@ -279,157 +279,6 @@ fbBresFillDash(DrawablePtr pDrawable,
|
|||
fbSetFg(pDrawable, pGC, fg);
|
||||
}
|
||||
|
||||
static void
|
||||
fbBresSolid24RRop(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int dashOffset,
|
||||
int signdx,
|
||||
int signdy,
|
||||
int axis, int x1, int y1, int e, int e1, int e3, int len)
|
||||
{
|
||||
FbStip *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
|
||||
FbStip and = pPriv->and;
|
||||
FbStip xor = pPriv->xor;
|
||||
FbStip leftMask, rightMask;
|
||||
int nl;
|
||||
FbStip *d;
|
||||
int x;
|
||||
int rot;
|
||||
FbStip andT, xorT;
|
||||
|
||||
fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
dst += ((y1 + dstYoff) * dstStride);
|
||||
x1 = (x1 + dstXoff) * 24;
|
||||
if (signdy < 0)
|
||||
dstStride = -dstStride;
|
||||
signdx *= 24;
|
||||
while (len--) {
|
||||
d = dst + (x1 >> FB_STIP_SHIFT);
|
||||
x = x1 & FB_STIP_MASK;
|
||||
rot = FbFirst24Rot(x);
|
||||
andT = FbRot24Stip(and, rot);
|
||||
xorT = FbRot24Stip(xor, rot);
|
||||
FbMaskStip(x, 24, leftMask, nl, rightMask);
|
||||
if (leftMask) {
|
||||
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
|
||||
d++;
|
||||
andT = FbNext24Stip(andT);
|
||||
xorT = FbNext24Stip(xorT);
|
||||
}
|
||||
if (rightMask)
|
||||
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
|
||||
if (axis == X_AXIS) {
|
||||
x1 += signdx;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
e += e3;
|
||||
dst += dstStride;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dst += dstStride;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
e += e3;
|
||||
x1 += signdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fbFinishAccess(pDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
fbBresDash24RRop(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int dashOffset,
|
||||
int signdx,
|
||||
int signdy,
|
||||
int axis, int x1, int y1, int e, int e1, int e3, int len)
|
||||
{
|
||||
FbStip *dst;
|
||||
FbStride dstStride;
|
||||
int dstBpp;
|
||||
int dstXoff, dstYoff;
|
||||
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
|
||||
FbStip andT, xorT;
|
||||
FbStip fgand = pPriv->and;
|
||||
FbStip fgxor = pPriv->xor;
|
||||
FbStip bgand = pPriv->bgand;
|
||||
FbStip bgxor = pPriv->bgxor;
|
||||
FbStip leftMask, rightMask;
|
||||
int nl;
|
||||
FbStip *d;
|
||||
int x;
|
||||
int rot;
|
||||
|
||||
FbDashDeclare;
|
||||
int dashlen;
|
||||
Bool even;
|
||||
Bool doOdd;
|
||||
|
||||
fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
doOdd = pGC->lineStyle == LineDoubleDash;
|
||||
|
||||
/* compute current dash position */
|
||||
FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
|
||||
|
||||
dst += ((y1 + dstYoff) * dstStride);
|
||||
x1 = (x1 + dstXoff) * 24;
|
||||
if (signdy < 0)
|
||||
dstStride = -dstStride;
|
||||
signdx *= 24;
|
||||
while (len--) {
|
||||
if (even || doOdd) {
|
||||
if (even) {
|
||||
andT = fgand;
|
||||
xorT = fgxor;
|
||||
}
|
||||
else {
|
||||
andT = bgand;
|
||||
xorT = bgxor;
|
||||
}
|
||||
d = dst + (x1 >> FB_STIP_SHIFT);
|
||||
x = x1 & FB_STIP_MASK;
|
||||
rot = FbFirst24Rot(x);
|
||||
andT = FbRot24Stip(andT, rot);
|
||||
xorT = FbRot24Stip(xorT, rot);
|
||||
FbMaskStip(x, 24, leftMask, nl, rightMask);
|
||||
if (leftMask) {
|
||||
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
|
||||
d++;
|
||||
andT = FbNext24Stip(andT);
|
||||
xorT = FbNext24Stip(xorT);
|
||||
}
|
||||
if (rightMask)
|
||||
WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
|
||||
}
|
||||
if (axis == X_AXIS) {
|
||||
x1 += signdx;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
e += e3;
|
||||
dst += dstStride;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dst += dstStride;
|
||||
e += e1;
|
||||
if (e >= 0) {
|
||||
e += e3;
|
||||
x1 += signdx;
|
||||
}
|
||||
}
|
||||
FbDashStep(dashlen, even);
|
||||
}
|
||||
|
||||
fbFinishAccess(pDrawable);
|
||||
}
|
||||
|
||||
/*
|
||||
* For drivers that want to bail drawing some lines, this
|
||||
* function takes care of selecting the appropriate rasterizer
|
||||
|
@ -447,8 +296,6 @@ fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
|
|||
bres = fbBresFill;
|
||||
if (pGC->fillStyle == FillSolid) {
|
||||
bres = fbBresSolid;
|
||||
if (dstBpp == 24)
|
||||
bres = fbBresSolid24RRop;
|
||||
if (pPriv->and == 0) {
|
||||
switch (dstBpp) {
|
||||
case 8:
|
||||
|
@ -457,9 +304,6 @@ fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
|
|||
case 16:
|
||||
bres = fbBresSolid16;
|
||||
break;
|
||||
case 24:
|
||||
bres = fbBresSolid24;
|
||||
break;
|
||||
case 32:
|
||||
bres = fbBresSolid32;
|
||||
break;
|
||||
|
@ -471,8 +315,6 @@ fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
|
|||
bres = fbBresFillDash;
|
||||
if (pGC->fillStyle == FillSolid) {
|
||||
bres = fbBresDash;
|
||||
if (dstBpp == 24)
|
||||
bres = fbBresDash24RRop;
|
||||
if (pPriv->and == 0 &&
|
||||
(pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0)) {
|
||||
switch (dstBpp) {
|
||||
|
@ -482,9 +324,6 @@ fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
|
|||
case 16:
|
||||
bres = fbBresDash16;
|
||||
break;
|
||||
case 24:
|
||||
bres = fbBresDash24;
|
||||
break;
|
||||
case 32:
|
||||
bres = fbBresDash32;
|
||||
break;
|
||||
|
|
|
@ -42,10 +42,6 @@ fbSetSpans(DrawablePtr pDrawable,
|
|||
int xoff;
|
||||
int x1, x2;
|
||||
|
||||
if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
|
||||
fb24_32SetSpans(pDrawable, pGC, src, ppt, pwidth, nspans, fSorted);
|
||||
return;
|
||||
}
|
||||
fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
|
||||
while (nspans--) {
|
||||
d = dst + (ppt->y + dstYoff) * dstStride;
|
||||
|
|
114
fb/fbsolid.c
114
fb/fbsolid.c
|
@ -37,10 +37,6 @@ fbSolid(FbBits * dst,
|
|||
int n, nmiddle;
|
||||
int startbyte, endbyte;
|
||||
|
||||
if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor))) {
|
||||
fbSolid24(dst, dstStride, dstX, width, height, and, xor);
|
||||
return;
|
||||
}
|
||||
dst += dstX >> FB_SHIFT;
|
||||
dstX &= FB_MASK;
|
||||
FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
|
||||
|
@ -67,113 +63,3 @@ fbSolid(FbBits * dst,
|
|||
dst += dstStride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbSolid24(FbBits * dst,
|
||||
FbStride dstStride,
|
||||
int dstX, int width, int height, FbBits and, FbBits xor)
|
||||
{
|
||||
FbBits startmask, endmask;
|
||||
FbBits xor0 = 0, xor1 = 0, xor2 = 0;
|
||||
FbBits and0 = 0, and1 = 0, and2 = 0;
|
||||
FbBits xorS = 0, andS = 0, xorE = 0, andE = 0;
|
||||
int n, nmiddle;
|
||||
int rotS, rot;
|
||||
|
||||
dst += dstX >> FB_SHIFT;
|
||||
dstX &= FB_MASK;
|
||||
/*
|
||||
* Rotate pixel values this far across the word to align on
|
||||
* screen pixel boundaries
|
||||
*/
|
||||
rot = FbFirst24Rot(dstX);
|
||||
FbMaskBits(dstX, width, startmask, nmiddle, endmask);
|
||||
if (startmask)
|
||||
dstStride--;
|
||||
dstStride -= nmiddle;
|
||||
|
||||
/*
|
||||
* Precompute rotated versions of the rasterop values
|
||||
*/
|
||||
rotS = rot;
|
||||
xor = FbRot24(xor, rotS);
|
||||
and = FbRot24(and, rotS);
|
||||
if (startmask) {
|
||||
xorS = xor;
|
||||
andS = and;
|
||||
xor = FbNext24Pix(xor);
|
||||
and = FbNext24Pix(and);
|
||||
}
|
||||
|
||||
if (nmiddle) {
|
||||
xor0 = xor;
|
||||
and0 = and;
|
||||
xor1 = FbNext24Pix(xor0);
|
||||
and1 = FbNext24Pix(and0);
|
||||
xor2 = FbNext24Pix(xor1);
|
||||
and2 = FbNext24Pix(and1);
|
||||
}
|
||||
|
||||
if (endmask) {
|
||||
switch (nmiddle % 3) {
|
||||
case 0:
|
||||
xorE = xor;
|
||||
andE = and;
|
||||
break;
|
||||
case 1:
|
||||
xorE = xor1;
|
||||
andE = and1;
|
||||
break;
|
||||
case 2:
|
||||
xorE = xor2;
|
||||
andE = and2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (height--) {
|
||||
if (startmask) {
|
||||
WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
|
||||
dst++;
|
||||
}
|
||||
n = nmiddle;
|
||||
if (!and0) {
|
||||
while (n >= 3) {
|
||||
WRITE(dst++, xor0);
|
||||
WRITE(dst++, xor1);
|
||||
WRITE(dst++, xor2);
|
||||
n -= 3;
|
||||
}
|
||||
if (n) {
|
||||
WRITE(dst++, xor0);
|
||||
n--;
|
||||
if (n) {
|
||||
WRITE(dst++, xor1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (n >= 3) {
|
||||
WRITE(dst, FbDoRRop(READ(dst), and0, xor0));
|
||||
dst++;
|
||||
WRITE(dst, FbDoRRop(READ(dst), and1, xor1));
|
||||
dst++;
|
||||
WRITE(dst, FbDoRRop(READ(dst), and2, xor2));
|
||||
dst++;
|
||||
n -= 3;
|
||||
}
|
||||
if (n) {
|
||||
WRITE(dst, FbDoRRop(READ(dst), and0, xor0));
|
||||
dst++;
|
||||
n--;
|
||||
if (n) {
|
||||
WRITE(dst, FbDoRRop(READ(dst), and1, xor1));
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (endmask)
|
||||
WRITE(dst, FbDoMaskRRop(READ(dst), andE, xorE, endmask));
|
||||
dst += dstStride;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,9 +33,6 @@ fbCreateWindow(WindowPtr pWin)
|
|||
{
|
||||
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin),
|
||||
fbGetScreenPixmap(pWin->drawable.pScreen));
|
||||
if (pWin->drawable.bitsPerPixel == 32 && pWin->drawable.depth <= 24)
|
||||
pWin->drawable.bitsPerPixel =
|
||||
fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -136,13 +133,6 @@ fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
|
|||
{
|
||||
PixmapPtr pPixmap = *ppPixmap;
|
||||
|
||||
if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
|
||||
pPixmap = fb24_32ReformatTile(pPixmap, pDrawable->bitsPerPixel);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
(*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
|
||||
*ppPixmap = pPixmap;
|
||||
}
|
||||
if (FbEvenTile(pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel))
|
||||
fbPadPixmap(pPixmap);
|
||||
}
|
||||
|
|
|
@ -1,35 +1,22 @@
|
|||
#define fb24_32CopyMtoN wfb24_32CopyMtoN
|
||||
#define fb24_32CreateScreenResources wfb24_32CreateScreenResources
|
||||
#define fb24_32GetImage wfb24_32GetImage
|
||||
#define fb24_32GetSpans wfb24_32GetSpans
|
||||
#define fb24_32ModifyPixmapHeader wfb24_32ModifyPixmapHeader
|
||||
#define fb24_32PutZImage wfb24_32PutZImage
|
||||
#define fb24_32ReformatTile wfb24_32ReformatTile
|
||||
#define fb24_32SetSpans wfb24_32SetSpans
|
||||
#define fbAddTraps wfbAddTraps
|
||||
#define fbAddTriangles wfbAddTriangles
|
||||
#define fbAllocatePrivates wfbAllocatePrivates
|
||||
#define fbArc16 wfbArc16
|
||||
#define fbArc24 wfbArc24
|
||||
#define fbArc32 wfbArc32
|
||||
#define fbArc8 wfbArc8
|
||||
#define fbBlt wfbBlt
|
||||
#define fbBlt24 wfbBlt24
|
||||
#define fbBltOne wfbBltOne
|
||||
#define fbBltOne24 wfbBltOne24
|
||||
#define fbBltPlane wfbBltPlane
|
||||
#define fbBltStip wfbBltStip
|
||||
#define fbBres wfbBres
|
||||
#define fbBresDash wfbBresDash
|
||||
#define fbBresDash16 wfbBresDash16
|
||||
#define fbBresDash24 wfbBresDash24
|
||||
#define fbBresDash32 wfbBresDash32
|
||||
#define fbBresDash8 wfbBresDash8
|
||||
#define fbBresFill wfbBresFill
|
||||
#define fbBresFillDash wfbBresFillDash
|
||||
#define fbBresSolid wfbBresSolid
|
||||
#define fbBresSolid16 wfbBresSolid16
|
||||
#define fbBresSolid24 wfbBresSolid24
|
||||
#define fbBresSolid32 wfbBresSolid32
|
||||
#define fbBresSolid8 wfbBresSolid8
|
||||
#define fbChangeWindowAttributes wfbChangeWindowAttributes
|
||||
|
@ -47,7 +34,6 @@
|
|||
#define fbCreateDefColormap wfbCreateDefColormap
|
||||
#define fbCreateGC wfbCreateGC
|
||||
#define fbCreatePixmap wfbCreatePixmap
|
||||
#define fbCreatePixmapBpp wfbCreatePixmapBpp
|
||||
#define fbCreateWindow wfbCreateWindow
|
||||
#define fbDestroyGlyphCache wfbDestroyGlyphCache
|
||||
#define fbDestroyPixmap wfbDestroyPixmap
|
||||
|
@ -55,7 +41,6 @@
|
|||
#define fbDoCopy wfbDoCopy
|
||||
#define fbDots wfbDots
|
||||
#define fbDots16 wfbDots16
|
||||
#define fbDots24 wfbDots24
|
||||
#define fbDots32 wfbDots32
|
||||
#define fbDots8 wfbDots8
|
||||
#define fbExpandDirectColors wfbExpandDirectColors
|
||||
|
@ -71,7 +56,6 @@
|
|||
#define fbGetSpans wfbGetSpans
|
||||
#define _fbGetWindowPixmap _wfbGetWindowPixmap
|
||||
#define fbGlyph16 wfbGlyph16
|
||||
#define fbGlyph24 wfbGlyph24
|
||||
#define fbGlyph32 wfbGlyph32
|
||||
#define fbGlyph8 wfbGlyph8
|
||||
#define fbGlyphs wfbGlyphs
|
||||
|
@ -82,7 +66,6 @@
|
|||
#define fbListInstalledColormaps wfbListInstalledColormaps
|
||||
#define FbMergeRopBits wFbMergeRopBits
|
||||
#define fbOver wfbOver
|
||||
#define fbOver24 wfbOver24
|
||||
#define fbOverlayCloseScreen wfbOverlayCloseScreen
|
||||
#define fbOverlayCopyWindow wfbOverlayCopyWindow
|
||||
#define fbOverlayCreateScreenResources wfbOverlayCreateScreenResources
|
||||
|
@ -103,13 +86,11 @@
|
|||
#define fbPolyGlyphBlt wfbPolyGlyphBlt
|
||||
#define fbPolyLine wfbPolyLine
|
||||
#define fbPolyline16 wfbPolyline16
|
||||
#define fbPolyline24 wfbPolyline24
|
||||
#define fbPolyline32 wfbPolyline32
|
||||
#define fbPolyline8 wfbPolyline8
|
||||
#define fbPolyPoint wfbPolyPoint
|
||||
#define fbPolySegment wfbPolySegment
|
||||
#define fbPolySegment16 wfbPolySegment16
|
||||
#define fbPolySegment24 wfbPolySegment24
|
||||
#define fbPolySegment32 wfbPolySegment32
|
||||
#define fbPolySegment8 wfbPolySegment8
|
||||
#define fbPositionWindow wfbPositionWindow
|
||||
|
@ -134,7 +115,6 @@
|
|||
#define fbSetVisualTypesAndMasks wfbSetVisualTypesAndMasks
|
||||
#define _fbSetWindowPixmap _wfbSetWindowPixmap
|
||||
#define fbSolid wfbSolid
|
||||
#define fbSolid24 wfbSolid24
|
||||
#define fbSolidBoxClipped wfbSolidBoxClipped
|
||||
#define fbTrapezoids wfbTrapezoids
|
||||
#define fbTriangles wfbTriangles
|
||||
|
|
|
@ -200,43 +200,6 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
|
|||
* Preempt fbValidateGC by doing its work and masking the change out, so
|
||||
* that we can do the Prepare/finish_access.
|
||||
*/
|
||||
#ifdef FB_24_32BIT
|
||||
if ((changes & GCTile) && fbGetRotatedPixmap(gc)) {
|
||||
gc->pScreen->DestroyPixmap(fbGetRotatedPixmap(gc));
|
||||
fbGetRotatedPixmap(gc) = 0;
|
||||
}
|
||||
|
||||
if (gc->fillStyle == FillTiled) {
|
||||
PixmapPtr old_tile, new_tile;
|
||||
|
||||
old_tile = gc->tile.pixmap;
|
||||
if (old_tile->drawable.bitsPerPixel != drawable->bitsPerPixel) {
|
||||
new_tile = fbGetRotatedPixmap(gc);
|
||||
if (!new_tile ||
|
||||
new_tile->drawable.bitsPerPixel != drawable->bitsPerPixel) {
|
||||
if (new_tile)
|
||||
gc->pScreen->DestroyPixmap(new_tile);
|
||||
/* fb24_32ReformatTile will do direct access of a newly-
|
||||
* allocated pixmap.
|
||||
*/
|
||||
glamor_fallback
|
||||
("GC %p tile FB_24_32 transformat %p.\n", gc, old_tile);
|
||||
|
||||
if (glamor_prepare_access
|
||||
(&old_tile->drawable, GLAMOR_ACCESS_RO)) {
|
||||
new_tile =
|
||||
fb24_32ReformatTile(old_tile, drawable->bitsPerPixel);
|
||||
glamor_finish_access(&old_tile->drawable);
|
||||
}
|
||||
}
|
||||
if (new_tile) {
|
||||
fbGetRotatedPixmap(gc) = old_tile;
|
||||
gc->tile.pixmap = new_tile;
|
||||
changes |= GCTile;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (changes & GCTile) {
|
||||
if (!gc->tileIsPixel) {
|
||||
glamor_pixmap_private *pixmap_priv =
|
||||
|
|
|
@ -278,14 +278,7 @@ typedef struct _GC {
|
|||
const GCFuncs *funcs;
|
||||
const GCOps *ops;
|
||||
PrivateRec *devPrivates;
|
||||
/*
|
||||
* The following were moved here from private storage to allow device-
|
||||
* independent access to them from screen wrappers.
|
||||
* --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org)
|
||||
*/
|
||||
PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */
|
||||
RegionPtr pCompositeClip;
|
||||
/* fExpose & freeCompClip defined above */
|
||||
} GC;
|
||||
|
||||
#endif /* GCSTRUCT_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user