Rev 5722 | Rev 5752 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5722 | Rev 5750 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 14... | Line 14... | ||
14 | 14 | ||
Line 15... | Line 15... | ||
15 | 15 | ||
16 | create_palette: |
16 | create_palette: |
17 | - | ||
18 | push ecx edx edi |
- | |
19 | mov dl, [palettesize] |
- | |
20 | DEBUGF 1, "Loading palette of %u colors\n", dl |
- | |
21 | mov edi, palette |
- | |
22 | .loop: |
- | |
23 | call load_pixel_trle |
- | |
24 | mov [edi], ecx |
- | |
25 | add edi, 4 |
17 | |
26 | dec dl |
- | |
27 | jnz .loop |
- | |
28 | pop edi edx ecx |
- | |
Line 29... | Line -... | ||
29 | - | ||
30 | ret |
- | |
31 | - | ||
32 | 18 | push eax ecx edi |
|
33 | load_pixel_trle: ; returns in ecx |
19 | movzx ecx, [palettesize] |
34 | 20 | lea ecx, [ecx*BYTES_PER_CPIXEL] |
|
35 | push eax |
21 | |
36 | @@: |
22 | @@: |
37 | lea eax, [esi+BYTES_PER_PIXEL] |
23 | lea eax, [esi+ecx] |
38 | cmp [datapointer], eax |
24 | cmp [datapointer], eax |
Line -... | Line 25... | ||
- | 25 | jae @f |
|
- | 26 | call read_data.more |
|
- | 27 | jmp @b |
|
- | 28 | @@: |
|
- | 29 | ||
39 | jae @f |
30 | DEBUGF 1, "Loading palette of %u colors\n", ecx |
- | 31 | mov edi, palette |
|
- | 32 | .loop: |
|
Line 40... | Line 33... | ||
40 | call read_data.more |
33 | call load_cpixel |
Line 41... | Line -... | ||
41 | jmp @b |
- | |
42 | @@: |
- | |
43 | - | ||
44 | if BITS_PER_PIXEL = 8 |
- | |
45 | - | ||
46 | push ebx |
- | |
47 | - | ||
48 | mov bl, 36 |
- | |
49 | mov al, [esi] |
- | |
50 | and al, 7 |
- | |
51 | mul bl |
- | |
52 | mov ch, al ; red |
- | |
53 | - | ||
54 | mov al, [esi] |
- | |
55 | shr al, 3 |
- | |
56 | and al, 7 |
- | |
57 | mul bl |
- | |
58 | mov cl, al ; green |
- | |
59 | - | ||
Line -... | Line 34... | ||
- | 34 | stosd |
|
- | 35 | dec ecx |
|
- | 36 | jnz .loop |
|
- | 37 | pop edi ecx eax |
|
60 | mov bl, 85 |
38 | |
61 | mov al, [esi] |
39 | ret |
- | 40 | ||
Line 62... | Line 41... | ||
62 | shr al, 6 |
41 | |
Line -... | Line 42... | ||
- | 42 | load_cpixel: ; returns in eax |
|
63 | and al, 3 |
43 | |
- | 44 | if BITS_PER_PIXEL = 8 |
|
- | 45 | ||
- | 46 | xor eax, eax |
|
- | 47 | lodsb |
|
64 | mul bl |
48 | mov eax, [lut_8bpp+eax*4] |
65 | shl ecx, 8 |
49 | |
- | 50 | else if BITS_PER_PIXEL = 16 |
|
Line 66... | Line 51... | ||
66 | mov cl, al ; blue |
51 | |
67 | 52 | push ebx |
|
68 | inc esi |
53 | lodsw |
69 | pop ebx |
- | |
70 | - | ||
71 | else if BITS_PER_PIXEL = 16 |
54 | mov bx, ax |
72 | 55 | shl bx, 5 |
|
73 | lodsw |
- | |
Line 74... | Line 56... | ||
74 | mov cl, ah |
56 | and bh, 0xfc ; green |
Line 75... | Line 57... | ||
75 | and al, 0xf8 ; red |
57 | |
76 | 58 | mov bl, ah |
|
77 | mov cx, ax |
59 | and bl, 0xf8 ; red |
Line 78... | Line 60... | ||
78 | shl cx, 5 |
60 | shl ebx, 8 |
79 | and ch, 0xfc ; green |
- | |
Line 80... | Line 61... | ||
80 | shl ecx, 8 |
61 | |
Line 81... | Line 62... | ||
81 | 62 | mov bl, al |
|
Line 260... | Line 241... | ||
260 | dec edx |
241 | dec edx |
261 | jnz .rle_line |
242 | jnz .rle_line |
262 | jmp .next_tile |
243 | jmp .next_tile |
Line 263... | Line 244... | ||
263 | 244 | ||
264 | .rle_reload: |
- | |
265 | call load_pixel_trle |
- | |
266 | 245 | .rle_reload: |
|
267 | @@: |
246 | @@: |
268 | lea eax, [esi+1] |
247 | lea eax, [esi+BYTES_PER_CPIXEL+1] |
269 | cmp [datapointer], eax |
248 | cmp [datapointer], eax |
270 | jae @f |
249 | jae @f |
271 | call read_data.more |
250 | call read_data.more |
272 | jmp @b |
251 | jmp @b |
- | 252 | @@: |
|
- | 253 | ; load pixel value |
|
- | 254 | call load_cpixel |
|
Line 273... | Line 255... | ||
273 | @@: |
255 | mov ecx, eax |
274 | 256 | ||
275 | ; load length |
257 | ; load length |
276 | xor eax, eax |
258 | xor eax, eax |
Line 291... | Line 273... | ||
291 | 273 | ||
292 | 274 | ||
293 | .reuse_palette: |
275 | .reuse_palette: |
294 | cmp [palettesize], 1 |
276 | cmp [palettesize], 1 |
295 | jne .reuse_palette_ |
277 | jne .reuse_palette_ |
296 | mov ecx, [palette] |
278 | mov eax, [palette] |
297 | mov eax, ecx |
279 | mov ecx, eax |
Line 298... | Line 280... | ||
298 | shr eax, 16 |
280 | shr ecx, 16 |
299 | jmp .solid_line |
281 | jmp .solid_line |
300 | 282 | ||
Line 491... | Line 473... | ||
491 | ; RAW tile |
473 | ; RAW tile |
492 | .raw: |
474 | .raw: |
493 | push edx |
475 | push edx |
494 | mov eax, [subrectangle.width] |
476 | mov eax, [subrectangle.width] |
495 | mul [subrectangle.height] |
477 | mul [subrectangle.height] |
496 | lea eax, [eax*3] |
- | |
497 | pop edx |
- | |
Line 498... | Line -... | ||
498 | - | ||
499 | @@: |
478 | |
- | 479 | push eax |
|
- | 480 | lea ecx, [eax*BYTES_PER_CPIXEL] |
|
500 | push eax |
481 | @@: |
501 | add eax, esi |
482 | lea eax, [esi+ecx] |
502 | cmp [datapointer], eax |
483 | cmp [datapointer], eax |
503 | jae @f |
484 | jae @f |
504 | call read_data.more |
- | |
505 | pop eax |
485 | call read_data.more |
506 | jmp @b |
486 | jmp @b |
507 | @@: |
487 | @@: |
- | 488 | pop eax |
|
- | 489 | lea eax, [eax*3] |
|
Line 508... | Line 490... | ||
508 | pop eax |
490 | pop edx |
509 | 491 | ||
510 | DEBUGF 1, "RAW tile\n" |
492 | DEBUGF 1, "RAW tile\n" |
511 | .raw_line: |
493 | .raw_line: |
512 | mov ebx, [subrectangle.width] |
494 | mov ebx, [subrectangle.width] |
513 | .raw_pixel: |
495 | .raw_pixel: |
514 | call load_pixel_trle |
496 | call load_cpixel |
515 | mov word[edi], cx |
- | |
516 | shr ecx, 16 |
- | |
517 | add edi, 2 |
497 | stosw |
518 | mov byte[edi], cl |
498 | shr eax, 16 |
519 | inc edi |
499 | stosb |
520 | dec ebx |
500 | dec ebx |
521 | jnz .raw_pixel |
501 | jnz .raw_pixel |
522 | add edi, ebp |
502 | add edi, ebp |
Line 527... | Line 507... | ||
527 | 507 | ||
528 | 508 | ||
529 | ; Single color tile |
509 | ; Single color tile |
- | 510 | .solid: |
|
- | 511 | DEBUGF 1, "Solid tile\n" |
|
- | 512 | @@: |
|
- | 513 | lea eax, [esi+BYTES_PER_CPIXEL] |
|
- | 514 | cmp [datapointer], eax |
|
- | 515 | jae @f |
|
- | 516 | call read_data.more |
|
530 | .solid: |
517 | jmp @b |
531 | DEBUGF 1, "Solid tile\n" |
518 | @@: |
532 | call load_pixel_trle |
519 | call load_cpixel |
Line 533... | Line 520... | ||
533 | mov eax, ecx |
520 | mov ecx, eax |
534 | shr eax, 16 |
521 | shr ecx, 16 |
Line 535... | Line 522... | ||
535 | 522 | ||
536 | mov [palettesize], 1 |
523 | mov [palettesize], 1 |
537 | mov [palette], ecx |
524 | mov [palette], eax |
538 | - | ||
539 | .solid_line: |
525 | |
540 | mov ebx, [subrectangle.width] |
526 | .solid_line: |
541 | .solid_pixel: |
527 | mov ebx, [subrectangle.width] |
542 | mov [edi], cx |
528 | .solid_pixel: |
543 | add edi, 2 |
529 | stosw |
544 | mov [edi], al |
530 | mov [edi], cl |
545 | inc edi |
531 | inc edi |