diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/fb/fbblt.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-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/fb/fbblt.c')
-rw-r--r-- | xorg-server/fb/fbblt.c | 1372 |
1 files changed, 607 insertions, 765 deletions
diff --git a/xorg-server/fb/fbblt.c b/xorg-server/fb/fbblt.c index 680940467..17bd6986b 100644 --- a/xorg-server/fb/fbblt.c +++ b/xorg-server/fb/fbblt.c @@ -40,47 +40,38 @@ } void -fbBlt (FbBits *srcLine, - FbStride srcStride, - int srcX, - - FbBits *dstLine, - FbStride dstStride, - int dstX, - - int width, - int height, - - int alu, - FbBits pm, - int bpp, - - Bool reverse, - Bool upsidedown) +fbBlt(FbBits * srcLine, + FbStride srcStride, + int srcX, + FbBits * dstLine, + FbStride dstStride, + int dstX, + int width, + int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown) { - FbBits *src, *dst; - int leftShift, rightShift; - FbBits startmask, endmask; - FbBits bits, bits1; - int n, nmiddle; - Bool destInvarient; - int startbyte, endbyte; - int careful; - FbDeclareMergeRop (); - - if (bpp == 24 && !FbCheck24Pix (pm)) - { - fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, - width, height, alu, pm, reverse, upsidedown); - return; + FbBits *src, *dst; + int leftShift, rightShift; + FbBits startmask, endmask; + FbBits bits, bits1; + int n, nmiddle; + Bool destInvarient; + int startbyte, endbyte; + int careful; + + FbDeclareMergeRop(); + + if (bpp == 24 && !FbCheck24Pix(pm)) { + fbBlt24(srcLine, srcStride, srcX, dstLine, dstStride, dstX, + width, height, alu, pm, reverse, upsidedown); + return; } - careful = !((srcLine < dstLine && srcLine + width * (bpp>>3) > dstLine) || - (dstLine < srcLine && dstLine + width * (bpp>>3) > srcLine)) || - (bpp & 7); + careful = !((srcLine < dstLine && srcLine + width * (bpp >> 3) > dstLine) || + (dstLine < srcLine && dstLine + width * (bpp >> 3) > srcLine)) + || (bpp & 7); if (alu == GXcopy && pm == FB_ALLONES && !careful && - !(srcX & 7) && !(dstX & 7) && !(width & 7)) { + !(srcX & 7) && !(dstX & 7) && !(width & 7)) { int i; CARD8 *src = (CARD8 *) srcLine; CARD8 *dst = (CARD8 *) dstLine; @@ -103,506 +94,423 @@ fbBlt (FbBits *srcLine, FbInitializeMergeRop(alu, pm); destInvarient = FbDestInvarientMergeRop(); - if (upsidedown) - { - srcLine += (height - 1) * (srcStride); - dstLine += (height - 1) * (dstStride); - srcStride = -srcStride; - dstStride = -dstStride; + if (upsidedown) { + srcLine += (height - 1) * (srcStride); + dstLine += (height - 1) * (dstStride); + srcStride = -srcStride; + dstStride = -dstStride; } - FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte, - nmiddle, endmask, endbyte); - if (reverse) - { - srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; - dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; - srcX = (srcX + width - 1) & FB_MASK; - dstX = (dstX + width - 1) & FB_MASK; + FbMaskBitsBytes(dstX, width, destInvarient, startmask, startbyte, + nmiddle, endmask, endbyte); + if (reverse) { + srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; + dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; + srcX = (srcX + width - 1) & FB_MASK; + dstX = (dstX + width - 1) & FB_MASK; } - else - { - srcLine += srcX >> FB_SHIFT; - dstLine += dstX >> FB_SHIFT; - srcX &= FB_MASK; - dstX &= FB_MASK; + else { + srcLine += srcX >> FB_SHIFT; + dstLine += dstX >> FB_SHIFT; + srcX &= FB_MASK; + dstX &= FB_MASK; } - if (srcX == dstX) - { - while (height--) - { - src = srcLine; - srcLine += srcStride; - dst = dstLine; - dstLine += dstStride; - if (reverse) - { - if (endmask) - { - bits = READ(--src); - --dst; - FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); - } - n = nmiddle; - if (destInvarient) - { - while (n--) - WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src))); - } - else - { - while (n--) - { - bits = READ(--src); - --dst; - WRITE(dst, FbDoMergeRop (bits, READ(dst))); - } - } - if (startmask) - { - bits = READ(--src); - --dst; - FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); - } - } - else - { - if (startmask) - { - bits = READ(src++); - FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); - dst++; - } - n = nmiddle; - if (destInvarient) - { + if (srcX == dstX) { + while (height--) { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + if (reverse) { + if (endmask) { + bits = READ(--src); + --dst; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + n = nmiddle; + if (destInvarient) { + while (n--) + WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src))); + } + else { + while (n--) { + bits = READ(--src); + --dst; + WRITE(dst, FbDoMergeRop(bits, READ(dst))); + } + } + if (startmask) { + bits = READ(--src); + --dst; + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + } + } + else { + if (startmask) { + bits = READ(src++); + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) { #if 0 - /* - * This provides some speedup on screen->screen blts - * over the PCI bus, usually about 10%. But fb - * isn't usually used for this operation... - */ - if (_ca2 + 1 == 0 && _cx2 == 0) - { - FbBits t1, t2, t3, t4; - while (n >= 4) - { - t1 = *src++; - t2 = *src++; - t3 = *src++; - t4 = *src++; - *dst++ = t1; - *dst++ = t2; - *dst++ = t3; - *dst++ = t4; - n -= 4; - } - } + /* + * This provides some speedup on screen->screen blts + * over the PCI bus, usually about 10%. But fb + * isn't usually used for this operation... + */ + if (_ca2 + 1 == 0 && _cx2 == 0) { + FbBits t1, t2, t3, t4; + + while (n >= 4) { + t1 = *src++; + t2 = *src++; + t3 = *src++; + t4 = *src++; + *dst++ = t1; + *dst++ = t2; + *dst++ = t3; + *dst++ = t4; + n -= 4; + } + } #endif - while (n--) - WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++))); - } - else - { - while (n--) - { - bits = READ(src++); - WRITE(dst, FbDoMergeRop (bits, READ(dst))); - dst++; - } - } - if (endmask) - { - bits = READ(src); - FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); - } - } - } + while (n--) + WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++))); + } + else { + while (n--) { + bits = READ(src++); + WRITE(dst, FbDoMergeRop(bits, READ(dst))); + dst++; + } + } + if (endmask) { + bits = READ(src); + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + } + } } - else - { - if (srcX > dstX) - { - leftShift = srcX - dstX; - rightShift = FB_UNIT - leftShift; - } - else - { - rightShift = dstX - srcX; - leftShift = FB_UNIT - rightShift; - } - while (height--) - { - src = srcLine; - srcLine += srcStride; - dst = dstLine; - dstLine += dstStride; - - bits1 = 0; - if (reverse) - { - if (srcX < dstX) - bits1 = READ(--src); - if (endmask) - { - bits = FbScrRight(bits1, rightShift); - if (FbScrRight(endmask, leftShift)) - { - bits1 = READ(--src); - bits |= FbScrLeft(bits1, leftShift); - } - --dst; - FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); - } - n = nmiddle; - if (destInvarient) - { - while (n--) - { - bits = FbScrRight(bits1, rightShift); - bits1 = READ(--src); - bits |= FbScrLeft(bits1, leftShift); - --dst; - WRITE(dst, FbDoDestInvarientMergeRop(bits)); - } - } - else - { - while (n--) - { - bits = FbScrRight(bits1, rightShift); - bits1 = READ(--src); - bits |= FbScrLeft(bits1, leftShift); - --dst; - WRITE(dst, FbDoMergeRop(bits, READ(dst))); - } - } - if (startmask) - { - bits = FbScrRight(bits1, rightShift); - if (FbScrRight(startmask, leftShift)) - { - bits1 = READ(--src); - bits |= FbScrLeft(bits1, leftShift); - } - --dst; - FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); - } - } - else - { - if (srcX > dstX) - bits1 = READ(src++); - if (startmask) - { - bits = FbScrLeft(bits1, leftShift); - if (FbScrLeft(startmask, rightShift)) - { - bits1 = READ(src++); - bits |= FbScrRight(bits1, rightShift); - } - FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); - dst++; - } - n = nmiddle; - if (destInvarient) - { - while (n--) - { - bits = FbScrLeft(bits1, leftShift); - bits1 = READ(src++); - bits |= FbScrRight(bits1, rightShift); - WRITE(dst, FbDoDestInvarientMergeRop(bits)); - dst++; - } - } - else - { - while (n--) - { - bits = FbScrLeft(bits1, leftShift); - bits1 = READ(src++); - bits |= FbScrRight(bits1, rightShift); - WRITE(dst, FbDoMergeRop(bits, READ(dst))); - dst++; - } - } - if (endmask) - { - bits = FbScrLeft(bits1, leftShift); - if (FbScrLeft(endmask, rightShift)) - { - bits1 = READ(src); - bits |= FbScrRight(bits1, rightShift); - } - FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask); - } - } - } + else { + if (srcX > dstX) { + leftShift = srcX - dstX; + rightShift = FB_UNIT - leftShift; + } + else { + rightShift = dstX - srcX; + leftShift = FB_UNIT - rightShift; + } + while (height--) { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + + bits1 = 0; + if (reverse) { + if (srcX < dstX) + bits1 = READ(--src); + if (endmask) { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(endmask, leftShift)) { + bits1 = READ(--src); + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + n = nmiddle; + if (destInvarient) { + while (n--) { + bits = FbScrRight(bits1, rightShift); + bits1 = READ(--src); + bits |= FbScrLeft(bits1, leftShift); + --dst; + WRITE(dst, FbDoDestInvarientMergeRop(bits)); + } + } + else { + while (n--) { + bits = FbScrRight(bits1, rightShift); + bits1 = READ(--src); + bits |= FbScrLeft(bits1, leftShift); + --dst; + WRITE(dst, FbDoMergeRop(bits, READ(dst))); + } + } + if (startmask) { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(startmask, leftShift)) { + bits1 = READ(--src); + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + } + } + else { + if (srcX > dstX) + bits1 = READ(src++); + if (startmask) { + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(startmask, rightShift)) { + bits1 = READ(src++); + bits |= FbScrRight(bits1, rightShift); + } + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) { + while (n--) { + bits = FbScrLeft(bits1, leftShift); + bits1 = READ(src++); + bits |= FbScrRight(bits1, rightShift); + WRITE(dst, FbDoDestInvarientMergeRop(bits)); + dst++; + } + } + else { + while (n--) { + bits = FbScrLeft(bits1, leftShift); + bits1 = READ(src++); + bits |= FbScrRight(bits1, rightShift); + WRITE(dst, FbDoMergeRop(bits, READ(dst))); + dst++; + } + } + if (endmask) { + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(endmask, rightShift)) { + bits1 = READ(src); + bits |= FbScrRight(bits1, rightShift); + } + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + } + } } } - #undef DEBUG_BLT24 #ifdef DEBUG_BLT24 static unsigned long -getPixel (char *src, int x) +getPixel(char *src, int x) { - unsigned long l; + unsigned long l; l = 0; - memcpy (&l, src + x * 3, 3); + 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) +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; + 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); + + 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); + 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); + 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); + 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; + 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); + 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); + ErrorF("dstX: %d rot: %d\n", dstX, rot); #endif } - mask = FbRot24(pm,rot); + mask = FbRot24(pm, rot); #ifdef DEBUG_BLT24 - ErrorF ("pm 0x%x mask 0x%x\n", pm, mask); + 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)); - } - } + 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)); - } - } + 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"); + 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) +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; + 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; + while (height--) { + fbBlt24Line(srcLine, srcX, dstLine, dstX, width, alu, pm, reverse); + srcLine += srcStride; + dstLine += dstStride; } #ifdef DEBUG_BLT24 - ErrorF ("\n"); + ErrorF("\n"); #endif } @@ -614,49 +522,42 @@ fbBlt24 (FbBits *srcLine, */ void -fbBltOdd (FbBits *srcLine, - FbStride srcStrideEven, - FbStride srcStrideOdd, - int srcXEven, - int srcXOdd, - - FbBits *dstLine, - FbStride dstStrideEven, - FbStride dstStrideOdd, - int dstXEven, - int dstXOdd, - - int width, - int height, - - int alu, - FbBits pm, - int bpp) +fbBltOdd(FbBits * srcLine, + FbStride srcStrideEven, + FbStride srcStrideOdd, + int srcXEven, + int srcXOdd, + FbBits * dstLine, + FbStride dstStrideEven, + FbStride dstStrideOdd, + int dstXEven, + int dstXOdd, int width, int height, int alu, FbBits pm, int bpp) { - FbBits *src; - int leftShiftEven, rightShiftEven; - FbBits startmaskEven, endmaskEven; - int nmiddleEven; - - FbBits *dst; - int leftShiftOdd, rightShiftOdd; - FbBits startmaskOdd, endmaskOdd; - int nmiddleOdd; - - int leftShift, rightShift; - FbBits startmask, endmask; - int nmiddle; - - int srcX, dstX; - - FbBits bits, bits1; - int n; - - Bool destInvarient; - Bool even; - FbDeclareMergeRop (); - - FbInitializeMergeRop (alu, pm); + FbBits *src; + int leftShiftEven, rightShiftEven; + FbBits startmaskEven, endmaskEven; + int nmiddleEven; + + FbBits *dst; + int leftShiftOdd, rightShiftOdd; + FbBits startmaskOdd, endmaskOdd; + int nmiddleOdd; + + int leftShift, rightShift; + FbBits startmask, endmask; + int nmiddle; + + int srcX, dstX; + + FbBits bits, bits1; + int n; + + Bool destInvarient; + Bool even; + + FbDeclareMergeRop(); + + FbInitializeMergeRop(alu, pm); destInvarient = FbDestInvarientMergeRop(); srcLine += srcXEven >> FB_SHIFT; @@ -668,162 +569,133 @@ fbBltOdd (FbBits *srcLine, FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); - + even = TRUE; InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven); InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd); - while (height--) - { - src = srcLine; - dst = dstLine; - if (even) - { - srcX = srcXEven; - dstX = dstXEven; - startmask = startmaskEven; - endmask = endmaskEven; - nmiddle = nmiddleEven; - leftShift = leftShiftEven; - rightShift = rightShiftEven; - srcLine += srcStrideEven; - dstLine += dstStrideEven; - even = FALSE; - } - else - { - srcX = srcXOdd; - dstX = dstXOdd; - startmask = startmaskOdd; - endmask = endmaskOdd; - nmiddle = nmiddleOdd; - leftShift = leftShiftOdd; - rightShift = rightShiftOdd; - srcLine += srcStrideOdd; - dstLine += dstStrideOdd; - even = TRUE; - } - if (srcX == dstX) - { - if (startmask) - { - bits = READ(src++); - WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), startmask)); - dst++; - } - n = nmiddle; - if (destInvarient) - { - while (n--) - { - bits = READ(src++); - WRITE(dst, FbDoDestInvarientMergeRop(bits)); - dst++; - } - } - else - { - while (n--) - { - bits = READ(src++); - WRITE(dst, FbDoMergeRop (bits, READ(dst))); - dst++; - } - } - if (endmask) - { - bits = READ(src); - WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask)); - } - } - else - { - bits = 0; - if (srcX > dstX) - bits = READ(src++); - if (startmask) - { - bits1 = FbScrLeft(bits, leftShift); - bits = READ(src++); - bits1 |= FbScrRight(bits, rightShift); - WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), startmask)); - dst++; - } - n = nmiddle; - if (destInvarient) - { - while (n--) - { - bits1 = FbScrLeft(bits, leftShift); - bits = READ(src++); - bits1 |= FbScrRight(bits, rightShift); - WRITE(dst, FbDoDestInvarientMergeRop(bits1)); - dst++; - } - } - else - { - while (n--) - { - bits1 = FbScrLeft(bits, leftShift); - bits = READ(src++); - bits1 |= FbScrRight(bits, rightShift); - WRITE(dst, FbDoMergeRop(bits1, READ(dst))); - dst++; - } - } - if (endmask) - { - bits1 = FbScrLeft(bits, leftShift); - if (FbScrLeft(endmask, rightShift)) - { - bits = READ(src); - bits1 |= FbScrRight(bits, rightShift); - } - WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), endmask)); - } - } + while (height--) { + src = srcLine; + dst = dstLine; + if (even) { + srcX = srcXEven; + dstX = dstXEven; + startmask = startmaskEven; + endmask = endmaskEven; + nmiddle = nmiddleEven; + leftShift = leftShiftEven; + rightShift = rightShiftEven; + srcLine += srcStrideEven; + dstLine += dstStrideEven; + even = FALSE; + } + else { + srcX = srcXOdd; + dstX = dstXOdd; + startmask = startmaskOdd; + endmask = endmaskOdd; + nmiddle = nmiddleOdd; + leftShift = leftShiftOdd; + rightShift = rightShiftOdd; + srcLine += srcStrideOdd; + dstLine += dstStrideOdd; + even = TRUE; + } + if (srcX == dstX) { + if (startmask) { + bits = READ(src++); + WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), startmask)); + dst++; + } + n = nmiddle; + if (destInvarient) { + while (n--) { + bits = READ(src++); + WRITE(dst, FbDoDestInvarientMergeRop(bits)); + dst++; + } + } + else { + while (n--) { + bits = READ(src++); + WRITE(dst, FbDoMergeRop(bits, READ(dst))); + dst++; + } + } + if (endmask) { + bits = READ(src); + WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask)); + } + } + else { + bits = 0; + if (srcX > dstX) + bits = READ(src++); + if (startmask) { + bits1 = FbScrLeft(bits, leftShift); + bits = READ(src++); + bits1 |= FbScrRight(bits, rightShift); + WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), startmask)); + dst++; + } + n = nmiddle; + if (destInvarient) { + while (n--) { + bits1 = FbScrLeft(bits, leftShift); + bits = READ(src++); + bits1 |= FbScrRight(bits, rightShift); + WRITE(dst, FbDoDestInvarientMergeRop(bits1)); + dst++; + } + } + else { + while (n--) { + bits1 = FbScrLeft(bits, leftShift); + bits = READ(src++); + bits1 |= FbScrRight(bits, rightShift); + WRITE(dst, FbDoMergeRop(bits1, READ(dst))); + dst++; + } + } + if (endmask) { + bits1 = FbScrLeft(bits, leftShift); + if (FbScrLeft(endmask, rightShift)) { + bits = READ(src); + bits1 |= FbScrRight(bits, rightShift); + } + WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), endmask)); + } + } } } void -fbBltOdd24 (FbBits *srcLine, - FbStride srcStrideEven, - FbStride srcStrideOdd, - int srcXEven, - int srcXOdd, - - FbBits *dstLine, - FbStride dstStrideEven, - FbStride dstStrideOdd, - int dstXEven, - int dstXOdd, - - int width, - int height, - - int alu, - FbBits pm) +fbBltOdd24(FbBits * srcLine, + FbStride srcStrideEven, + FbStride srcStrideOdd, + int srcXEven, + int srcXOdd, + FbBits * dstLine, + FbStride dstStrideEven, + FbStride dstStrideOdd, + int dstXEven, int dstXOdd, int width, int height, int alu, FbBits pm) { - Bool even = TRUE; - - while (height--) - { - if (even) - { - fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven, - width, alu, pm, FALSE); - srcLine += srcStrideEven; - dstLine += dstStrideEven; - even = FALSE; - } - else - { - fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd, - width, alu, pm, FALSE); - srcLine += srcStrideOdd; - dstLine += dstStrideOdd; - even = TRUE; - } + Bool even = TRUE; + + while (height--) { + if (even) { + fbBlt24Line(srcLine, srcXEven, dstLine, dstXEven, + width, alu, pm, FALSE); + srcLine += srcStrideEven; + dstLine += dstStrideEven; + even = FALSE; + } + else { + fbBlt24Line(srcLine, srcXOdd, dstLine, dstXOdd, + width, alu, pm, FALSE); + srcLine += srcStrideOdd; + dstLine += dstStrideOdd; + even = TRUE; + } } } @@ -831,17 +703,15 @@ fbBltOdd24 (FbBits *srcLine, #if FB_STIP_SHIFT != FB_SHIFT void -fbSetBltOdd (FbStip *stip, - FbStride stipStride, - int srcX, - FbBits **bits, - FbStride *strideEven, - FbStride *strideOdd, - int *srcXEven, - int *srcXOdd) +fbSetBltOdd(FbStip * stip, + FbStride stipStride, + int srcX, + FbBits ** bits, + FbStride * strideEven, + FbStride * strideOdd, int *srcXEven, int *srcXOdd) { - int srcAdjust; - int strideAdjust; + int srcAdjust; + int strideAdjust; /* * bytes needed to align source @@ -853,96 +723,68 @@ fbSetBltOdd (FbStip *stip, strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT); *bits = (FbBits *) ((char *) stip - srcAdjust); - if (srcAdjust) - { - *strideEven = FbStipStrideToBitsStride (stipStride + 1); - *strideOdd = FbStipStrideToBitsStride (stipStride); + if (srcAdjust) { + *strideEven = FbStipStrideToBitsStride(stipStride + 1); + *strideOdd = FbStipStrideToBitsStride(stipStride); - *srcXEven = srcX + (srcAdjust << 3); - *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT); + *srcXEven = srcX + (srcAdjust << 3); + *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT); } - else - { - *strideEven = FbStipStrideToBitsStride (stipStride); - *strideOdd = FbStipStrideToBitsStride (stipStride + 1); - - *srcXEven = srcX; - *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT); + else { + *strideEven = FbStipStrideToBitsStride(stipStride); + *strideOdd = FbStipStrideToBitsStride(stipStride + 1); + + *srcXEven = srcX; + *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT); } } #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 */ - int dstX, - - int width, - int height, - - int alu, - FbBits pm, - int bpp) +fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */ + int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */ + int dstX, int width, int height, int alu, FbBits pm, int bpp) { #if FB_STIP_SHIFT != FB_SHIFT if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) || - FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) - { - FbStride srcStrideEven, srcStrideOdd; - FbStride dstStrideEven, dstStrideOdd; - int srcXEven, srcXOdd; - int dstXEven, dstXOdd; - FbBits *s, *d; - int sx, dx; - - src += srcX >> FB_STIP_SHIFT; - srcX &= FB_STIP_MASK; - dst += dstX >> FB_STIP_SHIFT; - dstX &= FB_STIP_MASK; - - fbSetBltOdd (src, srcStride, srcX, - &s, - &srcStrideEven, &srcStrideOdd, - &srcXEven, &srcXOdd); - - fbSetBltOdd (dst, dstStride, dstX, - &d, - &dstStrideEven, &dstStrideOdd, - &dstXEven, &dstXOdd); - - if (bpp == 24 && !FbCheck24Pix (pm)) - { - fbBltOdd24 (s, srcStrideEven, srcStrideOdd, - srcXEven, srcXOdd, - - d, dstStrideEven, dstStrideOdd, - dstXEven, dstXOdd, - - width, height, alu, pm); - } - else - { - fbBltOdd (s, srcStrideEven, srcStrideOdd, - srcXEven, srcXOdd, - - d, dstStrideEven, dstStrideOdd, - dstXEven, dstXOdd, - - width, height, alu, pm, bpp); - } + FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) { + FbStride srcStrideEven, srcStrideOdd; + FbStride dstStrideEven, dstStrideOdd; + int srcXEven, srcXOdd; + int dstXEven, dstXOdd; + FbBits *s, *d; + int sx, dx; + + src += srcX >> FB_STIP_SHIFT; + srcX &= FB_STIP_MASK; + dst += dstX >> FB_STIP_SHIFT; + dstX &= FB_STIP_MASK; + + fbSetBltOdd(src, srcStride, srcX, + &s, &srcStrideEven, &srcStrideOdd, &srcXEven, &srcXOdd); + + fbSetBltOdd(dst, dstStride, dstX, + &d, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd); + + if (bpp == 24 && !FbCheck24Pix(pm)) { + fbBltOdd24(s, srcStrideEven, srcStrideOdd, + srcXEven, srcXOdd, + d, dstStrideEven, dstStrideOdd, + dstXEven, dstXOdd, width, height, alu, pm); + } + else { + fbBltOdd(s, srcStrideEven, srcStrideOdd, + srcXEven, srcXOdd, + d, dstStrideEven, dstStrideOdd, + dstXEven, dstXOdd, width, height, alu, pm, bpp); + } } else #endif { - fbBlt ((FbBits *) src, FbStipStrideToBitsStride (srcStride), - srcX, - (FbBits *) dst, FbStipStrideToBitsStride (dstStride), - dstX, - width, height, - alu, pm, bpp, FALSE, FALSE); + fbBlt((FbBits *) src, FbStipStrideToBitsStride(srcStride), + srcX, + (FbBits *) dst, FbStipStrideToBitsStride(dstStride), + dstX, width, height, alu, pm, bpp, FALSE, FALSE); } } |