Rev 5668 | Rev 5715 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5668 | 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 | pixel_to_24bpp: ; returns in ecx, destroys eax, ebx |
||
5677 | hidnplayr | 16 | if BITS_PER_PIXEL = 8 |
5668 | hidnplayr | 17 | ; Convert pixel to 24BPP |
18 | mov bl, 85 |
||
19 | mov al, [esi] |
||
5677 | hidnplayr | 20 | shr al, 6 |
5668 | hidnplayr | 21 | and al, 3 |
22 | mul bl |
||
5677 | hidnplayr | 23 | mov ch, al ; blue |
24 | mov bl, 36 |
||
5668 | hidnplayr | 25 | mov al, [esi] |
5677 | hidnplayr | 26 | shr al, 3 |
27 | and al, 7 |
||
5668 | hidnplayr | 28 | mul bl |
5677 | hidnplayr | 29 | mov cl, al ; green |
5668 | hidnplayr | 30 | mov al, [esi] |
5677 | hidnplayr | 31 | and al, 7 |
5668 | hidnplayr | 32 | mul bl |
5677 | hidnplayr | 33 | shr ecx, 8 |
34 | mov cl, al ; red |
||
35 | inc esi |
||
36 | else if BITS_PER_PIXEL = 16 |
||
37 | lodsw |
||
5668 | hidnplayr | 38 | mov cl, al |
5677 | hidnplayr | 39 | shl cl, 3 |
40 | and cx, 0x00f8 ; blue |
||
41 | shl ecx, 16 |
||
42 | mov cx, ax |
||
43 | shl cx, 5 |
||
44 | and ch, 0xfc ; green |
||
45 | mov cl, ah |
||
46 | and al, 0xf8 ; red |
||
47 | else |
||
48 | xor ecx, ecx |
||
49 | mov cx, [esi] |
||
50 | shr ecx, 8 |
||
51 | mov cl, [esi+2] |
||
52 | add esi, 3 |
||
53 | end if |
||
5668 | hidnplayr | 54 | |
55 | ret |
||
56 | |||
57 | encoding_RRE: |
||
58 | |||
5677 | hidnplayr | 59 | DEBUGF 2,"RRE\n" |
5668 | hidnplayr | 60 | |
61 | @@: |
||
62 | lea eax, [esi+5] |
||
63 | cmp [datapointer], eax |
||
64 | jae @f |
||
65 | call read_data.more |
||
66 | jmp @b |
||
67 | @@: |
||
68 | |||
69 | lodsd |
||
70 | bswap eax |
||
71 | mov [subrectangles], eax |
||
72 | |||
73 | call pixel_to_24bpp |
||
74 | |||
75 | movzx eax, [screen.width] |
||
76 | mul [rectangle.y] ; [screen.width]*[rectangle.y] |
||
77 | add eax, [rectangle.x] ; [screen.width]*[rectangle.y]+[rectangle.x] |
||
78 | lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3 |
||
79 | |||
80 | movzx eax, [screen.width] |
||
81 | sub eax, [rectangle.width] |
||
82 | lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
||
83 | |||
84 | push edi |
||
85 | mov eax, ecx |
||
86 | mov edx, [rectangle.height] |
||
87 | .lineloop: |
||
88 | mov ecx, [rectangle.width] |
||
89 | .pixelloop: |
||
90 | stosw |
||
91 | rol eax, 16 |
||
92 | stosb |
||
93 | rol eax, 16 |
||
94 | dec ecx |
||
95 | jnz .pixelloop |
||
96 | add edi, ebp |
||
97 | dec edx |
||
98 | jnz .lineloop |
||
99 | pop edi |
||
100 | |||
101 | .subrectangle: |
||
102 | @@: |
||
103 | lea eax, [esi+9] |
||
104 | cmp [datapointer], eax |
||
105 | jae @f |
||
106 | call read_data.more |
||
107 | jmp @b |
||
108 | @@: |
||
109 | |||
110 | call pixel_to_24bpp |
||
111 | |||
112 | xor eax, eax |
||
113 | lodsw |
||
114 | xchg al, ah |
||
115 | mov [subrectangle.x], eax |
||
116 | lodsw |
||
117 | xchg al, ah |
||
118 | mov [subrectangle.y], eax |
||
119 | lodsw |
||
120 | xchg al, ah |
||
121 | mov [subrectangle.height], eax |
||
122 | lodsw |
||
123 | xchg al, ah |
||
124 | mov [subrectangle.width], eax |
||
125 | |||
126 | push edi |
||
127 | mov eax, [rectangle.width] |
||
128 | mul [subrectangle.y] |
||
129 | add eax, [subrectangle.x] |
||
130 | add edi, eax |
||
131 | |||
132 | mov eax, ecx |
||
133 | mov edx, [subrectangle.height] |
||
134 | .lineloop2: |
||
135 | mov ecx, [subrectangle.width] |
||
136 | .pixelloop2: |
||
137 | stosw |
||
138 | rol eax, 16 |
||
139 | stosb |
||
140 | rol eax, 16 |
||
141 | dec ecx |
||
142 | jnz .pixelloop2 |
||
143 | add edi, ebp |
||
144 | dec edx |
||
145 | jnz .lineloop2 |
||
146 | |||
147 | pop edi |
||
148 | |||
149 | dec [subrectangles] |
||
150 | jnz .subrectangle |
||
151 | jmp next_rectangle |