Annotation of ntddk/src/video/displays/s3/lines.h, revision 1.1.1.1

1.1       root        1: /******************************Module*Header*******************************\
                      2: * Module Name: lines.h
                      3: *
                      4: * Line drawing constants and structures.
                      5: *
                      6: * NOTE: This file mirrors LINES.INC.  Changes here must be reflected in
                      7: * the .inc file!
                      8: *
                      9: * Copyright (c) 1992 Microsoft Corporation
                     10: \**************************************************************************/
                     11: 
                     12: // We have to be careful that we don't overflow any registers when using
                     13: // the hardware to draw lines (as opposed to going through the strips
                     14: // routines, which will never overflow).  We accomplish this by simply
                     15: // checking the bounds of the path; if it is so large that any of the
                     16: // hardware terms may overflow, we punt the entire path to the strips
                     17: // code (should be pretty rare).
                     18: 
                     19: #define MAX_INTEGER_BOUND  (1535)   // S3's line length term is limited to
                     20: #define MIN_INTEGER_BOUND  (-512)   //   a maximum value of 2047
                     21: 
                     22: // We have special strip routines when all strips have at most this many
                     23: // pixels:
                     24: 
                     25: #define MAX_SHORT_STROKE_LENGTH 15
                     26: 
                     27: // # of strip drawers in every group:
                     28: 
                     29: #define NUM_STRIP_DRAW_DIRECTIONS 4
                     30: 
                     31: // # of strip drawers for doing either solid lines or styled lines:
                     32: 
                     33: #define NUM_STRIP_DRAW_STYLES 8
                     34: 
                     35: typedef LONG STYLEPOS;
                     36: 
                     37: #define STYLE_MAX_COUNT     16
                     38: #define STYLE_MAX_VALUE     0x3fffL
                     39: #define RUN_MAX             20
                     40: #define STRIP_MAX           100
                     41: #define STYLE_DENSITY       3
                     42: 
                     43: // For the ROP table:
                     44: 
                     45: #define MIX_XOR_OFFSET      8
                     46: 
                     47: #define AND_ZERO            0L
                     48: #define AND_PEN             1L
                     49: #define AND_NOTPEN          2L
                     50: #define AND_ONE             3L
                     51: 
                     52: #define XOR_ZERO            (AND_ZERO   << MIX_XOR_OFFSET)
                     53: #define XOR_PEN             (AND_PEN    << MIX_XOR_OFFSET)
                     54: #define XOR_NOTPEN          (AND_NOTPEN << MIX_XOR_OFFSET)
                     55: #define XOR_ONE             (AND_ONE    << MIX_XOR_OFFSET)
                     56: 
                     57: // Flip and round flags:
                     58: 
                     59: #define FL_H_ROUND_DOWN         0x00000080L     // .... .... 1... ....
                     60: #define FL_V_ROUND_DOWN         0x00000100L     // .... ...1 .... ....
                     61: 
                     62: #define FL_FLIP_D               0x00000005L     // .... .... .... .1.1
                     63: #define FL_FLIP_V               0x00000008L     // .... .... .... 1...
                     64: #define FL_FLIP_SLOPE_ONE       0x00000010L     // .... .... ...1 ....
                     65: #define FL_FLIP_HALF            0x00000002L     // .... .... .... ..1.
                     66: #define FL_FLIP_H               0x00000200L     // .... ..1. .... ....
                     67: 
                     68: #define FL_ROUND_MASK           0x0000001CL     // .... .... ...1 11..
                     69: #define FL_ROUND_SHIFT          2
                     70: 
                     71: #define FL_RECTLCLIP_MASK       0x0000000CL     // .... .... .... 11..
                     72: #define FL_RECTLCLIP_SHIFT      2
                     73: 
                     74: #define FL_STRIP_MASK           0x00000003L     // .... .... .... ..11
                     75: #define FL_STRIP_SHIFT          0
                     76: 
                     77: #define FL_SIMPLE_CLIP          0x00000020      // .... .... ..1. ....
                     78: #define FL_COMPLEX_CLIP         0x00000040      // .... .... .1.. ....
                     79: #define FL_CLIP                (FL_SIMPLE_CLIP | FL_COMPLEX_CLIP)
                     80: 
                     81: #define FL_ARBITRARYSTYLED      0x00000400L     // .... .1.. .... ....
                     82: #define FL_MASKSTYLED           0x00000800L     // .... 1... .... ....
                     83: #define FL_STYLED              (FL_ARBITRARYSTYLED | FL_MASKSTYLED)
                     84: #define FL_ALTERNATESTYLED      0x00001000L     // ...1 .... .... ....
                     85: 
                     86: #define FL_STYLE_MASK           0x00000C00L
                     87: #define FL_STYLE_SHIFT          10
                     88: 
                     89: // Simpler flag bits in high byte:
                     90: 
                     91: #define FL_DONT_DO_HALF_FLIP    0x00002000L     // ..1. .... .... ....
                     92: #define FL_PHYSICAL_DEVICE      0x00004000L     // .1.. .... .... ....
                     93: 
                     94: // Miscellaneous DDA defines:
                     95: 
                     96: #define LROUND(x, flRoundDown) (((x) + F/2 - ((flRoundDown) > 0)) >> 4)
                     97: #define F                     16
                     98: #define FLOG2                 4
                     99: #define LFLOOR(x)             ((x) >> 4)
                    100: #define FXFRAC(x)             ((x) & (F - 1))
                    101: 
                    102: typedef struct _STRIP {
                    103:     LONG   cStrips;               // # of strips in array
                    104:     LONG   flFlips;               // Indicates if line goes up or down
                    105:     POINTL ptlStart;             // first point
                    106:     LONG   alStrips[STRIP_MAX];   // Array of strips
                    107: } STRIP;
                    108: 
                    109: typedef struct _LINESTATE {
                    110:     LONG            lNextScan;      // Offset to next scan
                    111:     BYTE            jAnd;           // Color to be ANDed for DFBs
                    112:     BYTE            jXor;           // Color to be XORed for DFBs
                    113:     BYTE            filler1[2];
                    114: 
                    115:     STYLEPOS*       pspStart;       // Pointer to start of style array
                    116:     STYLEPOS*       pspEnd;         // Pointer to end of style array
                    117:     STYLEPOS*       psp;            // Pointer to current style entry
                    118: 
                    119:     STYLEPOS        spRemaining;    // To go in current style
                    120:     STYLEPOS        spTotal;        // Sum of style array
                    121:     STYLEPOS        spTotal2;       // Twice sum of style array
                    122:     STYLEPOS        spNext;         // Style state at start of next line
                    123:     STYLEPOS        spComplex;      // Style state at start of complex clip line
                    124: 
                    125:     STYLEPOS*       aspRtoL;        // Style array in right-to-left order
                    126:     STYLEPOS*       aspLtoR;        // Style array in left-to-right order
                    127: 
                    128:     ULONG           ulStyleMask;    // Are we working on a gap in the style?
                    129:                                     // 0xff if yes, 0x0 if not
                    130:     ULONG           xyDensity;      // Density of style
                    131:     ULONG           cStyle;         // Size of style array
                    132: 
                    133:     ULONG           ulStyleMaskLtoR;// Original style mask, left-to-right order
                    134:     ULONG           ulStyleMaskRtoL;// Original style mask, right-to-left order
                    135: 
                    136:     BOOL            ulStartMask;    // Determines if first element in style
                    137:                                     // array is for a gap or a dash
                    138: 
                    139: } LINESTATE;                        /* ls */
                    140: 
                    141: // Strip drawer prototype:
                    142: 
                    143: typedef VOID (*PFNSTRIP)(PPDEV, STRIP*, LINESTATE*);
                    144: 
                    145: // Strip drawers:
                    146: 
                    147: VOID vssSolidHorizontal(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    148: VOID vrlSolidHorizontal(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    149: 
                    150: VOID vssSolidVertical(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    151: VOID vrlSolidVertical(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    152: 
                    153: VOID vssSolidDiagonalHorizontal(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    154: VOID vrlSolidDiagonalHorizontal(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    155: 
                    156: VOID vssSolidDiagonalVertical(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    157: VOID vrlSolidDiagonalVertical(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    158: 
                    159: VOID vStripStyledHorizontal(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    160: VOID vStripStyledVertical(PPDEV ppdev, STRIP *pStrip, LINESTATE *pLineState);
                    161: 
                    162: // External calls:
                    163: 
                    164: #ifdef __CPLUSPLUS
                    165: extern "C"
                    166: BOOL bLines(PPDEV, POINTFIX*, POINTFIX*, RUN* prun, ULONG,
                    167:             LINESTATE*, RECTL*, PFNSTRIP*, FLONG);
                    168: #else
                    169: BOOL bLines(PPDEV, POINTFIX*, POINTFIX*, RUN* prun, ULONG,
                    170:             LINESTATE*, RECTL*, PFNSTRIP*, FLONG);
                    171: #endif
                    172: 
                    173: VOID vSetStrips(PPDEV, LINEATTRS *, INT, INT);
                    174: 
                    175: VOID vFastLine(PPDEV, PATHOBJ*, RECTL*, PFNSTRIP*, LONG);

unix.superglobalmegacorp.com

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