Rev 5722 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5722 | Rev 5750 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
11 | ;; Version 2, June 1991 ;; |
11 | ;; Version 2, June 1991 ;; |
12 | ;; ;; |
12 | ;; ;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 14... | Line 14... | ||
14 | 14 | ||
15 | load_pixel_rre: ; returns in ecx |
- | |
16 | - | ||
17 | push eax |
- | |
18 | @@: |
- | |
19 | lea eax, [esi+BYTES_PER_PIXEL] |
- | |
20 | cmp [datapointer], eax |
- | |
21 | jae @f |
- | |
22 | call read_data.more |
- | |
23 | jmp @b |
- | |
Line 24... | Line 15... | ||
24 | @@: |
15 | load_pixel: ; returns in eax |
Line 25... | Line -... | ||
25 | - | ||
26 | if BITS_PER_PIXEL = 8 |
- | |
27 | - | ||
28 | push ebx |
- | |
29 | - | ||
30 | mov bl, 36 |
- | |
31 | mov al, [esi] |
- | |
32 | and al, 7 |
- | |
33 | mul bl |
- | |
34 | mov ch, al ; red |
16 | |
35 | - | ||
36 | mov al, [esi] |
17 | if BITS_PER_PIXEL = 8 |
37 | shr al, 3 |
- | |
38 | and al, 7 |
- | |
39 | mul bl |
- | |
40 | mov cl, al ; green |
18 | |
41 | - | ||
42 | mov bl, 85 |
- | |
43 | mov al, [esi] |
- | |
44 | shr al, 6 |
- | |
45 | and al, 3 |
- | |
46 | mul bl |
- | |
47 | shl ecx, 8 |
- | |
48 | mov cl, al ; blue |
- | |
Line 49... | Line 19... | ||
49 | 19 | xor eax, eax |
|
Line -... | Line 20... | ||
- | 20 | lodsb |
|
50 | inc esi |
21 | mov eax, [lut_8bpp+eax*4] |
51 | pop ebx |
22 | |
- | 23 | else if BITS_PER_PIXEL = 16 |
|
52 | 24 | ||
53 | else if BITS_PER_PIXEL = 16 |
25 | push ebx |
54 | 26 | lodsw |
|
55 | lodsw |
- | |
56 | mov cl, ah |
27 | mov bx, ax |
57 | and al, 0xf8 ; red |
28 | shl bx, 5 |
58 | 29 | and bh, 0xfc ; green |
|
59 | mov cx, ax |
30 | |
60 | shl cx, 5 |
31 | mov bl, ah |
61 | and ch, 0xfc ; green |
32 | and bl, 0xf8 ; red |
- | 33 | shl ebx, 8 |
|
- | 34 | ||
Line 62... | Line 35... | ||
62 | shl ecx, 8 |
35 | mov bl, al |
Line 63... | Line 36... | ||
63 | 36 | shl bl, 3 |
|
64 | mov cl, al |
37 | and bl, 0xf8 ; blue |
65 | shl cl, 3 |
38 | mov eax, ebx |
Line 66... | Line 39... | ||
66 | and cx, 0x00f8 ; blue |
39 | pop ebx |
Line 67... | Line -... | ||
67 | - | ||
68 | else if BITS_PER_PIXEL = 24 |
- | |
69 | 40 | ||
Line 70... | Line 41... | ||
70 | mov ecx, [esi] |
41 | else if BITS_PER_PIXEL = 24 |
71 | and ecx, 0x00ffffff |
- | |
Line 72... | Line 42... | ||
72 | add esi, 3 |
42 | |
Line -... | Line 43... | ||
- | 43 | mov eax, [esi] |
|
- | 44 | and eax, 0x00ffffff |
|
73 | 45 | add esi, 3 |
|
Line 74... | Line 46... | ||
74 | else if BITS_PER_PIXEL = 32 |
46 | |
Line 75... | Line 47... | ||
75 | 47 | else if BITS_PER_PIXEL = 32 |
|
Line 98... | Line 70... | ||
98 | bswap eax |
70 | bswap eax |
99 | mov [subrectangles], eax |
71 | mov [subrectangles], eax |
Line 100... | Line 72... | ||
100 | 72 | ||
Line 101... | Line -... | ||
101 | DEBUGF 1, "%u subrectangles\n", eax |
- | |
102 | - | ||
103 | ; Get background color |
- | |
104 | call load_pixel_rre |
73 | DEBUGF 1, "%u subrectangles\n", eax |
105 | 74 | ||
106 | ; Calculate first pixel pos |
75 | ; Calculate first pixel pos |
107 | movzx eax, [screen.width] |
76 | movzx eax, [screen.width] |
108 | mul [rectangle.y] ; [screen.width]*[rectangle.y] |
77 | mul [rectangle.y] ; [screen.width]*[rectangle.y] |
Line 112... | Line 81... | ||
112 | ; Calculate offset between two rows of pixels |
81 | ; Calculate offset between two rows of pixels |
113 | movzx eax, [screen.width] |
82 | movzx eax, [screen.width] |
114 | sub eax, [rectangle.width] |
83 | sub eax, [rectangle.width] |
115 | lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
84 | lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
Line -... | Line 85... | ||
- | 85 | ||
- | 86 | ; Get background color |
|
- | 87 | call load_pixel |
|
116 | 88 | ||
117 | ; Draw background rectangle |
89 | ; Draw background rectangle |
118 | push edi |
- | |
119 | mov eax, ecx |
90 | push edi |
120 | mov edx, [rectangle.height] |
91 | mov edx, [rectangle.height] |
121 | .lineloop: |
92 | .lineloop: |
122 | mov ecx, [rectangle.width] |
93 | mov ecx, [rectangle.width] |
123 | .pixelloop: |
94 | .pixelloop: |
Line 135... | Line 106... | ||
135 | ; Any subrectangles at all? |
106 | ; Any subrectangles at all? |
136 | cmp [subrectangles], 0 |
107 | cmp [subrectangles], 0 |
137 | je next_rectangle |
108 | je next_rectangle |
Line 138... | Line 109... | ||
138 | 109 | ||
- | 110 | .subrectangle: |
|
139 | .subrectangle: |
111 | push edi |
140 | @@: |
112 | @@: |
141 | lea eax, [esi+8+BYTES_PER_PIXEL] |
113 | lea eax, [esi+8+BYTES_PER_PIXEL] |
142 | cmp [datapointer], eax |
114 | cmp [datapointer], eax |
143 | jae @f |
115 | jae @f |
144 | call read_data.more |
116 | call read_data.more |
145 | jmp @b |
117 | jmp @b |
Line 146... | Line 118... | ||
146 | @@: |
118 | @@: |
147 | 119 | ||
- | 120 | ; Get subrectangle color |
|
Line 148... | Line 121... | ||
148 | ; Get subrectangle color |
121 | call load_pixel |
149 | call load_pixel_rre |
122 | push eax |
150 | 123 | ||
151 | ; Get coordinates |
124 | ; Get coordinates |
Line 164... | Line 137... | ||
164 | mov [subrectangle.height], eax |
137 | mov [subrectangle.height], eax |
165 | DEBUGF 1, "Subrectangle: x=%u y=%u width=%u height=%u\n", \ |
138 | DEBUGF 1, "Subrectangle: x=%u y=%u width=%u height=%u\n", \ |
166 | [subrectangle.x], [subrectangle.y], [subrectangle.width], [subrectangle.height] |
139 | [subrectangle.x], [subrectangle.y], [subrectangle.width], [subrectangle.height] |
Line 167... | Line 140... | ||
167 | 140 | ||
168 | ; Calculate pos of first pixel |
- | |
169 | push edi |
141 | ; Calculate pos of first pixel |
170 | movzx eax, [screen.width] |
142 | movzx eax, [screen.width] |
171 | mul [subrectangle.y] |
143 | mul [subrectangle.y] |
172 | add eax, [subrectangle.x] |
144 | add eax, [subrectangle.x] |
173 | lea eax, [eax*3] |
145 | lea eax, [eax*3] |
Line 177... | Line 149... | ||
177 | movzx eax, [screen.width] |
149 | movzx eax, [screen.width] |
178 | sub eax, [subrectangle.width] |
150 | sub eax, [subrectangle.width] |
179 | lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
151 | lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
Line 180... | Line 152... | ||
180 | 152 | ||
181 | ; Draw the subrectangle |
153 | ; Draw the subrectangle |
182 | mov eax, ecx |
154 | pop eax |
183 | mov edx, [subrectangle.height] |
155 | mov edx, [subrectangle.height] |
184 | .lineloop2: |
156 | .lineloop2: |
185 | mov ecx, [subrectangle.width] |
157 | mov ecx, [subrectangle.width] |
186 | .pixelloop2: |
158 | .pixelloop2: |
Line 195... | Line 167... | ||
195 | jnz .lineloop2 |
167 | jnz .lineloop2 |
196 | pop edi |
168 | pop edi |
197 | dec [subrectangles] |
169 | dec [subrectangles] |
198 | jnz .subrectangle |
170 | jnz .subrectangle |
199 | jmp next_rectangle |
171 | jmp next_rectangle |
200 | 172 | ||
- | 173 |