Rev 5717 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5717 | Rev 5722 | ||
---|---|---|---|
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 -... | Line 14... | ||
- | 14 | ||
- | 15 | ||
- | 16 | load_pixel_zrle: ; returns in ecx |
|
- | 17 | ||
- | 18 | push eax |
|
- | 19 | ||
- | 20 | ; TODO: check for buffer underrun! |
|
- | 21 | ||
- | 22 | if BITS_PER_PIXEL = 8 |
|
- | 23 | ||
- | 24 | push ebx |
|
- | 25 | ||
- | 26 | mov bl, 36 |
|
- | 27 | mov al, [esi] |
|
- | 28 | and al, 7 |
|
- | 29 | mul bl |
|
- | 30 | mov ch, al ; red |
|
- | 31 | ||
- | 32 | mov al, [esi] |
|
- | 33 | shr al, 3 |
|
- | 34 | and al, 7 |
|
- | 35 | mul bl |
|
- | 36 | mov cl, al ; green |
|
- | 37 | ||
- | 38 | mov bl, 85 |
|
- | 39 | mov al, [esi] |
|
- | 40 | shr al, 6 |
|
- | 41 | and al, 3 |
|
- | 42 | mul bl |
|
- | 43 | shl ecx, 8 |
|
- | 44 | mov cl, al ; blue |
|
- | 45 | ||
- | 46 | inc esi |
|
- | 47 | pop ebx |
|
- | 48 | ||
- | 49 | else if BITS_PER_PIXEL = 16 |
|
- | 50 | ||
- | 51 | lodsw |
|
- | 52 | mov cl, ah |
|
- | 53 | and al, 0xf8 ; red |
|
- | 54 | ||
- | 55 | mov cx, ax |
|
- | 56 | shl cx, 5 |
|
- | 57 | and ch, 0xfc ; green |
|
- | 58 | shl ecx, 8 |
|
- | 59 | ||
- | 60 | mov cl, al |
|
- | 61 | shl cl, 3 |
|
- | 62 | and cx, 0x00f8 ; blue |
|
- | 63 | ||
- | 64 | else ; 32 BPP gets packed to 24 BPP |
|
- | 65 | ||
- | 66 | mov ecx, [esi] |
|
- | 67 | and ecx, 0x00ffffff |
|
- | 68 | add esi, 3 |
|
- | 69 | ||
- | 70 | end if |
|
- | 71 | pop eax |
|
- | 72 | ||
- | 73 | ret |
|
- | 74 | ||
- | 75 | ||
14 | 76 | ||
15 | deflate_callback: |
77 | deflate_callback: |
16 | mov eax, [deflate_length] |
78 | mov eax, [deflate_length] |
17 | mov ecx, [esp+8] |
79 | mov ecx, [esp+8] |
18 | mov [ecx], eax |
80 | mov [ecx], eax |
19 | mov eax, [deflate_buffer] |
81 | mov eax, [deflate_buffer] |
Line -... | Line 82... | ||
- | 82 | ret 8 |
|
- | 83 | ||
20 | ret 8 |
84 | |
Line 21... | Line 85... | ||
21 | 85 | ||
22 | encoding_ZRLE: |
86 | encoding_ZRLE: |
23 | 87 | ||
Line 100... | Line 164... | ||
100 | add eax, [subrectangle.y] |
164 | add eax, [subrectangle.y] |
101 | movzx ebx, [screen.width] |
165 | movzx ebx, [screen.width] |
102 | mul ebx |
166 | mul ebx |
103 | add eax, [rectangle.x] |
167 | add eax, [rectangle.x] |
104 | add eax, [subrectangle.x] |
168 | add eax, [subrectangle.x] |
105 | lea edi, [framebuffer_data+eax*3] |
169 | lea edi, [framebuffer+eax*3] |
Line 106... | Line 170... | ||
106 | 170 | ||
107 | ; Calculate offset between two rows of pixels |
171 | ; Calculate offset between two rows of pixels |
108 | movzx eax, [screen.width] |
172 | movzx eax, [screen.width] |
109 | sub eax, [subrectangle.width] |
173 | sub eax, [subrectangle.width] |
Line 217... | Line 281... | ||
217 | dec edx |
281 | dec edx |
218 | jnz .rle_line |
282 | jnz .rle_line |
219 | jmp .next_tile |
283 | jmp .next_tile |
Line 220... | Line 284... | ||
220 | 284 | ||
221 | .rle_reload: |
285 | .rle_reload: |
222 | ; load pixel value |
- | |
Line 223... | Line 286... | ||
223 | call pixel_to_24bpp |
286 | call load_pixel_zrle |
Line 224... | Line 287... | ||
224 | 287 | ||
225 | ;;; |
288 | ;;; |
Line 452... | Line 515... | ||
452 | 515 | ||
453 | DEBUGF 1, "RAW tile\n" |
516 | DEBUGF 1, "RAW tile\n" |
454 | .raw_line: |
517 | .raw_line: |
455 | mov ebx, [subrectangle.width] |
518 | mov ebx, [subrectangle.width] |
456 | .raw_pixel: |
519 | .raw_pixel: |
457 | call pixel_to_24bpp |
520 | call load_pixel_zrle |
458 | mov word[edi], cx |
521 | mov word[edi], cx |
459 | shr ecx, 16 |
522 | shr ecx, 16 |
460 | add edi, 2 |
523 | add edi, 2 |
461 | mov byte[edi], cl |
524 | mov byte[edi], cl |
Line 470... | Line 533... | ||
470 | 533 | ||
471 | 534 | ||
472 | ; Single color tile |
535 | ; Single color tile |
473 | .solid: |
536 | .solid: |
474 | DEBUGF 1, "Solid tile\n" |
537 | DEBUGF 1, "Solid tile\n" |
475 | call pixel_to_24bpp |
538 | call load_pixel_zrle |
Line 476... | Line 539... | ||
476 | mov eax, ecx |
539 | mov eax, ecx |
477 | shr eax, 16 |
540 | shr eax, 16 |