Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9712 → Rev 9713

/programs/develop/libraries/libs-dev/.test/005/test005.asm
70,13 → 70,15
 
mov ebx, [image_converted]
mov eax, [ebx + Image.Width]
add eax, 200*0x10000 + 5*2 - 1 ; window x position + 10 pixels width for skin borders
; window x position + 10 pixels width for skin borders
add eax, 200*0x10000 + 5*2 - 1
mov [window_width], eax
 
mcall 48, 4 ; get skin height
mov ebx, [image_converted]
add eax, [ebx + Image.Height]
add eax, 100*0x10000 + 5 - 1 ; window y position + 5 pixels height for skin bottom border
; window y position + 5 pixels height for skin bottom border
add eax, 100*0x10000 + 5 - 1
mov [window_height], eax
;-----------------------------------------------------------------------------
 
93,7 → 95,8
 
.draw_window:
mcall 12, 1
mcall 0, [window_width], [window_height], 0x74FFFFFF, 0x00000000, window_title
mcall 0, [window_width], [window_height], 0x74FFFFFF, 0x00000000, \
window_title
call draw_image
mcall 12, 2
jmp still
116,7 → 119,8
proc draw_image
 
mov ebx, [image_converted]
invoke img.draw, ebx, 0, 0, [ebx + Image.Width], [ebx + Image.Height], 0, 0
invoke img.draw, ebx, 0, 0, [ebx + Image.Width], \
[ebx + Image.Height], 0, 0
 
ret
endp
/programs/develop/libraries/libs-dev/libimg/convert.asm
1,38 → 1,41
;;================================================================================================;;
;;//// convert.asm //// (c) dunkaist, 2012 ///////////////////////////////////////////////////////;;
;;================================================================================================;;
;;============================================================================;;
;;//// convert.asm //// (c) dunkaist, 2012,2016,2017,2020,2022 ///////////////;;
;;============================================================================;;
;; ;;
;; This file is part of Common development libraries (Libs-Dev). ;;
;; ;;
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
;; of the License, or (at your option) any later version. ;;
;; SPDX-License-Identifier: LGPL-2.1-or-later ;;
;; ;;
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
;; Lesser General Public License for more details. ;;
;; Libs-Dev is free software: you can redistribute it and/or modify it under ;;
;; the terms of the GNU Lesser General Public License as published by the ;;
;; Free Software Foundation, either version 2.1 of the License, or (at your ;;
;; option) any later version. ;;
;; ;;
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ;;
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;;
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public ;;
;; License for more details. ;;
;; ;;
;;================================================================================================;;
;; You should have received a copy of the GNU Lesser General Public License ;;
;; along with Libs-Dev. If not, see <http://www.gnu.org/licenses/>. ;;
;; ;;
;;============================================================================;;
 
 
 
;;================================================================================================;;
;;============================================================================;;
proc img.convert _src, _dst, _dst_type, _flags, _param ;;
;;------------------------------------------------------------------------------------------------;;
;;----------------------------------------------------------------------------;;
;? convert _image ;;
;;------------------------------------------------------------------------------------------------;;
;;----------------------------------------------------------------------------;;
;> [_src] = pointer to source image ;;
;> [_dst] = pointer to destination image, or 0 to create a new one ;;
;> [_dst_type] = Image.Type of resulting image ;;
;> [_flags] = see libimg.inc ;;
;> [_param] = depends on _flags fields, see libimg.inc ;;
;;------------------------------------------------------------------------------------------------;;
;;----------------------------------------------------------------------------;;
;< eax = 0 / pointer to converted image ;;
;< ecx = error code / undefined ;;
;;================================================================================================;;
;;============================================================================;;
locals
img dd ?
prev dd ?
75,20 → 78,20
endp
 
 
;;================================================================================================;;
;;============================================================================;;
proc img.convert.layer _src, _dst, _dst_type, _flags, _param ;;
;;------------------------------------------------------------------------------------------------;;
;;----------------------------------------------------------------------------;;
;? convert _image layer ;;
;;------------------------------------------------------------------------------------------------;;
;;----------------------------------------------------------------------------;;
;> [_src] = pointer to source image ;;
;> [_dst] = pointer to destination image, or 0 to create a new one ;;
;> [_dst_type] = Image.Type of resulting image ;;
;> [_flags] = see libimg.inc ;;
;> [_param] = depends on _flags fields, see libimg.inc ;;
;;------------------------------------------------------------------------------------------------;;
;;----------------------------------------------------------------------------;;
;< eax = 0 / pointer to converted image ;;
;< ecx = error code / undefined ;;
;;================================================================================================;;
;;============================================================================;;
locals
fun rd 1
endl
97,13 → 100,11
mov ebx, [_src]
mov eax, [ebx + Image.Type]
mov esi, [img.convert.table + 4*eax]
mov ecx, LIBIMG_ERROR_BIT_DEPTH
.next:
lodsd
test eax, eax
jnz @f
mov ecx, LIBIMG_ERROR_BIT_DEPTH
jmp .exit
@@:
jz .exit
cmp eax, [_dst_type]
lodsd
jnz .next
112,7 → 113,8
mov eax, [_dst]
test eax, eax
jnz @f
stdcall img.create, [ebx + Image.Width], [ebx + Image.Height], [_dst_type]
stdcall img.create, [ebx + Image.Width], [ebx + Image.Height], \
[_dst_type]
test eax, eax
jz .exit
mov [_dst], eax
151,7 → 153,6
ret
endp
 
 
proc img._.convert.bpp8i_to_bpp32 _src, _dst
mov ecx, [ebx + Image.Width]
imul ecx, [ebx + Image.Height]
168,7 → 169,6
ret
endp
 
 
proc img._.convert.bpp8g_to_bpp1 _src, _dst
mov eax, [_dst]
mov eax, [eax + Image.Palette]
219,6 → 219,21
ret
endp
 
