|
|
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 // Maximum number of style array entries
18: #define STYLE_MAX_VALUE 0x3fffL // Maximum for of a style array element
19: #define RUN_MAX 20 // Size of our complex clip runs buffer
20: #define STRIP_MAX 100 // Size of our strip buffer
21: #define STYLE_DENSITY 3 // Each style unit is 3 pixels long
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 (see lines.inc for a description):
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_SET 0x00000800L // .... 1... .... ....
63: #define FL_STYLED (FL_ARBITRARYSTYLED)
64:
65: #define FL_STRIP_ARRAY_MASK 0x00000C00L
66: #define FL_STRIP_ARRAY_SHIFT 10
67:
68: // Simpler flag bits in high byte:
69:
70: #define FL_DONT_DO_HALF_FLIP 0x00002000L // ..1. .... .... ....
71: #define FL_PHYSICAL_DEVICE 0x00004000L // .1.. .... .... ....
72:
73: // Miscellaneous DDA defines:
74:
75: #define LROUND(x, flRoundDown) (((x) + F/2 - ((flRoundDown) > 0)) >> 4)
76: #define F 16
77: #define FLOG2 4
78: #define LFLOOR(x) ((x) >> 4)
79: #define FXFRAC(x) ((x) & (F - 1))
80:
81: struct _STRIP;
82: struct _LINESTATE;
83:
84: typedef VOID (*PFNSTRIP)(struct _STRIP*, struct _LINESTATE*, LONG*);
85:
86: typedef struct _STRIP {
87:
88: // Updated by strip drawers:
89:
90: BYTE* pjScreen; // Points to the first pixel of the line
91: BYTE bIsGap; // Are we working on a gap in the style?
92: BYTE jFiller2[3]; // bIsGap sometimes treated as a ULONG
93:
94: STYLEPOS* psp; // Pointer to current style entry
95: STYLEPOS spRemaining; // To go in current style
96:
97: // Not modified by strip drawers:
98:
99: LONG lNextScan; // Signed increment to next scan
100: LONG* plStripEnd; // Points one element past last strip
101: LONG flFlips; // Indicates if line goes up or down
102: STYLEPOS* pspStart; // Pointer to start of style array
103: STYLEPOS* pspEnd; // Pointer to end of style array
104: ULONG xyDensity; // Density of style
105: ULONG chAndXor; // Lines colors (need 2 for doing ROPs)
106:
107: // We leave room for a couple of extra dwords at the end of the strips
108: // array that can be used by the strip drawers:
109:
110: LONG alStrips[STRIP_MAX + 2]; // Array of strips
111: } STRIP;
112:
113: typedef struct _LINESTATE {
114:
115: ULONG chAndXor; // Line colors (need 2 for doing ROPs)
116: STYLEPOS spTotal; // Sum of style array
117: STYLEPOS spTotal2; // Twice sum of style array
118: STYLEPOS spNext; // Style state at start of next line
119: STYLEPOS spComplex; // Style state at start of complex clip line
120:
121: STYLEPOS* aspRtoL; // Style array in right-to-left order
122: STYLEPOS* aspLtoR; // Style array in left-to-right order
123:
124: ULONG xyDensity; // Density of style
125: ULONG cStyle; // Size of style array
126:
127: ULONG ulStyleMaskLtoR;// Original style mask, left-to-right order
128: ULONG ulStyleMaskRtoL;// Original style mask, right-to-left order
129:
130: BOOL bStartIsGap; // Determines if first element in style
131: // array is for a gap or a dash
132:
133: } LINESTATE; /* ls */
134:
135: BOOL bLinesSimple(PPDEV, POINTFIX*, POINTFIX*, RUN*, ULONG, LINESTATE*,
136: RECTL*, PFNSTRIP*, FLONG);
137:
138: BOOL bLines(PPDEV, POINTFIX*, POINTFIX*, RUN*, ULONG,
139: LINESTATE*, RECTL*, PFNSTRIP*, FLONG);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.