|
|
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: * Created: 30-Mar-1992
10: * Author: Andrew Milton [w-andym]
11: *
12: * Copyright (c) 1992 Microsoft Corporation
13: \**************************************************************************/
14:
15: typedef LONG STYLEPOS;
16:
17: #define STYLE_MAX_COUNT 16
18: #define STYLE_MAX_VALUE 0x3fffL
19: #define RUN_MAX 20
20: #define STRIP_MAX 100
21: #define STYLE_DENSITY 3 // For VGA
22:
23: // For the ROP table:
24:
25: #define MIX_XOR_OFFSET 8
26:
27: #define AND_ZERO 0L
28: #define AND_PEN 1L
29: #define AND_NOTPEN 2L
30: #define AND_ONE 3L
31:
32: #define XOR_ZERO (AND_ZERO << MIX_XOR_OFFSET)
33: #define XOR_PEN (AND_PEN << MIX_XOR_OFFSET)
34: #define XOR_NOTPEN (AND_NOTPEN << MIX_XOR_OFFSET)
35: #define XOR_ONE (AND_ONE << MIX_XOR_OFFSET)
36:
37: // Flip and round flags:
38:
39: #define FL_H_ROUND_DOWN 0x00000080L // .... .... 1... ....
40: #define FL_V_ROUND_DOWN 0x00008000L // 1... .... .... ....
41:
42: #define FL_FLIP_D 0x00000005L // .... .... .... .1.1
43: #define FL_FLIP_V 0x00000008L // .... .... .... 1...
44: #define FL_FLIP_SLOPE_ONE 0x00000010L // .... .... ...1 ....
45: #define FL_FLIP_HALF 0x00000002L // .... .... .... ..1.
46: #define FL_FLIP_H 0x00000200L // .... ..1. .... ....
47:
48: #define FL_ROUND_MASK 0x0000001CL // .... .... ...1 11..
49: #define FL_ROUND_SHIFT 2
50:
51: #define FL_RECTLCLIP_MASK 0x0000000CL // .... .... .... 11..
52: #define FL_RECTLCLIP_SHIFT 2
53:
54: #define FL_STRIP_MASK 0x00000003L // .... .... .... ..11
55: #define FL_STRIP_SHIFT 0
56:
57: #define FL_SIMPLE_CLIP 0x00000020 // .... .... ..1. ....
58: #define FL_COMPLEX_CLIP 0x00000040 // .... .... .1.. ....
59: #define FL_CLIP (FL_SIMPLE_CLIP | FL_COMPLEX_CLIP)
60:
61: #define FL_ARBITRARYSTYLED 0x00000400L // .... .1.. .... ....
62: #define FL_MASKSTYLED 0x00000800L // .... 1... .... ....
63: #define FL_STYLED (FL_ARBITRARYSTYLED | FL_MASKSTYLED)
64: #define FL_ALTERNATESTYLED 0x00001000L // ...1 .... .... ....
65:
66: #define FL_STYLE_MASK 0x00000C00L
67: #define FL_STYLE_SHIFT 10
68:
69: // Simpler flag bits in high byte:
70:
71: #define FL_DONT_DO_HALF_FLIP 0x00002000L // ..1. .... .... ....
72: #define FL_PHYSICAL_DEVICE 0x00004000L // .1.. .... .... ....
73:
74: // Miscellaneous DDA defines:
75:
76: #define LROUND(x, flRoundDown) (((x) + F/2 - ((flRoundDown) > 0)) >> 4)
77: #define F 16
78: #define FLOG2 4
79: #define LFLOOR(x) ((x) >> 4)
80: #define FXFRAC(x) ((x) & (F - 1))
81:
82: struct _STRIP;
83: struct _LINESTATE;
84:
85: typedef VOID (*PFNSTRIP)(struct _STRIP*, struct _LINESTATE*, LONG*);
86:
87: typedef struct _STRIP {
88:
89: // Updated by strip drawers:
90:
91: BYTE* pjScreen; // Points to the first pixel of the line
92: BYTE jBitMask; // Bit making for pixel in byte
93: BYTE jFiller1[3]; // jBitMask sometimes treated as a ULONG
94: BYTE jStyleMask; // Are we working on a gap in the style?
95: BYTE jFiller2[3]; // jStyleMask sometimes treated as a ULONG
96:
97: STYLEPOS* psp; // Pointer to current style entry
98: STYLEPOS spRemaining; // To go in current style
99:
100: // Not modified by strip drawers:
101:
102: LONG lNextScan; // Signed increment to next scan
103: LONG* plStripEnd; // Points one element past last strip
104: LONG flFlips; // Indicates if line goes up or down
105: STYLEPOS* pspStart; // Pointer to start of style array
106: STYLEPOS* pspEnd; // Pointer to end of style array
107: ULONG ulBitmapROP; // ROP info for DFBs
108: ULONG xyDensity; // Density of style
109:
110: // We leave room for a couple of extra dwords at the end of the strips
111: // array that can be used by the strip drawers:
112:
113: LONG alStrips[STRIP_MAX + 2]; // Array of strips
114: } STRIP;
115:
116: typedef struct _LINESTATE {
117:
118: STYLEPOS spTotal; // Sum of style array
119: STYLEPOS spTotal2; // Twice sum of style array
120: STYLEPOS spNext; // Style state at start of next line
121: STYLEPOS spComplex; // Style state at start of complex clip line
122:
123: STYLEPOS* aspRtoL; // Style array in right-to-left order
124: STYLEPOS* aspLtoR; // Style array in left-to-right order
125:
126: ULONG xyDensity; // Density of style
127: ULONG cStyle; // Size of style array
128:
129: ULONG ulStyleMaskLtoR;// Original style mask, left-to-right order
130: ULONG ulStyleMaskRtoL;// Original style mask, right-to-left order
131:
132: BOOL ulStartMask; // Determines if first element in style
133: // array is for a gap or a dash
134:
135: // Used for 2 pass ROPs and/or device-format bitmaps:
136:
137: PFNSTRIP* apfnStrip; // Actual strip table if doing 2-pass ROP
138: // or a DFB
139:
140: ULONG iColor; // Color for 2nd pass of 2-pass ROP
141: // or color index for DFB pen
142:
143: ULONG ulVgaMode; // VGA mode for 2nd pass of 2-pass ROP
144:
145: ULONG ulDrawModeIndex;// Set to mix - 1
146: ULONG ulBitmapROP; // ROP info for DFB strip drawer
147: LONG lNextPlane; // Offset to next plane, same scan line
148:
149: } LINESTATE; /* ls */
150:
151: BOOL bLinesSimple(PDEVSURF, POINTFIX*, POINTFIX*, RUN* prun, ULONG, LINESTATE*,
152: RECTL*, PFNSTRIP*, FLONG);
153:
154: BOOL bLines(PDEVSURF, POINTFIX*, POINTFIX*, RUN* prun, ULONG,
155: LINESTATE*, RECTL*, PFNSTRIP*, FLONG);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.