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/fb24_32.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/fb24_32.c')
-rw-r--r-- | xorg-server/fb/fb24_32.c | 803 |
1 files changed, 358 insertions, 445 deletions
diff --git a/xorg-server/fb/fb24_32.c b/xorg-server/fb/fb24_32.c index 033fa46c5..5eb81e8f0 100644 --- a/xorg-server/fb/fb24_32.c +++ b/xorg-server/fb/fb24_32.c @@ -51,214 +51,186 @@ (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); +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, +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; - int width, - int height, + FbDeclareMergeRop(); - 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); + 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)); + WRITE((CARD32 *) dst, (s0 & 0xffffff) | (s1 << 24)); #else - WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16)); + WRITE((CARD32 *) dst, (s0 << 8) | ((s1 & 0xffffff) >> 16)); #endif - s0 = READ(src++); - s0 = FbDoDestInvarientMergeRop(s0); + s0 = READ(src++); + s0 = FbDoDestInvarientMergeRop(s0); #if BITMAP_BIT_ORDER == LSBFirst - WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16)); + WRITE((CARD32 *) (dst + 4), + ((s1 & 0xffffff) >> 8) | (s0 << 16)); #else - WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8)); + WRITE((CARD32 *) (dst + 4), + (s1 << 16) | ((s0 & 0xffffff) >> 8)); #endif - s1 = READ(src++); - s1 = FbDoDestInvarientMergeRop(s1); + s1 = READ(src++); + s1 = FbDoDestInvarientMergeRop(s1); #if BITMAP_BIT_ORDER == LSBFirst - WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8)); + WRITE((CARD32 *) (dst + 8), + ((s0 & 0xffffff) >> 16) | (s1 << 8)); #else - WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff)); + 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; - } - } + 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, +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; - int width, - int height, + FbDeclareMergeRop(); - 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); + 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; + pixel = s0 & 0xffffff; #else - pixel = s0 >> 8; + pixel = s0 >> 8; #endif - WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); - s1 = READ((CARD32 *)(src+4)); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); + s1 = READ((CARD32 *) (src + 4)); #if BITMAP_BIT_ORDER == LSBFirst - pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff); + pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff); #else - pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16); + pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16); #endif - WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); - s0 = READ((CARD32 *)(src+8)); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); + s0 = READ((CARD32 *) (src + 8)); #if BITMAP_BIT_ORDER == LSBFirst - pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff); + pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff); #else - pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24); + pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24); #endif - WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); + WRITE(dst++, FbDoDestInvarientMergeRop(pixel)); #if BITMAP_BIT_ORDER == LSBFirst - pixel = s0 >> 8; + pixel = s0 >> 8; #else - pixel = s0 & 0xffffff; + 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++; - } - } + 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++; + } + } } } @@ -266,321 +238,265 @@ fb24_32BltUp (CARD8 *srcLine, * Spans functions; probably unused. */ void -fb24_32GetSpans(DrawablePtr pDrawable, - int wMax, - DDXPointPtr ppt, - int *pwidth, - int nspans, - char *pchardstStart) +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); + 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++; + 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); + fbFinishAccess(pDrawable); } void -fb24_32SetSpans (DrawablePtr pDrawable, - GCPtr pGC, - char *src, - DDXPointPtr ppt, - int *pwidth, - int nspans, - int fSorted) +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); + 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++; + 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); + 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) +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); + 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); + 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); + fbFinishAccess(pDrawable); } void -fb24_32GetImage (DrawablePtr pDrawable, - int x, - int y, - int w, - int h, - unsigned int format, - unsigned long planeMask, - char *d) +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); + 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); + srcStride *= sizeof(FbBits); x += pDrawable->x; y += pDrawable->y; - - pm = fbReplicatePixel (planeMask, 32); + + 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); + memset(d, 0, dstStride * h); + fb24_32BltUp(src + (y + srcYoff) * srcStride, srcStride, x + srcXoff, + (CARD8 *) d, dstStride, 0, w, h, GXcopy, pm); - fbFinishAccess (pDrawable); + 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) +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); + 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); + srcStride *= sizeof(FbBits); + fbGetDrawable(pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dst = (CARD8 *) dstBits; - dstStride *= sizeof (FbBits); + dstStride *= sizeof(FbBits); if (srcBpp == 24) - blt = fb24_32BltUp; + 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++; + 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); + 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; + 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); + 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); + return 0; + fbGetDrawable(&pOldTile->drawable, + old, oldStride, oldBpp, oldXoff, oldYoff); + fbGetDrawable(&pNewTile->drawable, + new, newStride, newBpp, newXoff, newYoff); if (oldBpp == 24) - blt = fb24_32BltUp; + blt = fb24_32BltUp; else - blt = fb24_32BltDown; + blt = fb24_32BltDown; (*blt) ((CARD8 *) old, - oldStride * sizeof (FbBits), - 0, - - (CARD8 *) new, - newStride * sizeof (FbBits), - 0, + oldStride * sizeof(FbBits), + 0, + (CARD8 *) new, + newStride * sizeof(FbBits), + 0, + pOldTile->drawable.width, + pOldTile->drawable.height, GXcopy, FB_ALLONES); - pOldTile->drawable.width, - pOldTile->drawable.height, - - GXcopy, - FB_ALLONES); - - fbFinishAccess (&pOldTile->drawable); - fbFinishAccess (&pNewTile->drawable); + fbFinishAccess(&pOldTile->drawable); + fbFinishAccess(&pNewTile->drawable); return pNewTile; } typedef struct { - pointer pbits; - int width; + pointer pbits; + int width; } miScreenInitParmsRec, *miScreenInitParmsPtr; Bool @@ -591,45 +507,42 @@ fb24_32CreateScreenResources(ScreenPtr pScreen) Bool retval; /* get the pitch before mi destroys it */ - pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; + 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; + 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, - pointer pPixData) +fb24_32ModifyPixmapHeader(PixmapPtr pPixmap, + int width, + int height, + int depth, + int bitsPerPixel, int devKind, pointer pPixData) { - int bpp, w; + int bpp, w; if (!pPixmap) - return FALSE; + 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); - } + 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); -} + devKind, pPixData); +} |