proc img._.convert.bpp8g_to_bpp32 _src, _dst
mov ecx, [ebx + Image.Width]
imul ecx, [ebx + Image.Height]
@@:
mov al, byte[esi]
mov byte[edi + 0], al
mov byte[edi + 1], al
mov byte[edi + 2], al
mov byte[edi + 3], -1
add esi, 1
add edi, 4
dec ecx
jnz @b
ret
endp
 
proc img._.convert.bpp24_to_bpp24 _src, _dst
mov ecx, [ebx + Image.Width]
233,7 → 248,6
ret
endp
 
 
proc img._.convert.bpp24_to_bpp8g _src, _dst
mov ecx, [ebx + Image.Width]
imul ecx, [ebx + Image.Height]
253,7 → 267,6
ret
endp
 
 
proc img._.convert.bpp24_to_bpp32 _src, _dst
mov ecx, [ebx + Image.Width]
imul ecx, [ebx + Image.Height]
269,6 → 282,17
ret
endp
 
proc img._.convert.bpp24_to_bpp1 _src, _dst
stdcall img.convert.layer, [_src], 0, Image.bpp8g, 0, 0
test eax, eax
jz .exit
push eax
mov ecx, [_dst]
stdcall img.convert.layer, eax, ecx, [ecx+Image.Type], 0, 0
stdcall img.destroy ; arg pushed
.exit:
ret
endp
 
proc img._.convert.bpp32_to_bpp24 _src, _dst
mov ecx, [ebx + Image.Width]
285,7 → 309,6
ret
endp
 
 
proc img._.convert.bpp32_to_bpp32 _src, _dst
mov ecx, [ebx + Image.Width]
imul ecx, [ebx + Image.Height]
293,7 → 316,38
ret
endp
 
proc img._.convert.bpp32_to_bpp1 _src, _dst
push esi
stdcall img.convert.layer, [_src], 0, Image.bpp24, 0, 0
test eax, eax
jz .exit
push eax
stdcall img.convert.layer, eax, 0, Image.bpp8g, 0, 0
mov esi, eax
stdcall img.destroy ; arg pushed
test esi, esi
jz .exit
push esi
mov ecx, [_dst]
stdcall img.convert.layer, esi, ecx, [ecx+Image.Type], 0, 0
stdcall img.destroy ; arg pushed
.exit:
pop esi
ret
endp
 
proc img._.convert.bpp32_to_bpp8g _src, _dst
stdcall img.convert.layer, [_src], 0, Image.bpp24, 0, 0
test eax, eax
jz .exit
push eax
mov ecx, [_dst]
stdcall img.convert.layer, eax, ecx, [ecx+Image.Type], 0, 0
stdcall img.destroy ; arg pushed
.exit:
ret
endp
 
proc img._.convert.bpp15_to_bpp24 _src, _dst
mov ecx, [ebx + Image.Width]
imul ecx, [ebx + Image.Height]
542,7 → 596,7
endp
 
 
proc img._.convert.bpp1_to_bpp24 _src, _dst
proc img._.convert.bpp1_to_bpp24 uses ebx, _src, _dst
locals
width rd 1
height rd 1
580,7 → 634,52
ret
endp
 
proc img._.convert.bpp1_to_bpp32 _src, _dst
stdcall img.convert.layer, [_src], 0, Image.bpp24, 0, 0
test eax, eax
jz .exit
push eax
mov ecx, [_dst]
stdcall img.convert.layer, eax, ecx, [ecx+Image.Type], 0, 0
stdcall img.destroy ; arg pushed
.exit:
ret
endp
 
proc img._.convert.bpp1_to_bpp8g _src, _dst
locals
width rd 1
height rd 1
endl
push [ebx + Image.Width]
pop [width]
push [ebx + Image.Height]
pop [height]
.line:
mov edx, [width]
.byte:
mov ah, 8
mov al, byte[esi]
inc esi
.bit:
xor ecx, ecx
shl al, 1
sbb ecx, 0
mov byte[edi], cl
inc edi
dec edx
jnz @f
dec [height]
jnz .line
jmp .done
@@:
dec ah
jnz .bit
jmp .byte
.done:
ret
endp
 
proc img._.convert.bpp8a_to_bpp1 _src, _dst
mov eax, [_dst]
mov eax, [eax + Image.Palette]
657,10 → 756,13
dd Image.bpp24, img._.convert.bpp24_to_bpp24
dd Image.bpp8g, img._.convert.bpp24_to_bpp8g
dd Image.bpp32, img._.convert.bpp24_to_bpp32
dd Image.bpp1, img._.convert.bpp24_to_bpp1
dd 0
img.convert.bpp32.table:
dd Image.bpp24, img._.convert.bpp32_to_bpp24
dd Image.bpp32, img._.convert.bpp32_to_bpp32
dd Image.bpp1, img._.convert.bpp32_to_bpp1
dd Image.bpp8g, img._.convert.bpp32_to_bpp8g
dd 0
img.convert.bpp15.table:
dd Image.bpp24, img._.convert.bpp15_to_bpp24
670,9 → 772,12
dd 0
img.convert.bpp1.table:
dd Image.bpp24, img._.convert.bpp1_to_bpp24
dd Image.bpp32, img._.convert.bpp1_to_bpp32
dd Image.bpp8g, img._.convert.bpp1_to_bpp8g
dd 0
img.convert.bpp8g.table:
dd Image.bpp24, img._.convert.bpp8g_to_bpp24
dd Image.bpp32, img._.convert.bpp8g_to_bpp32
dd Image.bpp1, img._.convert.bpp8g_to_bpp1
dd 0
img.convert.bpp2i.table: