2011-06-12 00:16:26 +02:00
|
|
|
;*****************************************************************************
|
|
|
|
; Scaling RAW image plugin - for zSea image viewer
|
|
|
|
; Copyright (c) 2009 - 2011, Marat Zakiyanov aka Mario79, aka Mario
|
|
|
|
; All rights reserved.
|
|
|
|
;
|
|
|
|
; Redistribution and use in source and binary forms, with or without
|
|
|
|
; modification, are permitted provided that the following conditions are met:
|
|
|
|
; * Redistributions of source code must retain the above copyright
|
|
|
|
; notice, this list of conditions and the following disclaimer.
|
|
|
|
; * Redistributions in binary form must reproduce the above copyright
|
|
|
|
; notice, this list of conditions and the following disclaimer in the
|
|
|
|
; documentation and/or other materials provided with the distribution.
|
|
|
|
; * Neither the name of the <organization> nor the
|
|
|
|
; names of its contributors may be used to endorse or promote products
|
|
|
|
; derived from this software without specific prior written permission.
|
|
|
|
;
|
|
|
|
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
|
|
|
|
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
|
|
|
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
;*****************************************************************************
|
|
|
|
; Scaling 32b, 24b, 16b, 8b
|
|
|
|
|
|
|
|
format MS COFF
|
|
|
|
|
|
|
|
public EXPORTS
|
|
|
|
|
|
|
|
section '.flat' code readable align 16
|
|
|
|
|
2011-06-13 16:32:25 +02:00
|
|
|
;include 'macros.inc'
|
2011-06-12 00:16:26 +02:00
|
|
|
include '../../../../macros.inc'
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
START:
|
|
|
|
pushad
|
2011-09-07 18:34:44 +02:00
|
|
|
mov eax,dword [esp+60] ; eax - crop size
|
|
|
|
mov ebx,eax
|
|
|
|
and eax,0xffff
|
|
|
|
shr ebx,16
|
|
|
|
mov [crop_x],ebx
|
|
|
|
mov [crop_y],eax
|
|
|
|
mov edi,dword [esp+56] ; edi - background color
|
|
|
|
mov esi,dword [esp+52] ; esi - filtering
|
|
|
|
mov edx,dword [esp+48] ; edx - scaling mode
|
|
|
|
mov ecx,dword [esp+44] ; ecx - start_coordinates
|
|
|
|
mov ebx,dword [esp+40] ; ebx - new_size
|
|
|
|
mov eax,dword [esp+36] ; eax - convert data table
|
|
|
|
mov [pointer],eax
|
|
|
|
test bx,bx
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
inc bx
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
ror ebx,16
|
|
|
|
test bx,bx
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
inc bx
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
rol ebx,16
|
|
|
|
mov [new_size],ebx
|
|
|
|
mov [start_coordinates],ecx
|
|
|
|
mov [scaling_mode],edx
|
|
|
|
mov [filtering],esi
|
|
|
|
mov [background_color],edi
|
|
|
|
mov eax,[eax+4]
|
|
|
|
mov [image_file],eax
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov esi,[eax+28]
|
|
|
|
add esi,eax
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ebx,[eax+20]
|
|
|
|
add ebx,eax
|
|
|
|
mov [palette],ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ebx,[eax+12]
|
|
|
|
mov [resolution],ebx
|
|
|
|
cmp ebx,32
|
|
|
|
jne @f
|
|
|
|
mov ebp,dword START.32
|
|
|
|
jmp .1
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
cmp ebx,24
|
|
|
|
jne @f
|
|
|
|
mov ebp,dword START.24
|
|
|
|
jmp .1
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
cmp ebx,16
|
|
|
|
jne @f
|
|
|
|
mov ebp,dword START.16
|
|
|
|
jmp .1
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
cmp ebx,15
|
|
|
|
jne @f
|
|
|
|
inc ebx
|
|
|
|
mov ebp,dword START.16
|
|
|
|
jmp .1
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
cmp ebx,8
|
|
|
|
jne @f
|
|
|
|
mov ebp,dword START.8
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
|
|
|
.1:
|
2011-09-07 18:34:44 +02:00
|
|
|
shr ebx,3
|
|
|
|
mov [bytes_to_pixel],ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ebx,[eax+8]
|
|
|
|
mov [y],ebx
|
|
|
|
mov ebx,[eax+4]
|
|
|
|
mov [x],ebx
|
|
|
|
imul ebx,[bytes_to_pixel]
|
|
|
|
mov [size_x],ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov eax,[crop_y]
|
|
|
|
test eax,eax
|
|
|
|
jz @f
|
|
|
|
mov [y],eax
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov eax,[crop_x]
|
|
|
|
test eax,eax
|
|
|
|
jz @f
|
|
|
|
mov [x],eax
|
|
|
|
@@:
|
|
|
|
mov eax,100
|
|
|
|
shl eax,12
|
|
|
|
mov ebx,[scaling_mode]
|
|
|
|
test ebx,ebx
|
|
|
|
jnz @f
|
|
|
|
inc ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
mov [scaling_delta],eax
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
call .get_memory
|
|
|
|
call .scaling
|
2011-06-12 00:16:26 +02:00
|
|
|
;---------------------------------------------------------------------
|
|
|
|
.ret_ok:
|
2011-09-07 18:34:44 +02:00
|
|
|
mcall 68,13,[area_for_x]
|
|
|
|
mov ebx,[pointer]
|
|
|
|
mov eax,[raw_area]
|
|
|
|
mov [ebx+20],eax ; store RAW pointer
|
|
|
|
; movzx eax,word [new_size.x1]
|
|
|
|
; mov [ebx+24],esi ;eax
|
|
|
|
; movzx eax,word [new_size.y1]
|
|
|
|
; mov [ebx+28],eax
|
|
|
|
; mov eax,[size_x]
|
|
|
|
; mov [ebx+32],eax
|
|
|
|
; mov eax,[bytes_to_pixel]
|
|
|
|
; mov [ebx+36],eax
|
|
|
|
; mov eax,[x]
|
|
|
|
; mov [ebx+40],eax
|
|
|
|
; mov eax,[y]
|
|
|
|
; mov [ebx+44],eax
|
2011-06-12 00:16:26 +02:00
|
|
|
.exit:
|
|
|
|
popad
|
2011-09-07 18:34:44 +02:00
|
|
|
ret 28
|
2011-06-12 00:16:26 +02:00
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.scaling:
|
2011-09-07 18:34:44 +02:00
|
|
|
xor eax,eax
|
|
|
|
mov ax,[start_coordinates.y]
|
|
|
|
imul eax,[size_x]
|
|
|
|
add esi,eax
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,[start_coordinates.x]
|
|
|
|
imul eax,[bytes_to_pixel]
|
|
|
|
add esi,eax
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
xor eax,eax
|
|
|
|
dec eax
|
|
|
|
mov [temp_y],eax
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
xor ecx,ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
.y_2:
|
2011-09-07 18:34:44 +02:00
|
|
|
xor ebx,ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
;-------------------------
|
|
|
|
align 4
|
|
|
|
.x_2:
|
2011-09-07 18:34:44 +02:00
|
|
|
call ebp
|
|
|
|
inc ebx
|
|
|
|
cmp bx,[new_size.x1]
|
|
|
|
jb .x_2
|
2011-06-12 00:16:26 +02:00
|
|
|
;-------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
inc ecx
|
|
|
|
cmp cx,[new_size.y1]
|
|
|
|
jb .y_2
|
2011-06-12 00:16:26 +02:00
|
|
|
ret
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.32:
|
2011-09-07 18:34:44 +02:00
|
|
|
push ecx ebx
|
|
|
|
call .calculate_pixel
|
|
|
|
mov eax,[ecx]
|
|
|
|
call .check_filtering_32
|
|
|
|
pop ebx ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosd
|
|
|
|
ret
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.24:
|
2011-09-07 18:34:44 +02:00
|
|
|
push ecx ebx
|
|
|
|
call .calculate_pixel
|
|
|
|
mov eax,[ecx]
|
|
|
|
call .check_filtering_24
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosw
|
2011-09-07 18:34:44 +02:00
|
|
|
shr eax,16
|
|
|
|
pop ebx ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosb
|
|
|
|
ret
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.16:
|
2011-09-07 18:34:44 +02:00
|
|
|
push ecx ebx
|
|
|
|
call .calculate_pixel
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,[ecx]
|
|
|
|
call .check_filtering_16
|
|
|
|
pop ebx ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosw
|
|
|
|
ret
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.8:
|
2011-09-07 18:34:44 +02:00
|
|
|
push ecx ebx
|
|
|
|
call .calculate_pixel
|
|
|
|
cmp [filtering],0
|
|
|
|
jne @f
|
|
|
|
mov al,[ecx]
|
|
|
|
pop ebx ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosb
|
|
|
|
ret
|
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
call .check_filtering_8
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosw
|
2011-09-07 18:34:44 +02:00
|
|
|
shr eax,16
|
|
|
|
pop ebx ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
cld
|
|
|
|
stosb
|
|
|
|
ret
|
|
|
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.calculate_pixel:
|
2011-09-07 18:34:44 +02:00
|
|
|
test ecx,ecx
|
|
|
|
jz .offset_x
|
2011-06-12 00:16:26 +02:00
|
|
|
;.offset_y:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov eax,ecx
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ecx,[temp_y]
|
|
|
|
cmp eax,ecx
|
|
|
|
jne .new_y
|
|
|
|
mov eax,[temp_y_offset]
|
|
|
|
mov ecx,eax
|
|
|
|
jmp .offset_x
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
.new_y:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov [temp_y],eax
|
|
|
|
mov ebx,[scaling_mode]
|
|
|
|
test ebx,ebx
|
|
|
|
jz @f
|
|
|
|
|
|
|
|
imul eax,[scaling_delta]
|
|
|
|
;--------------------------------
|
|
|
|
push ebx
|
|
|
|
mov ebx,eax
|
|
|
|
shr eax,12
|
|
|
|
and ebx,0xFFF
|
|
|
|
shl ebx,7 ;multiply 128
|
|
|
|
shr ebx,12
|
|
|
|
mov [next_pixel_y],ebx
|
|
|
|
pop ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
jmp .ex_1
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
imul eax,dword [y]
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
mov bx,word [new_size.y1]
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
.y_div:
|
2011-09-07 18:34:44 +02:00
|
|
|
test ebx,ebx
|
|
|
|
jnz @f
|
|
|
|
inc ebx
|
|
|
|
;--------------------------------
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
push eax
|
|
|
|
mov eax,edx
|
|
|
|
shl eax,7 ;multiply 128
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
mov [next_pixel_y],eax
|
|
|
|
pop eax
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
.ex_1:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov [temp_y1],eax
|
|
|
|
imul eax,[size_x]
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov [temp_y_offset],eax
|
|
|
|
mov ecx,eax
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
.offset_x:
|
2011-09-07 18:34:44 +02:00
|
|
|
test ebx,ebx
|
|
|
|
jz .finish
|
|
|
|
mov eax,[esp+4] ;ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov edx,[esp+8]
|
|
|
|
test edx,edx
|
|
|
|
jz .continue
|
|
|
|
shl eax,3
|
|
|
|
add eax,[area_for_x]
|
|
|
|
mov edx,[eax+4]
|
|
|
|
mov [next_pixel_x],edx
|
|
|
|
mov eax,[eax]
|
|
|
|
jmp .ex_3
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
.continue:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ebx,[scaling_mode]
|
|
|
|
test ebx,ebx
|
|
|
|
jz @f
|
|
|
|
imul eax,[scaling_delta]
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ebx,eax
|
|
|
|
shr eax,12
|
|
|
|
and ebx,0xFFF
|
|
|
|
shl ebx,7 ;multiply 128
|
|
|
|
shr ebx,12
|
|
|
|
mov [next_pixel_x],ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
jmp .ex_2
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
imul eax,dword [x]
|
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
mov bx,word [new_size.x1]
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
.x_div:
|
2011-09-07 18:34:44 +02:00
|
|
|
test ebx,ebx
|
|
|
|
jnz @f
|
|
|
|
inc ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
2011-09-07 18:34:44 +02:00
|
|
|
push eax
|
|
|
|
mov eax,edx
|
|
|
|
shl eax,7 ;multiply 128
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
mov [next_pixel_x],eax
|
|
|
|
pop eax
|
2011-06-12 00:16:26 +02:00
|
|
|
;--------------------------------
|
|
|
|
align 4
|
|
|
|
.ex_2:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov edx,[bytes_to_pixel]
|
|
|
|
mov ebx,eax
|
|
|
|
xor eax,eax
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
add eax,ebx
|
|
|
|
dec edx
|
|
|
|
jnz @r
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov ebx,[esp+4]
|
|
|
|
shl ebx,3
|
|
|
|
add ebx,[area_for_x]
|
|
|
|
mov [ebx],eax
|
|
|
|
mov edx,[next_pixel_x]
|
|
|
|
mov [ebx+4],edx
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
.ex_3:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov [temp_x1],eax
|
|
|
|
add ecx,eax
|
2011-06-12 00:16:26 +02:00
|
|
|
align 4
|
|
|
|
.finish:
|
2011-09-07 18:34:44 +02:00
|
|
|
add ecx,esi
|
2011-06-12 00:16:26 +02:00
|
|
|
ret
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
.get_memory:
|
2011-09-07 18:34:44 +02:00
|
|
|
xor ecx,ecx
|
|
|
|
mov cx,[new_size.x1]
|
|
|
|
shl ecx,3
|
|
|
|
mcall 68,12
|
|
|
|
mov [area_for_x],eax
|
|
|
|
|
|
|
|
xor ecx,ecx
|
|
|
|
mov ebx,[new_size]
|
|
|
|
mov cx,bx
|
|
|
|
shr ebx,16
|
|
|
|
imul ecx,ebx ;[eax+8]
|
|
|
|
mov eax,[bytes_to_pixel]
|
|
|
|
cmp eax,1
|
|
|
|
jne @f
|
|
|
|
mov eax,3
|
|
|
|
@@:
|
|
|
|
imul ecx,eax
|
|
|
|
mov edx,ecx
|
|
|
|
add ecx,44
|
|
|
|
mov eax,[image_file]
|
|
|
|
add ecx,[eax+24] ;palette area size
|
|
|
|
mcall 68,12
|
|
|
|
mov [raw_area],eax
|
|
|
|
mov edi,eax
|
|
|
|
|
|
|
|
; create RAW header
|
|
|
|
push esi
|
|
|
|
mov esi,[image_file]
|
|
|
|
mov ecx,44/4
|
|
|
|
cld
|
|
|
|
rep movsd ;copy the 3 first dword for the structure of RAW
|
|
|
|
mov edi,[raw_area]
|
|
|
|
movzx eax,word [new_size.x1]
|
|
|
|
mov [edi+4],eax
|
|
|
|
movzx eax,word [new_size.y1]
|
|
|
|
mov [edi+8],eax
|
|
|
|
mov [edi+32],edx ;rgb area size
|
|
|
|
xor eax,eax
|
|
|
|
mov [edi+36],eax ;transparency area pointer
|
|
|
|
mov [edi+40],eax ;transparency area size
|
|
|
|
|
|
|
|
cmp [filtering],eax ;0 or 1
|
|
|
|
je @f
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov [edi+20],eax ;palette area pointer
|
|
|
|
mov [edi+24],eax ;palette area size
|
|
|
|
mov [edi+28],dword 44 ;rgb area pointer
|
|
|
|
cmp [edi+12],dword 8 ;overall depth of the pixel
|
|
|
|
ja .not_overall_depth_8
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
mov [edi+12],dword 24 ;overall depth of the pixel
|
|
|
|
mov [edi+16],word 8 ;channel depth of the pixel
|
|
|
|
.not_overall_depth_8:
|
|
|
|
add edi,44
|
|
|
|
jmp .end
|
2011-06-12 00:16:26 +02:00
|
|
|
@@:
|
2011-09-07 18:34:44 +02:00
|
|
|
mov eax,[edi+24]
|
|
|
|
add edi,44
|
|
|
|
test eax,eax ;palette area is present?
|
|
|
|
jz @f
|
|
|
|
|
|
|
|
sub esi,44
|
|
|
|
|
|
|
|
mov ecx,[esi+24]
|
|
|
|
shr ecx,2
|
|
|
|
add esi,[esi+20]
|
|
|
|
cld
|
|
|
|
rep movsd ;copy palette area
|
|
|
|
@@:
|
|
|
|
|
|
|
|
.end:
|
|
|
|
pop esi
|
|
|
|
|
2011-06-12 00:16:26 +02:00
|
|
|
ret
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
include 'b_filter.inc'
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
EXPORTS:
|
2011-09-07 18:34:44 +02:00
|
|
|
dd szStart, START
|
|
|
|
dd szVersion, 0x00010003
|
|
|
|
dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
|
|
|
szStart db 'START',0
|
|
|
|
szVersion db 'version',0
|
|
|
|
|
|
|
|
align 4
|
|
|
|
pointer dd 0
|
|
|
|
image_file dd 0
|
|
|
|
new_size:
|
2011-09-07 18:34:44 +02:00
|
|
|
.y1: dw 0
|
|
|
|
.x1: dw 0
|
|
|
|
|
|
|
|
x: dd 0
|
|
|
|
y: dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
crop_x dd 0
|
|
|
|
crop_y dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
|
|
|
size_x dd 0
|
2011-09-07 18:34:44 +02:00
|
|
|
bytes_to_pixel dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
|
|
|
start_coordinates:
|
|
|
|
.y dw 0
|
|
|
|
.x dw 0
|
|
|
|
|
|
|
|
scaling_mode dd 0
|
|
|
|
raw_area dd 0
|
2011-09-07 18:34:44 +02:00
|
|
|
scaling_delta dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
area_for_x dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
temp_y dd 0
|
|
|
|
temp_y_offset dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
resolution dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
filtering dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
next_pixel_y dd 0
|
|
|
|
next_pixel_x dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
temp_y1 dd 0
|
|
|
|
temp_x1 dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
B_sample dd 0
|
|
|
|
G_sample dd 0
|
|
|
|
R_sample dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
B_sample_1 dd 0
|
|
|
|
G_sample_1 dd 0
|
|
|
|
R_sample_1 dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
palette dd 0
|
2011-06-12 00:16:26 +02:00
|
|
|
|
2011-09-07 18:34:44 +02:00
|
|
|
background_color dd 0
|