From ef860d69200409241a500d9c12a7ecf366f93b26 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Sat, 26 May 2012 18:26:46 +0000 Subject: [PATCH] libimg: img.flip.layer fix for images of scanline width less than 4 bytes bmp: check for more InfoHeader types git-svn-id: svn://kolibrios.org@2691 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../develop/libraries/libs-dev/libimg/bmp/bmp.asm | 8 +++++--- .../develop/libraries/libs-dev/libimg/libimg.asm | 10 +++++++--- .../develop/libraries/libs-dev/libimg/pcx/pcx.asm | 13 +++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/programs/develop/libraries/libs-dev/libimg/bmp/bmp.asm b/programs/develop/libraries/libs-dev/libimg/bmp/bmp.asm index 5d55801ae9..09a896f39d 100644 --- a/programs/develop/libraries/libs-dev/libimg/bmp/bmp.asm +++ b/programs/develop/libraries/libs-dev/libimg/bmp/bmp.asm @@ -92,11 +92,13 @@ img.decode.bmp.length_rest equ length_rest mov [bTopDown], 0 - cmp eax, 12 + cmp eax, 12 ; 0x0C jz .old1 - cmp eax, 40 + cmp eax, 40 ; 0x28 jz .normal - cmp eax, 56 + cmp eax, 56 ; 0x38 + je .normal + cmp eax, 108 ; 0x6C jnz .error ; convert images with <= 8 bpp to 8bpp, other - to 32 bpp .normal: diff --git a/programs/develop/libraries/libs-dev/libimg/libimg.asm b/programs/develop/libraries/libs-dev/libimg/libimg.asm index e8daa8e686..6cb699f94c 100644 --- a/programs/develop/libraries/libs-dev/libimg/libimg.asm +++ b/programs/develop/libraries/libs-dev/libimg/libimg.asm @@ -884,13 +884,17 @@ endl mov ecx, [scanline_len] push ecx shr ecx, 2 - @@: mov eax, [esi] + @@: + dec ecx + js @f + mov eax, [esi] xchg eax, [edi] mov [esi], eax add esi, 4 add edi, 4 - sub ecx, 1 - jnz @b + jmp @b + @@: + pop ecx and ecx, 3 jz .cont_line_vert diff --git a/programs/develop/libraries/libs-dev/libimg/pcx/pcx.asm b/programs/develop/libraries/libs-dev/libimg/pcx/pcx.asm index 4f42fcedad..32faf57e91 100644 --- a/programs/develop/libraries/libs-dev/libimg/pcx/pcx.asm +++ b/programs/develop/libraries/libs-dev/libimg/pcx/pcx.asm @@ -18,7 +18,6 @@ ;;================================================================================================;; include 'pcx.inc' -;include '../../../../system/board/trunk/debug.inc' ;;================================================================================================;; proc img.is.pcx _data, _length ;//////////////////////////////////////////////////////////////////;; @@ -238,14 +237,16 @@ endp ;;================================================================================================;; -proc img.encode.pcx _img, _p_length, _options ;///////////////////////////////////////////////////;; +proc img.encode.pcx _img, _common, _specific ;////////////////////////////////////////////////////;; ;;------------------------------------------------------------------------------------------------;; -;? Encode image into raw data in pcx format ;; +;? Encode image into raw data in pcx format ;; ;;------------------------------------------------------------------------------------------------;; -;> _img = pointer to image ;; +;> [_img] = pointer to image ;; +;> [_common] = format independent options ;; +;> [_specific] = 0 / pointer to the structure of format specific options ;; ;;------------------------------------------------------------------------------------------------;; -;< eax = 0 (error) or pointer to encoded data ;; -;< _p_length = encoded data length ;; +;< eax = 0 / pointer to encoded data ;; +;< ecx = error code / the size of encoded data ;; ;;================================================================================================;; xor eax, eax ret