Subversion Repositories Kolibri OS

Rev

Rev 5722 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5722 Rev 5750
Line 11... Line 11...
11
;;             Version 2, June 1991                                ;;
11
;;             Version 2, June 1991                                ;;
12
;;                                                                 ;;
12
;;                                                                 ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 14... Line -...
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
 
77
deflate_callback:
16
deflate_callback:
78
        mov     eax, [deflate_length]
17
        mov     eax, [deflate_length]
79
        mov     ecx, [esp+8]
18
        mov     ecx, [esp+8]
80
        mov     [ecx], eax
19
        mov     [ecx], eax
Line 81... Line -...
81
        mov     eax, [deflate_buffer]
-
 
82
        ret     8
20
        mov     eax, [deflate_buffer]
Line 83... Line 21...
83
 
21
        ret     8
84
 
22
 
85
 
23
 
Line 281... Line 219...
281
        dec     edx
219
        dec     edx
282
        jnz     .rle_line
220
        jnz     .rle_line
283
        jmp     .next_tile
221
        jmp     .next_tile
Line 284... Line 222...
284
 
222
 
285
  .rle_reload:
223
  .rle_reload:
Line 286... Line 224...
286
        call    load_pixel_zrle
224
; TODO: check for buffer underrun
-
 
225
 
-
 
226
        ; load pixel value
Line 287... Line 227...
287
 
227
        call    load_cpixel
288
;;;
228
        mov     ecx, eax
289
 
229
 
290
        ; load length
230
        ; load length
Line 509... Line 449...
509
        mov     eax, [subrectangle.width]
449
        mov     eax, [subrectangle.width]
510
        mul     [subrectangle.height]
450
        mul     [subrectangle.height]
511
        lea     eax, [eax*3]
451
        lea     eax, [eax*3]
512
        pop     edx
452
        pop     edx
Line 513... Line -...
513
 
-
 
-
 
453
 
Line 514... Line 454...
514
;;;
454
; TODO: check for buffer underrun
515
 
455
 
516
        DEBUGF  1, "RAW tile\n"
456
        DEBUGF  1, "RAW tile\n"
517
  .raw_line:
457
  .raw_line:
518
        mov     ebx, [subrectangle.width]
458
        mov     ebx, [subrectangle.width]
519
  .raw_pixel:
459
  .raw_pixel:
520
        call    load_pixel_zrle
460
        call    load_cpixel
521
        mov     word[edi], cx
-
 
522
        shr     ecx, 16
-
 
523
        add     edi, 2
461
        stosw
524
        mov     byte[edi], cl
462
        shr     eax, 16
525
        inc     edi
463
        stosb
526
        dec     ebx
464
        dec     ebx
527
        jnz     .raw_pixel
465
        jnz     .raw_pixel
528
        add     edi, ebp
466
        add     edi, ebp
Line 533... Line 471...
533
 
471
 
534
 
472
 
535
; Single color tile
473
; Single color tile
-
 
474
  .solid:
-
 
475
        DEBUGF  1, "Solid tile\n"
-
 
476
 
536
  .solid:
477
; TODO: check for buffer underrun
537
        DEBUGF  1, "Solid tile\n"
478
 
538
        call    load_pixel_zrle
479
        call    load_cpixel
Line 539... Line 480...
539
        mov     eax, ecx
480
        mov     ecx, eax
540
        shr     eax, 16
481
        shr     ecx, 16
Line 541... Line 482...
541
 
482
 
542
        mov     [palettesize], 1
483
        mov     [palettesize], 1
543
        mov     [palette], ecx
484
        mov     [palette], eax
544
 
-
 
545
  .solid_line:
485
 
546
        mov     ebx, [subrectangle.width]
486
  .solid_line:
547
  .solid_pixel:
487
        mov     ebx, [subrectangle.width]
548
        mov     [edi], cx
488
  .solid_pixel:
549
        add     edi, 2
489
        stosw
550
        mov     [edi], al
490
        mov     [edi], cl
551
        inc     edi
491
        inc     edi