aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/xaa/xaaBitmap.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/xfree86/xaa/xaaBitmap.c
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/xfree86/xaa/xaaBitmap.c')
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitmap.c653
1 files changed, 327 insertions, 326 deletions
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitmap.c b/xorg-server/hw/xfree86/xaa/xaaBitmap.c
index f7ae78d3f..45d5a09be 100644
--- a/xorg-server/hw/xfree86/xaa/xaaBitmap.c
+++ b/xorg-server/hw/xfree86/xaa/xaaBitmap.c
@@ -1,5 +1,4 @@
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -9,241 +8,236 @@
#include "xaacexp.h"
#include "xf86.h"
-
/********** byte swapping ***************/
-
#ifdef FIXEDBASE
-# define DEST(i) *dest
-# define RETURN(i) return(dest)
+#define DEST(i) *dest
+#define RETURN(i) return(dest)
#else
-# define DEST(i) dest[i]
-# define RETURN(i) return(dest + i)
+#define DEST(i) dest[i]
+#define RETURN(i) return(dest + i)
#endif
#ifdef MSBFIRST
-# define SOURCE(i) SWAP_BITS_IN_BYTES(src[i])
+#define SOURCE(i) SWAP_BITS_IN_BYTES(src[i])
#else
-# define SOURCE(i) src[i]
+#define SOURCE(i) src[i]
#endif
-
-typedef CARD32 *(* BitmapScanlineProcPtr)(CARD32 *, CARD32 *, int, int);
+typedef CARD32 *(*BitmapScanlineProcPtr) (CARD32 *, CARD32 *, int, int);
#ifdef TRIPLE_BITS
-static CARD32*
-BitmapScanline(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline(CARD32 *src, CARD32 *base, int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = *src;
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = *src;
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = *src;
- WRITE_BITS1(bits);
- }
-
- return base;
+ CARD32 bits;
+
+ while (count >= 3) {
+ bits = *src;
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = *src;
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits = *src;
+ WRITE_BITS1(bits);
+ }
+
+ return base;
}
-static CARD32*
-BitmapScanline_Inverted(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Inverted(CARD32 *src, CARD32 *base, int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = ~(*src);
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = ~(*src);
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = ~(*src);
- WRITE_BITS1(bits);
- }
-
- return base;
-}
+ CARD32 bits;
+ while (count >= 3) {
+ bits = ~(*src);
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = ~(*src);
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits = ~(*src);
+ WRITE_BITS1(bits);
+ }
-static CARD32*
-BitmapScanline_Shifted(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+ return base;
+}
+
+static CARD32 *
+BitmapScanline_Shifted(CARD32 *src, CARD32 *base, int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
- WRITE_BITS1(bits);
- }
-
- return base;
+ CARD32 bits;
+
+ while (count >= 3) {
+ bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
+ WRITE_BITS1(bits);
+ }
+
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Inverted(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Inverted(CARD32 *src, CARD32 *base,
+ int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
- WRITE_BITS1(bits);
- }
-
- return base;
+ CARD32 bits;
+
+ while (count >= 3) {
+ bits =
+ ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits =
+ ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits =
+ ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
+ WRITE_BITS1(bits);
+ }
+
+ return base;
}
#define BitmapScanline_Shifted_Careful BitmapScanline_Shifted
#define BitmapScanline_Shifted_Inverted_Careful BitmapScanline_Shifted_Inverted
#else
-static CARD32*
-BitmapScanline(
- CARD32 *src, CARD32 *dest,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline(CARD32 *src, CARD32 *dest, int count, int skipleft)
{
- while(count >= 4) {
- DEST(0) = SOURCE(0);
- DEST(1) = SOURCE(1);
- DEST(2) = SOURCE(2);
- DEST(3) = SOURCE(3);
- count -= 4;
- src += 4;
+ while (count >= 4) {
+ DEST(0) = SOURCE(0);
+ DEST(1) = SOURCE(1);
+ DEST(2) = SOURCE(2);
+ DEST(3) = SOURCE(3);
+ count -= 4;
+ src += 4;
#ifndef FIXEDBASE
- dest += 4;
+ dest += 4;
#endif
- }
-
- if(!count) return dest;
- DEST(0) = SOURCE(0);
- if(count == 1) RETURN(1);
- DEST(1) = SOURCE(1);
- if(count == 2) RETURN(2);
- DEST(2) = SOURCE(2);
- RETURN(3);
+ }
+
+ if (!count)
+ return dest;
+ DEST(0) = SOURCE(0);
+ if (count == 1)
+ RETURN(1);
+ DEST(1) = SOURCE(1);
+ if (count == 2)
+ RETURN(2);
+ DEST(2) = SOURCE(2);
+ RETURN(3);
}
-static CARD32*
-BitmapScanline_Inverted(
- CARD32 *src, CARD32 *dest,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Inverted(CARD32 *src, CARD32 *dest, int count, int skipleft)
{
- while(count >= 4) {
- DEST(0) = ~SOURCE(0);
- DEST(1) = ~SOURCE(1);
- DEST(2) = ~SOURCE(2);
- DEST(3) = ~SOURCE(3);
- count -= 4;
- src += 4;
+ while (count >= 4) {
+ DEST(0) = ~SOURCE(0);
+ DEST(1) = ~SOURCE(1);
+ DEST(2) = ~SOURCE(2);
+ DEST(3) = ~SOURCE(3);
+ count -= 4;
+ src += 4;
#ifndef FIXEDBASE
- dest += 4;
+ dest += 4;
#endif
- }
-
- if(!count) return dest;
- DEST(0) = ~SOURCE(0);
- if(count == 1) RETURN(1);
- DEST(1) = ~SOURCE(1);
- if(count == 2) RETURN(2);
- DEST(2) = ~SOURCE(2);
- RETURN(3);
-}
+ }
+ if (!count)
+ return dest;
+ DEST(0) = ~SOURCE(0);
+ if (count == 1)
+ RETURN(1);
+ DEST(1) = ~SOURCE(1);
+ if (count == 2)
+ RETURN(2);
+ DEST(2) = ~SOURCE(2);
+ RETURN(3);
+}
-static CARD32*
-BitmapScanline_Shifted(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted(CARD32 *bits, CARD32 *base, int count, int skipleft)
{
- while(count--) {
- register CARD32 tmp = SHIFT_R(*bits,skipleft) |
- SHIFT_L(*(bits + 1),(32 - skipleft));
- WRITE_BITS(tmp);
- bits++;
- }
- return base;
+ while (count--) {
+ register CARD32 tmp = SHIFT_R(*bits, skipleft) |
+ SHIFT_L(*(bits + 1), (32 - skipleft));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Inverted(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Inverted(CARD32 *bits, CARD32 *base,
+ int count, int skipleft)
{
- while(count--) {
- register CARD32 tmp = ~(SHIFT_R(*bits,skipleft) |
- SHIFT_L(*(bits + 1),(32 - skipleft)));
- WRITE_BITS(tmp);
- bits++;
- }
- return base;
+ while (count--) {
+ register CARD32 tmp = ~(SHIFT_R(*bits, skipleft) |
+ SHIFT_L(*(bits + 1), (32 - skipleft)));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Careful(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Careful(CARD32 *bits, CARD32 *base,
+ int count, int skipleft)
{
- register CARD32 tmp;
- while(--count) {
- tmp = SHIFT_R(*bits,skipleft) | SHIFT_L(*(bits + 1),(32 - skipleft));
- WRITE_BITS(tmp);
- bits++;
- }
- tmp = SHIFT_R(*bits,skipleft);
- WRITE_BITS(tmp);
-
- return base;
+ register CARD32 tmp;
+
+ while (--count) {
+ tmp = SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ tmp = SHIFT_R(*bits, skipleft);
+ WRITE_BITS(tmp);
+
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Inverted_Careful(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Inverted_Careful(CARD32 *bits, CARD32 *base,
+ int count, int skipleft)
{
- register CARD32 tmp;
- while(--count) {
- tmp = ~(SHIFT_R(*bits,skipleft) | SHIFT_L(*(bits + 1),(32 - skipleft)));
- WRITE_BITS(tmp);
- bits++;
- }
- tmp = ~(SHIFT_R(*bits,skipleft));
- WRITE_BITS(tmp);
- return base;
+ register CARD32 tmp;
+
+ while (--count) {
+ tmp =
+ ~(SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft)));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ tmp = ~(SHIFT_R(*bits, skipleft));
+ WRITE_BITS(tmp);
+ return base;
}
#endif
@@ -253,26 +247,23 @@ BitmapScanline_Shifted_Inverted_Careful(
the fill in two passes, inverting the source on the second pass.
For GXcopy we can fill the backing rectangle as a solid rect and
avoid the invert.
-*/
+*/
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAWriteBitmapColorExpand3)(
+ EXPNAME(XAAWriteBitmapColorExpand3) (
#else
-EXPNAME(XAAWriteBitmapColorExpand)(
+ EXPNAME(XAAWriteBitmapColorExpand) (
#endif
- ScrnInfoPtr pScrn,
- int x, int y, int w, int H,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-)
-{
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int H,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base;
+ CARD32 *base;
unsigned char *srcp = src;
int SecondPassColor = -1;
int shift = 0, dwords;
@@ -282,44 +273,49 @@ EXPNAME(XAAWriteBitmapColorExpand)(
int h = H;
#ifdef TRIPLE_BITS
- if((bg != -1) &&
- ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) ||
- ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
+ if ((bg != -1) &&
+ ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg != -1) &&
- (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+ if ((bg != -1) &&
+ (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- if((rop == GXcopy) && infoRec->SetupForSolidFill) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- } else SecondPassColor = bg;
- bg = -1;
+ if ((rop == GXcopy) && infoRec->SetupForSolidFill) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ }
+ else
+ SecondPassColor = bg;
+ bg = -1;
}
#ifdef TRIPLE_BITS
- if(skipleft) {
+ if (skipleft) {
#else
- if(skipleft &&
- (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) ||
- (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (skipleft > x)))) {
+ if (skipleft &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->
+ CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
#endif
- if((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
- /* don't read past the end */
- firstFunc = BitmapScanline_Shifted_Careful;
- secondFunc = BitmapScanline_Shifted_Inverted_Careful;
- } else {
- firstFunc = BitmapScanline_Shifted;
- secondFunc = BitmapScanline_Shifted_Inverted;
- }
- shift = skipleft;
- skipleft = 0;
- } else {
- firstFunc = BitmapScanline;
- secondFunc = BitmapScanline_Inverted;
- w += skipleft;
- x -= skipleft;
+ if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
+ /* don't read past the end */
+ firstFunc = BitmapScanline_Shifted_Careful;
+ secondFunc = BitmapScanline_Shifted_Inverted_Careful;
+ }
+ else {
+ firstFunc = BitmapScanline_Shifted;
+ secondFunc = BitmapScanline_Shifted_Inverted;
+ }
+ shift = skipleft;
+ skipleft = 0;
+ }
+ else {
+ firstFunc = BitmapScanline;
+ secondFunc = BitmapScanline_Inverted;
+ w += skipleft;
+ x -= skipleft;
}
#ifdef TRIPLE_BITS
@@ -328,69 +324,68 @@ EXPNAME(XAAWriteBitmapColorExpand)(
dwords = (w + 31) >> 5;
#endif
-SECOND_PASS:
+ SECOND_PASS:
- flag = (infoRec->CPUToScreenColorExpandFillFlags
- & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
+ flag = (infoRec->CPUToScreenColorExpandFillFlags
+ & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
- base = (CARD32*)infoRec->ColorExpandBase;
+ base = (CARD32 *) infoRec->ColorExpandBase;
#ifndef FIXEDBASE
- if((dwords * h) <= infoRec->ColorExpandRange)
- while(h--) {
- base = (*firstFunc)((CARD32*)srcp, base, dwords, shift);
- srcp += srcwidth;
- }
+ if ((dwords * h) <= infoRec->ColorExpandRange)
+ while (h--) {
+ base = (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
+ srcp += srcwidth;
+ }
else
#endif
- while(h--) {
- (*firstFunc)((CARD32*)srcp, base, dwords, shift);
- srcp += srcwidth;
- }
-
- if(flag){
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
+ while (h--) {
+ (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
+ srcp += srcwidth;
+ }
+
+ if (flag) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
}
- if(SecondPassColor != -1) {
- h = H; /* Reset height */
- fg = SecondPassColor;
- SecondPassColor = -1;
- firstFunc = secondFunc;
- srcp = src;
- goto SECOND_PASS;
+ if (SecondPassColor != -1) {
+ h = H; /* Reset height */
+ fg = SecondPassColor;
+ SecondPassColor = -1;
+ firstFunc = secondFunc;
+ srcp = src;
+ goto SECOND_PASS;
}
- if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
+ if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
}
#ifndef FIXEDBASE
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAWriteBitmapScanlineColorExpand3)(
+ EXPNAME(XAAWriteBitmapScanlineColorExpand3) (
#else
-EXPNAME(XAAWriteBitmapScanlineColorExpand)(
+ EXPNAME(XAAWriteBitmapScanlineColorExpand) (
#endif
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-)
-{
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base;
+ CARD32 *base;
unsigned char *srcp = src;
int SecondPassColor = -1;
int shift = 0, dwords, bufferNo;
@@ -398,45 +393,50 @@ EXPNAME(XAAWriteBitmapScanlineColorExpand)(
BitmapScanlineProcPtr secondFunc;
#ifdef TRIPLE_BITS
- if((bg != -1) &&
- ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
- || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
+ if ((bg != -1) &&
+ ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
+ || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg != -1) &&
- (infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)){
+ if ((bg != -1) &&
+ (infoRec->
+ ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- if((rop == GXcopy) && infoRec->SetupForSolidFill) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- } else SecondPassColor = bg;
- bg = -1;
+ if ((rop == GXcopy) && infoRec->SetupForSolidFill) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ }
+ else
+ SecondPassColor = bg;
+ bg = -1;
}
#ifdef TRIPLE_BITS
- if(skipleft) {
+ if (skipleft) {
#else
- if(skipleft &&
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- LEFT_EDGE_CLIPPING) ||
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) {
+ if (skipleft &&
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) {
#endif
- if((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
- /* don't read past the end */
- firstFunc = BitmapScanline_Shifted_Careful;
- secondFunc = BitmapScanline_Shifted_Inverted_Careful;
- } else {
- firstFunc = BitmapScanline_Shifted;
- secondFunc = BitmapScanline_Shifted_Inverted;
- }
- shift = skipleft;
- skipleft = 0;
- } else {
- firstFunc = BitmapScanline;
- secondFunc = BitmapScanline_Inverted;
- w += skipleft;
- x -= skipleft;
+ if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
+ /* don't read past the end */
+ firstFunc = BitmapScanline_Shifted_Careful;
+ secondFunc = BitmapScanline_Shifted_Inverted_Careful;
+ }
+ else {
+ firstFunc = BitmapScanline_Shifted;
+ secondFunc = BitmapScanline_Shifted_Inverted;
+ }
+ shift = skipleft;
+ skipleft = 0;
+ }
+ else {
+ firstFunc = BitmapScanline;
+ secondFunc = BitmapScanline_Inverted;
+ w += skipleft;
+ x -= skipleft;
}
#ifdef TRIPLE_BITS
@@ -445,29 +445,30 @@ EXPNAME(XAAWriteBitmapScanlineColorExpand)(
dwords = (w + 31) >> 5;
#endif
-SECOND_PASS:
+ SECOND_PASS:
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
bufferNo = 0;
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*firstFunc)((CARD32*)srcp, base, dwords, shift);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- srcp += srcwidth;
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ srcp += srcwidth;
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
}
- if(SecondPassColor != -1) {
- fg = SecondPassColor;
- SecondPassColor = -1;
- firstFunc = secondFunc;
- srcp = src;
- goto SECOND_PASS;
+ if (SecondPassColor != -1) {
+ fg = SecondPassColor;
+ SecondPassColor = -1;
+ firstFunc = secondFunc;
+ srcp = src;
+ goto SECOND_PASS;
}
SET_SYNC_FLAG(infoRec);