⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfbgc.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
/***********************************************************Copyright (c) 1987  X ConsortiumPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THEX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER INAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.Except as contained in this notice, the name of the X Consortium shall not beused in advertising or otherwise to promote the sale, use or other dealingsin this Software without prior written authorization from the X Consortium.Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.                        All Rights ReservedPermission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and thatboth that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not beused in advertising or publicity pertaining to distribution of thesoftware without specific, written prior permission.  DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ORANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THISSOFTWARE.******************************************************************//* $XConsortium: cfbgc.c,v 5.62 94/04/17 20:28:49 dpw Exp $ */#include "X.h"#include "Xmd.h"#include "Xproto.h"#include "cfb.h"#include "fontstruct.h"#include "dixfontstr.h"#include "gcstruct.h"#include "windowstr.h"#include "pixmapstr.h"#include "scrnintstr.h"#include "region.h"#include "mistruct.h"#include "mibstore.h"#include "migc.h"#include "cfbmskbits.h"#include "cfb8bit.h"#if PSZ == 8# define useTEGlyphBlt  cfbTEGlyphBlt8#else# ifdef WriteBitGroup#  define useTEGlyphBlt	cfbImageGlyphBlt8# else#  define useTEGlyphBlt	cfbTEGlyphBlt# endif#endif#ifdef WriteBitGroup# define useImageGlyphBlt	cfbImageGlyphBlt8# define usePolyGlyphBlt	cfbPolyGlyphBlt8#else# define useImageGlyphBlt	miImageGlyphBlt# define usePolyGlyphBlt	miPolyGlyphBlt#endif#ifdef FOUR_BIT_CODE# define usePushPixels	cfbPushPixels8#else# define usePushPixels	mfbPushPixels#endif#ifdef PIXEL_ADDR# define ZeroPolyArc	cfbZeroPolyArcSS8Copy#else# define ZeroPolyArc	miZeroPolyArc#endifGCFuncs cfbGCFuncs = {    cfbValidateGC,    miChangeGC,    miCopyGC,    miDestroyGC,    miChangeClip,    miDestroyClip,    miCopyClip,};GCOps	cfbTEOps1Rect = {    cfbSolidSpansCopy,    cfbSetSpans,    cfbPutImage,    cfbCopyArea,    cfbCopyPlane,    cfbPolyPoint,#ifdef PIXEL_ADDR    cfb8LineSS1Rect,    cfb8SegmentSS1Rect,#else    cfbLineSS,    cfbSegmentSS,#endif    miPolyRectangle,    ZeroPolyArc,    cfbFillPoly1RectCopy,    cfbPolyFillRect,    cfbPolyFillArcSolidCopy,    miPolyText8,    miPolyText16,    miImageText8,    miImageText16,    useTEGlyphBlt,    usePolyGlyphBlt,    usePushPixels#ifdef NEED_LINEHELPER    ,NULL#endif};GCOps	cfbNonTEOps1Rect = {    cfbSolidSpansCopy,    cfbSetSpans,    cfbPutImage,    cfbCopyArea,    cfbCopyPlane,    cfbPolyPoint,#ifdef PIXEL_ADDR    cfb8LineSS1Rect,    cfb8SegmentSS1Rect,#else    cfbLineSS,    cfbSegmentSS,#endif    miPolyRectangle,    ZeroPolyArc,    cfbFillPoly1RectCopy,    cfbPolyFillRect,    cfbPolyFillArcSolidCopy,    miPolyText8,    miPolyText16,    miImageText8,    miImageText16,    useImageGlyphBlt,    usePolyGlyphBlt,    usePushPixels#ifdef NEED_LINEHELPER    ,NULL#endif};GCOps	cfbTEOps = {    cfbSolidSpansCopy,    cfbSetSpans,    cfbPutImage,    cfbCopyArea,    cfbCopyPlane,    cfbPolyPoint,    cfbLineSS,    cfbSegmentSS,    miPolyRectangle,    ZeroPolyArc,    miFillPolygon,    cfbPolyFillRect,    cfbPolyFillArcSolidCopy,    miPolyText8,    miPolyText16,    miImageText8,    miImageText16,    useTEGlyphBlt,    usePolyGlyphBlt,    usePushPixels#ifdef NEED_LINEHELPER    ,NULL#endif};GCOps	cfbNonTEOps = {    cfbSolidSpansCopy,    cfbSetSpans,    cfbPutImage,    cfbCopyArea,    cfbCopyPlane,    cfbPolyPoint,    cfbLineSS,    cfbSegmentSS,    miPolyRectangle,#ifdef PIXEL_ADDR    cfbZeroPolyArcSS8Copy,#else    miZeroPolyArc,#endif    miFillPolygon,    cfbPolyFillRect,    cfbPolyFillArcSolidCopy,    miPolyText8,    miPolyText16,    miImageText8,    miImageText16,    useImageGlyphBlt,    usePolyGlyphBlt,    usePushPixels#ifdef NEED_LINEHELPER    ,NULL#endif};GCOps *cfbMatchCommon (pGC, devPriv)    GCPtr	    pGC;    cfbPrivGCPtr    devPriv;{    if (pGC->lineWidth != 0)	return 0;    if (pGC->lineStyle != LineSolid)	return 0;    if (pGC->fillStyle != FillSolid)	return 0;    if (devPriv->rop != GXcopy)	return 0;    if (pGC->font &&	FONTMAXBOUNDS(pGC->font,rightSideBearing) -        FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&	FONTMINBOUNDS(pGC->font,characterWidth) >= 0)    {	if (TERMINALFONT(pGC->font)#ifdef FOUR_BIT_CODE	    && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB#endif	)#ifdef NO_ONE_RECT            return &cfbTEOps1Rect;#else	    if (devPriv->oneRect)		return &cfbTEOps1Rect;	    else		return &cfbTEOps;#endif	else#ifdef NO_ONE_RECT	    return &cfbNonTEOps1Rect;#else	    if (devPriv->oneRect)		return &cfbNonTEOps1Rect;	    else		return &cfbNonTEOps;#endif    }    return 0;}BoolcfbCreateGC(pGC)    register GCPtr pGC;{    cfbPrivGC  *pPriv;    if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)	return (mfbCreateGC(pGC));    pGC->clientClip = NULL;    pGC->clientClipType = CT_NONE;    /*     * some of the output primitives aren't really necessary, since they     * will be filled in ValidateGC because of dix/CreateGC() setting all     * the change bits.  Others are necessary because although they depend     * on being a color frame buffer, they don't change      */    pGC->ops = &cfbNonTEOps;    pGC->funcs = &cfbGCFuncs;    /* cfb wants to translate before scan conversion */    pGC->miTranslate = 1;    pPriv = cfbGetGCPrivate(pGC);    pPriv->rop = pGC->alu;    pPriv->oneRect = FALSE;    pPriv->fExpose = TRUE;    pPriv->freeCompClip = FALSE;    pPriv->pRotatedPixmap = (PixmapPtr) NULL;    return TRUE;}/* Clipping conventions	if the drawable is a window	    CT_REGION ==> pCompositeClip really is the composite	    CT_other ==> pCompositeClip is the window clip region	if the drawable is a pixmap	    CT_REGION ==> pCompositeClip is the translated client region		clipped to the pixmap boundary	    CT_other ==> pCompositeClip is the pixmap bounding box*/voidcfbValidateGC(pGC, changes, pDrawable)    register GCPtr  pGC;    unsigned long   changes;    DrawablePtr	    pDrawable;{    int         mask;		/* stateChanges */    int         index;		/* used for stepping through bitfields */    int		new_rrop;    int         new_line, new_text, new_fillspans, new_fillarea;    int		new_rotate;    int		xrot, yrot;    /* flags for changing the proc vector */    cfbPrivGCPtr devPriv;    int		oneRect;    new_rotate = pGC->lastWinOrg.x != pDrawable->x ||		 pGC->lastWinOrg.y != pDrawable->y;    pGC->lastWinOrg.x = pDrawable->x;    pGC->lastWinOrg.y = pDrawable->y;    devPriv = cfbGetGCPrivate(pGC);    new_rrop = FALSE;    new_line = FALSE;    new_text = FALSE;    new_fillspans = FALSE;    new_fillarea = FALSE;    /*     * if the client clip is different or moved OR the subwindowMode has     * changed OR the window's clip has changed since the last validation     * we need to recompute the composite clip      */    if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||	(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))	)    {	miComputeCompositeClip (pGC, pDrawable);#ifdef NO_ONE_RECT	devPriv->oneRect = FALSE;#else	oneRect = REGION_NUM_RECTS(devPriv->pCompositeClip) == 1;	if (oneRect != devPriv->oneRect)	    new_line = TRUE;	devPriv->oneRect = oneRect;#endif    }    mask = changes;    while (mask) {	index = lowbit (mask);	mask &= ~index;	/*	 * this switch acculmulates a list of which procedures might have	 * to change due to changes in the GC.  in some cases (e.g.	 * changing one 16 bit tile for another) we might not really need	 * a change, but the code is being paranoid. this sort of batching	 * wins if, for example, the alu and the font have been changed,	 * or any other pair of items that both change the same thing. 	 */	switch (index) {	case GCFunction:	case GCForeground:	    new_rrop = TRUE;	    break;	case GCPlaneMask:	    new_rrop = TRUE;	    new_text = TRUE;	    break;	case GCBackground:	    break;	case GCLineStyle:	case GCLineWidth:	    new_line = TRUE;	    break;	case GCJoinStyle:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -