Subversion Repositories Kolibri OS

Rev

Rev 5677 | Rev 5716 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5677 Rev 5715
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
pixel_to_24bpp:         ; returns in ecx
15
pixel_to_24bpp:         ; returns in ecx, destroys eax, ebx
16
 
-
 
17
if BITS_PER_PIXEL = 8
16
if BITS_PER_PIXEL = 8
18
 
-
 
19
        push    eax ebx
17
; Convert pixel to 24BPP
20
 
18
        mov     bl, 85
21
        mov     bl, 36
19
        mov     al, [esi]
-
 
20
        shr     al, 6
22
        mov     al, [esi]
21
        and     al, 3
23
        and     al, 7
22
        mul     bl
24
        mul     bl
23
        mov     ch, al          ; blue
-
 
-
 
25
        mov     ch, al          ; red
24
        mov     bl, 36
26
 
25
        mov     al, [esi]
27
        mov     al, [esi]
26
        shr     al, 3
28
        shr     al, 3
27
        and     al, 7
29
        and     al, 7
28
        mul     bl
30
        mul     bl
-
 
31
        mov     cl, al          ; green
-
 
32
 
29
        mov     cl, al          ; green
33
        mov     bl, 85
-
 
34
        mov     al, [esi]
30
        mov     al, [esi]
35
        shr     al, 6
31
        and     al, 7
36
        and     al, 3
32
        mul     bl
37
        mul     bl
33
        shr     ecx, 8
38
        shl     ecx, 8
-
 
39
        mov     cl, al          ; blue
34
        mov     cl, al          ; red
40
 
-
 
41
        inc     esi
-
 
42
        pop     ebx eax
35
        inc     esi
43
 
-
 
44
else if BITS_PER_PIXEL = 16
-
 
45
 
36
else if BITS_PER_PIXEL = 16
46
        push    eax
37
        lodsw
47
        lodsw
38
        mov     cl, al
-
 
39
        shl     cl, 3
48
        mov     cl, ah
40
        and     cx, 0x00f8      ; blue
-
 
-
 
49
        and     al, 0xf8        ; red
41
        shl     ecx, 16
50
 
42
        mov     cx, ax
51
        mov     cx, ax
43
        shl     cx, 5
52
        shl     cx, 5
-
 
53
        and     ch, 0xfc        ; green
-
 
54
        shl     ecx, 8
44
        and     ch, 0xfc        ; green
55
 
-
 
56
        mov     cl, al
45
        mov     cl, ah
57
        shl     cl, 3
-
 
58
        and     cx, 0x00f8      ; blue
-
 
59
        pop     eax
46
        and     al, 0xf8        ; red
60
 
-
 
61
else
47
else
62
 
48
        xor     ecx, ecx
63
        xor     ecx, ecx
49
        mov     cx, [esi]
64
        mov     cx, [esi]
50
        shr     ecx, 8
65
        shl     ecx, 8
51
        mov     cl, [esi+2]
66
        mov     cl, [esi+2]
-
 
67
        add     esi, 3
52
        add     esi, 3
68
 
Line 53... Line 69...
53
end if
69
end if
Line 54... Line 70...
54
 
70
 
Line 55... Line 71...
55
        ret
71
        ret
Line 56... Line 72...
56
 
72
 
57
encoding_RRE:
73
encoding_RRE:
58
 
74
 
59
        DEBUGF  2,"RRE\n"
75
        DEBUGF  1,"RRE\n"
60
 
76
 
61
  @@:
77
  @@:
62
        lea     eax, [esi+5]
78
        lea     eax, [esi+4+BYTES_PER_PIXEL]
Line 63... Line 79...
63
        cmp     [datapointer], eax
79
        cmp     [datapointer], eax
64
        jae     @f
80
        jae     @f
65
        call    read_data.more
81
        call    read_data.more
Line -... Line 82...
-
 
82
        jmp     @b
-
 
83
  @@:
-
 
84
 
66
        jmp     @b
85
        lodsd
Line -... Line 86...
-
 
86
        bswap   eax
67
  @@:
87
        mov     [subrectangles], eax
68
 
88
 
69
        lodsd
89
        DEBUGF  1, "%u subrectangles\n", eax
70
        bswap   eax
90
 
Line -... Line 91...
-
 
91
; Get background color
71
        mov     [subrectangles], eax
92
        call    pixel_to_24bpp
72
 
93
 
73
        call    pixel_to_24bpp
