Rev 2188 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2188 | Rev 2236 | ||
---|---|---|---|
1 | ;--------------------------------------------------------------------- |
1 | ;--------------------------------------------------------------------- |
2 | ; ÓÑÒÀÍÎÂÈÒÜ ÔÎÍ |
2 | ; ÓÑÒÀÍÎÂÈÒÜ ÔÎÍ |
3 | background: |
3 | background: |
4 | cmp [soi],0 |
4 | cmp [soi],0 |
5 | je .end |
5 | je .end |
6 | 6 | ||
7 | cmp [bgrmode],dword 2 |
7 | cmp [bgrmode],dword 2 |
8 | ja .stretch_crop |
8 | ja .stretch_crop |
9 | 9 | ||
10 | mov ecx,[img_width] ; øèðèíà |
10 | mov ecx,[img_width] ; øèðèíà |
11 | test ecx,ecx |
11 | test ecx,ecx |
12 | jz .end |
12 | jz .end |
13 | mov edx,[img_high] ; âûñîòà |
13 | mov edx,[img_high] ; âûñîòà |
14 | test edx,edx |
14 | test edx,edx |
15 | jz .end |
15 | jz .end |
16 | mcall 15,1 ; set size |
16 | mcall 15,1 ; set size |
17 | 17 | ||
18 | mov esi,ecx |
18 | mov esi,ecx |
19 | imul esi,edx |
19 | imul esi,edx |
20 | lea esi,[esi*3] |
20 | lea esi,[esi*3] |
21 | mov ecx,[soi] |
21 | mov ecx,[soi] |
22 | 22 | ||
23 | xor edx,edx |
23 | xor edx,edx |
24 | 24 | ||
25 | cmp [img_resolution],24 |
25 | cmp [img_resolution],24 |
26 | je @f |
26 | je @f |
27 | 27 | ||
28 | push dword image_file |
28 | push dword image_file |
29 | call [convert_Conv_24b] |
29 | call [convert_Conv_24b] |
30 | 30 | ||
31 | mov ecx,[raw_pointer_2] |
31 | mov ecx,[raw_pointer_2] |
32 | add ecx,44 |
32 | add ecx,44 |
33 | mcall 15,5 ;15,5 set data |
33 | mcall 15,5 ;15,5 set data |
34 | mcall 68,13,[raw_pointer_2] |
34 | mcall 68,13,[raw_pointer_2] |
35 | jmp .set_mode |
35 | jmp .set_mode |
36 | @@: |
36 | @@: |
37 | mcall 15,5 ; 15,5 set data |
37 | mcall 15,5 ; 15,5 set data |
38 | .set_mode: |
38 | .set_mode: |
39 | mcall 15,4,[bgrmode] ; 15,4 set mode |
39 | mcall 15,4,[bgrmode] ; 15,4 set mode |
40 | dec ebx ; 15,3 redraw background |
40 | dec ebx ; 15,3 redraw background |
41 | mcall |
41 | mcall |
42 | .end: |
42 | .end: |
43 | ret |
43 | ret |
44 | ;--------------------------------------------------------------------- |
44 | ;--------------------------------------------------------------------- |
45 | .stretch_crop: |
45 | .stretch_crop: |
46 | ; cmp [bgrmode],dword 3 |
46 | cmp [bgrmode],dword 3 |
47 | ; jne .stretch_inscribe |
47 | jne .stretch_inscribe |
48 | xor eax,eax |
48 | xor eax,eax |
49 | mov [stretch_start_coordinates],eax |
49 | mov [stretch_start_coordinates],eax |
50 | 50 | ||
51 | mcall 14 |
51 | mcall 14 |
52 | 52 | ||
53 | mov ebx,eax |
53 | mov ebx,eax |
54 | and eax,0xffff |
54 | and eax,0xffff |
55 | inc eax |
55 | inc eax |
56 | mov [screen_high],eax |
56 | mov [screen_high],eax |
57 | shr ebx,16 |
57 | shr ebx,16 |
58 | inc ebx |
58 | inc ebx |
59 | mov [screen_width],ebx |
59 | mov [screen_width],ebx |
60 | 60 | ||
61 | xchg eax,ebx |
61 | xchg eax,ebx |
62 | call calculate_relation |
62 | call calculate_relation |
63 | mov [screen_relation],eax |
63 | mov [screen_relation],eax |
64 | 64 | ||
65 | mov eax,[img_width] |
65 | mov eax,[img_width] |
66 | mov ebx,[img_high] |
66 | mov ebx,[img_high] |
67 | call calculate_relation |
67 | call calculate_relation |
68 | mov [picture_relation],eax |
68 | mov [picture_relation],eax |
69 | 69 | ||
70 | cmp eax,[screen_relation] |
70 | cmp eax,[screen_relation] |
71 | jb @f |
71 | jb @f |
72 | ; Y = Yimg |
72 | ; Y = Yimg |
73 | ; X = Yimg*Xscreen/Yscreen |
73 | ; X = Yimg*Xscreen/Yscreen |
74 | mov eax,[img_high] |
74 | mov eax,[img_high] |
75 | mov [stretch_img_high],eax |
75 | mov [stretch_img_high],eax |
76 | mov eax,[img_high] |
76 | mov eax,[img_high] |
77 | imul eax,dword [screen_width] |
77 | imul eax,dword [screen_width] |
78 | mov ebx,[screen_high] |
78 | mov ebx,[screen_high] |
79 | call integer_division |
79 | call integer_division |
80 | mov [stretch_img_width],eax |
80 | mov [stretch_img_width],eax |
81 | jmp .continue |
81 | jmp .continue |
82 | @@: |
82 | @@: |
83 | ; X = Ximg |
83 | ; X = Ximg |
84 | ; Y = Ximg*Yscreen/Xscreen |
84 | ; Y = Ximg*Yscreen/Xscreen |
85 | mov eax,[img_width] |
85 | mov eax,[img_width] |
86 | mov [stretch_img_width],eax |
86 | mov [stretch_img_width],eax |
87 | mov eax,[img_width] |
87 | mov eax,[img_width] |
88 | imul eax,dword [screen_high] |
88 | imul eax,dword [screen_high] |
89 | mov ebx,[screen_width] |
89 | mov ebx,[screen_width] |
90 | call integer_division |
90 | call integer_division |
91 | mov [stretch_img_high],eax |
91 | mov [stretch_img_high],eax |
92 | .continue: |
92 | .continue: |
93 | mov eax,[Stretch_Crop_Corner] |
93 | mov eax,[Stretch_Crop_Corner] |
94 | mov ebx,eax |
94 | mov ebx,eax |
95 | shr eax,16 |
95 | shr eax,16 |
96 | shl eax,2 |
96 | shl eax,2 |
97 | mov eax,[eax+call_to_calculate_stretch_start_coordinates_Y] |
97 | mov eax,[eax+call_to_calculate_stretch_start_coordinates_Y] |
98 | call eax |
98 | call eax |
99 | and ebx,0xffff |
99 | and ebx,0xffff |
100 | shl ebx,2 |
100 | shl ebx,2 |
101 | mov ebx,[ebx+call_to_calculate_stretch_start_coordinates_X] |
101 | mov ebx,[ebx+call_to_calculate_stretch_start_coordinates_X] |
102 | call ebx |
102 | call ebx |
103 | 103 | ||
104 | mov ebx,[screen_width] |
104 | mov ebx,[screen_width] |
105 | shl ebx,16 |
105 | shl ebx,16 |
106 | add ebx,[screen_high] |
106 | add ebx,[screen_high] |
107 | 107 | ||
108 | mov eax,[stretch_img_width] |
108 | mov eax,[stretch_img_width] |
109 | shl eax,16 |
109 | shl eax,16 |
110 | add eax,[stretch_img_high] |
110 | add eax,[stretch_img_high] |
111 | 111 | ||
112 | push dword eax ; eax - crop size |
112 | push dword eax ; eax - crop size |
113 | push dword 0 ; edi - background color |
113 | push dword 0 ; edi - background color |
114 | push dword 1 ; esi - filtering |
114 | push dword 1 ; esi - filtering |
115 | push dword 0 ; edx - scaling mode |
115 | push dword 0 ; edx - scaling mode |
116 | push dword [stretch_start_coordinates] ; ecx - start_coordinates |
116 | push dword [stretch_start_coordinates] ; ecx - start_coordinates |
117 | push ebx ; ebx - new_size |
117 | push ebx ; ebx - new_size |
118 | push dword image_file ; eax - convert data table |
118 | push dword image_file ; eax - convert data table |
119 | 119 | ||
120 | call [Scaling_Start] |
120 | call [Scaling_Start] |
121 | call background_1 |
121 | call background_1 |
122 | ret |
122 | ret |
- | 123 | ;--------------------------------------------------------------------- |
|
- | 124 | .stretch_inscribe: |
|
- | 125 | xor eax,eax |
|
- | 126 | mov [stretch_start_coordinates],eax |
|
- | 127 | ||
- | 128 | mcall 14 |
|
- | 129 | ||
- | 130 | mov ebx,eax |
|
- | 131 | and eax,0xffff |
|
- | 132 | inc eax |
|
- | 133 | mov [screen_high],eax |
|
- | 134 | shr ebx,16 |
|
- | 135 | inc ebx |
|
- | 136 | mov [screen_width],ebx |
|
- | 137 | ||
- | 138 | xchg eax,ebx |
|
- | 139 | call calculate_relation |
|
- | 140 | mov [screen_relation],eax |
|
- | 141 | ||
- | 142 | mov eax,[img_width] |
|
- | 143 | mov ebx,[img_high] |
|
- | 144 | call calculate_relation |
|
- | 145 | mov [picture_relation],eax |
|
- | 146 | ||
- | 147 | cmp eax,[screen_relation] |
|
- | 148 | ja @f |
|
- | 149 | ; Y = Yimg |
|
- | 150 | ; X = Yimg*Xscreen/Yscreen |
|
- | 151 | mov eax,[screen_high] ;[img_high] |
|
- | 152 | mov [stretch_img_high],eax |
|
- | 153 | mov eax,[screen_high] ;[img_high] |
|
- | 154 | imul eax,dword [img_width] ;[screen_width] |
|
- | 155 | mov ebx,[img_high] ;[screen_high] |
|
- | 156 | call integer_division |
|
- | 157 | mov [stretch_img_width],eax |
|
- | 158 | jmp .continue_1 |
|
- | 159 | @@: |
|
- | 160 | ; X = Ximg |
|
- | 161 | ; Y = Ximg*Yscreen/Xscreen |
|
- | 162 | mov eax,[screen_width] ;[img_width] |
|
- | 163 | mov [stretch_img_width],eax |
|
- | 164 | mov eax,[screen_width] ;[img_width] |
|
- | 165 | imul eax,dword [img_high] ;[screen_high] |
|
- | 166 | mov ebx,[img_width] ;[screen_width] |
|
- | 167 | call integer_division |
|
- | 168 | mov [stretch_img_high],eax |
|
- | 169 | .continue_1: |
|
- | 170 | ; mov ebx,[screen_width] |
|
- | 171 | ; shl ebx,16 |
|
- | 172 | ; add ebx,[screen_high] |
|
- | 173 | ||
- | 174 | mov ebx,[stretch_img_width] |
|
- | 175 | shl ebx,16 |
|
- | 176 | add ebx,[stretch_img_high] |
|
- | 177 | ||
- | 178 | ||
- | 179 | push dword 0 ; eax - crop size |
|
- | 180 | push dword 0 ; edi - background color |
|
- | 181 | push dword 1 ; esi - filtering |
|
- | 182 | push dword 0 ; edx - scaling mode |
|
- | 183 | push dword [stretch_start_coordinates] ; ecx - start_coordinates |
|
- | 184 | push ebx ; ebx - new_size |
|
- | 185 | push dword image_file ; eax - convert data table |
|
- | 186 | ||
- | 187 | call [Scaling_Start] |
|
- | 188 | ||
- | 189 | mov eax,[raw_pointer_2] |
|
- | 190 | mov [crop_raw_pointer],eax |
|
- | 191 | mov [crop_raw_pointer_2],eax |
|
- | 192 | ||
- | 193 | mov eax,[raw_pointer_2] |
|
- | 194 | mov eax,[eax+12] ;overall depth of the pixel |
|
- | 195 | cmp al,24 |
|
- | 196 | je @f |
|
- | 197 | ||
- | 198 | push dword crop_image_file |
|
- | 199 | call [convert_Conv_24b] |
|
- | 200 | ||
- | 201 | mov ecx,[raw_pointer_2] |
|
- | 202 | mcall 68,13 |
|
- | 203 | @@: |
|
- | 204 | mov ecx,[screen_width] |
|
- | 205 | imul ecx,[screen_high] |
|
- | 206 | lea ecx,[ecx*3] |
|
- | 207 | add ecx,44 |
|
- | 208 | ||
- | 209 | ; mcall 68,20,,[crop_raw_pointer_2] |
|
- | 210 | ; mov [crop_raw_pointer_2],eax |
|
- | 211 | mov eax,[crop_raw_pointer_2] |
|
- | 212 | mov [crop_raw_pointer],eax |
|
- | 213 | ||
- | 214 | mcall 68,12 |
|
- | 215 | mov [crop_raw_pointer_2],eax |
|
- | 216 | ||
- | 217 | ; fill of color |
|
- | 218 | sub ecx,44 |
|
- | 219 | mov edi,eax |
|
- | 220 | add edi,44 |
|
- | 221 | mov eax,0xaaaaaa |
|
- | 222 | cld |
|
- | 223 | @@: |
|
- | 224 | stosb |
|
- | 225 | ror eax,8 |
|
- | 226 | stosb |
|
- | 227 | ror eax,8 |
|
- | 228 | stosb |
|
- | 229 | rol eax,16 |
|
- | 230 | sub ecx,2 |
|
- | 231 | loop @b |
|
- | 232 | ||
- | 233 | ; copy of data |
|
- | 234 | mov eax,[screen_width] |
|
- | 235 | sub eax,[stretch_img_width] |
|
- | 236 | mov ebx,eax |
|
- | 237 | lea eax,[eax*3] |
|
- | 238 | shr ebx,1 |
|
- | 239 | lea ebx,[ebx*3] |
|
- | 240 | ||
- | 241 | mov edi,[screen_high] |
|
- | 242 | sub edi,[stretch_img_high] |
|
- | 243 | shr edi,1 |
|
- | 244 | imul edi,[screen_width] |
|
- | 245 | lea edi,[edi*3] |
|
- | 246 | add edi,[crop_raw_pointer_2] |
|
- | 247 | add edi,44 |
|
- | 248 | add edi,ebx |
|
- | 249 | ||
- | 250 | mov esi,[crop_raw_pointer] |
|
- | 251 | add esi,44 |
|
- | 252 | ||
- | 253 | mov ebx,[stretch_img_width] |
|
- | 254 | lea ebx,[ebx*3] |
|
- | 255 | ||
- | 256 | mov ecx,[stretch_img_high] |
|
- | 257 | @@: |
|
- | 258 | push ecx |
|
- | 259 | mov ecx,ebx |
|
- | 260 | rep movsb |
|
- | 261 | pop ecx |
|
- | 262 | add edi,eax |
|
- | 263 | loop @b |
|
- | 264 | ||
- | 265 | ; header |
|
- | 266 | mov esi,[crop_raw_pointer] |
|
- | 267 | mov edi,[crop_raw_pointer_2] |
|
- | 268 | mov ecx,44/4 |
|
- | 269 | rep stosd |
|
- | 270 | ||
- | 271 | mcall 68,13,[crop_raw_pointer] |
|
- | 272 | ;set the background |
|
- | 273 | mov eax,[crop_raw_pointer_2] |
|
- | 274 | mov ebx,[screen_width] |
|
- | 275 | mov [eax+4],ebx |
|
- | 276 | mov ebx,[screen_high] |
|
- | 277 | mov [eax+8],ebx |
|
- | 278 | ||
- | 279 | mov ecx,[screen_width] ; øèðèíà |
|
- | 280 | test ecx,ecx |
|
- | 281 | jz @f |
|
- | 282 | mov edx,[screen_high] ; âûñîòà |
|
- | 283 | test edx,edx |
|
- | 284 | jz @f |
|
- | 285 | mcall 15,1 ; set size |
|
- | 286 | ||
- | 287 | mov esi,ecx |
|
- | 288 | imul esi,edx |
|
- | 289 | lea esi,[esi*3] |
|
- | 290 | ||
- | 291 | xor edx,edx |
|
- | 292 | mov ecx,[crop_raw_pointer_2] |
|
- | 293 | add ecx,44 |
|
- | 294 | mcall 15,5 ;15,5 set data |
|
- | 295 | xor ecx,ecx |
|
- | 296 | inc ecx |
|
- | 297 | mcall 15,4 ; 15,4 set mode |
|
- | 298 | dec ebx ; 15,3 redraw background |
|
- | 299 | mcall |
|
- | 300 | @@: |
|
- | 301 | mcall 68,13,[crop_raw_pointer_2] |
|
123 | 302 | ret |
|
124 | ;--------------------------------------------------------------------- |
303 | ;--------------------------------------------------------------------- |
125 | call_to_calculate_stretch_start_coordinates_X: |
304 | call_to_calculate_stretch_start_coordinates_X: |
126 | dd calculate_stretch_start_coordinates_XL |
305 | dd calculate_stretch_start_coordinates_XL |
127 | dd calculate_stretch_start_coordinates_XC |
306 | dd calculate_stretch_start_coordinates_XC |
128 | dd calculate_stretch_start_coordinates_XR |
307 | dd calculate_stretch_start_coordinates_XR |
129 | ;--------------------------------------------------------------------- |
308 | ;--------------------------------------------------------------------- |
130 | call_to_calculate_stretch_start_coordinates_Y: |
309 | call_to_calculate_stretch_start_coordinates_Y: |
131 | dd calculate_stretch_start_coordinates_YU |
310 | dd calculate_stretch_start_coordinates_YU |
132 | dd calculate_stretch_start_coordinates_YC |
311 | dd calculate_stretch_start_coordinates_YC |
133 | dd calculate_stretch_start_coordinates_YD |
312 | dd calculate_stretch_start_coordinates_YD |
134 | ;--------------------------------------------------------------------- |
313 | ;--------------------------------------------------------------------- |
135 | calculate_stretch_start_coordinates_XC: |
314 | calculate_stretch_start_coordinates_XC: |
136 | xor ecx,ecx |
315 | xor ecx,ecx |
137 | .1: |
316 | .1: |
138 | mov eax,[img_width] |
317 | mov eax,[img_width] |
139 | sub eax,[stretch_img_width] |
318 | sub eax,[stretch_img_width] |
140 | test ecx,ecx |
319 | test ecx,ecx |
141 | jnz @f |
320 | jnz @f |
142 | shr eax,1 |
321 | shr eax,1 |
143 | @@: |
322 | @@: |
144 | mov [stretch_start_coordinates.x],ax |
323 | mov [stretch_start_coordinates.x],ax |
145 | calculate_stretch_start_coordinates_XL: |
324 | calculate_stretch_start_coordinates_XL: |
146 | ret |
325 | ret |
147 | ;--------------------------------------------------------------------- |
326 | ;--------------------------------------------------------------------- |
148 | calculate_stretch_start_coordinates_XR: |
327 | calculate_stretch_start_coordinates_XR: |
149 | xor ecx,ecx |
328 | xor ecx,ecx |
150 | inc ecx |
329 | inc ecx |
151 | jmp calculate_stretch_start_coordinates_XC.1 |
330 | jmp calculate_stretch_start_coordinates_XC.1 |
152 | ;--------------------------------------------------------------------- |
331 | ;--------------------------------------------------------------------- |
153 | calculate_stretch_start_coordinates_YC: |
332 | calculate_stretch_start_coordinates_YC: |
154 | xor ecx,ecx |
333 | xor ecx,ecx |
155 | .1: |
334 | .1: |
156 | mov eax,[img_high] |
335 | mov eax,[img_high] |
157 | sub eax,[stretch_img_high] |
336 | sub eax,[stretch_img_high] |
158 | test ecx,ecx |
337 | test ecx,ecx |
159 | jnz @f |
338 | jnz @f |
160 | shr eax,1 |
339 | shr eax,1 |
161 | @@: |
340 | @@: |
162 | mov [stretch_start_coordinates.y],ax |
341 | mov [stretch_start_coordinates.y],ax |
163 | calculate_stretch_start_coordinates_YU: |
342 | calculate_stretch_start_coordinates_YU: |
164 | ret |
343 | ret |
165 | ;--------------------------------------------------------------------- |
344 | ;--------------------------------------------------------------------- |
166 | calculate_stretch_start_coordinates_YD: |
345 | calculate_stretch_start_coordinates_YD: |
167 | xor ecx,ecx |
346 | xor ecx,ecx |
168 | inc ecx |
347 | inc ecx |
169 | jmp calculate_stretch_start_coordinates_YC.1 |
348 | jmp calculate_stretch_start_coordinates_YC.1 |
170 | ;--------------------------------------------------------------------- |
349 | ;--------------------------------------------------------------------- |
171 | ;.stretch_inscribe: |
- | |
172 | ; ret |
- | |
173 | ;--------------------------------------------------------------------- |
- | |
174 | background_1: |
350 | background_1: |
175 | mov ecx,[screen_width] ;[crop_img_width] ; øèðèíà |
351 | mov ecx,[screen_width] ;[crop_img_width] ; øèðèíà |
176 | test ecx,ecx |
352 | test ecx,ecx |
177 | jz .end |
353 | jz .end |
178 | mov edx,[screen_high] ;[crop_img_high] ; âûñîòà |
354 | mov edx,[screen_high] ;[crop_img_high] ; âûñîòà |
179 | test edx,edx |
355 | test edx,edx |
180 | jz .end |
356 | jz .end |
181 | mcall 15,1 ; set size |
357 | mcall 15,1 ; set size |
182 | 358 | .1: |
|
183 | mov esi,ecx |
359 | mov esi,ecx |
184 | imul esi,edx |
360 | imul esi,edx |
185 | lea esi,[esi*3] |
361 | lea esi,[esi*3] |
186 | mov ecx,[raw_pointer_2] ;[soi] |
362 | mov ecx,[raw_pointer_2] ;[soi] |
187 | mov eax,[ecx+28] |
363 | mov eax,[ecx+28] |
188 | add ecx,eax |
364 | add ecx,eax |
189 | 365 | ||
190 | xor edx,edx |
366 | xor edx,edx |
191 | 367 | ||
192 | mov eax,[raw_pointer_2] |
368 | mov eax,[raw_pointer_2] |
193 | mov eax,[eax+12] ;overall depth of the pixel |
369 | mov eax,[eax+12] ;overall depth of the pixel |
194 | cmp al,24 |
370 | cmp al,24 |
195 | je @f |
371 | je @f |
196 | 372 | ||
197 | mov eax,[raw_pointer_2] |
373 | mov eax,[raw_pointer_2] |
198 | mov [crop_raw_pointer],eax |
374 | mov [crop_raw_pointer],eax |
199 | 375 | ||
200 | push dword crop_image_file |
376 | push dword crop_image_file |
201 | call [convert_Conv_24b] |
377 | call [convert_Conv_24b] |
202 | 378 | ||
203 | mov ecx,[crop_raw_pointer_2] |
379 | mov ecx,[crop_raw_pointer_2] |
204 | add ecx,44 |
380 | add ecx,44 |
205 | mcall 15,5 ;15,5 set data |
381 | mcall 15,5 ;15,5 set data |
206 | mcall 68,13,[crop_raw_pointer_2] |
382 | mcall 68,13,[crop_raw_pointer_2] |
207 | jmp .set_mode |
383 | jmp .set_mode |
208 | @@: |
384 | @@: |
209 | mcall 15,5 ; 15,5 set data |
385 | mcall 15,5 ; 15,5 set data |
210 | .set_mode: |
386 | .set_mode: |
211 | xor ecx,ecx |
387 | xor ecx,ecx |
212 | inc ecx |
388 | inc ecx |
213 | ; mov ecx,[bgrmode] |
389 | ; mov ecx,[bgrmode] |
214 | mcall 15,4 ; 15,4 set mode |
390 | mcall 15,4 ; 15,4 set mode |
215 | dec ebx ; 15,3 redraw background |
391 | dec ebx ; 15,3 redraw background |
216 | mcall |
392 | mcall |
217 | .end: |
393 | .end: |
218 | mov ecx,[raw_pointer_2] |
394 | mov ecx,[raw_pointer_2] |
219 | mcall 68,13 |
395 | mcall 68,13 |
220 | ret |
396 | ret |
221 | ;--------------------------------------------------------------------- |
397 | ;--------------------------------------------------------------------- |