12,60 → 12,44 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
pixel_to_24bpp: ; returns in ecx |
|
pixel_to_24bpp: ; returns in ecx, destroys eax, ebx |
if BITS_PER_PIXEL = 8 |
|
push eax ebx |
|
mov bl, 36 |
; Convert pixel to 24BPP |
mov bl, 85 |
mov al, [esi] |
and al, 7 |
shr al, 6 |
and al, 3 |
mul bl |
mov ch, al ; red |
|
mov ch, al ; blue |
mov bl, 36 |
mov al, [esi] |
shr al, 3 |
and al, 7 |
mul bl |
mov cl, al ; green |
|
mov bl, 85 |
mov al, [esi] |
shr al, 6 |
and al, 3 |
and al, 7 |
mul bl |
shl ecx, 8 |
mov cl, al ; blue |
|
shr ecx, 8 |
mov cl, al ; red |
inc esi |
pop ebx eax |
|
else if BITS_PER_PIXEL = 16 |
|
push eax |
lodsw |
mov cl, ah |
and al, 0xf8 ; red |
|
mov cl, al |
shl cl, 3 |
and cx, 0x00f8 ; blue |
shl ecx, 16 |
mov cx, ax |
shl cx, 5 |
and ch, 0xfc ; green |
shl ecx, 8 |
|
mov cl, al |
shl cl, 3 |
and cx, 0x00f8 ; blue |
pop eax |
|
mov cl, ah |
and al, 0xf8 ; red |
else |
|
xor ecx, ecx |
mov cx, [esi] |
shl ecx, 8 |
shr ecx, 8 |
mov cl, [esi+2] |
add esi, 3 |
|
end if |
|
ret |
72,10 → 56,10 |
|
encoding_RRE: |
|
DEBUGF 1,"RRE\n" |
DEBUGF 2,"RRE\n" |
|
@@: |
lea eax, [esi+4+BYTES_PER_PIXEL] |
lea eax, [esi+5] |
cmp [datapointer], eax |
jae @f |
call read_data.more |
86,23 → 70,17 |
bswap eax |
mov [subrectangles], eax |
|
DEBUGF 1, "%u subrectangles\n", eax |
|
; Get background color |
call pixel_to_24bpp |
|
; Calculate first pixel pos |
movzx eax, [screen.width] |
mul [rectangle.y] ; [screen.width]*[rectangle.y] |
add eax, [rectangle.x] ; [screen.width]*[rectangle.y]+[rectangle.x] |
lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3 |
|
; Calculate offset between two rows of pixels |
movzx eax, [screen.width] |
sub eax, [rectangle.width] |
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
|
; Draw background rectangle |
push edi |
mov eax, ecx |
mov edx, [rectangle.height] |
120,13 → 98,9 |
jnz .lineloop |
pop edi |
|
; Any subrectangles at all? |
cmp [subrectangles], 0 |
je next_rectangle |
|
.subrectangle: |
@@: |
lea eax, [esi+8+BYTES_PER_PIXEL] |
lea eax, [esi+9] |
cmp [datapointer], eax |
jae @f |
call read_data.more |
133,10 → 107,8 |
jmp @b |
@@: |
|
; Get subrectangle color |
call pixel_to_24bpp |
|
; Get coordinates |
xor eax, eax |
lodsw |
xchg al, ah |
146,27 → 118,17 |
mov [subrectangle.y], eax |
lodsw |
xchg al, ah |
mov [subrectangle.width], eax |
mov [subrectangle.height], eax |
lodsw |
xchg al, ah |
mov [subrectangle.height], eax |
DEBUGF 1, "Subrectangle: x=%u y=%u width=%u height=%u\n", \ |
[subrectangle.x], [subrectangle.y], [subrectangle.width], [subrectangle.height] |
mov [subrectangle.width], eax |
|
; Calculate pos of first pixel |
push edi |
movzx eax, [screen.width] |
mov eax, [rectangle.width] |
mul [subrectangle.y] |
add eax, [subrectangle.x] |
lea eax, [eax*3] |
add edi, eax |
|
; Calculate offset between two rows of pixels |
movzx eax, [screen.width] |
sub eax, [subrectangle.width] |
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 |
|
; Draw the subrectangle |
mov eax, ecx |
mov edx, [subrectangle.height] |
.lineloop2: |
181,7 → 143,9 |
add edi, ebp |
dec edx |
jnz .lineloop2 |
|
pop edi |
|
dec [subrectangles] |
jnz .subrectangle |
jmp next_rectangle |