Annotation of researchv9/X11/src/X.V11R1/server/ddx/cfb/cfb.h, revision 1.1.1.1

1.1       root        1: /************************************************************
                      2: Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
                      3: 
                      4:                     All Rights Reserved
                      5: 
                      6: Permission  to  use,  copy,  modify,  and  distribute   this
                      7: software  and  its documentation for any purpose and without
                      8: fee is hereby granted, provided that the above copyright no-
                      9: tice  appear  in all copies and that both that copyright no-
                     10: tice and this permission notice appear in  supporting  docu-
                     11: mentation,  and  that the names of Sun or MIT not be used in
                     12: advertising or publicity pertaining to distribution  of  the
                     13: software  without specific prior written permission. Sun and
                     14: M.I.T. make no representations about the suitability of this
                     15: software for any purpose. It is provided "as is" without any
                     16: express or implied warranty.
                     17: 
                     18: SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
                     19: INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
                     20: NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
                     21: ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     22: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
                     23: PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
                     24: OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
                     25: THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     26: 
                     27: ********************************************************/
                     28: 
                     29: #include "pixmap.h"
                     30: #include "region.h"
                     31: #include "gc.h"
                     32: #include "colormap.h"
                     33: #include "miscstruct.h"
                     34: 
                     35: extern Bool cfbScreenInit();
                     36: extern void cfbQueryBestSize();
                     37: extern Bool cfbCreateWindow();
                     38: extern Bool cfbPositionWindow();
                     39: extern Bool cfbChangeWindowAttributes();
                     40: extern Bool cfbMapWindow();
                     41: extern Bool cfbUnmapWindow();
                     42: extern Bool cfbDestroyWindow();
                     43: 
                     44: extern Bool cfbRealizeFont();
                     45: extern Bool cfbUnrealizeFont();
                     46: extern Bool cfbRealizeCursor();
                     47: extern Bool cfbUnrealizeCursor();
                     48: extern Bool cfbScreenSaver();
                     49: extern Bool cfbCreateGC();
                     50: 
                     51: extern PixmapPtr cfbCreatePixmap();
                     52: extern Bool cfbDestroyPixmap();
                     53: 
                     54: extern void cfbCopyWindow();
                     55: extern void cfbPaintWindowBorder();
                     56: extern void cfbPaintWindowBackground();
                     57: extern void cfbPaintAreaNone();
                     58: extern void cfbPaintAreaPR();
                     59: extern void cfbPaintAreaSolid();
                     60: extern void cfbPaintArea32();
                     61: extern void cfbPaintAreaOther();
                     62: 
                     63: extern void miPolyFillRect();
                     64: extern void miPolyFillArc();
                     65: 
                     66: extern void cfbDestroyGC();
                     67: extern void cfbValidateGC();
                     68: extern void cfbDestroyClip();
                     69: extern void cfbCopyClip();
                     70: extern void cfbChangeClip();
                     71: extern void cfbCopyGCDest();
                     72: 
                     73: extern void cfbSetSpans();
                     74: extern unsigned int *cfbGetSpans();
                     75: extern void cfbSolidFS();
                     76: extern void cfbUnnaturalTileFS();
                     77: extern void cfbUnnaturalStippleFS();
                     78: 
                     79: /* included from mfb.h; we can't include mfb.h directly because of other 
                     80:  * conflicts */
                     81: extern void mfbSetSpans();
                     82: extern unsigned int *mfbGetSpans();
                     83: extern void mfbUnnaturalTileFS();
                     84: extern void mfbUnnaturalStippleFS();
                     85: extern Bool mfbRealizeFont();
                     86: extern Bool mfbUnrealizeFont();
                     87: extern RegionPtr mfbPixmapToRegion();
                     88: 
                     89: extern void miNotMiter();
                     90: extern void miMiter();
                     91: extern PixmapPtr cfbCopyPixmap();
                     92: extern void  cfbConvertRects();
                     93: extern void  miPolyArc();
                     94: extern void  miFillPolyArc();
                     95: 
                     96: extern void miPutImage();
                     97: extern void miGetImage();
                     98: extern void miCopyArea();
                     99: extern void miCopyPlane();
                    100: extern void miPolyPoint();
                    101: extern void miPushPixels();
                    102: 
                    103: extern int cfbListInstalledColormaps();
                    104: 
                    105: extern ColormapPtr cfbGetStaticColormap();
                    106: #ifdef STATIC_COLOR
                    107: extern void cfbResolveStaticColor();
                    108: #endif
                    109: 
                    110: /*
                    111:    private filed of pixmap
                    112:    pixmap.devPrivate = (unsigned int *)pointer_to_bits
                    113:    pixmap.devKind = width_of_pixmap_in_bytes
                    114: */
                    115: 
                    116: /* private field of GC */
                    117: typedef struct {
                    118:     short      rop;            /* reduction of rasterop to 1 of 3 */
                    119:     short      ropOpStip;      /* rop for opaque stipple */
                    120:     short      fExpose;        /* callexposure handling ? */
                    121:     short      freeCompClip;
                    122:     PixmapPtr  pRotatedTile;   /* tile/stipple  rotated to align with window */
                    123:     PixmapPtr  pRotatedStipple;        /* and using offsets */
                    124:     RegionPtr  pAbsClientRegion; /* client region in screen coords */
                    125:     RegionPtr  pCompositeClip; /* FREE_CC or REPLACE_CC */
                    126:     } cfbPrivGC;
                    127: typedef cfbPrivGC      *cfbPrivGCPtr;
                    128: 
                    129: /* freeCompositeClip values */
                    130: #define REPLACE_CC     0               /* compsite clip is a copy of a
                    131:                                        pointer, so it doesn't need to 
                    132:                                        be freed; just overwrite it.
                    133:                                        this happens if there is no
                    134:                                        client clip and the gc is
                    135:                                        clipped by children 
                    136:                                        */
                    137: #define FREE_CC                1               /* composite clip is a real
                    138:                                           region that we need to free
                    139:                                        */
                    140: 
                    141: /* private field of window */
                    142: typedef struct {
                    143:     int                fastBorder;     /* non-zero if border is 32 bits wide */
                    144:     int                fastBackground;
                    145:     DDXPointRec        oldRotate;
                    146:     PixmapPtr  pRotatedBackground;
                    147:     PixmapPtr  pRotatedBorder;
                    148:     } cfbPrivWin;
                    149: 
                    150: /* precomputed information about each glyph for GlyphBlt code.
                    151:    this saves recalculating the per glyph information for each
                    152: box.
                    153: */
                    154: typedef struct _pos{
                    155:     int xpos;          /* xposition of glyph's origin */
                    156:     int xchar;         /* x position mod 32 */
                    157:     int leftEdge;
                    158:     int rightEdge;
                    159:     int topEdge;
                    160:     int bottomEdge;
                    161:     int *pdstBase;     /* longword with character origin */
                    162:     int widthGlyph;    /* width in bytes of this glyph */
                    163: } TEXTPOS;
                    164: 
                    165: /* reduced raster ops for cfb */
                    166: #define RROP_BLACK     GXclear
                    167: #define RROP_WHITE     GXset
                    168: #define RROP_NOP       GXnoop
                    169: #define RROP_INVERT    GXinvert
                    170: 
                    171: /* out of clip region codes */
                    172: #define OUT_LEFT 0x08
                    173: #define OUT_RIGHT 0x04
                    174: #define OUT_ABOVE 0x02
                    175: #define OUT_BELOW 0x01
                    176: 
                    177: /* major axis for bresenham's line */
                    178: #define X_AXIS 0
                    179: #define Y_AXIS 1
                    180: 
                    181: /* optimization codes for FONT's devPrivate field */
                    182: #define FT_VARPITCH    0
                    183: #define FT_SMALLPITCH  1
                    184: #define FT_FIXPITCH    2
                    185: 
                    186: /* macros for cfbbitblt.c, cfbfillsp.c
                    187:    these let the code do one switch on the rop per call, rather
                    188: than a switch on the rop per item (span or rectangle.)
                    189: */
                    190: 
                    191: #define fnCLEAR(src, dst)      (0)
                    192: #define fnAND(src, dst)        (src & dst)
                    193: #define fnANDREVERSE(src, dst) (src & ~dst)
                    194: #define fnCOPY(src, dst)       (src)
                    195: #define fnANDINVERTED(src, dst)        (~src & dst)
                    196: #define fnNOOP(src, dst)       (dst)
                    197: #define fnXOR(src, dst)                (src ^ dst)
                    198: #define fnOR(src, dst)         (src | dst)
                    199: #define fnNOR(src, dst)                (~(src | dst))
                    200: #define fnEQUIV(src, dst)      (~src ^ dst)
                    201: #define fnINVERT(src, dst)     (~dst)
                    202: #define fnORREVERSE(src, dst)  (src | ~dst)
                    203: #define fnCOPYINVERTED(src, dst)(~src)
                    204: #define fnORINVERTED(src, dst) (~src | dst)
                    205: #define fnNAND(src, dst)       (~(src & dst))
                    206: #define fnSET(src, dst)                (~0)
                    207: 
                    208: /* Binary search to figure out what to do for the raster op.  It may
                    209:  * do 5 comparisons, but at least it does no function calls 
                    210:  * Special cases copy because it's so frequent 
                    211:  * XXX - can't use this in many cases because it has no plane mask.
                    212:  */
                    213: #define DoRop(alu, src, dst) \
                    214: ( ((alu) == GXcopy) ? (src) : \
                    215:     (((alu) >= GXnor) ? \
                    216:      (((alu) >= GXcopyInverted) ? \
                    217:        (((alu) >= GXnand) ? \
                    218:          (((alu) == GXnand) ? ~((src) & (dst)) : ~0) : \
                    219:          (((alu) == GXcopyInverted) ? ~(src) : (~(src) | (dst)))) : \
                    220:        (((alu) >= GXinvert) ? \
                    221:         (((alu) == GXinvert) ? ~(dst) : ((src) | ~(dst))) : \
                    222:         (((alu) == GXnor) ? ~((src) | (dst)) : (~(src) ^ (dst)))) ) : \
                    223:      (((alu) >= GXandInverted) ? \
                    224:        (((alu) >= GXxor) ? \
                    225:         (((alu) == GXxor) ? ((src) ^ (dst)) : ((src) | (dst))) : \
                    226:         (((alu) == GXnoop) ? (dst) : (~(src) & (dst)))) : \
                    227:        (((alu) >= GXandReverse) ? \
                    228:         (((alu) == GXandReverse) ? ((src) & ~(dst)) : (src)) : \
                    229:         (((alu) == GXand) ? ((src) & (dst)) : 0)))  ) )

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.