94
; Calculate first pixel pos
Line -... Line 95...
-
 
95
        movzx   eax, [screen.width]
74
 
96
        mul     [rectangle.y]                           ; [screen.width]*[rectangle.y]
75
        movzx   eax, [screen.width]
97
        add     eax, [rectangle.x]                      ; [screen.width]*[rectangle.y]+[rectangle.x]
76
        mul     [rectangle.y]                           ; [screen.width]*[rectangle.y]
98
        lea     edi, [framebuffer_data+eax*3]           ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
77
        add     eax, [rectangle.x]                      ; [screen.width]*[rectangle.y]+[rectangle.x]
99
 
78
        lea     edi, [framebuffer_data+eax*3]           ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
100
; Calculate offset between two rows of pixels
Line 96... Line 118...
96
        add     edi, ebp
118
        add     edi, ebp
97
        dec     edx
119
        dec     edx
98
        jnz     .lineloop
120
        jnz     .lineloop
99
        pop     edi
121
        pop     edi
Line -... Line 122...
-
 
122
 
-
 
123
; Any subrectangles at all?
-
 
124
        cmp     [subrectangles], 0
-
 
125
        je      next_rectangle
100
 
126
 
101
  .subrectangle:
127
  .subrectangle:
102
  @@:
128
  @@:
103
        lea     eax, [esi+9]
129
        lea     eax, [esi+8+BYTES_PER_PIXEL]
104
        cmp     [datapointer], eax
130
        cmp     [datapointer], eax
105
        jae     @f
131
        jae     @f
106
        call    read_data.more
132
        call    read_data.more
107
        jmp     @b
133
        jmp     @b
Line -... Line 134...
-
 
134
  @@:
108
  @@:
135
 
Line -... Line 136...
-
 
136
; Get subrectangle color
109
 
137
        call    pixel_to_24bpp
110
        call    pixel_to_24bpp
138
 
111
 
139
; Get coordinates
112
        xor     eax, eax
140
        xor     eax, eax
113
        lodsw
141
        lodsw
114
        xchg    al, ah
142
        xchg    al, ah
115
        mov     [subrectangle.x], eax
143
        mov     [subrectangle.x], eax
116
        lodsw
144
        lodsw
117
        xchg    al, ah
145
        xchg    al, ah
118
        mov     [subrectangle.y], eax
146
        mov     [subrectangle.y], eax
119
        lodsw
147
        lodsw
120
        xchg    al, ah
148
        xchg    al, ah
121
        mov     [subrectangle.height], eax
149
        mov     [subrectangle.width], eax
-
 
150
        lodsw
-
 
151
        xchg    al, ah
Line -... Line 152...
-
 
152
        mov     [subrectangle.height], eax
122
        lodsw
153
        DEBUGF  1, "Subrectangle: x=%u y=%u width=%u height=%u\n", \
123
        xchg    al, ah
154
        [subrectangle.x], [subrectangle.y], [subrectangle.width], [subrectangle.height]
124
        mov     [subrectangle.width], eax
155
 
125
 
156
; Calculate pos of first pixel
-
 
157
        push    edi
126
        push    edi
158
        movzx   eax, [screen.width]
Line -... Line 159...
-
 
159
        mul     [subrectangle.y]
-
 
160
        add     eax, [subrectangle.x]
-
 
161
        lea     eax, [eax*3]
-
 
162
        add     edi, eax
-
 
163
 
-
 
164
; Calculate offset between two rows of pixels
127
        mov     eax, [rectangle.width]
165
        movzx   eax, [screen.width]
128
        mul     [subrectangle.y]
166
        sub     eax, [subrectangle.width]
129
        add     eax, [subrectangle.x]
167
        lea     ebp, [eax*3]                            ; ebp = ([screen.width]-[rectangle.width])*3
130
        add     edi, eax
168
 
131
 
169
; Draw the subrectangle
Line 141... Line 179...
141
        dec     ecx
179
        dec     ecx
142
        jnz     .pixelloop2
180
        jnz     .pixelloop2
143
        add     edi, ebp
181
        add     edi, ebp
144
        dec     edx
182
        dec     edx
145
        jnz     .lineloop2
183
        jnz     .lineloop2
146
 
-
 
147
        pop     edi
184
        pop     edi
148
 
-
 
149
        dec     [subrectangles]
185
        dec     [subrectangles]
150
        jnz     .subrectangle
186
        jnz     .subrectangle
151
        jmp     next_rectangle
187
        jmp     next_rectangle
152
188