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/render/mipict.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/render/mipict.c')
-rw-r--r-- | xorg-server/render/mipict.c | 786 |
1 files changed, 364 insertions, 422 deletions
diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c index caa76e396..421df5aa8 100644 --- a/xorg-server/render/mipict.c +++ b/xorg-server/render/mipict.c @@ -34,76 +34,72 @@ #include "mipict.h" int -miCreatePicture (PicturePtr pPicture) +miCreatePicture(PicturePtr pPicture) { return Success; } void -miDestroyPicture (PicturePtr pPicture) +miDestroyPicture(PicturePtr pPicture) { if (pPicture->freeCompClip) - RegionDestroy(pPicture->pCompositeClip); + RegionDestroy(pPicture->pCompositeClip); } void -miDestroyPictureClip (PicturePtr pPicture) +miDestroyPictureClip(PicturePtr pPicture) { switch (pPicture->clientClipType) { case CT_NONE: - return; + return; case CT_PIXMAP: - (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip)); - break; + (*pPicture->pDrawable->pScreen-> + DestroyPixmap) ((PixmapPtr) (pPicture->clientClip)); + break; default: - /* - * we know we'll never have a list of rectangles, since ChangeClip - * immediately turns them into a region - */ - RegionDestroy(pPicture->clientClip); - break; + /* + * we know we'll never have a list of rectangles, since ChangeClip + * immediately turns them into a region + */ + RegionDestroy(pPicture->clientClip); + break; } pPicture->clientClip = NULL; pPicture->clientClipType = CT_NONE; -} +} int -miChangePictureClip (PicturePtr pPicture, - int type, - pointer value, - int n) +miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n) { - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - pointer clientClip; - int clientClipType; - + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + pointer clientClip; + int clientClipType; + switch (type) { case CT_PIXMAP: - /* convert the pixmap to a region */ - clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value); - if (!clientClip) - return BadAlloc; - clientClipType = CT_REGION; - (*pScreen->DestroyPixmap) ((PixmapPtr) value); - break; + /* convert the pixmap to a region */ + clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value); + if (!clientClip) + return BadAlloc; + clientClipType = CT_REGION; + (*pScreen->DestroyPixmap) ((PixmapPtr) value); + break; case CT_REGION: - clientClip = value; - clientClipType = CT_REGION; - break; + clientClip = value; + clientClipType = CT_REGION; + break; case CT_NONE: - clientClip = 0; - clientClipType = CT_NONE; - break; + clientClip = 0; + clientClipType = CT_NONE; + break; default: - clientClip = (pointer) RegionFromRects(n, - (xRectangle *) value, - type); - if (!clientClip) - return BadAlloc; - clientClipType = CT_REGION; - free(value); - break; + clientClip = (pointer) RegionFromRects(n, (xRectangle *) value, type); + if (!clientClip) + return BadAlloc; + clientClipType = CT_REGION; + free(value); + break; } (*ps->DestroyPictureClip) (pPicture); pPicture->clientClip = clientClip; @@ -113,149 +109,137 @@ miChangePictureClip (PicturePtr pPicture, } void -miChangePicture (PicturePtr pPicture, - Mask mask) +miChangePicture(PicturePtr pPicture, Mask mask) { return; } void -miValidatePicture (PicturePtr pPicture, - Mask mask) +miValidatePicture(PicturePtr pPicture, Mask mask) { - DrawablePtr pDrawable = pPicture->pDrawable; - - if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) || - (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) - { - if (pDrawable->type == DRAWABLE_WINDOW) - { - WindowPtr pWin = (WindowPtr) pDrawable; - RegionPtr pregWin; - Bool freeTmpClip, freeCompClip; - - if (pPicture->subWindowMode == IncludeInferiors) - { - pregWin = NotClippedByChildren(pWin); - freeTmpClip = TRUE; - } - else - { - pregWin = &pWin->clipList; - freeTmpClip = FALSE; - } - freeCompClip = pPicture->freeCompClip; - - /* - * if there is no client clip, we can get by with just keeping the - * pointer we got, and remembering whether or not should destroy - * (or maybe re-use) it later. this way, we avoid unnecessary - * copying of regions. (this wins especially if many clients clip - * by children and have no client clip.) - */ - if (pPicture->clientClipType == CT_NONE) - { - if (freeCompClip) - RegionDestroy(pPicture->pCompositeClip); - pPicture->pCompositeClip = pregWin; - pPicture->freeCompClip = freeTmpClip; - } - else - { - /* - * we need one 'real' region to put into the composite clip. if - * pregWin the current composite clip are real, we can get rid of - * one. if pregWin is real and the current composite clip isn't, - * use pregWin for the composite clip. if the current composite - * clip is real and pregWin isn't, use the current composite - * clip. if neither is real, create a new region. - */ - - RegionTranslate(pPicture->clientClip, - pDrawable->x + pPicture->clipOrigin.x, - pDrawable->y + pPicture->clipOrigin.y); - - if (freeCompClip) - { - RegionIntersect(pPicture->pCompositeClip, - pregWin, pPicture->clientClip); - if (freeTmpClip) - RegionDestroy(pregWin); - } - else if (freeTmpClip) - { - RegionIntersect(pregWin, pregWin, pPicture->clientClip); - pPicture->pCompositeClip = pregWin; - } - else - { - pPicture->pCompositeClip = RegionCreate(NullBox, 0); - RegionIntersect(pPicture->pCompositeClip, - pregWin, pPicture->clientClip); - } - pPicture->freeCompClip = TRUE; - RegionTranslate(pPicture->clientClip, - -(pDrawable->x + pPicture->clipOrigin.x), - -(pDrawable->y + pPicture->clipOrigin.y)); - } - } /* end of composite clip for a window */ - else - { - BoxRec pixbounds; - - /* XXX should we translate by drawable.x/y here ? */ - /* If you want pixmaps in offscreen memory, yes */ - pixbounds.x1 = pDrawable->x; - pixbounds.y1 = pDrawable->y; - pixbounds.x2 = pDrawable->x + pDrawable->width; - pixbounds.y2 = pDrawable->y + pDrawable->height; - - if (pPicture->freeCompClip) - { - RegionReset(pPicture->pCompositeClip, &pixbounds); - } - else - { - pPicture->freeCompClip = TRUE; - pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); - } - - if (pPicture->clientClipType == CT_REGION) - { - if(pDrawable->x || pDrawable->y) { - RegionTranslate(pPicture->clientClip, - pDrawable->x + pPicture->clipOrigin.x, - pDrawable->y + pPicture->clipOrigin.y); - RegionIntersect(pPicture->pCompositeClip, - pPicture->pCompositeClip, pPicture->clientClip); - RegionTranslate(pPicture->clientClip, - -(pDrawable->x + pPicture->clipOrigin.x), - -(pDrawable->y + pPicture->clipOrigin.y)); - } else { - RegionTranslate(pPicture->pCompositeClip, - -pPicture->clipOrigin.x, -pPicture->clipOrigin.y); - RegionIntersect(pPicture->pCompositeClip, - pPicture->pCompositeClip, pPicture->clientClip); - RegionTranslate(pPicture->pCompositeClip, - pPicture->clipOrigin.x, pPicture->clipOrigin.y); - } - } - } /* end of composite clip for pixmap */ + DrawablePtr pDrawable = pPicture->pDrawable; + + if ((mask & (CPClipXOrigin | CPClipYOrigin | CPClipMask | CPSubwindowMode)) + || (pDrawable->serialNumber != + (pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) { + if (pDrawable->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr) pDrawable; + RegionPtr pregWin; + Bool freeTmpClip, freeCompClip; + + if (pPicture->subWindowMode == IncludeInferiors) { + pregWin = NotClippedByChildren(pWin); + freeTmpClip = TRUE; + } + else { + pregWin = &pWin->clipList; + freeTmpClip = FALSE; + } + freeCompClip = pPicture->freeCompClip; + + /* + * if there is no client clip, we can get by with just keeping the + * pointer we got, and remembering whether or not should destroy + * (or maybe re-use) it later. this way, we avoid unnecessary + * copying of regions. (this wins especially if many clients clip + * by children and have no client clip.) + */ + if (pPicture->clientClipType == CT_NONE) { + if (freeCompClip) + RegionDestroy(pPicture->pCompositeClip); + pPicture->pCompositeClip = pregWin; + pPicture->freeCompClip = freeTmpClip; + } + else { + /* + * we need one 'real' region to put into the composite clip. if + * pregWin the current composite clip are real, we can get rid of + * one. if pregWin is real and the current composite clip isn't, + * use pregWin for the composite clip. if the current composite + * clip is real and pregWin isn't, use the current composite + * clip. if neither is real, create a new region. + */ + + RegionTranslate(pPicture->clientClip, + pDrawable->x + pPicture->clipOrigin.x, + pDrawable->y + pPicture->clipOrigin.y); + + if (freeCompClip) { + RegionIntersect(pPicture->pCompositeClip, + pregWin, pPicture->clientClip); + if (freeTmpClip) + RegionDestroy(pregWin); + } + else if (freeTmpClip) { + RegionIntersect(pregWin, pregWin, pPicture->clientClip); + pPicture->pCompositeClip = pregWin; + } + else { + pPicture->pCompositeClip = RegionCreate(NullBox, 0); + RegionIntersect(pPicture->pCompositeClip, + pregWin, pPicture->clientClip); + } + pPicture->freeCompClip = TRUE; + RegionTranslate(pPicture->clientClip, + -(pDrawable->x + pPicture->clipOrigin.x), + -(pDrawable->y + pPicture->clipOrigin.y)); + } + } /* end of composite clip for a window */ + else { + BoxRec pixbounds; + + /* XXX should we translate by drawable.x/y here ? */ + /* If you want pixmaps in offscreen memory, yes */ + pixbounds.x1 = pDrawable->x; + pixbounds.y1 = pDrawable->y; + pixbounds.x2 = pDrawable->x + pDrawable->width; + pixbounds.y2 = pDrawable->y + pDrawable->height; + + if (pPicture->freeCompClip) { + RegionReset(pPicture->pCompositeClip, &pixbounds); + } + else { + pPicture->freeCompClip = TRUE; + pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); + } + + if (pPicture->clientClipType == CT_REGION) { + if (pDrawable->x || pDrawable->y) { + RegionTranslate(pPicture->clientClip, + pDrawable->x + pPicture->clipOrigin.x, + pDrawable->y + pPicture->clipOrigin.y); + RegionIntersect(pPicture->pCompositeClip, + pPicture->pCompositeClip, + pPicture->clientClip); + RegionTranslate(pPicture->clientClip, + -(pDrawable->x + pPicture->clipOrigin.x), + -(pDrawable->y + pPicture->clipOrigin.y)); + } + else { + RegionTranslate(pPicture->pCompositeClip, + -pPicture->clipOrigin.x, + -pPicture->clipOrigin.y); + RegionIntersect(pPicture->pCompositeClip, + pPicture->pCompositeClip, + pPicture->clientClip); + RegionTranslate(pPicture->pCompositeClip, + pPicture->clipOrigin.x, + pPicture->clipOrigin.y); + } + } + } /* end of composite clip for pixmap */ } } int -miChangePictureTransform (PicturePtr pPicture, - PictTransform *transform) +miChangePictureTransform(PicturePtr pPicture, PictTransform * transform) { return Success; } int -miChangePictureFilter (PicturePtr pPicture, - int filter, - xFixed *params, - int nparams) +miChangePictureFilter(PicturePtr pPicture, + int filter, xFixed * params, int nparams) { return Success; } @@ -263,96 +247,85 @@ miChangePictureFilter (PicturePtr pPicture, #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) static __inline pixman_bool_t -miClipPictureReg (pixman_region16_t * pRegion, - pixman_region16_t * pClip, - int dx, - int dy) +miClipPictureReg(pixman_region16_t * pRegion, + pixman_region16_t * pClip, int dx, int dy) { if (pixman_region_n_rects(pRegion) == 1 && - pixman_region_n_rects(pClip) == 1) - { - pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL); - pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL); - int v; - - if (pRbox->x1 < (v = pCbox->x1 + dx)) - pRbox->x1 = BOUND(v); - if (pRbox->x2 > (v = pCbox->x2 + dx)) - pRbox->x2 = BOUND(v); - if (pRbox->y1 < (v = pCbox->y1 + dy)) - pRbox->y1 = BOUND(v); - if (pRbox->y2 > (v = pCbox->y2 + dy)) - pRbox->y2 = BOUND(v); - if (pRbox->x1 >= pRbox->x2 || - pRbox->y1 >= pRbox->y2) - { - pixman_region_init (pRegion); - } + pixman_region_n_rects(pClip) == 1) { + pixman_box16_t *pRbox = pixman_region_rectangles(pRegion, NULL); + pixman_box16_t *pCbox = pixman_region_rectangles(pClip, NULL); + int v; + + if (pRbox->x1 < (v = pCbox->x1 + dx)) + pRbox->x1 = BOUND(v); + if (pRbox->x2 > (v = pCbox->x2 + dx)) + pRbox->x2 = BOUND(v); + if (pRbox->y1 < (v = pCbox->y1 + dy)) + pRbox->y1 = BOUND(v); + if (pRbox->y2 > (v = pCbox->y2 + dy)) + pRbox->y2 = BOUND(v); + if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) { + pixman_region_init(pRegion); + } } - else if (!pixman_region_not_empty (pClip)) - return FALSE; - else - { - if (dx || dy) - pixman_region_translate (pRegion, -dx, -dy); - if (!pixman_region_intersect (pRegion, pRegion, pClip)) - return FALSE; - if (dx || dy) - pixman_region_translate(pRegion, dx, dy); + else if (!pixman_region_not_empty(pClip)) + return FALSE; + else { + if (dx || dy) + pixman_region_translate(pRegion, -dx, -dy); + if (!pixman_region_intersect(pRegion, pRegion, pClip)) + return FALSE; + if (dx || dy) + pixman_region_translate(pRegion, dx, dy); } return pixman_region_not_empty(pRegion); } static inline Bool -miClipPictureSrc (RegionPtr pRegion, - PicturePtr pPicture, - int dx, - int dy) +miClipPictureSrc(RegionPtr pRegion, PicturePtr pPicture, int dx, int dy) { - if (pPicture->clientClipType != CT_NONE) - { - Bool result; - - pixman_region_translate ( pPicture->clientClip, - pPicture->clipOrigin.x + dx, - pPicture->clipOrigin.y + dy); - - result = RegionIntersect(pRegion, pRegion, pPicture->clientClip); - - pixman_region_translate ( pPicture->clientClip, - - (pPicture->clipOrigin.x + dx), - - (pPicture->clipOrigin.y + dy)); - - if (!result) - return FALSE; + if (pPicture->clientClipType != CT_NONE) { + Bool result; + + pixman_region_translate(pPicture->clientClip, + pPicture->clipOrigin.x + dx, + pPicture->clipOrigin.y + dy); + + result = RegionIntersect(pRegion, pRegion, pPicture->clientClip); + + pixman_region_translate(pPicture->clientClip, + -(pPicture->clipOrigin.x + dx), + -(pPicture->clipOrigin.y + dy)); + + if (!result) + return FALSE; } return TRUE; } static void -SourceValidateOnePicture (PicturePtr pPicture) +SourceValidateOnePicture(PicturePtr pPicture) { - DrawablePtr pDrawable = pPicture->pDrawable; - ScreenPtr pScreen; + DrawablePtr pDrawable = pPicture->pDrawable; + ScreenPtr pScreen; if (!pDrawable) return; pScreen = pDrawable->pScreen; - if (pScreen->SourceValidate) - { - pScreen->SourceValidate ( - pDrawable, 0, 0, pDrawable->width, pDrawable->height, pPicture->subWindowMode); + if (pScreen->SourceValidate) { + pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width, + pDrawable->height, pPicture->subWindowMode); } } void -miCompositeSourceValidate (PicturePtr pPicture) +miCompositeSourceValidate(PicturePtr pPicture) { - SourceValidateOnePicture (pPicture); + SourceValidateOnePicture(pPicture); if (pPicture->alphaMap) - SourceValidateOnePicture (pPicture->alphaMap); + SourceValidateOnePicture(pPicture->alphaMap); } /* @@ -361,21 +334,18 @@ miCompositeSourceValidate (PicturePtr pPicture) */ Bool -miComputeCompositeRegion (RegionPtr pRegion, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) +miComputeCompositeRegion(RegionPtr pRegion, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { - - int v; + + int v; pRegion->extents.x1 = xDst; v = xDst + width; @@ -386,254 +356,226 @@ miComputeCompositeRegion (RegionPtr pRegion, pRegion->data = 0; /* Check for empty operation */ if (pRegion->extents.x1 >= pRegion->extents.x2 || - pRegion->extents.y1 >= pRegion->extents.y2) - { - pixman_region_init (pRegion); - return FALSE; + pRegion->extents.y1 >= pRegion->extents.y2) { + pixman_region_init(pRegion); + return FALSE; } /* clip against dst */ - if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) - { - pixman_region_fini (pRegion); - return FALSE; + if (!miClipPictureReg(pRegion, pDst->pCompositeClip, 0, 0)) { + pixman_region_fini(pRegion); + return FALSE; } - if (pDst->alphaMap) - { - if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip, - -pDst->alphaOrigin.x, - -pDst->alphaOrigin.y)) - { - pixman_region_fini (pRegion); - return FALSE; - } + if (pDst->alphaMap) { + if (!miClipPictureReg(pRegion, pDst->alphaMap->pCompositeClip, + -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) { + pixman_region_fini(pRegion); + return FALSE; + } } /* clip against src */ - if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) - { - pixman_region_fini (pRegion); - return FALSE; + if (!miClipPictureSrc(pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { + pixman_region_fini(pRegion); + return FALSE; } - if (pSrc->alphaMap) - { - if (!miClipPictureSrc (pRegion, pSrc->alphaMap, - xDst - (xSrc - pSrc->alphaOrigin.x), - yDst - (ySrc - pSrc->alphaOrigin.y))) - { - pixman_region_fini (pRegion); - return FALSE; - } + if (pSrc->alphaMap) { + if (!miClipPictureSrc(pRegion, pSrc->alphaMap, + xDst - (xSrc - pSrc->alphaOrigin.x), + yDst - (ySrc - pSrc->alphaOrigin.y))) { + pixman_region_fini(pRegion); + return FALSE; + } } /* clip against mask */ - if (pMask) - { - if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) - { - pixman_region_fini (pRegion); - return FALSE; - } - if (pMask->alphaMap) - { - if (!miClipPictureSrc (pRegion, pMask->alphaMap, - xDst - (xMask - pMask->alphaOrigin.x), - yDst - (yMask - pMask->alphaOrigin.y))) - { - pixman_region_fini (pRegion); - return FALSE; - } - } + if (pMask) { + if (!miClipPictureSrc(pRegion, pMask, xDst - xMask, yDst - yMask)) { + pixman_region_fini(pRegion); + return FALSE; + } + if (pMask->alphaMap) { + if (!miClipPictureSrc(pRegion, pMask->alphaMap, + xDst - (xMask - pMask->alphaOrigin.x), + yDst - (yMask - pMask->alphaOrigin.y))) { + pixman_region_fini(pRegion); + return FALSE; + } + } } - - miCompositeSourceValidate (pSrc); + miCompositeSourceValidate(pSrc); if (pMask) - miCompositeSourceValidate (pMask); + miCompositeSourceValidate(pMask); return TRUE; } void -miRenderColorToPixel (PictFormatPtr format, - xRenderColor *color, - CARD32 *pixel) +miRenderColorToPixel(PictFormatPtr format, xRenderColor * color, CARD32 *pixel) { - CARD32 r, g, b, a; - miIndexedPtr pIndexed; + CARD32 r, g, b, a; + miIndexedPtr pIndexed; switch (format->type) { case PictTypeDirect: - r = color->red >> (16 - Ones (format->direct.redMask)); - g = color->green >> (16 - Ones (format->direct.greenMask)); - b = color->blue >> (16 - Ones (format->direct.blueMask)); - a = color->alpha >> (16 - Ones (format->direct.alphaMask)); - r = r << format->direct.red; - g = g << format->direct.green; - b = b << format->direct.blue; - a = a << format->direct.alpha; - *pixel = r|g|b|a; - break; + r = color->red >> (16 - Ones(format->direct.redMask)); + g = color->green >> (16 - Ones(format->direct.greenMask)); + b = color->blue >> (16 - Ones(format->direct.blueMask)); + a = color->alpha >> (16 - Ones(format->direct.alphaMask)); + r = r << format->direct.red; + g = g << format->direct.green; + b = b << format->direct.blue; + a = a << format->direct.alpha; + *pixel = r | g | b | a; + break; case PictTypeIndexed: - pIndexed = (miIndexedPtr) (format->index.devPrivate); - if (pIndexed->color) - { - r = color->red >> 11; - g = color->green >> 11; - b = color->blue >> 11; - *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b); - } - else - { - r = color->red >> 8; - g = color->green >> 8; - b = color->blue >> 8; - *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b); - } - break; + pIndexed = (miIndexedPtr) (format->index.devPrivate); + if (pIndexed->color) { + r = color->red >> 11; + g = color->green >> 11; + b = color->blue >> 11; + *pixel = miIndexToEnt15(pIndexed, (r << 10) | (g << 5) | b); + } + else { + r = color->red >> 8; + g = color->green >> 8; + b = color->blue >> 8; + *pixel = miIndexToEntY24(pIndexed, (r << 16) | (g << 8) | b); + } + break; } } static CARD16 -miFillColor (CARD32 pixel, int bits) +miFillColor(CARD32 pixel, int bits) { - while (bits < 16) - { - pixel |= pixel << bits; - bits <<= 1; + while (bits < 16) { + pixel |= pixel << bits; + bits <<= 1; } return (CARD16) pixel; } Bool -miIsSolidAlpha (PicturePtr pSrc) +miIsSolidAlpha(PicturePtr pSrc) { - ScreenPtr pScreen; - char line[1]; + ScreenPtr pScreen; + char line[1]; if (!pSrc->pDrawable) return FALSE; pScreen = pSrc->pDrawable->pScreen; - + /* Alpha-only */ - if (PICT_FORMAT_TYPE (pSrc->format) != PICT_TYPE_A) - return FALSE; + if (PICT_FORMAT_TYPE(pSrc->format) != PICT_TYPE_A) + return FALSE; /* repeat */ if (!pSrc->repeat) - return FALSE; + return FALSE; /* 1x1 */ if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1) - return FALSE; + return FALSE; line[0] = 1; (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line); switch (pSrc->pDrawable->bitsPerPixel) { case 1: - return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80; + return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80; case 4: - return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0; + return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0; case 8: - return (CARD8) line[0] == 0xff; + return (CARD8) line[0] == 0xff; default: - return FALSE; + return FALSE; } } void -miRenderPixelToColor (PictFormatPtr format, - CARD32 pixel, - xRenderColor *color) +miRenderPixelToColor(PictFormatPtr format, CARD32 pixel, xRenderColor * color) { - CARD32 r, g, b, a; - miIndexedPtr pIndexed; - + CARD32 r, g, b, a; + miIndexedPtr pIndexed; + switch (format->type) { case PictTypeDirect: - r = (pixel >> format->direct.red) & format->direct.redMask; - g = (pixel >> format->direct.green) & format->direct.greenMask; - b = (pixel >> format->direct.blue) & format->direct.blueMask; - a = (pixel >> format->direct.alpha) & format->direct.alphaMask; - color->red = miFillColor (r, Ones (format->direct.redMask)); - color->green = miFillColor (g, Ones (format->direct.greenMask)); - color->blue = miFillColor (b, Ones (format->direct.blueMask)); - color->alpha = miFillColor (a, Ones (format->direct.alphaMask)); - break; + r = (pixel >> format->direct.red) & format->direct.redMask; + g = (pixel >> format->direct.green) & format->direct.greenMask; + b = (pixel >> format->direct.blue) & format->direct.blueMask; + a = (pixel >> format->direct.alpha) & format->direct.alphaMask; + color->red = miFillColor(r, Ones(format->direct.redMask)); + color->green = miFillColor(g, Ones(format->direct.greenMask)); + color->blue = miFillColor(b, Ones(format->direct.blueMask)); + color->alpha = miFillColor(a, Ones(format->direct.alphaMask)); + break; case PictTypeIndexed: - pIndexed = (miIndexedPtr) (format->index.devPrivate); - pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)]; - r = (pixel >> 16) & 0xff; - g = (pixel >> 8) & 0xff; - b = (pixel ) & 0xff; - color->red = miFillColor (r, 8); - color->green = miFillColor (g, 8); - color->blue = miFillColor (b, 8); - color->alpha = 0xffff; - break; + pIndexed = (miIndexedPtr) (format->index.devPrivate); + pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED - 1)]; + r = (pixel >> 16) & 0xff; + g = (pixel >> 8) & 0xff; + b = (pixel) & 0xff; + color->red = miFillColor(r, 8); + color->green = miFillColor(g, 8); + color->blue = miFillColor(b, 8); + color->alpha = 0xffff; + break; } } void -miTriStrip (CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, - int npoints, - xPointFixed *points) +miTriStrip(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points) { - xTriangle *tris, *tri; - int ntri; + xTriangle *tris, *tri; + int ntri; ntri = npoints - 2; - tris = malloc(ntri * sizeof (xTriangle)); + tris = malloc(ntri * sizeof(xTriangle)); if (!tris) return; - for (tri = tris; npoints >= 3; npoints--, points++, tri++) - { + for (tri = tris; npoints >= 3; npoints--, points++, tri++) { tri->p1 = points[0]; tri->p2 = points[1]; tri->p3 = points[2]; } - CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); + CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); free(tris); } void -miTriFan (CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, - int npoints, - xPointFixed *points) +miTriFan(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points) { - xTriangle *tris, *tri; - xPointFixed *first; - int ntri; + xTriangle *tris, *tri; + xPointFixed *first; + int ntri; ntri = npoints - 2; - tris = malloc(ntri * sizeof (xTriangle)); + tris = malloc(ntri * sizeof(xTriangle)); if (!tris) - return; + return; first = points++; - for (tri = tris; npoints >= 3; npoints--, points++, tri++) - { - tri->p1 = *first; - tri->p2 = points[0]; - tri->p3 = points[1]; + for (tri = tris; npoints >= 3; npoints--, points++, tri++) { + tri->p1 = *first; + tri->p2 = points[0]; + tri->p3 = points[1]; } - CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); + CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); free(tris); } Bool -miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) +miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { - PictureScreenPtr ps; - - if (!PictureInit (pScreen, formats, nformats)) - return FALSE; + PictureScreenPtr ps; + + if (!PictureInit(pScreen, formats, nformats)) + return FALSE; ps = GetPictureScreen(pScreen); ps->CreatePicture = miCreatePicture; ps->DestroyPicture = miDestroyPicture; @@ -650,18 +592,18 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) ps->UnrealizeGlyph = miUnrealizeGlyph; /* MI rendering routines */ - ps->Composite = 0; /* requires DDX support */ - ps->Glyphs = miGlyphs; - ps->CompositeRects = miCompositeRects; - ps->Trapezoids = 0; - ps->Triangles = 0; - - ps->RasterizeTrapezoid = 0; /* requires DDX support */ - ps->AddTraps = 0; /* requires DDX support */ - ps->AddTriangles = 0; /* requires DDX support */ - - ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */ - ps->TriFan = miTriFan; + ps->Composite = 0; /* requires DDX support */ + ps->Glyphs = miGlyphs; + ps->CompositeRects = miCompositeRects; + ps->Trapezoids = 0; + ps->Triangles = 0; + + ps->RasterizeTrapezoid = 0; /* requires DDX support */ + ps->AddTraps = 0; /* requires DDX support */ + ps->AddTriangles = 0; /* requires DDX support */ + + ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */ + ps->TriFan = miTriFan; return TRUE; } |