Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
808 serge 1
 
2
3
 
4
5
 
6
7
 
8
  .biSize          dd ? ; DWORD
9
  .biWidth         dd ? ; LONG
10
  .biHeight        dd ? ; LONG
11
  .biPlanes        dw ? ; WORD
12
  .biBitCount      dw ? ; WORD
13
  .biCompression   dd ? ; DWORD
14
  .biSizeImage     dd ? ; DWORD
15
  .biXPelsPerMeter dd ? ; LONG
16
  .biYPelsPerMeter dd ? ; LONG
17
  .biClrUsed       dd ? ; DWORD
18
  .biClrImportant  dd ? ; DWORD
19
}
20
21
 
22
  BI BITMAPINFOHEADER
23
end virtual
24
25
 
26
public ___destroy_cursor
27
public _copy_cursor@8
28
29
 
30
extrn _destroy_cursor   :dword
31
extrn _tmp_cursor       :dword
32
33
 
34
35
 
36
___create_cursor:
37
             push ecx
38
             push ebx
39
             push eax
40
             call _create_cursor
41
             add esp, 12
42
             ret
43
align 16
44
___destroy_cursor:
45
             push eax
46
             call _destroy_cursor
47
             add esp, 4
48
             ret
49
align 16
50
proc _copy_cursor@8 stdcall, dst:dword, src:dword
51
           locals
52
             rBase    dd ?
53
             pQuad    dd ?
54
             pBits    dd ?
55
             pAnd     dd ?
56
             width    dd ?
57
             height   dd ?
58
             counter  dd ?
59
           endl
60
61
 
62
           add esi,[esi+18]
63
           mov eax,esi
64
65
 
66
           je .img_24
67
           cmp [esi+BI.biBitCount], 8
68
           je .img_8
69
           cmp [esi+BI.biBitCount], 4
70
           je .img_4
71
72
 
73
           add eax, [esi]
74
           mov [pQuad],eax
75
           add eax,8
76
           mov [pBits],eax
77
           add eax, 128
78
           mov [pAnd],eax
79
           mov eax,[esi+4]
80
           mov [width],eax
81
           mov ebx,[esi+8]
82
           shr ebx,1
83
           mov [height],ebx
84
85
 
86
           add edi, 32*31*4
87
           mov [rBase],edi
88
89
 
90
.l21:
91
           mov ebx, [pBits]
92
           mov ebx, [ebx]
93
           bswap ebx
94
           mov eax, [pAnd]
95
           mov eax, [eax]
96
           bswap eax
97
           mov [counter], 32
98
@@:
99
           xor edx, edx
100
           shl eax,1
101
           setc dl
102
           dec edx
103
104
 
105
           shl ebx,1
106
           setc cl
107
           mov ecx, [esi+ecx*4]
108
           and ecx, edx
109
           and edx, 0xFF000000
110
           or edx, ecx
111
           mov [edi], edx
112
113
 
114
           dec [counter]
115
           jnz @B
116
117
 
118
           add [pAnd], 4
119
           mov edi,[rBase]
120
           sub edi,128
121
           mov [rBase],edi
122
           sub [height],1
123
           jnz .l21
124
           jmp .copy
125
.img_4:
126
           add eax, [esi]
127
           mov [pQuad],eax
128
           add eax,64
129
           mov [pBits],eax
130
           add eax, 0x200
131
           mov [pAnd],eax
132
           mov eax,[esi+4]
133
           mov [width],eax
134
           mov ebx,[esi+8]
135
           shr ebx,1
136
           mov [height],ebx
137
138
 
139
           add edi, 32*31*4
140
           mov [rBase],edi
141
142
 
143
           mov ebx, [pBits]
144
.l4:
145
           mov eax, [pAnd]
146
           mov eax, [eax]
147
           bswap eax
148
           mov [counter], 16
149
@@:
150
           xor edx, edx
151
           shl eax,1
152
           setc dl
153
           dec edx
154
155
 
156
           and cl, 0xF0
157
           shr ecx, 2
158
           mov ecx, [esi+ecx]
159
           and ecx, edx
160
           and edx, 0xFF000000
161
           or edx, ecx
162
           mov [edi], edx
163
164
 
165
           shl eax,1
166
           setc dl
167
           dec edx
168
169
 
170
           and cl, 0x0F
171
           mov ecx, [esi+ecx*4]
172
           and ecx, edx
173
           and edx, 0xFF000000
174
           or edx, ecx
175
           mov [edi+4], edx
176
177
 
178
           add edi, 8
