Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5750 hidnplayr 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
6
;;  VNC client for KolibriOS                                       ;;
7
;;                                                                 ;;
8
;;  Written by hidnplayr@kolibrios.org                             ;;
9
;;                                                                 ;;
10
;;          GNU GENERAL PUBLIC LICENSE                             ;;
11
;;             Version 2, June 1991                                ;;
12
;;                                                                 ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
 
15
 
16
encoding_cursor:
17
 
18
        DEBUGF  1, "Set cursor: width=%u height=%u\n", [rectangle.width], [rectangle.height]
19
 
20
        mov     eax, [rectangle.width]
21
        mul     [rectangle.height]
22
        mov     ebx, eax
23
        add     ebx, 7
24
        shr     ebx, 3
25
        mov     ecx, BYTES_PER_PIXEL
26
        mul     ecx
27
        lea     ecx, [eax+ebx]
28
 
29
  @@:
30
        lea     eax, [esi+ecx]
31
        cmp     [datapointer], eax
32
        jae     @f
33
        call    read_data.more
34
        jmp     @b
35
  @@:
36
 
37
; TODO: chop larger cursor sizes to 32x32 ?
38
        cmp     [rectangle.width], 32
39
        ja      .fail
40
        cmp     [rectangle.height], 32
41
        ja      .fail
42
 
43
; Convert cursor image to 32*32 ARGB format
44
        mov     edi, cursor.image
45
        mov     edx, [rectangle.height]
46
        test    edx, edx
47
        jz      .zero_height
48
  .lineloop:
49
        mov     ecx, [rectangle.width]
50
        test    ecx, ecx
51
        jz      .zero_width
52
  .pixelloop:
53
        call    load_pixel
54
        stosd
55
        dec     ecx
56
        jnz     .pixelloop
57
 
58
  .zero_width:
59
        mov     ecx, 32
60
        sub     ecx, [rectangle.width]
61
        jz      @f
62
        xor     eax, eax
63
        rep stosd
64
  @@:
65
        dec     edx
66
        jnz     .lineloop
67
 
68
  .zero_height:
69
        mov     ecx, 32
70
        sub     ecx, [rectangle.height]
71
        jz      @f
72
        shl     ecx, 5  ; mul 32
73
        xor     eax, eax
74
        rep stosd
75
  @@:
76
 
77
        mov     edi, cursor.image+3
78
        mov     edx, [rectangle.height]
79
        test    edx, edx
80
        jz      .finish
81
  .zloop:
82
        mov     ecx, [rectangle.width]
83
        test    ecx, ecx
84
        jz      .finish
85
  .aloop:
86
        lodsb
87
 
88
        mov     bl, al
89
        shl     bl, 1
90
        salc
91
        mov     byte[edi], al
92
        add     edi, 4
93
        dec     ecx
94
        jz      .n
95
 
96
        shl     bl, 1
97
        salc
98
        mov     byte[edi], al
99
        add     edi, 4
100
        dec     ecx
101
        jz      .n
102
 
103
        shl     bl, 1
104
        salc
105
        mov     byte[edi], al
106
        add     edi, 4
107
        dec     ecx
108
        jz      .n
109
 
110
        shl     bl, 1
111
        salc
112
        mov     byte[edi], al
113
        add     edi, 4
114
        dec     ecx
115
        jz      .n
116
 
117
        shl     bl, 1
118
        salc
119
        mov     byte[edi], al
120
        add     edi, 4
121
        dec     ecx
122
        jz      .n
123
 
124
        shl     bl, 1
125
        salc
126
        mov     byte[edi], al
127
        add     edi, 4
128
        dec     ecx
129
        jz      .n
130
 
131
        shl     bl, 1
132
        salc
133
        mov     byte[edi], al
134
        add     edi, 4
135
        dec     ecx
136
        jz      .n
137
 
138
        shl     bl, 1
139
        salc
140
        mov     byte[edi], al
141
        add     edi, 4
142
        dec     ecx
143
        jz      .n
144
        jmp     .aloop
145
 
146
  .n:
147
        mov     eax, 32
148
        sub     eax, [rectangle.width]
149
        shl     eax, 2
150
        add     edi, eax
151
        dec     edx
152
        jnz     .zloop
153
 
154
  .finish:
155
        mov     eax, [rectangle.x]
156
        mov     [cursor.x], al
157
        mov     eax, [rectangle.y]
158
        mov     [cursor.y], al
159
        or      [work], WORK_CURSOR
160
 
161
        DEBUGF  1, "Set cursor succeeded\n"
162
        jmp     next_rectangle
163
 
164
  .fail:
165
        add     esi, ecx
166
        DEBUGF  2, "Set cursor failed!\n"
167
        jmp     next_rectangle