179
           dec [counter]
180
           jnz @B
181
182
 
183
           mov edi,[rBase]
184
           sub edi,128
185
           mov [rBase],edi
186
           sub [height],1
187
           jnz .l4
188
           jmp .copy
189
.img_8:
190
           add eax, [esi]
191
           mov [pQuad],eax
192
           add eax,1024
193
           mov [pBits],eax
194
           add eax, 1024
195
           mov [pAnd],eax
196
           mov eax,[esi+4]
197
           mov [width],eax
198
           mov ebx,[esi+8]
199
           shr ebx,1
200
           mov [height],ebx
201
202
 
203
           add edi, 32*31*4
204
           mov [rBase],edi
205
206
 
207
           mov ebx, [pBits]
208
.l81:
209
           mov eax, [pAnd]
210
           mov eax, [eax]
211
           bswap eax
212
           mov [counter], 32
213
@@:
214
           xor edx, edx
215
           shl eax,1
216
           setc dl
217
           dec edx
218
219
 
220
           mov ecx, [esi+ecx*4]
221
           and ecx, edx
222
           and edx, 0xFF000000
223
           or edx, ecx
224
           mov [edi], edx
225
226
 
227
           add edi, 4
228
           dec [counter]
229
           jnz @B
230
231
 
232
           mov edi,[rBase]
233
           sub edi,128
234
           mov [rBase],edi
235
           sub [height],1
236
           jnz .l81
237
           jmp .copy
238
.img_24:
239
           add eax, [esi]
240
           mov [pQuad],eax
241
           add eax, 0xC00
242
           mov [pAnd],eax
243
           mov eax,[esi+BI.biWidth]
244
           mov [width],eax
245
           mov ebx,[esi+BI.biHeight]
246
           shr ebx,1
247
           mov [height],ebx
248
249
 
250
           add edi, 32*31*4
251
           mov [rBase],edi
252
253
 
254
           mov ebx, [pQuad]
255
.row_24:
256
           mov eax, [esi]
257
           bswap eax
258
           mov [counter], 32
259
@@:
260
           xor edx, edx
261
           shl eax,1
262
           setc dl
263
           dec edx
264
265
 
266
           and ecx, 0x00FFFFFF
267
           and ecx, edx
268
           and edx, 0xFF000000
269
           or edx, ecx
270
           mov [edi], edx
271
           add ebx, 3
272
           add edi, 4
273
           dec [counter]
274
           jnz @B
275
276
 
277
           mov edi,[rBase]
278
           sub edi,128
279
           mov [rBase],edi
280
           sub [height],1
281
           jnz .row_24
282
.copy:
283
           mov edi, [dst]
284
           mov ecx, 64*64
285
           xor eax,eax
286
           rep stosd
287
288
 
289
           mov edi, [dst]
290
           mov ebx, 32
291
           cld
292
@@:
293
           mov ecx, 32
294
           rep movsd
295
           add edi, 128
296
           dec ebx
297
           jnz @B
298
           ret
299
endp
300
301
 
302
{
303
     mov op1, [edi+op2]
304
}
305
306
 
307
{
308
     mov dword [edi+dest], src
309
}
310
311
 
312
{;common object header
313
   .magic       dd ?   ;'CURS'
314
   .destroy     dd ?   ;internal destructor
315
   .fd          dd ?   ;next object in list
316
   .bk          dd ?   ;prev object in list
317
   .pid         dd ?   ;owner id
318
319
 
320
   .base        dd ?   ;allocated memory
321
   .hot_x       dd ?   ;hotspot coords
322
   .hot_y       dd ?
323
}
324
virtual at 0
325
  CURSOR CURSOR
326
end virtual
327
328
 
329
align 4
330
proc _r500_SelectCursor@4 stdcall,hcursor:dword
331
332
 
333
           mov edi, [_rhd]
334
335
 
336
           sub edx, [_rhd+3*4]
337
           add edx, [_rhd+5*4]
338
           mov [edi+0x6408], edx
339
340
 
341
           shl eax, 16
342
           mov ax, word [ecx+CURSOR.hot_y]
343
           mov [edi+0x6418], eax
344
           ret
345
endp
346
347
 
348
align 4
349
proc _r500_SetCursor@12 stdcall, hcursor:dword, x:dword, y:dword
350
           pushfd
351
           cli
352
353
 
354
355
 
356
           shl eax, 16
357
           mov ax, word [y]
358
359
 
360
           or dword [edx+0x6400], 1
361
362
 
363
           ret
364
endp
365