Rev 1717 | Rev 1910 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1717 | Rev 1727 | ||
---|---|---|---|
1 | format MS COFF |
1 | format MS COFF |
2 | public EXPORTS |
2 | public EXPORTS |
3 | section '.flat' code readable align 16 |
3 | section '.flat' code readable align 16 |
4 | 4 | ||
5 | include '../../../../macros.inc' |
5 | include '../../../../macros.inc' |
6 | include '../../../../proc32.inc' |
6 | include '../../../../proc32.inc' |
7 | 7 | ||
8 | ;----------------------------------------------------------------------------- |
8 | ;----------------------------------------------------------------------------- |
9 | mem.alloc dd ? ;äãªæ¨ï ¤«ï ¢ë¤¥«¥¨ï ¯ ¬ï⨠|
9 | mem.alloc dd ? ;äãªæ¨ï ¤«ï ¢ë¤¥«¥¨ï ¯ ¬ï⨠|
10 | mem.free dd ? ;äãªæ¨ï ¤«ï ®á¢®¡®¦¤¥¨ï ¯ ¬ï⨠|
10 | mem.free dd ? ;äãªæ¨ï ¤«ï ®á¢®¡®¦¤¥¨ï ¯ ¬ï⨠|
11 | mem.realloc dd ? ;äãªæ¨ï ¤«ï ¯¥à¥à á¯à¥¤¥«¥¨ï ¯ ¬ï⨠|
11 | mem.realloc dd ? ;äãªæ¨ï ¤«ï ¯¥à¥à á¯à¥¤¥«¥¨ï ¯ ¬ï⨠|
12 | dll.load dd ? |
12 | dll.load dd ? |
13 | 13 | ||
14 | BUF_STRUCT_SIZE equ 21 |
14 | BUF_STRUCT_SIZE equ 21 |
15 | buf2d_data equ dword[edi] ;¤ ë¥ ¡ãä¥à ¨§®¡à ¦¥¨ï |
15 | buf2d_data equ dword[edi] ;¤ ë¥ ¡ãä¥à ¨§®¡à ¦¥¨ï |
16 | buf2d_w equ dword[edi+8] ;è¨à¨ ¡ãä¥à |
16 | buf2d_w equ dword[edi+8] ;è¨à¨ ¡ãä¥à |
17 | buf2d_h equ dword[edi+12] ;¢ëá®â ¡ãä¥à |
17 | buf2d_h equ dword[edi+12] ;¢ëá®â ¡ãä¥à |
18 | buf2d_l equ word[edi+4] |
18 | buf2d_l equ word[edi+4] |
19 | buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã |
19 | buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã |
20 | buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢ ¨ á¯à ¢ ¤«ï ¡ãä¥à |
20 | buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢ ¨ á¯à ¢ ¤«ï ¡ãä¥à |
21 | buf2d_color equ dword[edi+16] ;梥â ä® ¡ãä¥à |
21 | buf2d_color equ dword[edi+16] ;梥â ä® ¡ãä¥à |
22 | buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥¨ï |
22 | buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥¨ï |
23 | 23 | ||
24 | struct buf_2d_header |
24 | struct buf_2d_header |
25 | img_data dd ? |
25 | img_data dd ? |
26 | left dw ? ;+4 left |
26 | left dw ? ;+4 left |
27 | top dw ? ;+6 top |
27 | top dw ? ;+6 top |
28 | size_x dd ? ;+8 w |
28 | size_x dd ? ;+8 w |
29 | size_y dd ? ;+12 h |
29 | size_y dd ? ;+12 h |
30 | color dd ? ;+16 color |
30 | color dd ? ;+16 color |
31 | bit_pp db ? ;+21 bit in pixel |
31 | bit_pp db ? ;+21 bit in pixel |
32 | ends |
32 | ends |
33 | 33 | ||
34 | macro swap v1, v2 { |
34 | macro swap v1, v2 { |
35 | push v1 |
35 | push v1 |
36 | push v2 |
36 | push v2 |
37 | pop v1 |
37 | pop v1 |
38 | pop v2 |
38 | pop v2 |
39 | } |
39 | } |
40 | 40 | ||
41 | ;ä« £¨, ¤«ï äãªæ¨¨ ®¡à¥§ ¨ï ¡ãä¥à |
41 | ;ä« £¨, ¤«ï äãªæ¨¨ ®¡à¥§ ¨ï ¡ãä¥à |
42 | BUF2D_OPT_CROP_TOP equ 1 ;®¡à¥§ª ᢥàåã |
42 | BUF2D_OPT_CROP_TOP equ 1 ;®¡à¥§ª ᢥàåã |
43 | BUF2D_OPT_CROP_LEFT equ 2 ;®¡à¥§ª á«¥¢ |
43 | BUF2D_OPT_CROP_LEFT equ 2 ;®¡à¥§ª á«¥¢ |
44 | BUF2D_OPT_CROP_BOTTOM equ 4 ;®¡à¥§ª ᨧã |
44 | BUF2D_OPT_CROP_BOTTOM equ 4 ;®¡à¥§ª ᨧã |
45 | BUF2D_OPT_CROP_RIGHT equ 8 ;®¡à¥§ª á¯à ¢ |
45 | BUF2D_OPT_CROP_RIGHT equ 8 ;®¡à¥§ª á¯à ¢ |
46 | BUF2D_BIT_OPT_CROP_TOP equ 0 |
46 | BUF2D_BIT_OPT_CROP_TOP equ 0 |
47 | BUF2D_BIT_OPT_CROP_LEFT equ 1 |
47 | BUF2D_BIT_OPT_CROP_LEFT equ 1 |
48 | BUF2D_BIT_OPT_CROP_BOTTOM equ 2 |
48 | BUF2D_BIT_OPT_CROP_BOTTOM equ 2 |
49 | BUF2D_BIT_OPT_CROP_RIGHT equ 3 |
49 | BUF2D_BIT_OPT_CROP_RIGHT equ 3 |
50 | 50 | ||
51 | ;input: |
51 | ;input: |
52 | ; eax = 㪠§ ⥫ì äãªæ¨î ¢ë¤¥«¥¨ï ¯ ¬ï⨠|
52 | ; eax = 㪠§ ⥫ì äãªæ¨î ¢ë¤¥«¥¨ï ¯ ¬ï⨠|
53 | ; ebx = ... ®á¢®¡®¦¤¥¨ï ¯ ¬ï⨠|
53 | ; ebx = ... ®á¢®¡®¦¤¥¨ï ¯ ¬ï⨠|
54 | ; ecx = ... ¯¥à¥à á¯à¥¤¥«¥¨ï ¯ ¬ï⨠|
54 | ; ecx = ... ¯¥à¥à á¯à¥¤¥«¥¨ï ¯ ¬ï⨠|
55 | ; edx = ... § £à㧪¨ ¡¨¡«¨®â¥ª¨ (¯®ª ¥ ¨á¯®«ì§ã¥âáï) |
55 | ; edx = ... § £à㧪¨ ¡¨¡«¨®â¥ª¨ (¯®ª ¥ ¨á¯®«ì§ã¥âáï) |
56 | align 16 |
56 | align 16 |
57 | lib_init: |
57 | lib_init: |
58 | mov dword[mem.alloc], eax |
58 | mov dword[mem.alloc], eax |
59 | mov dword[mem.free], ebx |
59 | mov dword[mem.free], ebx |
60 | mov dword[mem.realloc], ecx |
60 | mov dword[mem.realloc], ecx |
61 | mov dword[dll.load], edx |
61 | mov dword[dll.load], edx |
62 | ret |
62 | ret |
63 | 63 | ||
64 | ;input: |
64 | ;input: |
65 | ; ebx = coord x |
65 | ; ebx = coord x |
66 | ; ecx = coord y |
66 | ; ecx = coord y |
67 | ; edx = pixel color |
67 | ; edx = pixel color |
68 | ; edi = pointer to buffer struct |
68 | ; edi = pointer to buffer struct |
69 | align 4 |
69 | align 4 |
70 | draw_pixel: |
70 | draw_pixel: |
71 | ;cmp buf2d_bits,24 |
71 | ;cmp buf2d_bits,24 |
72 | ;jne @f |
72 | ;jne @f |
73 | bt ebx,31 |
73 | bt ebx,31 |
74 | jc @f |
74 | jc @f |
75 | bt ecx,31 |
75 | bt ecx,31 |
76 | jc @f |
76 | jc @f |
77 | cmp ebx,buf2d_w |
77 | cmp ebx,buf2d_w |
78 | jge @f |
78 | jge @f |
79 | cmp ecx,buf2d_h |
79 | cmp ecx,buf2d_h |
80 | jge @f |
80 | jge @f |
81 | push esi |
81 | push esi |
82 | mov esi,buf2d_w ;size x |
82 | mov esi,buf2d_w ;size x |
83 | imul esi,ecx ;size_x*y |
83 | imul esi,ecx ;size_x*y |
84 | add esi,ebx ;size_x*y+x |
84 | add esi,ebx ;size_x*y+x |
85 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
85 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
86 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
86 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
87 | 87 | ||
88 | mov word[esi],dx ;copy pixel color |
88 | mov word[esi],dx ;copy pixel color |
89 | ror edx,16 |
89 | ror edx,16 |
90 | mov byte[esi+2],dl |
90 | mov byte[esi+2],dl |
91 | ror edx,16 |
91 | ror edx,16 |
92 | pop esi |
92 | pop esi |
93 | @@: |
93 | @@: |
94 | ret |
94 | ret |
95 | 95 | ||
96 | ;input: |
96 | ;input: |
97 | ; ebx = coord x |
97 | ; ebx = coord x |
98 | ; ecx = coord y |
98 | ; ecx = coord y |
99 | ; edi = pointer to buffer struct |
99 | ; edi = pointer to buffer struct |
100 | ;output: |
100 | ;output: |
101 | ; eax = 梥â â®çª¨ |
101 | ; eax = 梥â â®çª¨ |
102 | ; ¢ á«ãç ¥ ®è¨¡ª¨ eax = 0xffffffff |
102 | ; ¢ á«ãç ¥ ®è¨¡ª¨ eax = 0xffffffff |
103 | align 4 |
103 | align 4 |
104 | get_pixel_24: |
104 | get_pixel_24: |
105 | mov eax,0xffffffff |
105 | mov eax,0xffffffff |
106 | 106 | ||
107 | bt ebx,31 |
107 | bt ebx,31 |
108 | jc @f |
108 | jc @f |
109 | bt ecx,31 |
109 | bt ecx,31 |
110 | jc @f |
110 | jc @f |
111 | cmp ebx,buf2d_w |
111 | cmp ebx,buf2d_w |
112 | jge @f |
112 | jge @f |
113 | cmp ecx,buf2d_h |
113 | cmp ecx,buf2d_h |
114 | jge @f |
114 | jge @f |
115 | push esi |
115 | push esi |
116 | mov esi,buf2d_w ;size x |
116 | mov esi,buf2d_w ;size x |
117 | imul esi,ecx ;size_x*y |
117 | imul esi,ecx ;size_x*y |
118 | add esi,ebx ;size_x*y+x |
118 | add esi,ebx ;size_x*y+x |
119 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
119 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
120 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
120 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
121 | 121 | ||
122 | xor eax,eax |
122 | xor eax,eax |
123 | mov ax,word[esi] ;copy pixel color |
123 | mov ax,word[esi] ;copy pixel color |
124 | ror eax,16 |
124 | ror eax,16 |
125 | mov al,byte[esi+2] |
125 | mov al,byte[esi+2] |
126 | ror eax,16 |
126 | ror eax,16 |
127 | pop esi |
127 | pop esi |
128 | @@: |
128 | @@: |
129 | ret |
129 | ret |
130 | 130 | ||
131 | 131 | ||
132 | ;ᮧ¤ ¨¥ ¡ãä¥à |
132 | ;ᮧ¤ ¨¥ ¡ãä¥à |
133 | align 4 |
133 | align 4 |
134 | proc buf_create, buf_struc:dword |
134 | proc buf_create, buf_struc:dword |
135 | pushad |
135 | pushad |
136 | mov edi,dword[buf_struc] |
136 | mov edi,dword[buf_struc] |
137 | mov ecx,buf2d_w |
137 | mov ecx,buf2d_w |
138 | mov ebx,buf2d_h |
138 | mov ebx,buf2d_h |
139 | imul ecx,ebx |
139 | imul ecx,ebx |
140 | cmp buf2d_bits,24 |
140 | cmp buf2d_bits,24 |
141 | jne @f |
141 | jne @f |
142 | lea ecx,[ecx+ecx*2] ; 24 bit = 3 |
142 | lea ecx,[ecx+ecx*2] ; 24 bit = 3 |
143 | ;;;inc ecx ;§ ¯ ᮩ ¡ ©â ¢ ª®æ¥ ¡ãä¥à , çâ®-¡ë ¥ £«î稫¨ ¥ª®â®àë¥ äãªæ¨¨ ¨§®¡à ¦¥¨ïå ªà âëå 4 |
143 | ;;;inc ecx ;§ ¯ ᮩ ¡ ©â ¢ ª®æ¥ ¡ãä¥à , çâ®-¡ë ¥ £«î稫¨ ¥ª®â®àë¥ äãªæ¨¨ ¨§®¡à ¦¥¨ïå ªà âëå 4 |
144 | @@: |
144 | @@: |
145 | cmp buf2d_bits,32 |
145 | cmp buf2d_bits,32 |
146 | jne @f |
146 | jne @f |
147 | shl ecx,2 ; 32 bit = 4 |
147 | shl ecx,2 ; 32 bit = 4 |
148 | @@: |
148 | @@: |
149 | invoke mem.alloc,ecx |
149 | invoke mem.alloc,ecx |
150 | mov buf2d_data,eax |
150 | mov buf2d_data,eax |
151 | 151 | ||
152 | stdcall buf_clear,edi,buf2d_color ;®ç¨á⪠¡ãä¥à ä®®¢ë¬ 梥⮬ |
152 | stdcall buf_clear,edi,buf2d_color ;®ç¨á⪠¡ãä¥à ä®®¢ë¬ 梥⮬ |
153 | popad |
153 | popad |
154 | ret |
154 | ret |
155 | endp |
155 | endp |
156 | 156 | ||
157 | ;ᮧ¤ ¨¥ ¡ãä¥à ®á®¢¥ ¨§®¡à ¦¥¨ï rgb |
157 | ;ᮧ¤ ¨¥ ¡ãä¥à ®á®¢¥ ¨§®¡à ¦¥¨ï rgb |
158 | align 4 |
158 | align 4 |
159 | proc buf_create_f_img, buf_struc:dword, rgb_data:dword |
159 | proc buf_create_f_img, buf_struc:dword, rgb_data:dword |
160 | pushad |
160 | pushad |
161 | mov edi,dword[buf_struc] |
161 | mov edi,dword[buf_struc] |
162 | mov ecx,buf2d_w |
162 | mov ecx,buf2d_w |
163 | mov ebx,buf2d_h |
163 | mov ebx,buf2d_h |
164 | imul ecx,ebx |
164 | imul ecx,ebx |
165 | cmp buf2d_bits,24 |
165 | cmp buf2d_bits,24 |
166 | jne @f |
166 | jne @f |
167 | lea ecx,[ecx+ecx*2] ; 24 bit = 3 |
167 | lea ecx,[ecx+ecx*2] ; 24 bit = 3 |
168 | ;;;inc ecx ;§ ¯ ᮩ ¡ ©â ¢ ª®æ¥ ¡ãä¥à , çâ®-¡ë ¥ £«î稫¨ ¥ª®â®àë¥ äãªæ¨¨ ¨§®¡à ¦¥¨ïå ªà âëå 4 |
168 | ;;;inc ecx ;§ ¯ ᮩ ¡ ©â ¢ ª®æ¥ ¡ãä¥à , çâ®-¡ë ¥ £«î稫¨ ¥ª®â®àë¥ äãªæ¨¨ ¨§®¡à ¦¥¨ïå ªà âëå 4 |
169 | @@: |
169 | @@: |
170 | cmp buf2d_bits,32 |
170 | cmp buf2d_bits,32 |
171 | jne @f |
171 | jne @f |
172 | shl ecx,2 ; 32 bit = 4 |
172 | shl ecx,2 ; 32 bit = 4 |
173 | @@: |
173 | @@: |
174 | invoke mem.alloc,ecx |
174 | invoke mem.alloc,ecx |
175 | mov buf2d_data,eax |
175 | mov buf2d_data,eax |
176 | 176 | ||
177 | cmp buf2d_bits,24 |
177 | cmp buf2d_bits,24 |
178 | jne @f |
178 | jne @f |
179 | cld |
179 | cld |
180 | mov esi,[rgb_data] |
180 | mov esi,[rgb_data] |
181 | mov edi,eax ;eax=buf2d_data |
181 | mov edi,eax ;eax=buf2d_data |
182 | rep movsb ;ª®¯¨à㥬 ¡¨âë ¨§®¡à ¦¥¨ï ¢ ¡ãä¥à |
182 | rep movsb ;ª®¯¨à㥬 ¡¨âë ¨§®¡à ¦¥¨ï ¢ ¡ãä¥à |
183 | jmp .end_create |
183 | jmp .end_create |
184 | @@: |
184 | @@: |
185 | stdcall buf_clear,edi,buf2d_color ;®ç¨á⪠¡ãä¥à ä®®¢ë¬ 梥⮬ |
185 | stdcall buf_clear,edi,buf2d_color ;®ç¨á⪠¡ãä¥à ä®®¢ë¬ 梥⮬ |
186 | .end_create: |
186 | .end_create: |
187 | popad |
187 | popad |
188 | ret |
188 | ret |
189 | endp |
189 | endp |
190 | 190 | ||
191 | align 4 |
191 | align 4 |
192 | proc buf_clear, buf_struc:dword, color:dword ;®ç¨á⪠¡ãä¥à § ¤ ë¬ æ¢¥â®¬ |
192 | proc buf_clear, buf_struc:dword, color:dword ;®ç¨á⪠¡ãä¥à § ¤ ë¬ æ¢¥â®¬ |
193 | pushad |
193 | pushad |
194 | mov edi,dword[buf_struc] |
194 | mov edi,dword[buf_struc] |
195 | 195 | ||
196 | mov ecx,buf2d_w |
196 | mov ecx,buf2d_w |
197 | mov ebx,buf2d_h |
197 | mov ebx,buf2d_h |
198 | imul ecx,ebx |
198 | imul ecx,ebx |
199 | 199 | ||
200 | cld |
200 | cld |
201 | 201 | ||
202 | cmp buf2d_bits,8 |
202 | cmp buf2d_bits,8 |
203 | jne .end_clear_8 |
203 | jne .end_clear_8 |
204 | mov edi,buf2d_data |
204 | mov edi,buf2d_data |
205 | mov al,byte[color] |
205 | mov al,byte[color] |
206 | rep stosb |
206 | rep stosb |
207 | jmp .end_clear_32 |
207 | jmp .end_clear_32 |
208 | .end_clear_8: |
208 | .end_clear_8: |
209 | 209 | ||
210 | cmp buf2d_bits,24 |
210 | cmp buf2d_bits,24 |
211 | jne .end_clear_24 |
211 | jne .end_clear_24 |
212 | mov edi,buf2d_data |
212 | mov edi,buf2d_data |
213 | mov eax,dword[color] |
213 | mov eax,dword[color] |
214 | mov ebx,eax |
214 | mov ebx,eax |
215 | shr ebx,16 |
215 | shr ebx,16 |
216 | @@: |
216 | @@: |
217 | stosw |
217 | stosw |
218 | mov byte[edi],bl |
218 | mov byte[edi],bl |
219 | inc edi |
219 | inc edi |
220 | loop @b |
220 | loop @b |
221 | jmp .end_clear_32 |
221 | jmp .end_clear_32 |
222 | .end_clear_24: |
222 | .end_clear_24: |
223 | 223 | ||
224 | cmp buf2d_bits,32 |
224 | cmp buf2d_bits,32 |
225 | jne .end_clear_32 |
225 | jne .end_clear_32 |
226 | mov edi,buf2d_data |
226 | mov edi,buf2d_data |
227 | mov eax,dword[color] |
227 | mov eax,dword[color] |
228 | rep stosd |
228 | rep stosd |
229 | ;jmp .end_clear_32 |
229 | ;jmp .end_clear_32 |
230 | .end_clear_32: |
230 | .end_clear_32: |
231 | popad |
231 | popad |
232 | ret |
232 | ret |
233 | endp |
233 | endp |
234 | 234 | ||
235 | ;äãªæ¨ï ¤«ï ®¡à¥§ ¨ï ¡ãä¥à®¢ 8 ¨ 24 ¡¨âëå, ¯® § ¤ ®¬ã 梥âã. |
235 | ;äãªæ¨ï ¤«ï ®¡à¥§ ¨ï ¡ãä¥à®¢ 8 ¨ 24 ¡¨âëå, ¯® § ¤ ®¬ã 梥âã. |
236 | ;¯ à ¬¥âà opt § ¤ ¥âáï ª®¬¡¨ 樥© ª®áâ â: |
236 | ;¯ à ¬¥âà opt § ¤ ¥âáï ª®¬¡¨ 樥© ª®áâ â: |
237 | ; BUF2D_OPT_CROP_TOP - ®¡à¥§ª ᢥàåã |
237 | ; BUF2D_OPT_CROP_TOP - ®¡à¥§ª ᢥàåã |
238 | ; BUF2D_OPT_CROP_LEFT - ®¡à¥§ª á«¥¢ |
238 | ; BUF2D_OPT_CROP_LEFT - ®¡à¥§ª á«¥¢ |
239 | ; BUF2D_OPT_CROP_BOTTOM - ®¡à¥§ª ᨧã |
239 | ; BUF2D_OPT_CROP_BOTTOM - ®¡à¥§ª ᨧã |
240 | ; BUF2D_OPT_CROP_RIGHT - ®¡à¥§ª á¯à ¢ |
240 | ; BUF2D_OPT_CROP_RIGHT - ®¡à¥§ª á¯à ¢ |
241 | align 4 |
241 | align 4 |
242 | proc buf_crop_color, buf_struc:dword, color:dword, opt:dword |
242 | proc buf_crop_color, buf_struc:dword, color:dword, opt:dword |
243 | locals |
243 | locals |
244 | crop_r dd ? |
244 | crop_r dd ? |
245 | endl |
245 | endl |
246 | pushad |
246 | pushad |
247 | mov edi,dword[buf_struc] |
247 | mov edi,dword[buf_struc] |
248 | cmp buf2d_bits,24 |
248 | cmp buf2d_bits,24 |
249 | jne .24end_f |
249 | jne .24end_f |
250 | 250 | ||
251 | bt dword[opt],BUF2D_BIT_OPT_CROP_BOTTOM |
251 | bt dword[opt],BUF2D_BIT_OPT_CROP_BOTTOM |
252 | jae .24no_crop_bottom |
252 | jae .24no_crop_bottom |
253 | mov eax,dword[color] |
253 | mov eax,dword[color] |
254 | mov edx,eax ;ax = colors - r,g |
254 | mov edx,eax ;ax = colors - r,g |
255 | shr edx,16 ;dl = color - b |
255 | shr edx,16 ;dl = color - b |
256 | mov ecx,buf2d_h |
256 | mov ecx,buf2d_h |
257 | cmp ecx,1 |
257 | cmp ecx,1 |
258 | jle .24no_crop_bottom ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
258 | jle .24no_crop_bottom ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
259 | mov ebx,buf2d_w |
259 | mov ebx,buf2d_w |
260 | imul ecx,ebx |
260 | imul ecx,ebx |
261 | lea esi,[ecx+ecx*2] ;esi=3*ecx |
261 | lea esi,[ecx+ecx*2] ;esi=3*ecx |
262 | add esi,buf2d_data |
262 | add esi,buf2d_data |
263 | cld |
263 | cld |
264 | @@: |
264 | @@: |
265 | sub esi,3 |
265 | sub esi,3 |
266 | cmp word[esi],ax |
266 | cmp word[esi],ax |
267 | jne @f |
267 | jne @f |
268 | cmp byte[esi+2],dl |
268 | cmp byte[esi+2],dl |
269 | jne @f |
269 | jne @f |
270 | loop @b |
270 | loop @b |
271 | @@: |
271 | @@: |
272 | lea ebx,[ebx+ebx*2] |
272 | lea ebx,[ebx+ebx*2] |
273 | xor edx,edx |
273 | xor edx,edx |
274 | mov eax,buf2d_h |
274 | mov eax,buf2d_h |
275 | imul eax,ebx |
275 | imul eax,ebx |
276 | add eax,buf2d_data ;eax - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
276 | add eax,buf2d_data ;eax - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
277 | @@: |
277 | @@: |
278 | add esi,ebx |
278 | add esi,ebx |
279 | cmp esi,eax |
279 | cmp esi,eax |
280 | jge @f |
280 | jge @f |
281 | inc edx ;¢ëç¨á«ï¥¬ ç¨á«® ¯®«ëå áâப ¤«ï ®¡à¥§ ¨ï |
281 | inc edx ;¢ëç¨á«ï¥¬ ç¨á«® ¯®«ëå áâப ¤«ï ®¡à¥§ ¨ï |
282 | loop @b |
282 | loop @b |
283 | @@: |
283 | @@: |
284 | cmp edx,0 |
284 | cmp edx,0 |
285 | je .24no_crop_bottom |
285 | je .24no_crop_bottom |
286 | cmp edx,buf2d_h |
286 | cmp edx,buf2d_h |
287 | jge .24no_crop_bottom ;çâ®-¡ë ¥ ¯®«ãç¨âì ¯ãá⮩ ¡ãä¥à |
287 | jge .24no_crop_bottom ;çâ®-¡ë ¥ ¯®«ãç¨âì ¯ãá⮩ ¡ãä¥à |
288 | sub buf2d_h,edx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
288 | sub buf2d_h,edx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
289 | mov ecx,buf2d_h |
289 | mov ecx,buf2d_h |
290 | imul ecx,ebx ;ecx = ®¢ë© à §¬¥à ¨§®¡à ¦¥¨ï |
290 | imul ecx,ebx ;ecx = ®¢ë© à §¬¥à ¨§®¡à ¦¥¨ï |
291 | invoke mem.realloc,buf2d_data,ecx |
291 | invoke mem.realloc,buf2d_data,ecx |
292 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
292 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
293 | .24no_crop_bottom: |
293 | .24no_crop_bottom: |
294 | 294 | ||
295 | bt dword[opt],BUF2D_BIT_OPT_CROP_TOP |
295 | bt dword[opt],BUF2D_BIT_OPT_CROP_TOP |
296 | jae .24no_crop_top |
296 | jae .24no_crop_top |
297 | mov eax,dword[color] |
297 | mov eax,dword[color] |
298 | mov edx,eax ;ax = colors - r,g |
298 | mov edx,eax ;ax = colors - r,g |
299 | shr edx,16 ;dl = color - b |
299 | shr edx,16 ;dl = color - b |
300 | mov esi,buf2d_data |
300 | mov esi,buf2d_data |
301 | mov ecx,buf2d_h |
301 | mov ecx,buf2d_h |
302 | cmp ecx,1 |
302 | cmp ecx,1 |
303 | jle .24no_crop_top ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
303 | jle .24no_crop_top ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
304 | dec ecx ;¯à¨ ®¡à¥§ ¨¨ ¤®«¦ ®áâ âìáï ¬¨¨¬ã¬ 1- áâப ¯¨ªá¥«¥© |
304 | dec ecx ;¯à¨ ®¡à¥§ ¨¨ ¤®«¦ ®áâ âìáï ¬¨¨¬ã¬ 1- áâப ¯¨ªá¥«¥© |
305 | mov ebx,buf2d_w |
305 | mov ebx,buf2d_w |
306 | imul ecx,ebx |
306 | imul ecx,ebx |
307 | cld |
307 | cld |
308 | @@: |
308 | @@: |
309 | cmp word[esi],ax |
309 | cmp word[esi],ax |
310 | jne @f |
310 | jne @f |
311 | cmp byte[esi+2],dl |
311 | cmp byte[esi+2],dl |
312 | jne @f |
312 | jne @f |
313 | add esi,3 |
313 | add esi,3 |
314 | loop @b |
314 | loop @b |
315 | @@: |
315 | @@: |
316 | lea ebx,[ebx+ebx*2] |
316 | lea ebx,[ebx+ebx*2] |
317 | xor edx,edx |
317 | xor edx,edx |
318 | @@: |
318 | @@: |
319 | sub esi,ebx |
319 | sub esi,ebx |
320 | cmp esi,buf2d_data |
320 | cmp esi,buf2d_data |
321 | jl @f |
321 | jl @f |
322 | inc edx ;¢ëç¨á«ï¥¬ ç¨á«® ¯®«ëå áâப ¤«ï ®¡à¥§ ¨ï |
322 | inc edx ;¢ëç¨á«ï¥¬ ç¨á«® ¯®«ëå áâப ¤«ï ®¡à¥§ ¨ï |
323 | loop @b |
323 | loop @b |
324 | @@: |
324 | @@: |
325 | cmp edx,0 |
325 | cmp edx,0 |
326 | je .24no_crop_top |
326 | je .24no_crop_top |
327 | xor eax,eax |
327 | xor eax,eax |
328 | sub eax,edx |
328 | sub eax,edx |
329 | mov ebx,buf2d_h |
329 | mov ebx,buf2d_h |
330 | sub ebx,edx |
330 | sub ebx,edx |
331 | stdcall buf_offset_h, edi, eax, edx, ebx ;ᤢ¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢ ¡ãä¥à¥ ¢¢¥àå (eax<0) |
331 | stdcall buf_offset_h, edi, eax, edx, ebx ;ᤢ¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢ ¡ãä¥à¥ ¢¢¥àå (eax<0) |
332 | sub buf2d_h,edx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
332 | sub buf2d_h,edx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
333 | mov ecx,buf2d_h |
333 | mov ecx,buf2d_h |
334 | add buf2d_t,dx ;ᤢ¨£ ¥¬ ®âáâ㯠¢¨§, ç¨á«® ®¡à¥§ ëå áâப |
334 | add buf2d_t,dx ;ᤢ¨£ ¥¬ ®âáâ㯠¢¨§, ç¨á«® ®¡à¥§ ëå áâப |
335 | mov ebx,buf2d_w |
335 | mov ebx,buf2d_w |
336 | imul ecx,ebx |
336 | imul ecx,ebx |
337 | lea ecx,[ecx+ecx*2] |
337 | lea ecx,[ecx+ecx*2] |
338 | invoke mem.realloc,buf2d_data,ecx |
338 | invoke mem.realloc,buf2d_data,ecx |
339 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
339 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
340 | .24no_crop_top: |
340 | .24no_crop_top: |
341 | 341 | ||
342 | bt dword[opt],BUF2D_BIT_OPT_CROP_RIGHT |
342 | bt dword[opt],BUF2D_BIT_OPT_CROP_RIGHT |
343 | jae .24no_crop_right |
343 | jae .24no_crop_right |
344 | mov eax,dword[color] |
344 | mov eax,dword[color] |
345 | mov edx,eax ;ax = colors - r,g |
345 | mov edx,eax ;ax = colors - r,g |
346 | shr edx,16 ;dl = color - b |
346 | shr edx,16 ;dl = color - b |
347 | mov ebx,buf2d_w |
347 | mov ebx,buf2d_w |
348 | cmp ebx,1 |
348 | cmp ebx,1 |
349 | jle .24no_crop_right ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
349 | jle .24no_crop_right ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
350 | lea ebx,[ebx+ebx*2] |
350 | lea ebx,[ebx+ebx*2] |
351 | mov esi,ebx |
351 | mov esi,ebx |
352 | imul esi,buf2d_h |
352 | imul esi,buf2d_h |
353 | add esi,buf2d_data ;esi - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
353 | add esi,buf2d_data ;esi - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
354 | mov dword[crop_r],0 |
354 | mov dword[crop_r],0 |
355 | cld |
355 | cld |
356 | .24found_beg_right: |
356 | .24found_beg_right: |
357 | sub esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
357 | sub esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
358 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
358 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
359 | @@: |
359 | @@: |
360 | cmp word[esi],ax |
360 | cmp word[esi],ax |
361 | jne .24found_right |
361 | jne .24found_right |
362 | cmp byte[esi+2],dl |
362 | cmp byte[esi+2],dl |
363 | jne .24found_right |
363 | jne .24found_right |
364 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
364 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
365 | loop @b |
365 | loop @b |
366 | inc dword[crop_r] |
366 | inc dword[crop_r] |
367 | 367 | ||
368 | mov ecx,buf2d_w |
368 | mov ecx,buf2d_w |
369 | dec ecx ;1 ª®«®ª § ¯ á |
369 | dec ecx ;1 ª®«®ª § ¯ á |
370 | cmp dword[crop_r],ecx |
370 | cmp dword[crop_r],ecx |
371 | jge .24found_right |
371 | jge .24found_right |
372 | 372 | ||
373 | sub esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
373 | sub esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
374 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
374 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
375 | @@: |
375 | @@: |
376 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
376 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
377 | cmp word[esi],ax |
377 | cmp word[esi],ax |
378 | jne .24found_right |
378 | jne .24found_right |
379 | cmp byte[esi+2],dl |
379 | cmp byte[esi+2],dl |
380 | jne .24found_right |
380 | jne .24found_right |
381 | loop @b |
381 | loop @b |
382 | inc dword[crop_r] |
382 | inc dword[crop_r] |
383 | 383 | ||
384 | mov ecx,buf2d_w |
384 | mov ecx,buf2d_w |
385 | dec ecx ;1 ª®«®ª § ¯ á |
385 | dec ecx ;1 ª®«®ª § ¯ á |
386 | cmp dword[crop_r],ecx |
386 | cmp dword[crop_r],ecx |
387 | jl .24found_beg_right |
387 | jl .24found_beg_right |
388 | 388 | ||
389 | .24found_right: |
389 | .24found_right: |
390 | cmp dword[crop_r],0 |
390 | cmp dword[crop_r],0 |
391 | je .24no_crop_right |
391 | je .24no_crop_right |
392 | mov ecx,buf2d_w |
392 | mov ecx,buf2d_w |
393 | sub ecx,dword[crop_r] |
393 | sub ecx,dword[crop_r] |
394 | stdcall img_rgb_crop_r, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
394 | stdcall img_rgb_crop_r, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
395 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
395 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
396 | mov ebx,buf2d_h |
396 | mov ebx,buf2d_h |
397 | imul ecx,ebx |
397 | imul ecx,ebx |
398 | lea ecx,[ecx+ecx*2] |
398 | lea ecx,[ecx+ecx*2] |
399 | invoke mem.realloc,buf2d_data,ecx |
399 | invoke mem.realloc,buf2d_data,ecx |
400 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
400 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
401 | .24no_crop_right: |
401 | .24no_crop_right: |
402 | 402 | ||
403 | bt dword[opt],BUF2D_BIT_OPT_CROP_LEFT |
403 | bt dword[opt],BUF2D_BIT_OPT_CROP_LEFT |
404 | jae .24no_crop_left |
404 | jae .24no_crop_left |
405 | mov eax,dword[color] |
405 | mov eax,dword[color] |
406 | mov edx,eax ;ax = colors - r,g |
406 | mov edx,eax ;ax = colors - r,g |
407 | shr edx,16 ;dl = color - b |
407 | shr edx,16 ;dl = color - b |
408 | mov ebx,buf2d_w |
408 | mov ebx,buf2d_w |
409 | cmp ebx,1 |
409 | cmp ebx,1 |
410 | jle .24no_crop_left ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
410 | jle .24no_crop_left ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
411 | lea ebx,[ebx+ebx*2] |
411 | lea ebx,[ebx+ebx*2] |
412 | mov esi,buf2d_data ;esi - 㪠§ ⥫ì 箫® ¡ãä¥à ¨§®¡à ¦¥¨ï |
412 | mov esi,buf2d_data ;esi - 㪠§ ⥫ì 箫® ¡ãä¥à ¨§®¡à ¦¥¨ï |
413 | mov dword[crop_r],0 |
413 | mov dword[crop_r],0 |
414 | cld |
414 | cld |
415 | .24found_beg_left: |
415 | .24found_beg_left: |
416 | 416 | ||
417 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
417 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
418 | @@: |
418 | @@: |
419 | cmp word[esi],ax |
419 | cmp word[esi],ax |
420 | jne .24found_left |
420 | jne .24found_left |
421 | cmp byte[esi+2],dl |
421 | cmp byte[esi+2],dl |
422 | jne .24found_left |
422 | jne .24found_left |
423 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
423 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
424 | loop @b |
424 | loop @b |
425 | inc dword[crop_r] |
425 | inc dword[crop_r] |
426 | add esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
426 | add esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
427 | 427 | ||
428 | mov ecx,buf2d_w |
428 | mov ecx,buf2d_w |
429 | dec ecx ;1 ª®«®ª § ¯ á |
429 | dec ecx ;1 ª®«®ª § ¯ á |
430 | cmp dword[crop_r],ecx |
430 | cmp dword[crop_r],ecx |
431 | jge .24found_left |
431 | jge .24found_left |
432 | 432 | ||
433 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
433 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
434 | @@: |
434 | @@: |
435 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
435 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
436 | cmp word[esi],ax |
436 | cmp word[esi],ax |
437 | jne .24found_left |
437 | jne .24found_left |
438 | cmp byte[esi+2],dl |
438 | cmp byte[esi+2],dl |
439 | jne .24found_left |
439 | jne .24found_left |
440 | loop @b |
440 | loop @b |
441 | inc dword[crop_r] |
441 | inc dword[crop_r] |
442 | add esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
442 | add esi,3 ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
443 | 443 | ||
444 | mov ecx,buf2d_w |
444 | mov ecx,buf2d_w |
445 | dec ecx ;1 ª®«®ª § ¯ á |
445 | dec ecx ;1 ª®«®ª § ¯ á |
446 | cmp dword[crop_r],ecx |
446 | cmp dword[crop_r],ecx |
447 | jl .24found_beg_left |
447 | jl .24found_beg_left |
448 | 448 | ||
449 | .24found_left: |
449 | .24found_left: |
450 | cmp dword[crop_r],0 |
450 | cmp dword[crop_r],0 |
451 | je .24no_crop_left |
451 | je .24no_crop_left |
452 | mov ecx,buf2d_w |
452 | mov ecx,buf2d_w |
453 | sub ecx,dword[crop_r] |
453 | sub ecx,dword[crop_r] |
454 | stdcall img_rgb_crop_l, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
454 | stdcall img_rgb_crop_l, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
455 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
455 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
456 | mov ebx,buf2d_h |
456 | mov ebx,buf2d_h |
457 | imul ecx,ebx |
457 | imul ecx,ebx |
458 | lea ecx,[ecx+ecx*2] |
458 | lea ecx,[ecx+ecx*2] |
459 | invoke mem.realloc,buf2d_data,ecx |
459 | invoke mem.realloc,buf2d_data,ecx |
460 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
460 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
461 | mov eax,dword[crop_r] |
461 | mov eax,dword[crop_r] |
462 | add buf2d_l,ax |
462 | add buf2d_l,ax |
463 | .24no_crop_left: |
463 | .24no_crop_left: |
464 | 464 | ||
465 | .24end_f: |
465 | .24end_f: |
466 | 466 | ||
467 | 467 | ||
468 | cmp buf2d_bits,8 |
468 | cmp buf2d_bits,8 |
469 | jne .8end_f |
469 | jne .8end_f |
470 | 470 | ||
471 | bt dword[opt],BUF2D_BIT_OPT_CROP_BOTTOM |
471 | bt dword[opt],BUF2D_BIT_OPT_CROP_BOTTOM |
472 | jae .8no_crop_bottom |
472 | jae .8no_crop_bottom |
473 | mov eax,dword[color] |
473 | mov eax,dword[color] |
474 | mov esi,buf2d_data |
474 | mov esi,buf2d_data |
475 | mov ecx,buf2d_h |
475 | mov ecx,buf2d_h |
476 | cmp ecx,1 |
476 | cmp ecx,1 |
477 | jle .8no_crop_bottom ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
477 | jle .8no_crop_bottom ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
478 | mov ebx,buf2d_w |
478 | mov ebx,buf2d_w |
479 | imul ecx,ebx |
479 | imul ecx,ebx |
480 | mov esi,ecx |
480 | mov esi,ecx |
481 | add esi,buf2d_data |
481 | add esi,buf2d_data |
482 | cld |
482 | cld |
483 | @@: |
483 | @@: |
484 | dec esi |
484 | dec esi |
485 | cmp byte[esi],al |
485 | cmp byte[esi],al |
486 | jne @f |
486 | jne @f |
487 | loop @b |
487 | loop @b |
488 | @@: |
488 | @@: |
489 | xor edx,edx |
489 | xor edx,edx |
490 | mov eax,buf2d_h |
490 | mov eax,buf2d_h |
491 | imul eax,ebx |
491 | imul eax,ebx |
492 | add eax,buf2d_data ;eax - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
492 | add eax,buf2d_data ;eax - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
493 | @@: |
493 | @@: |
494 | add esi,ebx |
494 | add esi,ebx |
495 | cmp esi,eax |
495 | cmp esi,eax |
496 | jge @f |
496 | jge @f |
497 | inc edx |
497 | inc edx |
498 | loop @b |
498 | loop @b |
499 | @@: |
499 | @@: |
500 | cmp edx,0 |
500 | cmp edx,0 |
501 | je .8no_crop_bottom |
501 | je .8no_crop_bottom |
502 | cmp edx,buf2d_h |
502 | cmp edx,buf2d_h |
503 | jge .8no_crop_bottom ;çâ®-¡ë ¥ ¯®«ãç¨âì ¯ãá⮩ ¡ãä¥à |
503 | jge .8no_crop_bottom ;çâ®-¡ë ¥ ¯®«ãç¨âì ¯ãá⮩ ¡ãä¥à |
504 | sub buf2d_h,edx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
504 | sub buf2d_h,edx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
505 | mov ecx,buf2d_h |
505 | mov ecx,buf2d_h |
506 | imul ecx,ebx ;ecx = ®¢ë© à §¬¥à ¨§®¡à ¦¥¨ï |
506 | imul ecx,ebx ;ecx = ®¢ë© à §¬¥à ¨§®¡à ¦¥¨ï |
507 | invoke mem.realloc,buf2d_data,ecx |
507 | invoke mem.realloc,buf2d_data,ecx |
508 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
508 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
509 | .8no_crop_bottom: |
509 | .8no_crop_bottom: |
510 | 510 | ||
511 | bt dword[opt],BUF2D_BIT_OPT_CROP_TOP |
511 | bt dword[opt],BUF2D_BIT_OPT_CROP_TOP |
512 | jae .8no_crop_top |
512 | jae .8no_crop_top |
513 | mov eax,dword[color] |
513 | mov eax,dword[color] |
514 | mov esi,buf2d_data |
514 | mov esi,buf2d_data |
515 | mov ecx,buf2d_h |
515 | mov ecx,buf2d_h |
516 | cmp ecx,1 |
516 | cmp ecx,1 |
517 | jle .8no_crop_top ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
517 | jle .8no_crop_top ;¯à®¢¥à塞 á«ãç © ¥á«¨ ¢ëá®â ¡ãä¥à 1 ¯¨ªá¥«ì |
518 | dec ecx ;¯à¨ ®¡à¥§ ¨¨ ¤®«¦ ®áâ âìáï ¬¨¨¬ã¬ 1- áâப ¯¨ªá¥«¥© |
518 | dec ecx ;¯à¨ ®¡à¥§ ¨¨ ¤®«¦ ®áâ âìáï ¬¨¨¬ã¬ 1- áâப ¯¨ªá¥«¥© |
519 | mov ebx,buf2d_w |
519 | mov ebx,buf2d_w |
520 | imul ecx,ebx |
520 | imul ecx,ebx |
521 | cld |
521 | cld |
522 | @@: |
522 | @@: |
523 | cmp byte[esi],al |
523 | cmp byte[esi],al |
524 | jne @f |
524 | jne @f |
525 | inc esi |
525 | inc esi |
526 | loop @b |
526 | loop @b |
527 | @@: |
527 | @@: |
528 | xor edx,edx |
528 | xor edx,edx |
529 | @@: |
529 | @@: |
530 | sub esi,ebx |
530 | sub esi,ebx |
531 | cmp esi,buf2d_data |
531 | cmp esi,buf2d_data |
532 | jl @f |
532 | jl @f |
533 | inc edx |
533 | inc edx |
534 | loop @b |
534 | loop @b |
535 | @@: |
535 | @@: |
536 | cmp edx,0 |
536 | cmp edx,0 |
537 | je .8no_crop_top |
537 | je .8no_crop_top |
538 | xor eax,eax |
538 | xor eax,eax |
539 | sub eax,edx |
539 | sub eax,edx |
540 | mov ebx,buf2d_h |
540 | mov ebx,buf2d_h |
541 | sub ebx,edx |
541 | sub ebx,edx |
542 | stdcall buf_offset_h, edi, eax, edx, ebx |
542 | stdcall buf_offset_h, edi, eax, edx, ebx |
543 | mov ecx,buf2d_h |
543 | mov ecx,buf2d_h |
544 | sub ecx,edx |
544 | sub ecx,edx |
545 | mov buf2d_h,ecx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
545 | mov buf2d_h,ecx ;㬥ìè ¥¬ ¢ëá®âã ¡ãä¥à |
546 | add buf2d_t,dx ;ᤢ¨£ ¥¬ ®âáâ㯠¢¨§, ç¨á«® ®¡à¥§ ëå áâப |
546 | add buf2d_t,dx ;ᤢ¨£ ¥¬ ®âáâ㯠¢¨§, ç¨á«® ®¡à¥§ ëå áâப |
547 | mov ebx,buf2d_w |
547 | mov ebx,buf2d_w |
548 | imul ecx,ebx |
548 | imul ecx,ebx |
549 | invoke mem.realloc,buf2d_data,ecx |
549 | invoke mem.realloc,buf2d_data,ecx |
550 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
550 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
551 | .8no_crop_top: |
551 | .8no_crop_top: |
552 | 552 | ||
553 | bt dword[opt],BUF2D_BIT_OPT_CROP_RIGHT |
553 | bt dword[opt],BUF2D_BIT_OPT_CROP_RIGHT |
554 | jae .8no_crop_right |
554 | jae .8no_crop_right |
555 | mov eax,dword[color] |
555 | mov eax,dword[color] |
556 | mov ebx,buf2d_w |
556 | mov ebx,buf2d_w |
557 | cmp ebx,1 |
557 | cmp ebx,1 |
558 | jle .8no_crop_right ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
558 | jle .8no_crop_right ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
559 | mov esi,ebx |
559 | mov esi,ebx |
560 | imul esi,buf2d_h |
560 | imul esi,buf2d_h |
561 | add esi,buf2d_data ;esi - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
561 | add esi,buf2d_data ;esi - 㪠§ â¥«ì ª®¥æ ¡ãä¥à ¨§®¡à ¦¥¨ï |
562 | xor edx,edx |
562 | xor edx,edx |
563 | cld |
563 | cld |
564 | 564 | ||
565 | .8found_beg: |
565 | .8found_beg: |
566 | dec esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
566 | dec esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
567 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
567 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
568 | @@: |
568 | @@: |
569 | cmp byte[esi],al |
569 | cmp byte[esi],al |
570 | jne .8found |
570 | jne .8found |
571 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
571 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
572 | loop @b |
572 | loop @b |
573 | inc edx |
573 | inc edx |
574 | mov ecx,buf2d_w |
574 | mov ecx,buf2d_w |
575 | dec ecx ;1 ª®«®ª § ¯ á |
575 | dec ecx ;1 ª®«®ª § ¯ á |
576 | cmp edx,ecx |
576 | cmp edx,ecx |
577 | jge .8found |
577 | jge .8found |
578 | 578 | ||
579 | dec esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
579 | dec esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢«¥¢® |
580 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
580 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
581 | @@: |
581 | @@: |
582 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
582 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
583 | cmp byte[esi],al |
583 | cmp byte[esi],al |
584 | jne .8found |
584 | jne .8found |
585 | loop @b |
585 | loop @b |
586 | inc edx |
586 | inc edx |
587 | 587 | ||
588 | mov ecx,buf2d_w |
588 | mov ecx,buf2d_w |
589 | dec ecx ;1 ª®«®ª § ¯ á |
589 | dec ecx ;1 ª®«®ª § ¯ á |
590 | cmp edx,ecx |
590 | cmp edx,ecx |
591 | jl .8found_beg |
591 | jl .8found_beg |
592 | 592 | ||
593 | .8found: |
593 | .8found: |
594 | cmp edx,0 |
594 | cmp edx,0 |
595 | je .8no_crop_right |
595 | je .8no_crop_right |
596 | mov ecx,buf2d_w |
596 | mov ecx,buf2d_w |
597 | sub ecx,edx |
597 | sub ecx,edx |
598 | stdcall img_gray_crop_r, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
598 | stdcall img_gray_crop_r, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
599 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
599 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
600 | mov ebx,buf2d_h |
600 | mov ebx,buf2d_h |
601 | imul ecx,ebx |
601 | imul ecx,ebx |
602 | invoke mem.realloc,buf2d_data,ecx |
602 | invoke mem.realloc,buf2d_data,ecx |
603 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
603 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
604 | .8no_crop_right: |
604 | .8no_crop_right: |
605 | 605 | ||
606 | bt dword[opt],BUF2D_BIT_OPT_CROP_LEFT |
606 | bt dword[opt],BUF2D_BIT_OPT_CROP_LEFT |
607 | jae .8no_crop_left |
607 | jae .8no_crop_left |
608 | mov eax,dword[color] |
608 | mov eax,dword[color] |
609 | mov ebx,buf2d_w |
609 | mov ebx,buf2d_w |
610 | cmp ebx,1 |
610 | cmp ebx,1 |
611 | jle .8no_crop_left ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
611 | jle .8no_crop_left ; á«ãç © ¥á«¨ è¨à¨ ¡ãä¥à 1 ¯¨ªá¥«ì |
612 | mov esi,buf2d_data ;esi - 㪠§ ⥫ì 箫® ¡ãä¥à ¨§®¡à ¦¥¨ï |
612 | mov esi,buf2d_data ;esi - 㪠§ ⥫ì 箫® ¡ãä¥à ¨§®¡à ¦¥¨ï |
613 | mov edx,0 |
613 | mov edx,0 |
614 | cld |
614 | cld |
615 | .8found_beg_left: |
615 | .8found_beg_left: |
616 | 616 | ||
617 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
617 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
618 | @@: |
618 | @@: |
619 | cmp word[esi],ax |
619 | cmp word[esi],ax |
620 | jne .8found_left |
620 | jne .8found_left |
621 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
621 | add esi,ebx ;¯àë£ ¥¬ ¨¦îî áâபã |
622 | loop @b |
622 | loop @b |
623 | inc edx |
623 | inc edx |
624 | inc esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
624 | inc esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
625 | 625 | ||
626 | mov ecx,buf2d_w |
626 | mov ecx,buf2d_w |
627 | dec ecx ;1 ª®«®ª § ¯ á |
627 | dec ecx ;1 ª®«®ª § ¯ á |
628 | cmp edx,ecx |
628 | cmp edx,ecx |
629 | jge .8found_left |
629 | jge .8found_left |
630 | 630 | ||
631 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
631 | mov ecx,buf2d_h ;¢®ááâ ®¢«¥¨¥ ecx ¤«ï ®¢®£® 横« |
632 | @@: |
632 | @@: |
633 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
633 | sub esi,ebx ;¯àë£ ¥¬ ¢¥àåîî áâபã |
634 | cmp word[esi],ax |
634 | cmp word[esi],ax |
635 | jne .8found_left |
635 | jne .8found_left |
636 | loop @b |
636 | loop @b |
637 | inc edx |
637 | inc edx |
638 | inc esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
638 | inc esi ;¤¢¨£ ¥¬áï 1-ã ª®«®ªã ¢¯à ¢® |
639 | 639 | ||
640 | mov ecx,buf2d_w |
640 | mov ecx,buf2d_w |
641 | dec ecx ;1 ª®«®ª § ¯ á |
641 | dec ecx ;1 ª®«®ª § ¯ á |
642 | cmp edx,ecx |
642 | cmp edx,ecx |
643 | jl .8found_beg_left |
643 | jl .8found_beg_left |
644 | 644 | ||
645 | .8found_left: |
645 | .8found_left: |
646 | cmp edx,0 |
646 | cmp edx,0 |
647 | je .8no_crop_left |
647 | je .8no_crop_left |
648 | mov ecx,buf2d_w |
648 | mov ecx,buf2d_w |
649 | sub ecx,edx |
649 | sub ecx,edx |
650 | stdcall img_gray_crop_l, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
650 | stdcall img_gray_crop_l, buf2d_data, buf2d_w, ecx, buf2d_h ;®¡à¥§ ¥¬ ¡ãä¥à, ¯® ®¢®¬ã à §¬¥àã |
651 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
651 | mov buf2d_w,ecx ;áâ ¢¨¬ ®¢ãî è¨à¨ã ¤«ï ¡ãä¥à |
652 | mov ebx,buf2d_h |
652 | mov ebx,buf2d_h |
653 | imul ecx,ebx |
653 | imul ecx,ebx |
654 | invoke mem.realloc,buf2d_data,ecx |
654 | invoke mem.realloc,buf2d_data,ecx |
655 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
655 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
656 | mov eax,edx |
656 | mov eax,edx |
657 | add buf2d_l,ax |
657 | add buf2d_l,ax |
658 | .8no_crop_left: |
658 | .8no_crop_left: |
659 | 659 | ||
660 | .8end_f: |
660 | .8end_f: |
661 | 661 | ||
662 | popad |
662 | popad |
663 | ret |
663 | ret |
664 | endp |
664 | endp |
665 | 665 | ||
666 | ;®¡à¥§ ¥¬ 梥⮥ ¨§®¡à ¦¥¨¥ á ¯à ¢®© áâ®à®ë |
666 | ;®¡à¥§ ¥¬ 梥⮥ ¨§®¡à ¦¥¨¥ á ¯à ¢®© áâ®à®ë |
667 | ;input: |
667 | ;input: |
668 | ;data_rgb - pointer to rgb data |
668 | ;data_rgb - pointer to rgb data |
669 | ;size_w_old - width img in pixels |
669 | ;size_w_old - width img in pixels |
670 | ;size_w_new - new width img in pixels |
670 | ;size_w_new - new width img in pixels |
671 | ;size_h - height img in pixels |
671 | ;size_h - height img in pixels |
672 | align 4 |
672 | align 4 |
673 | proc img_rgb_crop_r, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
673 | proc img_rgb_crop_r, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
674 | pushad |
674 | pushad |
675 | mov eax, dword[size_w_old] |
675 | mov eax, dword[size_w_old] |
676 | lea eax, dword[eax+eax*2] ;eax = width(old) * 3(rgb) |
676 | lea eax, dword[eax+eax*2] ;eax = width(old) * 3(rgb) |
677 | mov ebx, dword[size_w_new] |
677 | mov ebx, dword[size_w_new] |
678 | lea ebx, dword[ebx+ebx*2] ;ebx = width(new) * 3(rgb) |
678 | lea ebx, dword[ebx+ebx*2] ;ebx = width(new) * 3(rgb) |
679 | mov edx, dword[size_h] |
679 | mov edx, dword[size_h] |
680 | mov edi, dword[data_rgb] ;edi - ¯®«ãç ¥â ¤ ë¥ |
680 | mov edi, dword[data_rgb] ;edi - ¯®«ãç ¥â ¤ ë¥ |
681 | mov esi, edi |
681 | mov esi, edi |
682 | add edi, ebx |
682 | add edi, ebx |
683 | add esi, eax |
683 | add esi, eax |
684 | cld |
684 | cld |
685 | @@: |
685 | @@: |
686 | dec edx ;㬥ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப 1 |
686 | dec edx ;㬥ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப 1 |
687 | cmp edx,0 |
687 | cmp edx,0 |
688 | jle @f |
688 | jle @f |
689 | mov ecx, ebx |
689 | mov ecx, ebx |
690 | rep movsb ;¯¥à¥®á (ª®¯¨à®¢ ¨¥) áâப¨ ¯¨ªá¥«¥© |
690 | rep movsb ;¯¥à¥®á (ª®¯¨à®¢ ¨¥) áâப¨ ¯¨ªá¥«¥© |
691 | add esi,eax ;¯¥à¥å®¤ ®¢ãî áâà®çªã ¨§®¡à ¦¥¨ï |
691 | add esi,eax ;¯¥à¥å®¤ ®¢ãî áâà®çªã ¨§®¡à ¦¥¨ï |
692 | sub esi,ebx |
692 | sub esi,ebx |
693 | jmp @b |
693 | jmp @b |
694 | @@: |
694 | @@: |
695 | popad |
695 | popad |
696 | ret |
696 | ret |
697 | endp |
697 | endp |
698 | 698 | ||
699 | ;®¡à¥§ ¥¬ á¥à®¥ ¨§®¡à ¦¥¨¥ á ¯à ¢®© áâ®à®ë |
699 | ;®¡à¥§ ¥¬ á¥à®¥ ¨§®¡à ¦¥¨¥ á ¯à ¢®© áâ®à®ë |
700 | ;input: |
700 | ;input: |
701 | ;data_gray - pointer to gray data |
701 | ;data_gray - pointer to gray data |
702 | ;size_w_old - width img in pixels |
702 | ;size_w_old - width img in pixels |
703 | ;size_w_new - new width img in pixels |
703 | ;size_w_new - new width img in pixels |
704 | ;size_h - height img in pixels |
704 | ;size_h - height img in pixels |
705 | align 4 |
705 | align 4 |
706 | proc img_gray_crop_r, data_gray:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
706 | proc img_gray_crop_r, data_gray:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
707 | pushad |
707 | pushad |
708 | mov eax, dword[size_w_old] |
708 | mov eax, dword[size_w_old] |
709 | mov ebx, dword[size_w_new] |
709 | mov ebx, dword[size_w_new] |
710 | mov edx, dword[size_h] |
710 | mov edx, dword[size_h] |
711 | mov edi, dword[data_gray] ;edi - ¯®«ãç ¥â ¤ ë¥ |
711 | mov edi, dword[data_gray] ;edi - ¯®«ãç ¥â ¤ ë¥ |
712 | mov esi, edi |
712 | mov esi, edi |
713 | add edi, ebx |
713 | add edi, ebx |
714 | add esi, eax |
714 | add esi, eax |
715 | cld |
715 | cld |
716 | @@: |
716 | @@: |
717 | dec edx ;㬥ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப 1 |
717 | dec edx ;㬥ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப 1 |
718 | cmp edx,0 |
718 | cmp edx,0 |
719 | jle @f |
719 | jle @f |
720 | mov ecx, ebx |
720 | mov ecx, ebx |
721 | rep movsb ;¯¥à¥®á (ª®¯¨à®¢ ¨¥) áâப¨ ¯¨ªá¥«¥© |
721 | rep movsb ;¯¥à¥®á (ª®¯¨à®¢ ¨¥) áâப¨ ¯¨ªá¥«¥© |
722 | add esi,eax ;¯¥à¥å®¤ ®¢ãî áâà®çªã ¨§®¡à ¦¥¨ï |
722 | add esi,eax ;¯¥à¥å®¤ ®¢ãî áâà®çªã ¨§®¡à ¦¥¨ï |
723 | sub esi,ebx |
723 | sub esi,ebx |
724 | jmp @b |
724 | jmp @b |
725 | @@: |
725 | @@: |
726 | popad |
726 | popad |
727 | ret |
727 | ret |
728 | endp |
728 | endp |
729 | 729 | ||
730 | ;®¡à¥§ ¥¬ 梥⮥ ¨§®¡à ¦¥¨¥ á «¥¢®© áâ®à®ë |
730 | ;®¡à¥§ ¥¬ 梥⮥ ¨§®¡à ¦¥¨¥ á «¥¢®© áâ®à®ë |
731 | ;input: |
731 | ;input: |
732 | ;data_rgb - pointer to rgb data |
732 | ;data_rgb - pointer to rgb data |
733 | ;size_w_old - width img in pixels |
733 | ;size_w_old - width img in pixels |
734 | ;size_w_new - new width img in pixels |
734 | ;size_w_new - new width img in pixels |
735 | ;size_h - height img in pixels |
735 | ;size_h - height img in pixels |
736 | align 4 |
736 | align 4 |
737 | proc img_rgb_crop_l, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
737 | proc img_rgb_crop_l, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
738 | pushad |
738 | pushad |
739 | mov edi,dword[data_rgb] |
739 | mov edi,dword[data_rgb] |
740 | mov esi,edi |
740 | mov esi,edi |
741 | mov eax,dword[size_w_old] |
741 | mov eax,dword[size_w_old] |
742 | mov ebx,dword[size_w_new] |
742 | mov ebx,dword[size_w_new] |
743 | cmp eax,ebx |
743 | cmp eax,ebx |
744 | jle .end_f ;áâ àë© à §¬¥à ¨§®¡à ¦¥¨ï ¥ ¬®¦¥â ¡ëâì ¬¥ìè¥ ®¢®£® (¯à¨ ãá«®¢¨¨ ®¡à¥§ ¨ï ª à⨪¨) |
744 | jle .end_f ;áâ àë© à §¬¥à ¨§®¡à ¦¥¨ï ¥ ¬®¦¥â ¡ëâì ¬¥ìè¥ ®¢®£® (¯à¨ ãá«®¢¨¨ ®¡à¥§ ¨ï ª à⨪¨) |
745 | lea eax,[eax+eax*2] |
745 | lea eax,[eax+eax*2] |
746 | lea ebx,[ebx+ebx*2] |
746 | lea ebx,[ebx+ebx*2] |
747 | sub eax,ebx |
747 | sub eax,ebx |
748 | mov edx,dword[size_h] ;¢ëá®â ¨§®¡à ¦¥¨ï |
748 | mov edx,dword[size_h] ;¢ëá®â ¨§®¡à ¦¥¨ï |
749 | cld |
749 | cld |
750 | @@: |
750 | @@: |
751 | add esi,eax |
751 | add esi,eax |
752 | mov ecx,ebx |
752 | mov ecx,ebx |
753 | rep movsb |
753 | rep movsb |
754 | dec edx |
754 | dec edx |
755 | cmp edx,0 |
755 | cmp edx,0 |
756 | jg @b |
756 | jg @b |
757 | .end_f: |
757 | .end_f: |
758 | popad |
758 | popad |
759 | ret |
759 | ret |
760 | endp |
760 | endp |
761 | 761 | ||
762 | ;®¡à¥§ ¥¬ á¥à®¥ ¨§®¡à ¦¥¨¥ á «¥¢®© áâ®à®ë |
762 | ;®¡à¥§ ¥¬ á¥à®¥ ¨§®¡à ¦¥¨¥ á «¥¢®© áâ®à®ë |
763 | ;input: |
763 | ;input: |
764 | ;data_gray - pointer to gray data |
764 | ;data_gray - pointer to gray data |
765 | ;size_w_old - width img in pixels |
765 | ;size_w_old - width img in pixels |
766 | ;size_w_new - new width img in pixels |
766 | ;size_w_new - new width img in pixels |
767 | ;size_h - height img in pixels |
767 | ;size_h - height img in pixels |
768 | align 4 |
768 | align 4 |
769 | proc img_gray_crop_l, data_gray:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
769 | proc img_gray_crop_l, data_gray:dword, size_w_old:dword, size_w_new:dword, size_h:dword |
770 | pushad |
770 | pushad |
771 | mov edi,dword[data_gray] |
771 | mov edi,dword[data_gray] |
772 | mov esi,edi |
772 | mov esi,edi |
773 | mov eax,dword[size_w_old] |
773 | mov eax,dword[size_w_old] |
774 | mov ebx,dword[size_w_new] |
774 | mov ebx,dword[size_w_new] |
775 | cmp eax,ebx |
775 | cmp eax,ebx |
776 | jle .end_f ;áâ àë© à §¬¥à ¨§®¡à ¦¥¨ï ¥ ¬®¦¥â ¡ëâì ¬¥ìè¥ ®¢®£® (¯à¨ ãá«®¢¨¨ ®¡à¥§ ¨ï ª à⨪¨) |
776 | jle .end_f ;áâ àë© à §¬¥à ¨§®¡à ¦¥¨ï ¥ ¬®¦¥â ¡ëâì ¬¥ìè¥ ®¢®£® (¯à¨ ãá«®¢¨¨ ®¡à¥§ ¨ï ª à⨪¨) |
777 | sub eax,ebx |
777 | sub eax,ebx |
778 | mov edx,dword[size_h] ;¢ëá®â ¨§®¡à ¦¥¨ï |
778 | mov edx,dword[size_h] ;¢ëá®â ¨§®¡à ¦¥¨ï |
779 | cld |
779 | cld |
780 | @@: |
780 | @@: |
781 | add esi,eax |
781 | add esi,eax |
782 | mov ecx,ebx |
782 | mov ecx,ebx |
783 | rep movsb |
783 | rep movsb |
784 | dec edx |
784 | dec edx |
785 | cmp edx,0 |
785 | cmp edx,0 |
786 | jg @b |
786 | jg @b |
787 | .end_f: |
787 | .end_f: |
788 | popad |
788 | popad |
789 | ret |
789 | ret |
790 | endp |
790 | endp |
791 | 791 | ||
792 | ;hoffs - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ª®âàë¥ ¯®¤¨¬ ¥âáï/®¯ã᪠¥âáï ¨§®¡à ¦¥¨¥ |
792 | ;hoffs - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ª®âàë¥ ¯®¤¨¬ ¥âáï/®¯ã᪠¥âáï ¨§®¡à ¦¥¨¥ |
793 | ;img_t - ¢ëá®â , á ª®â®à®© ç¨ ¥âáï ¤¢¨£ îé ïáï ç áâì ¨§®¡à ¦¥¨ï |
793 | ;img_t - ¢ëá®â , á ª®â®à®© ç¨ ¥âáï ¤¢¨£ îé ïáï ç áâì ¨§®¡à ¦¥¨ï |
794 | align 4 |
794 | align 4 |
795 | proc buf_offset_h, buf_struc:dword, hoffs:dword, img_t:dword, img_h:dword ;ᤢ¨£ ¥â ¨§®¡à ¦¥¨¥ ¯® ¢ëá®â¥ |
795 | proc buf_offset_h, buf_struc:dword, hoffs:dword, img_t:dword, img_h:dword ;ᤢ¨£ ¥â ¨§®¡à ¦¥¨¥ ¯® ¢ëá®â¥ |
796 | pushad |
796 | pushad |
797 | mov edi,dword[buf_struc] |
797 | mov edi,dword[buf_struc] |
798 | cmp buf2d_bits,24 |
798 | cmp buf2d_bits,24 |
799 | jne .end_move_24 |
799 | jne .end_move_24 |
800 | 800 | ||
801 | mov eax,[hoffs] |
801 | mov eax,[hoffs] |
802 | cmp eax,0 |
802 | cmp eax,0 |
803 | je .end_move_24 |
803 | je .end_move_24 |
804 | mov ebx,buf2d_w |
804 | mov ebx,buf2d_w |
805 | mov edx,dword[img_t] |
805 | mov edx,dword[img_t] |
806 | mov ecx,dword[img_h] ;ecx - ¢ëá®â ᤢ¨£ ¥¬ëå ¤ ëå |
806 | mov ecx,dword[img_h] ;ecx - ¢ëá®â ᤢ¨£ ¥¬ëå ¤ ëå |
807 | cmp ecx,buf2d_h |
807 | cmp ecx,buf2d_h |
808 | jge .end_f ;®è¨¡®ç®¥ ãá«®¢¨¥, ¢ëá®â ¨§®¡à ¦¥¨ï ¬¥ìè¥ ç¥¬ ¢ëá®â ᤢ¨£ ¥¬®£® ¨§®¡à ¦¥¨ï |
808 | jge .end_f ;®è¨¡®ç®¥ ãá«®¢¨¥, ¢ëá®â ¨§®¡à ¦¥¨ï ¬¥ìè¥ ç¥¬ ¢ëá®â ᤢ¨£ ¥¬®£® ¨§®¡à ¦¥¨ï |
809 | imul ecx,ebx ;ecx - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ ᤢ¨£ ¥¬ëå ¤ ëå |
809 | imul ecx,ebx ;ecx - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ ᤢ¨£ ¥¬ëå ¤ ëå |
810 | lea ecx,[ecx+ecx*2] |
810 | lea ecx,[ecx+ecx*2] |
811 | imul ebx,edx |
811 | imul ebx,edx |
812 | lea ebx,[ebx+ebx*2] |
812 | lea ebx,[ebx+ebx*2] |
813 | mov esi,buf2d_data |
813 | mov esi,buf2d_data |
814 | add esi,ebx |
814 | add esi,ebx |
815 | 815 | ||
816 | add edx,eax ;edx = img_t+hoffs (hoffs<0) |
816 | add edx,eax ;edx = img_t+hoffs (hoffs<0) |
817 | mov ebx,buf2d_w |
817 | mov ebx,buf2d_w |
818 | imul ebx,edx |
818 | imul ebx,edx |
819 | lea ebx,[ebx+ebx*2] |
819 | lea ebx,[ebx+ebx*2] |
820 | mov edi,buf2d_data ;¯®§¨æ¨ï, ªã¤ ¡ã¤¥â ¤¢¨£ âìáï ¨§®¡à ¦¥¨¥ |
820 | mov edi,buf2d_data ;¯®§¨æ¨ï, ªã¤ ¡ã¤¥â ¤¢¨£ âìáï ¨§®¡à ¦¥¨¥ |
821 | add edi,ebx |
821 | add edi,ebx |
822 | 822 | ||
823 | cmp eax,0 |
823 | cmp eax,0 |
824 | jg .move_down_24 |
824 | jg .move_down_24 |
825 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¢¥àå |
825 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¢¥àå |
826 | cld |
826 | cld |
827 | rep movsb |
827 | rep movsb |
828 | jmp .end_f |
828 | jmp .end_f |
829 | .move_down_24: |
829 | .move_down_24: |
830 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¨§ |
830 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¨§ |
831 | add esi,ecx |
831 | add esi,ecx |
832 | dec esi |
832 | dec esi |
833 | add edi,ecx |
833 | add edi,ecx |
834 | dec edi |
834 | dec edi |
835 | std |
835 | std |
836 | rep movsb |
836 | rep movsb |
837 | jmp .end_f |
837 | jmp .end_f |
838 | .end_move_24: |
838 | .end_move_24: |
839 | 839 | ||
840 | ;stdcall print_err,sz_buf2d_offset_h,txt_err_n24b |
840 | ;stdcall print_err,sz_buf2d_offset_h,txt_err_n24b |
841 | 841 | ||
842 | cmp buf2d_bits,8 |
842 | cmp buf2d_bits,8 |
843 | jne .end_move_8 |
843 | jne .end_move_8 |
844 | 844 | ||
845 | mov eax,[hoffs] |
845 | mov eax,[hoffs] |
846 | cmp eax,0 |
846 | cmp eax,0 |
847 | je .end_move_8 |
847 | je .end_move_8 |
848 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¢¥àå |
848 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¢¥àå |
849 | mov ebx,buf2d_w |
849 | mov ebx,buf2d_w |
850 | mov edx,dword[img_t] |
850 | mov edx,dword[img_t] |
851 | mov ecx,dword[img_h] ;ecx - ¢ëá®â ᤢ¨£ ¥¬ëå ¤ ëå |
851 | mov ecx,dword[img_h] ;ecx - ¢ëá®â ᤢ¨£ ¥¬ëå ¤ ëå |
852 | cmp ecx,buf2d_h |
852 | cmp ecx,buf2d_h |
853 | jge .end_f ;®è¨¡®ç®¥ ãá«®¢¨¥, ¢ëá®â ¨§®¡à ¦¥¨ï ¬¥ìè¥ ç¥¬ ¢ëá®â ᤢ¨£ ¥¬®£® ¨§®¡à ¦¥¨ï |
853 | jge .end_f ;®è¨¡®ç®¥ ãá«®¢¨¥, ¢ëá®â ¨§®¡à ¦¥¨ï ¬¥ìè¥ ç¥¬ ¢ëá®â ᤢ¨£ ¥¬®£® ¨§®¡à ¦¥¨ï |
854 | imul ecx,ebx ;ecx - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ ᤢ¨£ ¥¬ëå ¤ ëå |
854 | imul ecx,ebx ;ecx - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ ᤢ¨£ ¥¬ëå ¤ ëå |
855 | imul ebx,edx |
855 | imul ebx,edx |
856 | mov esi,buf2d_data |
856 | mov esi,buf2d_data |
857 | add esi,ebx |
857 | add esi,ebx |
858 | 858 | ||
859 | add edx,eax ;edx = img_t+hoffs (hoffs<0) |
859 | add edx,eax ;edx = img_t+hoffs (hoffs<0) |
860 | mov ebx,buf2d_w |
860 | mov ebx,buf2d_w |
861 | imul ebx,edx |
861 | imul ebx,edx |
862 | mov edi,buf2d_data ;¯®§¨æ¨ï, ªã¤ ¡ã¤¥â ¤¢¨£ âìáï ¨§®¡à ¦¥¨¥ |
862 | mov edi,buf2d_data ;¯®§¨æ¨ï, ªã¤ ¡ã¤¥â ¤¢¨£ âìáï ¨§®¡à ¦¥¨¥ |
863 | add edi,ebx |
863 | add edi,ebx |
864 | 864 | ||
865 | cmp eax,0 |
865 | cmp eax,0 |
866 | jg .move_down_8 |
866 | jg .move_down_8 |
867 | cld |
867 | cld |
868 | rep movsb |
868 | rep movsb |
869 | jmp .end_f |
869 | jmp .end_f |
870 | .move_down_8: |
870 | .move_down_8: |
871 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¨§ |
871 | ;¤¢¨£ ¥¬ ¨§®¡à ¦¥¨¥ ¢¨§ |
872 | add esi,ecx |
872 | add esi,ecx |
873 | dec esi |
873 | dec esi |
874 | add edi,ecx |
874 | add edi,ecx |
875 | dec edi |
875 | dec edi |
876 | std |
876 | std |
877 | rep movsb |
877 | rep movsb |
878 | jmp .end_f |
878 | jmp .end_f |
879 | .end_move_8: |
879 | .end_move_8: |
880 | 880 | ||
881 | .end_f: |
881 | .end_f: |
882 | popad |
882 | popad |
883 | ret |
883 | ret |
884 | endp |
884 | endp |
885 | 885 | ||
886 | 886 | ||
887 | align 4 |
887 | align 4 |
888 | proc buf_draw_buf, buf_struc:dword |
888 | proc buf_draw_buf, buf_struc:dword |
889 | pushad |
889 | pushad |
890 | mov edi,dword[buf_struc] |
890 | mov edi,dword[buf_struc] |
891 | cmp buf2d_bits,24 |
891 | cmp buf2d_bits,24 |
892 | jne .error |
892 | jne .error |
893 | mov eax,7 |
893 | mov eax,7 |
894 | mov ebx,buf2d_data |
894 | mov ebx,buf2d_data |
895 | 895 | ||
896 | mov ecx,buf2d_w |
896 | mov ecx,buf2d_w |
897 | ror ecx,16 |
897 | ror ecx,16 |
898 | mov edx,buf2d_h |
898 | mov edx,buf2d_h |
899 | mov cx,dx |
899 | mov cx,dx |
900 | 900 | ||
901 | mov edx,buf2d_size_lt |
901 | mov edx,buf2d_size_lt |
902 | ror edx,16 |
902 | ror edx,16 |
903 | int 0x40 |
903 | int 0x40 |
904 | jmp .end_draw_24 |
904 | jmp .end_draw_24 |
905 | .error: |
905 | .error: |
906 | stdcall print_err,sz_buf2d_draw,txt_err_n24b |
906 | stdcall print_err,sz_buf2d_draw,txt_err_n24b |
907 | .end_draw_24: |
907 | .end_draw_24: |
908 | popad |
908 | popad |
909 | ret |
909 | ret |
910 | endp |
910 | endp |
911 | 911 | ||
912 | align 4 |
912 | align 4 |
913 | proc buf_delete, buf_struc:dword |
913 | proc buf_delete, buf_struc:dword |
914 | push edi |
914 | push edi |
915 | mov edi,dword[buf_struc] |
915 | mov edi,dword[buf_struc] |
916 | invoke mem.free,buf2d_data |
916 | invoke mem.free,buf2d_data |
917 | pop edi |
917 | pop edi |
918 | ret |
918 | ret |
919 | endp |
919 | endp |
920 | 920 | ||
921 | align 4 |
921 | align 4 |
922 | proc buf_line_brs, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, coord_y1:dword, color:dword |
922 | proc buf_line_brs, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, coord_y1:dword, color:dword |
923 | locals |
923 | locals |
924 | loc_1 dd ? |
924 | loc_1 dd ? |
925 | loc_2 dd ? |
925 | loc_2 dd ? |
926 | napravl db ? |
926 | napravl db ? |
927 | endl |
927 | endl |
928 | pushad |
928 | pushad |
929 | mov edx,dword[color] |
929 | mov edx,dword[color] |
930 | 930 | ||
931 | mov eax,dword[coord_x1] |
931 | mov eax,dword[coord_x1] |
932 | sub eax,dword[coord_x0] |
932 | sub eax,dword[coord_x0] |
933 | bt eax,31 |
933 | bt eax,31 |
934 | jae @f |
934 | jae @f |
935 | neg eax |
935 | neg eax |
936 | inc eax |
936 | inc eax |
937 | @@: |
937 | @@: |
938 | mov ebx,dword[coord_y1] |
938 | mov ebx,dword[coord_y1] |
939 | sub ebx,dword[coord_y0] |
939 | sub ebx,dword[coord_y0] |
940 | bt ebx,31 |
940 | bt ebx,31 |
941 | jae @f |
941 | jae @f |
942 | neg ebx |
942 | neg ebx |
943 | inc ebx |
943 | inc ebx |
944 | @@: |
944 | @@: |
945 | 945 | ||
946 | mov [napravl],byte 0 ;bool steep=false |
946 | mov [napravl],byte 0 ;bool steep=false |
947 | cmp eax,ebx |
947 | cmp eax,ebx |
948 | jle @f |
948 | jle @f |
949 | mov [napravl],byte 1 ;bool steep=true |
949 | mov [napravl],byte 1 ;bool steep=true |
950 | swap dword[coord_x0],dword[coord_y0] ;swap(x0, y0); |
950 | swap dword[coord_x0],dword[coord_y0] ;swap(x0, y0); |
951 | swap dword[coord_x1],dword[coord_y1] ;swap(x1, y1); |
951 | swap dword[coord_x1],dword[coord_y1] ;swap(x1, y1); |
952 | @@: |
952 | @@: |
953 | mov eax,dword[coord_y0] ;x0 |
953 | mov eax,dword[coord_y0] ;x0 |
954 | cmp eax,dword[coord_y1] ;if(x0>x1) |
954 | cmp eax,dword[coord_y1] ;if(x0>x1) |
955 | jle @f |
955 | jle @f |
956 | swap dword[coord_y0],dword[coord_y1] ;swap(x0, x1); |
956 | swap dword[coord_y0],dword[coord_y1] ;swap(x0, x1); |
957 | swap dword[coord_x0],dword[coord_x1] ;swap(y0, y1); |
957 | swap dword[coord_x0],dword[coord_x1] ;swap(y0, y1); |
958 | @@: |
958 | @@: |
959 | 959 | ||
960 | ; int deltax esi |
960 | ; int deltax esi |
961 | ; int deltay edi |
961 | ; int deltay edi |
962 | ; int error ebp-6 |
962 | ; int error ebp-6 |
963 | ; int ystep ebp-8 |
963 | ; int ystep ebp-8 |
964 | 964 | ||
965 | mov eax,dword[coord_y0] |
965 | mov eax,dword[coord_y0] |
966 | mov esi,dword[coord_y1] |
966 | mov esi,dword[coord_y1] |
967 | sub esi,eax ;deltax = y1-y0 |
967 | sub esi,eax ;deltax = y1-y0 |
968 | mov ebx,esi |
968 | mov ebx,esi |
969 | shr ebx,1 |
969 | shr ebx,1 |
970 | mov [loc_1],ebx ;error = deltax/2 |
970 | mov [loc_1],ebx ;error = deltax/2 |
971 | 971 | ||
972 | mov eax,dword[coord_x0] |
972 | mov eax,dword[coord_x0] |
973 | mov edi,dword[coord_x1] |
973 | mov edi,dword[coord_x1] |
974 | mov [loc_2],dword -1 ;ystep = -1 |
974 | mov [loc_2],dword -1 ;ystep = -1 |
975 | cmp eax,edi ;if (x0 |
975 | cmp eax,edi ;if (x0 |
976 | jge @f |
976 | jge @f |
977 | mov [loc_2],dword 1 ;ystep = 1 |
977 | mov [loc_2],dword 1 ;ystep = 1 |
978 | @@: |
978 | @@: |
979 | sub edi,eax ;x1-x0 |
979 | sub edi,eax ;x1-x0 |
980 | 980 | ||
981 | bts edi,31 |
981 | bts edi,31 |
982 | jae @f |
982 | jae @f |
983 | neg edi |
983 | neg edi |
984 | inc edi |
984 | inc edi |
985 | @@: |
985 | @@: |
986 | and edi,0x7fffffff ;deltay = abs(x1-x0) |
986 | and edi,0x7fffffff ;deltay = abs(x1-x0) |
987 | 987 | ||
988 | mov eax,edi |
988 | mov eax,edi |
989 | mov edi,[buf_struc] |
989 | mov edi,[buf_struc] |
990 | cmp buf2d_bits,24 |
990 | cmp buf2d_bits,24 |
991 | jne .coord_end |
991 | jne .coord_end |
992 | 992 | ||
993 | cmp [napravl],0 |
993 | cmp [napravl],0 |
994 | jne .coord_yx |
994 | jne .coord_yx |
995 | mov ebx,dword[coord_x0] |
995 | mov ebx,dword[coord_x0] |
996 | mov ecx,dword[coord_y0] |
996 | mov ecx,dword[coord_y0] |
997 | 997 | ||
998 | @@: ;for (x=x0 ; x |
998 | @@: ;for (x=x0 ; x |
999 | cmp ecx,dword[coord_y1] |
999 | cmp ecx,dword[coord_y1] |
1000 | jg @f ;jge ??? |
1000 | jg @f ;jge ??? |
1001 | call draw_pixel |
1001 | call draw_pixel |
1002 | 1002 | ||
1003 | sub dword[loc_1],eax ;error -= deltay |
1003 | sub dword[loc_1],eax ;error -= deltay |
1004 | cmp dword[loc_1],0 ;if(error<0) |
1004 | cmp dword[loc_1],0 ;if(error<0) |
1005 | jge .if0 |
1005 | jge .if0 |
1006 | add ebx,[loc_2] ;y += ystep |
1006 | add ebx,[loc_2] ;y += ystep |
1007 | add [loc_1],esi ;error += deltax |
1007 | add [loc_1],esi ;error += deltax |
1008 | .if0: |
1008 | .if0: |
1009 | inc ecx |
1009 | inc ecx |
1010 | jmp @b |
1010 | jmp @b |
1011 | @@: |
1011 | @@: |
1012 | jmp .coord_end |
1012 | jmp .coord_end |
1013 | .coord_yx: |
1013 | .coord_yx: |
1014 | mov ebx,dword[coord_y0] |
1014 | mov ebx,dword[coord_y0] |
1015 | mov ecx,dword[coord_x0] |
1015 | mov ecx,dword[coord_x0] |
1016 | 1016 | ||
1017 | @@: ;for (x=x0 ; x |
1017 | @@: ;for (x=x0 ; x |
1018 | cmp ebx,dword[coord_y1] |
1018 | cmp ebx,dword[coord_y1] |
1019 | jg @f ;jge ??? |
1019 | jg @f ;jge ??? |
1020 | call draw_pixel |
1020 | call draw_pixel |
1021 | 1021 | ||
1022 | sub dword[loc_1],eax ;error -= deltay |
1022 | sub dword[loc_1],eax ;error -= deltay |
1023 | cmp dword[loc_1],0 ;if(error<0) |
1023 | cmp dword[loc_1],0 ;if(error<0) |
1024 | jge .if1 |
1024 | jge .if1 |
1025 | add ecx,[loc_2] ;y += ystep |
1025 | add ecx,[loc_2] ;y += ystep |
1026 | add [loc_1],esi ;error += deltax |
1026 | add [loc_1],esi ;error += deltax |
1027 | .if1: |
1027 | .if1: |
1028 | inc ebx |
1028 | inc ebx |
1029 | jmp @b |
1029 | jmp @b |
1030 | @@: |
1030 | @@: |
1031 | .coord_end: |
1031 | .coord_end: |
1032 | popad |
1032 | popad |
1033 | ret |
1033 | ret |
1034 | endp |
1034 | endp |
1035 | 1035 | ||
1036 | ;à¨á®¢ ¨¥ £®à¨§®â «ì®© «¨¨¨, ¯®â®¬ã ¥â ¯ à ¬¥âà coord_y1 |
1036 | ;à¨á®¢ ¨¥ £®à¨§®â «ì®© «¨¨¨, ¯®â®¬ã ¥â ¯ à ¬¥âà coord_y1 |
1037 | align 4 |
1037 | align 4 |
1038 | proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
1038 | proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
1039 | pushad |
1039 | pushad |
1040 | mov edi,[buf_struc] |
1040 | mov edi,[buf_struc] |
1041 | cmp buf2d_bits,24 |
1041 | cmp buf2d_bits,24 |
1042 | jne .end24 |
1042 | jne .end24 |
1043 | 1043 | ||
1044 | mov ebx,dword[coord_x0] |
1044 | mov ebx,dword[coord_x0] |
1045 | mov ecx,dword[coord_y0] |
1045 | mov ecx,dword[coord_y0] |
1046 | mov edx,dword[color] |
1046 | mov edx,dword[color] |
1047 | mov esi,dword[coord_x1] |
1047 | mov esi,dword[coord_x1] |
1048 | cmp ebx,esi |
1048 | cmp ebx,esi |
1049 | jle @f |
1049 | jle @f |
1050 | xchg ebx,esi ;¥á«¨ x0 > x1 â® ¬¥ï¥¬ ¬¥áâ ¬¨ x0 ¨ x1 |
1050 | xchg ebx,esi ;¥á«¨ x0 > x1 â® ¬¥ï¥¬ ¬¥áâ ¬¨ x0 ¨ x1 |
1051 | 1051 | ||
1052 | @@: ;横« ¯® ®á¨ x ®â x0 ¤® x1 |
1052 | @@: ;横« ¯® ®á¨ x ®â x0 ¤® x1 |
1053 | cmp ebx,esi |
1053 | cmp ebx,esi |
1054 | jge @f |
1054 | jge @f |
1055 | call draw_pixel |
1055 | call draw_pixel |
1056 | inc ebx |
1056 | inc ebx |
1057 | jmp @b |
1057 | jmp @b |
1058 | @@: |
1058 | @@: |
1059 | .end24: |
1059 | .end24: |
1060 | popad |
1060 | popad |
1061 | ret |
1061 | ret |
1062 | endp |
1062 | endp |
1063 | 1063 | ||
1064 | align 4 |
1064 | align 4 |
1065 | proc buf_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1065 | proc buf_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1066 | pushad |
1066 | pushad |
1067 | mov edi,[buf_struc] |
1067 | mov edi,[buf_struc] |
1068 | cmp buf2d_bits,24 |
1068 | cmp buf2d_bits,24 |
1069 | jne .coord_end |
1069 | jne .coord_end |
1070 | 1070 | ||
1071 | mov eax,[coord_x] |
1071 | mov eax,[coord_x] |
1072 | mov ebx,[coord_y] |
1072 | mov ebx,[coord_y] |
1073 | mov ecx,[w] |
1073 | mov ecx,[w] |
1074 | cmp ecx,1 |
1074 | cmp ecx,1 |
1075 | jl .coord_end |
1075 | jl .coord_end |
1076 | add ecx,eax |
1076 | add ecx,eax |
1077 | dec ecx |
1077 | dec ecx |
1078 | mov edx,[h] |
1078 | mov edx,[h] |
1079 | cmp edx,1 |
1079 | cmp edx,1 |
1080 | jl .coord_end |
1080 | jl .coord_end |
1081 | 1081 | ||
1082 | add edx,ebx |
1082 | add edx,ebx |
1083 | dec edx |
1083 | dec edx |
1084 | mov esi,dword[color] |
1084 | mov esi,dword[color] |
1085 | stdcall buf_line_h, edi, eax, ebx, ecx, esi ;«¨¨ï - |
1085 | stdcall buf_line_h, edi, eax, ebx, ecx, esi ;«¨¨ï - |
1086 | stdcall buf_line_brs, edi, eax, ebx, eax, edx, esi ;«¨¨ï | |
1086 | stdcall buf_line_brs, edi, eax, ebx, eax, edx, esi ;«¨¨ï | |
1087 | stdcall buf_line_h, edi, eax, edx, ecx, esi ;«¨¨ï - |
1087 | stdcall buf_line_h, edi, eax, edx, ecx, esi ;«¨¨ï - |
1088 | stdcall buf_line_brs, edi, ecx, ebx, ecx, edx, esi ;«¨¨ï | |
1088 | stdcall buf_line_brs, edi, ecx, ebx, ecx, edx, esi ;«¨¨ï | |
1089 | .coord_end: |
1089 | .coord_end: |
1090 | popad |
1090 | popad |
1091 | ret |
1091 | ret |
1092 | endp |
1092 | endp |
1093 | 1093 | ||
1094 | align 4 |
1094 | align 4 |
1095 | proc buf_filled_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1095 | proc buf_filled_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1096 | pushad |
1096 | pushad |
1097 | mov edi,[buf_struc] |
1097 | mov edi,[buf_struc] |
1098 | cmp buf2d_bits,24 |
1098 | cmp buf2d_bits,24 |
1099 | jne .coord_end |
1099 | jne .coord_end |
1100 | mov eax,[coord_x] |
1100 | mov eax,[coord_x] |
1101 | mov ebx,[coord_y] |
1101 | mov ebx,[coord_y] |
1102 | mov edx,[w] |
1102 | mov edx,[w] |
1103 | add edx,eax |
1103 | add edx,eax |
1104 | mov ecx,[h] |
1104 | mov ecx,[h] |
1105 | cmp ecx,1 ;áà ¢¥¨¥ á ¬¨¨¬ «ì® ¢®§¬®¦®© ¢ëá®â®© |
1105 | cmp ecx,1 ;áà ¢¥¨¥ á ¬¨¨¬ «ì® ¢®§¬®¦®© ¢ëá®â®© |
1106 | jl .coord_end ;¥á«¨ ¢ëá®â ¬¥ìè¥ 1-£® ¯¨ªá¥«ï |
1106 | jl .coord_end ;¥á«¨ ¢ëá®â ¬¥ìè¥ 1-£® ¯¨ªá¥«ï |
1107 | mov esi,dword[color] |
1107 | mov esi,dword[color] |
1108 | cld |
1108 | cld |
1109 | @@: |
1109 | @@: |
1110 | stdcall buf_line_h, edi, eax, ebx, edx, esi ;«¨¨ï - |
1110 | stdcall buf_line_h, edi, eax, ebx, edx, esi ;«¨¨ï - |
1111 | inc ebx |
1111 | inc ebx |
1112 | loop @b |
1112 | loop @b |
1113 | .coord_end: |
1113 | .coord_end: |
1114 | popad |
1114 | popad |
1115 | ret |
1115 | ret |
1116 | endp |
1116 | endp |
1117 | 1117 | ||
1118 | align 4 |
1118 | align 4 |
1119 | proc buf_circle, buf_struc:dword, coord_x:dword, coord_y:dword, r:dword, color:dword |
1119 | proc buf_circle, buf_struc:dword, coord_x:dword, coord_y:dword, r:dword, color:dword |
1120 | locals |
1120 | locals |
1121 | po_x dd ? |
1121 | po_x dd ? |
1122 | po_y dd ? |
1122 | po_y dd ? |
1123 | endl |
1123 | endl |
1124 | pushad |
1124 | pushad |
1125 | mov edi,dword[buf_struc] |
1125 | mov edi,dword[buf_struc] |
1126 | cmp buf2d_bits,24 |
1126 | cmp buf2d_bits,24 |
1127 | jne .error |
1127 | jne .error |
1128 | mov edx,dword[color] |
1128 | mov edx,dword[color] |
1129 | 1129 | ||
1130 | finit |
1130 | finit |
1131 | fild dword[coord_x] |
1131 | fild dword[coord_x] |
1132 | fild dword[coord_y] |
1132 | fild dword[coord_y] |
1133 | fild dword[r] |
1133 | fild dword[r] |
1134 | fldz ;px=0 |
1134 | fldz ;px=0 |
1135 | fld st1 ;py=r |
1135 | fld st1 ;py=r |
1136 | 1136 | ||
1137 | fldpi |
1137 | fldpi |
1138 | fmul st0,st3 |
1138 | fmul st0,st3 |
1139 | fistp dword[po_x] |
1139 | fistp dword[po_x] |
1140 | mov esi,dword[po_x] ;esi=pi*r |
1140 | mov esi,dword[po_x] ;esi=pi*r |
1141 | shl esi,1 ;esi=2*pi*r |
1141 | shl esi,1 ;esi=2*pi*r |
1142 | 1142 | ||
1143 | ;st0 = py |
1143 | ;st0 = py |
1144 | ;st1 = px |
1144 | ;st1 = px |
1145 | ;st2 = r |
1145 | ;st2 = r |
1146 | ;st3 = y |
1146 | ;st3 = y |
1147 | ;st4 = x |
1147 | ;st4 = x |
1148 | 1148 | ||
1149 | @@: |
1149 | @@: |
1150 | ;Point(px + x, y - py) |
1150 | ;Point(px + x, y - py) |
1151 | fld st1 ;st0=px |
1151 | fld st1 ;st0=px |
1152 | fadd st0,st5 ;st0=px+x |
1152 | fadd st0,st5 ;st0=px+x |
1153 | fistp dword[po_x] |
1153 | fistp dword[po_x] |
1154 | mov ebx,dword[po_x] |
1154 | mov ebx,dword[po_x] |
1155 | fld st3 ;st0=y |
1155 | fld st3 ;st0=y |
1156 | fsub st0,st1 ;st0=y-py |
1156 | fsub st0,st1 ;st0=y-py |
1157 | fistp dword[po_y] |
1157 | fistp dword[po_y] |
1158 | mov ecx,dword[po_y] |
1158 | mov ecx,dword[po_y] |
1159 | call draw_pixel |
1159 | call draw_pixel |
1160 | ;px += py/r |
1160 | ;px += py/r |
1161 | fld st0 ;st0=py |
1161 | fld st0 ;st0=py |
1162 | fdiv st0,st3 ;st0=py/r |
1162 | fdiv st0,st3 ;st0=py/r |
1163 | faddp st2,st0 ;st3+=st0 |
1163 | faddp st2,st0 ;st3+=st0 |
1164 | ;py -= px/r |
1164 | ;py -= px/r |
1165 | fld st1 ;st0=px |
1165 | fld st1 ;st0=px |
1166 | fdiv st0,st3 ;st0=px/r |
1166 | fdiv st0,st3 ;st0=px/r |
1167 | fsubp st1,st0 ;st2-=st0 |
1167 | fsubp st1,st0 ;st2-=st0 |
1168 | 1168 | ||
1169 | dec esi |
1169 | dec esi |
1170 | cmp esi,0 |
1170 | cmp esi,0 |
1171 | jge @b |
1171 | jge @b |
1172 | jmp .exit_fun |
1172 | jmp .exit_fun |
1173 | .error: |
1173 | .error: |
1174 | stdcall print_err,sz_buf2d_circle,txt_err_n24b |
1174 | stdcall print_err,sz_buf2d_circle,txt_err_n24b |
1175 | .exit_fun: |
1175 | .exit_fun: |
1176 | 1176 | ||
1177 | popad |
1177 | popad |
1178 | ret |
1178 | ret |
1179 | endp |
1179 | endp |
1180 | 1180 | ||
1181 | ;äãªæ¨ï ¤«ï § «¨¢ª¨ ®¡« á⨠¢ë¡à ë¬ æ¢¥â®¬ |
1181 | ;äãªæ¨ï ¤«ï § «¨¢ª¨ ®¡« á⨠¢ë¡à ë¬ æ¢¥â®¬ |
1182 | align 4 |
1182 | align 4 |
1183 | proc buf_flood_fill, buf_struc:dword, coord_x:dword, coord_y:dword, mode:dword, color_f:dword, color_b:dword |
1183 | proc buf_flood_fill, buf_struc:dword, coord_x:dword, coord_y:dword, mode:dword, color_f:dword, color_b:dword |
1184 | pushad |
1184 | pushad |
1185 | mov edi,[buf_struc] |
1185 | mov edi,[buf_struc] |
1186 | cmp buf2d_bits,24 |
1186 | cmp buf2d_bits,24 |
1187 | jne .end24 |
1187 | jne .end24 |
1188 | 1188 | ||
1189 | mov ebx,dword[coord_x] |
1189 | mov ebx,dword[coord_x] |
1190 | mov ecx,dword[coord_y] |
1190 | mov ecx,dword[coord_y] |
1191 | mov edx,dword[color_f] |
1191 | mov edx,dword[color_f] |
1192 | mov esi,dword[color_b] |
1192 | mov esi,dword[color_b] |
1193 | 1193 | ||
1194 | cmp dword[mode],1 ;¢ § ¢¨á¨¬®á⨠®â 'mode' ®¯à¥¤¥«ï¥¬ ª ª¨¬ «£®à¨â¬®¬ ¡ã¤¥¬ ¯®«ì§®¢ âìáï |
1194 | cmp dword[mode],1 ;¢ § ¢¨á¨¬®á⨠®â 'mode' ®¯à¥¤¥«ï¥¬ ª ª¨¬ «£®à¨â¬®¬ ¡ã¤¥¬ ¯®«ì§®¢ âìáï |
1195 | je @f |
1195 | je @f |
1196 | call buf_flood_fill_recurs_0 ;§ «¨¢ ¥¬ ¤® ¯¨ªá¥«¥© 梥â esi |
1196 | call buf_flood_fill_recurs_0 ;§ «¨¢ ¥¬ ¤® ¯¨ªá¥«¥© 梥â esi |
1197 | jmp .end24 |
1197 | jmp .end24 |
1198 | @@: |
1198 | @@: |
1199 | call buf_flood_fill_recurs_1 ;§ «¨¢ ¥¬ ¯¨ªá¥«¨ ¨¬¥î騥 梥â esi |
1199 | call buf_flood_fill_recurs_1 ;§ «¨¢ ¥¬ ¯¨ªá¥«¨ ¨¬¥î騥 梥â esi |
1200 | 1200 | ||
1201 | .end24: |
1201 | .end24: |
1202 | popad |
1202 | popad |
1203 | ret |
1203 | ret |
1204 | endp |
1204 | endp |
1205 | 1205 | ||
1206 | ;input: |
1206 | ;input: |
1207 | ; ebx = coord_x |
1207 | ; ebx = coord_x |
1208 | ; ecx = coord_y |
1208 | ; ecx = coord_y |
1209 | ; edx = 梥⠧ «¨¢ª¨ |
1209 | ; edx = 梥⠧ «¨¢ª¨ |
1210 | ; esi = æ¢¥â £à ¨æë, ¤® ª®â®à®© ¡ã¤¥â ¨â¨ § «¨¢ª |
1210 | ; esi = æ¢¥â £à ¨æë, ¤® ª®â®à®© ¡ã¤¥â ¨â¨ § «¨¢ª |
1211 | ; edi = buf_struc |
1211 | ; edi = buf_struc |
1212 | ;output: |
1212 | ;output: |
1213 | ; eax = ¯®àâ¨âáï |
1213 | ; eax = ¯®àâ¨âáï |
1214 | align 4 |
1214 | align 4 |
1215 | buf_flood_fill_recurs_0: |
1215 | buf_flood_fill_recurs_0: |
1216 | call get_pixel_24 |
1216 | call get_pixel_24 |
1217 | cmp eax,0xffffffff ;if error coords |
1217 | cmp eax,0xffffffff ;if error coords |
1218 | je .end_fun |
1218 | je .end_fun |
1219 | cmp eax,edx ;¥á«¨ 梥⠯¨ªá¥«ï ᮢ¯ « á 梥⮬ § «¨¢ª¨, § ç¨â § «¨¢ª ¢ í⮩ ®¡« á⨠㦥 ¡ë« ᤥ« |
1219 | cmp eax,edx ;¥á«¨ 梥⠯¨ªá¥«ï ᮢ¯ « á 梥⮬ § «¨¢ª¨, § ç¨â § «¨¢ª ¢ í⮩ ®¡« á⨠㦥 ¡ë« ᤥ« |
1220 | je .end_fun |
1220 | je .end_fun |
1221 | 1221 | ||
1222 | call draw_pixel |
1222 | call draw_pixel |
1223 | 1223 | ||
1224 | dec ebx |
1224 | dec ebx |
1225 | call get_pixel_24 |
1225 | call get_pixel_24 |
1226 | cmp eax,esi |
1226 | cmp eax,esi |
1227 | je @f |
1227 | je @f |
1228 | call buf_flood_fill_recurs_0 |
1228 | call buf_flood_fill_recurs_0 |
1229 | @@: |
1229 | @@: |
1230 | inc ebx |
1230 | inc ebx |
1231 | 1231 | ||
1232 | 1232 | ||
1233 | inc ebx |
1233 | inc ebx |
1234 | call get_pixel_24 |
1234 | call get_pixel_24 |
1235 | cmp eax,esi |
1235 | cmp eax,esi |
1236 | je @f |
1236 | je @f |
1237 | call buf_flood_fill_recurs_0 |
1237 | call buf_flood_fill_recurs_0 |
1238 | @@: |
1238 | @@: |
1239 | dec ebx |
1239 | dec ebx |
1240 | 1240 | ||
1241 | dec ecx |
1241 | dec ecx |
1242 | call get_pixel_24 |
1242 | call get_pixel_24 |
1243 | cmp eax,esi |
1243 | cmp eax,esi |
1244 | je @f |
1244 | je @f |
1245 | call buf_flood_fill_recurs_0 |
1245 | call buf_flood_fill_recurs_0 |
1246 | @@: |
1246 | @@: |
1247 | inc ecx |
1247 | inc ecx |
1248 | 1248 | ||
1249 | inc ecx |
1249 | inc ecx |
1250 | call get_pixel_24 |
1250 | call get_pixel_24 |
1251 | cmp eax,esi |
1251 | cmp eax,esi |
1252 | je @f |
1252 | je @f |
1253 | call buf_flood_fill_recurs_0 |
1253 | call buf_flood_fill_recurs_0 |
1254 | @@: |
1254 | @@: |
1255 | dec ecx |
1255 | dec ecx |
1256 | 1256 | ||
1257 | .end_fun: |
1257 | .end_fun: |
1258 | ret |
1258 | ret |
1259 | 1259 | ||
1260 | ;input: |
1260 | ;input: |
1261 | ; ebx = coord_x |
1261 | ; ebx = coord_x |
1262 | ; ecx = coord_y |
1262 | ; ecx = coord_y |
1263 | ; edx = 梥⠧ «¨¢ª¨ |
1263 | ; edx = 梥⠧ «¨¢ª¨ |
1264 | ; esi = 梥⠯¨ªá¥«¥©, ¯® ª®â®àë¬ ¡ã¤¥â ¨â¨ § «¨¢ª |
1264 | ; esi = 梥⠯¨ªá¥«¥©, ¯® ª®â®àë¬ ¡ã¤¥â ¨â¨ § «¨¢ª |
1265 | ; edi = buf_struc |
1265 | ; edi = buf_struc |
1266 | ;output: |
1266 | ;output: |
1267 | ; eax = ¯®àâ¨âáï |
1267 | ; eax = ¯®àâ¨âáï |
1268 | align 4 |
1268 | align 4 |
1269 | buf_flood_fill_recurs_1: |
1269 | buf_flood_fill_recurs_1: |
1270 | call get_pixel_24 |
1270 | call get_pixel_24 |
1271 | cmp eax,0xffffffff ;if error coords |
1271 | cmp eax,0xffffffff ;if error coords |
1272 | je .end_fun |
1272 | je .end_fun |
1273 | cmp eax,edx ;¥á«¨ 梥⠯¨ªá¥«ï ᮢ¯ « á 梥⮬ § «¨¢ª¨, § ç¨â § «¨¢ª ¢ í⮩ ®¡« á⨠㦥 ¡ë« ᤥ« |
1273 | cmp eax,edx ;¥á«¨ 梥⠯¨ªá¥«ï ᮢ¯ « á 梥⮬ § «¨¢ª¨, § ç¨â § «¨¢ª ¢ í⮩ ®¡« á⨠㦥 ¡ë« ᤥ« |
1274 | je .end_fun |
1274 | je .end_fun |
1275 | cmp eax,esi ;¥á«¨ 梥⠯¨ªá¥«ï ¥ ᮢ¯ « á § «¨¢ ¥¬ë¬ 梥⮬ § «¨¢ª¨, â® ¯à¥ªà é ¥¬ § «¨¢ªã |
1275 | cmp eax,esi ;¥á«¨ 梥⠯¨ªá¥«ï ¥ ᮢ¯ « á § «¨¢ ¥¬ë¬ 梥⮬ § «¨¢ª¨, â® ¯à¥ªà é ¥¬ § «¨¢ªã |
1276 | jne .end_fun |
1276 | jne .end_fun |
1277 | 1277 | ||
1278 | call draw_pixel |
1278 | call draw_pixel |
1279 | 1279 | ||
1280 | dec ebx |
1280 | dec ebx |
1281 | call get_pixel_24 |
1281 | call get_pixel_24 |
1282 | cmp eax,esi |
1282 | cmp eax,esi |
1283 | jne @f |
1283 | jne @f |
1284 | call buf_flood_fill_recurs_1 |
1284 | call buf_flood_fill_recurs_1 |
1285 | @@: |
1285 | @@: |
1286 | inc ebx |
1286 | inc ebx |
1287 | 1287 | ||
1288 | 1288 | ||
1289 | inc ebx |
1289 | inc ebx |
1290 | call get_pixel_24 |
1290 | call get_pixel_24 |
1291 | cmp eax,esi |
1291 | cmp eax,esi |
1292 | jne @f |
1292 | jne @f |
1293 | call buf_flood_fill_recurs_1 |
1293 | call buf_flood_fill_recurs_1 |
1294 | @@: |
1294 | @@: |
1295 | dec ebx |
1295 | dec ebx |
1296 | 1296 | ||
1297 | dec ecx |
1297 | dec ecx |
1298 | call get_pixel_24 |
1298 | call get_pixel_24 |
1299 | cmp eax,esi |
1299 | cmp eax,esi |
1300 | jne @f |
1300 | jne @f |
1301 | call buf_flood_fill_recurs_1 |
1301 | call buf_flood_fill_recurs_1 |
1302 | @@: |
1302 | @@: |
1303 | inc ecx |
1303 | inc ecx |
1304 | 1304 | ||
1305 | inc ecx |
1305 | inc ecx |
1306 | call get_pixel_24 |
1306 | call get_pixel_24 |
1307 | cmp eax,esi |
1307 | cmp eax,esi |
1308 | jne @f |
1308 | jne @f |
1309 | call buf_flood_fill_recurs_1 |
1309 | call buf_flood_fill_recurs_1 |
1310 | @@: |
1310 | @@: |
1311 | dec ecx |
1311 | dec ecx |
1312 | 1312 | ||
1313 | .end_fun: |
1313 | .end_fun: |
1314 | ret |
1314 | ret |
1315 | 1315 | ||
1316 | align 4 |
1316 | align 4 |
1317 | proc buf_img_wdiv2, buf_struc:dword |
1317 | proc buf_img_wdiv2, buf_struc:dword |
1318 | pushad |
1318 | pushad |
1319 | mov edi,dword[buf_struc] |
1319 | mov edi,dword[buf_struc] |
1320 | cmp buf2d_bits,24 |
1320 | cmp buf2d_bits,24 |
1321 | jne .end_draw_24 |
1321 | jne .end_draw_24 |
1322 | mov eax,buf2d_w |
1322 | mov eax,buf2d_w |
1323 | mov ecx,buf2d_h |
1323 | mov ecx,buf2d_h |
1324 | imul ecx,eax |
1324 | imul ecx,eax |
1325 | stdcall img_rgb24_wdiv2, buf2d_data,ecx |
1325 | stdcall img_rgb24_wdiv2, buf2d_data,ecx |
1326 | .end_draw_24: |
1326 | .end_draw_24: |
1327 | popad |
1327 | popad |
1328 | ret |
1328 | ret |
1329 | endp |
1329 | endp |
1330 | 1330 | ||
1331 | ;input: |
1331 | ;input: |
1332 | ;data_rgb - pointer to rgb data |
1332 | ;data_rgb - pointer to rgb data |
1333 | ;size - count img pixels (size img data / 3(rgb) ) |
1333 | ;size - count img pixels (size img data / 3(rgb) ) |
1334 | align 4 |
1334 | align 4 |
1335 | proc img_rgb24_wdiv2 data_rgb:dword, size:dword |
1335 | proc img_rgb24_wdiv2 data_rgb:dword, size:dword |
1336 | ;push eax ebx ecx edx |
1336 | ;push eax ebx ecx edx |
1337 | mov eax,dword[data_rgb] |
1337 | mov eax,dword[data_rgb] |
1338 | mov ecx,dword[size] ;ecx = size |
1338 | mov ecx,dword[size] ;ecx = size |
1339 | lea ecx,[ecx+ecx*2] |
1339 | lea ecx,[ecx+ecx*2] |
1340 | cld |
1340 | cld |
1341 | @@: ;§ ⥬¥¨¥ 梥⠯¨ªá¥«¥© |
1341 | @@: ;§ ⥬¥¨¥ 梥⠯¨ªá¥«¥© |
1342 | shr byte[eax],1 |
1342 | shr byte[eax],1 |
1343 | inc eax |
1343 | inc eax |
1344 | loop @b |
1344 | loop @b |
1345 | 1345 | ||
1346 | mov eax,dword[data_rgb] |
1346 | mov eax,dword[data_rgb] |
1347 | mov ecx,dword[size] ;ecx = size |
1347 | mov ecx,dword[size] ;ecx = size |
1348 | shr ecx,1 |
1348 | shr ecx,1 |
1349 | @@: ;á«®¦¥¨¥ 梥⮢ ¯¨ªá¥«¥© |
1349 | @@: ;á«®¦¥¨¥ 梥⮢ ¯¨ªá¥«¥© |
1350 | mov bx,word[eax+3] ;ª®¯¨à㥬 梥â á®á¥¤¥£® ¯¨ªá¥«ï |
1350 | mov bx,word[eax+3] ;ª®¯¨à㥬 梥â á®á¥¤¥£® ¯¨ªá¥«ï |
1351 | add word[eax],bx |
1351 | add word[eax],bx |
1352 | mov bl,byte[eax+5] ;ª®¯¨à㥬 梥â á®á¥¤¥£® ¯¨ªá¥«ï |
1352 | mov bl,byte[eax+5] ;ª®¯¨à㥬 梥â á®á¥¤¥£® ¯¨ªá¥«ï |
1353 | add byte[eax+2],bl |
1353 | add byte[eax+2],bl |
1354 | add eax,6 ;=2*3 |
1354 | add eax,6 ;=2*3 |
1355 | loop @b |
1355 | loop @b |
1356 | 1356 | ||
1357 | mov eax,dword[data_rgb] |
1357 | mov eax,dword[data_rgb] |
1358 | add eax,3 |
1358 | add eax,3 |
1359 | mov ebx,eax |
1359 | mov ebx,eax |
1360 | add ebx,3 |
1360 | add ebx,3 |
1361 | mov ecx,dword[size] ;ecx = size |
1361 | mov ecx,dword[size] ;ecx = size |
1362 | shr ecx,1 |
1362 | shr ecx,1 |
1363 | dec ecx ;«¨è¨© ¯¨ªá¥«ì |
1363 | dec ecx ;«¨è¨© ¯¨ªá¥«ì |
1364 | @@: ;¯®¤¦ ⨥ ¯¨ªá¥«¥© |
1364 | @@: ;¯®¤¦ ⨥ ¯¨ªá¥«¥© |
1365 | mov edx,dword[ebx] |
1365 | mov edx,dword[ebx] |
1366 | mov word[eax],dx |
1366 | mov word[eax],dx |
1367 | shr edx,16 |
1367 | shr edx,16 |
1368 | mov byte[eax+2],dl |
1368 | mov byte[eax+2],dl |
1369 | 1369 | ||
1370 | add eax,3 |
1370 | add eax,3 |
1371 | add ebx,6 |
1371 | add ebx,6 |
1372 | loop @b |
1372 | loop @b |
1373 | ;pop edx ecx ebx eax |
1373 | ;pop edx ecx ebx eax |
1374 | ret |
1374 | ret |
1375 | endp |
1375 | endp |
1376 | 1376 | ||
1377 | align 4 |
1377 | align 4 |
1378 | proc buf_img_hdiv2, buf_struc:dword |
1378 | proc buf_img_hdiv2, buf_struc:dword |
1379 | pushad |
1379 | pushad |
1380 | mov edi,dword[buf_struc] |
1380 | mov edi,dword[buf_struc] |
1381 | cmp buf2d_bits,24 |
1381 | cmp buf2d_bits,24 |
1382 | jne .end_draw_24 |
1382 | jne .end_draw_24 |
1383 | mov eax,buf2d_w |
1383 | mov eax,buf2d_w |
1384 | mov ecx,buf2d_h |
1384 | mov ecx,buf2d_h |
1385 | imul ecx,eax |
1385 | imul ecx,eax |
1386 | stdcall img_rgb24_hdiv2, buf2d_data,ecx,eax |
1386 | stdcall img_rgb24_hdiv2, buf2d_data,ecx,eax |
1387 | .end_draw_24: |
1387 | .end_draw_24: |
1388 | popad |
1388 | popad |
1389 | ret |
1389 | ret |
1390 | endp |
1390 | endp |
1391 | 1391 | ||
1392 | ;input: |
1392 | ;input: |
1393 | ;data_rgb - pointer to rgb data |
1393 | ;data_rgb - pointer to rgb data |
1394 | ;size - count img pixels (size img data / 3(rgb) ) |
1394 | ;size - count img pixels (size img data / 3(rgb) ) |
1395 | ;size_w - width img in pixels |
1395 | ;size_w - width img in pixels |
1396 | align 4 |
1396 | align 4 |
1397 | proc img_rgb24_hdiv2, data_rgb:dword, size:dword, size_w:dword |
1397 | proc img_rgb24_hdiv2, data_rgb:dword, size:dword, size_w:dword |
1398 | ;pushad |
1398 | ;pushad |
1399 | 1399 | ||
1400 | mov eax,dword[data_rgb] ;eax = |
1400 | mov eax,dword[data_rgb] ;eax = |
1401 | mov ecx,dword[size] ;ecx = size |
1401 | mov ecx,dword[size] ;ecx = size |
1402 | lea ecx,[ecx+ecx*2] |
1402 | lea ecx,[ecx+ecx*2] |
1403 | cld |
1403 | cld |
1404 | @@: ;§ ⥬¥¨¥ 梥⠯¨ªá¥«¥© |
1404 | @@: ;§ ⥬¥¨¥ 梥⠯¨ªá¥«¥© |
1405 | shr byte[eax],1 |
1405 | shr byte[eax],1 |
1406 | inc eax |
1406 | inc eax |
1407 | loop @b |
1407 | loop @b |
1408 | 1408 | ||
1409 | mov eax,dword[data_rgb] ;eax = |
1409 | mov eax,dword[data_rgb] ;eax = |
1410 | mov edi,dword[size_w] |
1410 | mov edi,dword[size_w] |
1411 | lea esi,[edi+edi*2] ;esi = width*3(rgb) |
1411 | lea esi,[edi+edi*2] ;esi = width*3(rgb) |
1412 | mov ebx,esi |
1412 | mov ebx,esi |
1413 | add ebx,eax |
1413 | add ebx,eax |
1414 | mov ecx,dword[size] ;ecx = size |
1414 | mov ecx,dword[size] ;ecx = size |
1415 | shr ecx,1 |
1415 | shr ecx,1 |
1416 | xor edi,edi |
1416 | xor edi,edi |
1417 | @@: ;á«®¦¥¨¥ 梥⮢ ¯¨ªá¥«¥© |
1417 | @@: ;á«®¦¥¨¥ 梥⮢ ¯¨ªá¥«¥© |
1418 | mov dx,word[ebx] ;ª®¯¨à㥬 梥⠨¦¥£® ¯¨ªá¥«ï |
1418 | mov dx,word[ebx] ;ª®¯¨à㥬 梥⠨¦¥£® ¯¨ªá¥«ï |
1419 | add word[eax],dx |
1419 | add word[eax],dx |
1420 | mov dl,byte[ebx+2] ;ª®¯¨à㥬 梥⠨¦¥£® ¯¨ªá¥«ï |
1420 | mov dl,byte[ebx+2] ;ª®¯¨à㥬 梥⠨¦¥£® ¯¨ªá¥«ï |
1421 | add byte[eax+2],dl |
1421 | add byte[eax+2],dl |
1422 | 1422 | ||
1423 | add eax,3 |
1423 | add eax,3 |
1424 | add ebx,3 |
1424 | add ebx,3 |
1425 | inc edi |
1425 | inc edi |
1426 | cmp edi,dword[size_w] |
1426 | cmp edi,dword[size_w] |
1427 | jl .old_line |
1427 | jl .old_line |
1428 | add eax,esi |
1428 | add eax,esi |
1429 | add ebx,esi |
1429 | add ebx,esi |
1430 | xor edi,edi |
1430 | xor edi,edi |
1431 | .old_line: |
1431 | .old_line: |
1432 | loop @b |
1432 | loop @b |
1433 | 1433 | ||
1434 | 1434 | ||
1435 | mov eax,dword[data_rgb] ;eax = |
1435 | mov eax,dword[data_rgb] ;eax = |
1436 | add eax,esi ;esi = width*3(rgb) |
1436 | add eax,esi ;esi = width*3(rgb) |
1437 | mov ebx,esi |
1437 | mov ebx,esi |
1438 | add ebx,eax |
1438 | add ebx,eax |
1439 | mov ecx,dword[size] ;ecx = size |
1439 | mov ecx,dword[size] ;ecx = size |
1440 | shr ecx,1 |
1440 | shr ecx,1 |
1441 | sub ecx,dword[size_w] ;«¨èïï áâப ¯¨ªá¥«¥© |
1441 | sub ecx,dword[size_w] ;«¨èïï áâப ¯¨ªá¥«¥© |
1442 | xor edi,edi |
1442 | xor edi,edi |
1443 | @@: ;¯®¤¦ ⨥ ¯¨ªá¥«¥© |
1443 | @@: ;¯®¤¦ ⨥ ¯¨ªá¥«¥© |
1444 | mov edx,dword[ebx] ;ª®¯¨à㥬 梥⠨¦¥£® ¯¨ªá¥«ï |
1444 | mov edx,dword[ebx] ;ª®¯¨à㥬 梥⠨¦¥£® ¯¨ªá¥«ï |
1445 | mov word[eax],dx |
1445 | mov word[eax],dx |
1446 | shr edx,16 |
1446 | shr edx,16 |
1447 | mov byte[eax+2],dl |
1447 | mov byte[eax+2],dl |
1448 | 1448 | ||
1449 | add eax,3 |
1449 | add eax,3 |
1450 | add ebx,3 |
1450 | add ebx,3 |
1451 | inc edi |
1451 | inc edi |
1452 | cmp edi,dword[size_w] |
1452 | cmp edi,dword[size_w] |
1453 | jl .old_line_2 |
1453 | jl .old_line_2 |
1454 | add ebx,esi |
1454 | add ebx,esi |
1455 | xor edi,edi |
1455 | xor edi,edi |
1456 | .old_line_2: |
1456 | .old_line_2: |
1457 | loop @b |
1457 | loop @b |
1458 | 1458 | ||
1459 | ;popad |
1459 | ;popad |
1460 | ret |
1460 | ret |
1461 | endp |
1461 | endp |
1462 | 1462 | ||
1463 | ;¯à¥®¡à §®¢ ¨¥ ¡ãä¥à ¨§ 24-¡¨â®£® ¢ 8-¡¨âë© |
1463 | ;¯à¥®¡à §®¢ ¨¥ ¡ãä¥à ¨§ 24-¡¨â®£® ¢ 8-¡¨âë© |
1464 | ; spectr - ®¯à¥¤¥«ï¥â ª ª®© ᯥªâà ¡à âì ¯à¨ ¯à¥®¡à §®¢ ¨¨ 0-ᨨ©, 1-§¥«¥ë©, 2-ªà áë© |
1464 | ; spectr - ®¯à¥¤¥«ï¥â ª ª®© ᯥªâà ¡à âì ¯à¨ ¯à¥®¡à §®¢ ¨¨ 0-ᨨ©, 1-§¥«¥ë©, 2-ªà áë© |
1465 | align 4 |
1465 | align 4 |
1466 | proc buf_conv_24_to_8, buf_struc:dword, spectr:dword |
1466 | proc buf_conv_24_to_8, buf_struc:dword, spectr:dword |
1467 | pushad |
1467 | pushad |
1468 | mov edi,dword[buf_struc] |
1468 | mov edi,dword[buf_struc] |
1469 | cmp buf2d_bits,24 |
1469 | cmp buf2d_bits,24 |
1470 | jne .error |
1470 | jne .error |
1471 | mov eax,buf2d_w |
1471 | mov eax,buf2d_w |
1472 | mov ecx,buf2d_h |
1472 | mov ecx,buf2d_h |
1473 | imul ecx,eax |
1473 | imul ecx,eax |
1474 | mov esi,ecx |
1474 | mov esi,ecx |
1475 | ;ebx - ¯ ¬ïâì ¨§ ª®â®à®© ª®¯¨àã¥âáï |
1475 | ;ebx - ¯ ¬ïâì ¨§ ª®â®à®© ª®¯¨àã¥âáï |
1476 | ;edx - ¯ ¬ïâì ªã¤ ª®¯¨àã¥âáï |
1476 | ;edx - ¯ ¬ïâì ªã¤ ª®¯¨àã¥âáï |
1477 | mov edx,buf2d_data |
1477 | mov edx,buf2d_data |
1478 | mov ebx,edx |
1478 | mov ebx,edx |
1479 | cmp [spectr],3 |
1479 | cmp [spectr],3 |
1480 | jge @f |
1480 | jge @f |
1481 | add ebx,[spectr] |
1481 | add ebx,[spectr] |
1482 | @@: |
1482 | @@: |
1483 | mov al,byte[ebx] |
1483 | mov al,byte[ebx] |
1484 | mov byte[edx],al |
1484 | mov byte[edx],al |
1485 | add ebx,3 |
1485 | add ebx,3 |
1486 | inc edx |
1486 | inc edx |
1487 | loop @b |
1487 | loop @b |
1488 | mov buf2d_bits,8 |
1488 | mov buf2d_bits,8 |
1489 | invoke mem.realloc,buf2d_data,esi ;㬥ìè ¥¬ ¯ ¬ïâì § ¨¬ ¥¬ãî ¡ãä¥à®¬ |
1489 | invoke mem.realloc,buf2d_data,esi ;㬥ìè ¥¬ ¯ ¬ïâì § ¨¬ ¥¬ãî ¡ãä¥à®¬ |
1490 | jmp .end_conv |
1490 | jmp .end_conv |
1491 | .error: |
1491 | .error: |
1492 | stdcall print_err,sz_buf2d_conv_24_to_8,txt_err_n24b |
1492 | stdcall print_err,sz_buf2d_conv_24_to_8,txt_err_n24b |
1493 | .end_conv: |
1493 | .end_conv: |
1494 | popad |
1494 | popad |
1495 | ret |
1495 | ret |
1496 | endp |
1496 | endp |
1497 | 1497 | ||
1498 | ;¯à¥®¡à §®¢ ¨¥ ¡ãä¥à ¨§ 24-¡¨â®£® ¢ 32-¡¨âë© |
1498 | ;¯à¥®¡à §®¢ ¨¥ ¡ãä¥à ¨§ 24-¡¨â®£® ¢ 32-¡¨âë© |
1499 | align 4 |
1499 | align 4 |
1500 | proc buf_conv_24_to_32, buf_struc:dword, buf_str8:dword |
1500 | proc buf_conv_24_to_32, buf_struc:dword, buf_str8:dword |
1501 | pushad |
1501 | pushad |
1502 | mov edi,dword[buf_struc] |
1502 | mov edi,dword[buf_struc] |
1503 | cmp buf2d_bits,24 |
1503 | cmp buf2d_bits,24 |
1504 | jne .error1 |
1504 | jne .error1 |
1505 | mov ecx,buf2d_w |
1505 | mov ecx,buf2d_w |
1506 | mov ebx,buf2d_h |
1506 | mov ebx,buf2d_h |
1507 | imul ebx,ecx |
1507 | imul ebx,ecx |
1508 | mov ecx,ebx ;ecx = size 8 b |
1508 | mov ecx,ebx ;ecx = size 8 b |
1509 | shl ebx,2 ;ebx = size 32 b |
1509 | shl ebx,2 ;ebx = size 32 b |
1510 | invoke mem.realloc,buf2d_data,ebx ;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì § ¨¬ ¥¬ãî ¡ãä¥à®¬ |
1510 | invoke mem.realloc,buf2d_data,ebx ;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì § ¨¬ ¥¬ãî ¡ãä¥à®¬ |
1511 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
1511 | mov buf2d_data,eax ; á«ãç © ¥á«¨ ¨§¬¥¨«áï 㪠§ â¥«ì ¤ ë¥ |
1512 | mov buf2d_bits,32 |
1512 | mov buf2d_bits,32 |
1513 | mov edx,ebx ;edx = size 32 b |
1513 | mov edx,ebx ;edx = size 32 b |
1514 | sub ebx,ecx ;ebx = size 24 b |
1514 | sub ebx,ecx ;ebx = size 24 b |
1515 | mov eax,ecx |
1515 | mov eax,ecx |
1516 | ;eax - à §¬¥à 8 ¡¨âëå ¤ ëå |
1516 | ;eax - à §¬¥à 8 ¡¨âëå ¤ ëå |
1517 | ;ebx - à §¬¥à 24 ¡¨âëå ¤ ëå |
1517 | ;ebx - à §¬¥à 24 ¡¨âëå ¤ ëå |
1518 | ;edx - à §¬¥à 32 ¡¨âëå ¤ ëå |
1518 | ;edx - à §¬¥à 32 ¡¨âëå ¤ ëå |
1519 | add ebx,buf2d_data |
1519 | add ebx,buf2d_data |
1520 | add edx,buf2d_data |
1520 | add edx,buf2d_data |
1521 | mov edi,dword[buf_str8] |
1521 | mov edi,dword[buf_str8] |
1522 | cmp buf2d_bits,8 |
1522 | cmp buf2d_bits,8 |
1523 | jne .error2 |
1523 | jne .error2 |
1524 | add eax,buf2d_data |
1524 | add eax,buf2d_data |
1525 | mov edi,edx |
1525 | mov edi,edx |
1526 | ;eax - 㪠§ â¥«ì ª®¥æ 8 ¡¨âëå ¤ ëå |
1526 | ;eax - 㪠§ â¥«ì ª®¥æ 8 ¡¨âëå ¤ ëå |
1527 | ;ebx - 㪠§ â¥«ì ª®¥æ 24 ¡¨âëå ¤ ëå |
1527 | ;ebx - 㪠§ â¥«ì ª®¥æ 24 ¡¨âëå ¤ ëå |
1528 | ;edi - 㪠§ â¥«ì ª®¥æ 32 ¡¨âëå ¤ ëå |
1528 | ;edi - 㪠§ â¥«ì ª®¥æ 32 ¡¨âëå ¤ ëå |
1529 | @@: |
1529 | @@: |
1530 | sub edi,4 ;®â¨¬ ¥¬ ¢ ç «¥ 横« , |
1530 | sub edi,4 ;®â¨¬ ¥¬ ¢ ç «¥ 横« , |
1531 | sub ebx,3 ; ¯®â®¬ã, ç⮠㪠§ ⥫¨ áâ®ïâ |
1531 | sub ebx,3 ; ¯®â®¬ã, ç⮠㪠§ ⥫¨ áâ®ïâ |
1532 | dec eax ; § ¯à¥¤¥« ¬¨ ¡ãä¥à®¢ |
1532 | dec eax ; § ¯à¥¤¥« ¬¨ ¡ãä¥à®¢ |
1533 | mov edx,dword[ebx] |
1533 | mov edx,dword[ebx] |
1534 | mov dword[edi],edx |
1534 | mov dword[edi],edx |
1535 | mov dl,byte[eax] |
1535 | mov dl,byte[eax] |
1536 | mov byte[edi+3],dl |
1536 | mov byte[edi+3],dl |
1537 | loop @b |
1537 | loop @b |
1538 | 1538 | ||
1539 | jmp .end_conv |
1539 | jmp .end_conv |
1540 | .error1: |
1540 | .error1: |
1541 | stdcall print_err,sz_buf2d_conv_24_to_32,txt_err_n24b |
1541 | stdcall print_err,sz_buf2d_conv_24_to_32,txt_err_n24b |
1542 | jmp .end_conv |
1542 | jmp .end_conv |
1543 | .error2: |
1543 | .error2: |
1544 | stdcall print_err,sz_buf2d_conv_24_to_32,txt_err_n8b |
1544 | stdcall print_err,sz_buf2d_conv_24_to_32,txt_err_n8b |
1545 | .end_conv: |
1545 | .end_conv: |
1546 | popad |
1546 | popad |
1547 | ret |
1547 | ret |
1548 | endp |
1548 | endp |
1549 | 1549 | ||
1550 | ;äãªæ¨ï ª®¯¨àã¥â ¨§®¡à ¦¥¨¥ ¨§ ¡ãä¥à buf_source (24b|32b) ¢ buf_destination (24b) |
1550 | ;äãªæ¨ï ª®¯¨àã¥â ¨§®¡à ¦¥¨¥ ¨§ ¡ãä¥à buf_source (24b|32b) ¢ buf_destination (24b) |
1551 | ; 㪠§ë¢ îâáï ª®®à¤¨ âë ¢áâ ¢ª¨ ¡ãä¥à buf_source ®â®á¨â¥«ì® buf_destination |
1551 | ; 㪠§ë¢ îâáï ª®®à¤¨ âë ¢áâ ¢ª¨ ¡ãä¥à buf_source ®â®á¨â¥«ì® buf_destination |
1552 | ; ¯à®§à ç®áâì ¯à¨ ª®¯¨à®¢ ¨¨ ¥ ãç¨âë¢ ¥âáï |
1552 | ; ¯à®§à ç®áâì ¯à¨ ª®¯¨à®¢ ¨¨ ¥ ãç¨âë¢ ¥âáï |
1553 | align 4 |
1553 | align 4 |
1554 | proc buf_bit_blt, buf_destination:dword, coord_x:dword, coord_y:dword, buf_source:dword |
1554 | proc buf_bit_blt, buf_destination:dword, coord_x:dword, coord_y:dword, buf_source:dword |
1555 | locals |
1555 | locals |
1556 | right_bytes dd ? |
1556 | right_bytes dd ? |
1557 | endl |
1557 | endl |
1558 | pushad |
1558 | pushad |
1559 | 1559 | ||
1560 | mov edi,[buf_source] |
1560 | mov edi,[buf_source] |
1561 | cmp buf2d_bits,24 |
1561 | cmp buf2d_bits,24 |
1562 | je .sou24 |
1562 | je .sou24 |
1563 | cmp buf2d_bits,32 |
1563 | cmp buf2d_bits,32 |
1564 | je .sou32 |
1564 | je .sou32 |
1565 | jmp .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1565 | jmp .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1566 | 1566 | ||
1567 | .sou24: ;¢ ¨áâ®ç¨ª¥ 24 ¡¨â ï ª à⨪ |
1567 | .sou24: ;¢ ¨áâ®ç¨ª¥ 24 ¡¨â ï ª à⨪ |
1568 | mov eax,buf2d_w |
1568 | mov eax,buf2d_w |
1569 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1569 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1570 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1570 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1571 | 1571 | ||
1572 | mov edi,[buf_destination] |
1572 | mov edi,[buf_destination] |
1573 | cmp buf2d_bits,24 |
1573 | cmp buf2d_bits,24 |
1574 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1574 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1575 | mov ebx,[coord_x] ;¢ ebx ¢à¥¬¥® áâ ¢¨¬ ®âáâ㯠¨§®¡à ¦¥¨ï (¤«ï ¯à®¢¥àª¨) |
1575 | mov ebx,[coord_x] ;¢ ebx ¢à¥¬¥® áâ ¢¨¬ ®âáâ㯠¨§®¡à ¦¥¨ï (¤«ï ¯à®¢¥àª¨) |
1576 | cmp ebx,buf2d_w ;¯à®¢¥à塞 ¢« §¨â «¨ ¨§®¡à ¦¥¨¥ ¯® è¨à¨¥ |
1576 | cmp ebx,buf2d_w ;¯à®¢¥à塞 ¢« §¨â «¨ ¨§®¡à ¦¥¨¥ ¯® è¨à¨¥ |
1577 | jge .copy_end ;¥á«¨ ¨§®¡à ¦¥¨¥ ¯®«®áâìî ¢ë« §¨â § ¯à ¢ãî áâ®à®ã |
1577 | jge .copy_end ;¥á«¨ ¨§®¡à ¦¥¨¥ ¯®«®áâìî ¢ë« §¨â § ¯à ¢ãî áâ®à®ã |
1578 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1578 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1579 | mov ecx,[coord_y] |
1579 | mov ecx,[coord_y] |
1580 | cmp ecx,ebx |
1580 | cmp ecx,ebx |
1581 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1581 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1582 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1582 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1583 | cmp ecx,ebx |
1583 | cmp ecx,ebx |
1584 | jle @f |
1584 | jle @f |
1585 | sub ecx,ebx |
1585 | sub ecx,ebx |
1586 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1586 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1587 | @@: |
1587 | @@: |
1588 | mov ebx,buf2d_w |
1588 | mov ebx,buf2d_w |
1589 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1589 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1590 | imul ecx,[coord_y] |
1590 | imul ecx,[coord_y] |
1591 | add ecx,[coord_x] |
1591 | add ecx,[coord_x] |
1592 | lea ecx,[ecx+ecx*2] |
1592 | lea ecx,[ecx+ecx*2] |
1593 | add ecx,buf2d_data |
1593 | add ecx,buf2d_data |
1594 | sub ebx,eax |
1594 | sub ebx,eax |
1595 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1595 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1596 | 1596 | ||
1597 | mov [right_bytes],0 |
1597 | mov [right_bytes],0 |
1598 | mov ecx,[coord_x] |
1598 | mov ecx,[coord_x] |
1599 | cmp ecx,ebx |
1599 | cmp ecx,ebx |
1600 | jl @f |
1600 | jl @f |
1601 | sub ecx,ebx |
1601 | sub ecx,ebx |
1602 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1602 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1603 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1603 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1604 | lea ecx,[ecx+ecx*2] ;ecx - ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1604 | lea ecx,[ecx+ecx*2] ;ecx - ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1605 | mov [right_bytes],ecx |
1605 | mov [right_bytes],ecx |
1606 | @@: |
1606 | @@: |
1607 | 1607 | ||
1608 | lea eax,[eax+eax*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1608 | lea eax,[eax+eax*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1609 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1609 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1610 | 1610 | ||
1611 | cld |
1611 | cld |
1612 | cmp [right_bytes],0 |
1612 | cmp [right_bytes],0 |
1613 | jg .copy_1 |
1613 | jg .copy_1 |
1614 | .copy_0: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1614 | .copy_0: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1615 | mov ecx,eax |
1615 | mov ecx,eax |
1616 | rep movsb |
1616 | rep movsb |
1617 | add edi,ebx |
1617 | add edi,ebx |
1618 | dec edx |
1618 | dec edx |
1619 | cmp edx,0 |
1619 | cmp edx,0 |
1620 | jg .copy_0 |
1620 | jg .copy_0 |
1621 | jmp .copy_end |
1621 | jmp .copy_end |
1622 | .copy_1: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1622 | .copy_1: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1623 | mov ecx,eax |
1623 | mov ecx,eax |
1624 | rep movsb |
1624 | rep movsb |
1625 | add edi,ebx |
1625 | add edi,ebx |
1626 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1626 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1627 | dec edx |
1627 | dec edx |
1628 | cmp edx,0 |
1628 | cmp edx,0 |
1629 | jg .copy_1 |
1629 | jg .copy_1 |
1630 | jmp .copy_end |
1630 | jmp .copy_end |
1631 | 1631 | ||
1632 | .sou32: ;¢ ¨áâ®ç¨ª¥ 32 ¡¨â ï ª à⨪ |
1632 | .sou32: ;¢ ¨áâ®ç¨ª¥ 32 ¡¨â ï ª à⨪ |
1633 | mov eax,buf2d_w |
1633 | mov eax,buf2d_w |
1634 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1634 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1635 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1635 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1636 | 1636 | ||
1637 | mov edi,[buf_destination] |
1637 | mov edi,[buf_destination] |
1638 | cmp buf2d_bits,24 |
1638 | cmp buf2d_bits,24 |
1639 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1639 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1640 | mov ebx,[coord_x] ;¢ ebx ¢à¥¬¥® áâ ¢¨¬ ®âáâ㯠¨§®¡à ¦¥¨ï (¤«ï ¯à®¢¥àª¨) |
1640 | mov ebx,[coord_x] ;¢ ebx ¢à¥¬¥® áâ ¢¨¬ ®âáâ㯠¨§®¡à ¦¥¨ï (¤«ï ¯à®¢¥àª¨) |
1641 | cmp ebx,buf2d_w ;¯à®¢¥à塞 ¢« §¨â «¨ ¨§®¡à ¦¥¨¥ ¯® è¨à¨¥ |
1641 | cmp ebx,buf2d_w ;¯à®¢¥à塞 ¢« §¨â «¨ ¨§®¡à ¦¥¨¥ ¯® è¨à¨¥ |
1642 | jge .copy_end ;¥á«¨ ¨§®¡à ¦¥¨¥ ¯®«®áâìî ¢ë« §¨â § ¯à ¢ãî áâ®à®ã |
1642 | jge .copy_end ;¥á«¨ ¨§®¡à ¦¥¨¥ ¯®«®áâìî ¢ë« §¨â § ¯à ¢ãî áâ®à®ã |
1643 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1643 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1644 | mov ecx,[coord_y] |
1644 | mov ecx,[coord_y] |
1645 | cmp ecx,ebx |
1645 | cmp ecx,ebx |
1646 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1646 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1647 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1647 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1648 | cmp ecx,ebx |
1648 | cmp ecx,ebx |
1649 | jle @f |
1649 | jle @f |
1650 | sub ecx,ebx |
1650 | sub ecx,ebx |
1651 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1651 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1652 | @@: |
1652 | @@: |
1653 | mov ebx,buf2d_w |
1653 | mov ebx,buf2d_w |
1654 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1654 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1655 | imul ecx,[coord_y] |
1655 | imul ecx,[coord_y] |
1656 | add ecx,[coord_x] |
1656 | add ecx,[coord_x] |
1657 | lea ecx,[ecx+ecx*2] |
1657 | lea ecx,[ecx+ecx*2] |
1658 | add ecx,buf2d_data |
1658 | add ecx,buf2d_data |
1659 | sub ebx,eax |
1659 | sub ebx,eax |
1660 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1660 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1661 | 1661 | ||
1662 | mov [right_bytes],0 |
1662 | mov [right_bytes],0 |
1663 | mov ecx,[coord_x] |
1663 | mov ecx,[coord_x] |
1664 | cmp ecx,ebx |
1664 | cmp ecx,ebx |
1665 | jl @f |
1665 | jl @f |
1666 | sub ecx,ebx |
1666 | sub ecx,ebx |
1667 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1667 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1668 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1668 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1669 | shl ecx,2 ;ecx - ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1669 | shl ecx,2 ;ecx - ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1670 | mov [right_bytes],ecx |
1670 | mov [right_bytes],ecx |
1671 | @@: |
1671 | @@: |
1672 | 1672 | ||
1673 | ;eax - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1673 | ;eax - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1674 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1674 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1675 | 1675 | ||
1676 | cld |
1676 | cld |
1677 | cmp [right_bytes],0 |
1677 | cmp [right_bytes],0 |
1678 | jg .copy_3 |
1678 | jg .copy_3 |
1679 | .copy_2: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1679 | .copy_2: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1680 | mov ecx,eax |
1680 | mov ecx,eax |
1681 | @@: |
1681 | @@: |
1682 | movsw |
1682 | movsw |
1683 | movsb |
1683 | movsb |
1684 | inc esi |
1684 | inc esi |
1685 | loop @b |
1685 | loop @b |
1686 | add edi,ebx |
1686 | add edi,ebx |
1687 | dec edx |
1687 | dec edx |
1688 | cmp edx,0 |
1688 | cmp edx,0 |
1689 | jg .copy_2 |
1689 | jg .copy_2 |
1690 | jmp .copy_end |
1690 | jmp .copy_end |
1691 | .copy_3: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1691 | .copy_3: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1692 | mov ecx,eax |
1692 | mov ecx,eax |
1693 | @@: |
1693 | @@: |
1694 | movsw |
1694 | movsw |
1695 | movsb |
1695 | movsb |
1696 | inc esi |
1696 | inc esi |
1697 | loop @b |
1697 | loop @b |
1698 | add edi,ebx |
1698 | add edi,ebx |
1699 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1699 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1700 | dec edx |
1700 | dec edx |
1701 | cmp edx,0 |
1701 | cmp edx,0 |
1702 | jg .copy_3 |
1702 | jg .copy_3 |
1703 | 1703 | ||
1704 | .copy_end: |
1704 | .copy_end: |
1705 | popad |
1705 | popad |
1706 | ret |
1706 | ret |
1707 | endp |
1707 | endp |
1708 | 1708 | ||
1709 | ;input: |
1709 | ;input: |
1710 | ; esi = pointer to color1 + transparent |
1710 | ; esi = pointer to color1 + transparent |
1711 | ; edi = pointer to background color2 |
1711 | ; edi = pointer to background color2 |
1712 | ;output: |
1712 | ;output: |
1713 | ; [edi] = combine color |
1713 | ; [edi] = combine color |
1714 | align 4 |
1714 | align 4 |
1715 | combine_colors: |
1715 | combine_colors: |
1716 | push ax bx cx dx |
1716 | push ax bx cx dx |
1717 | mov bx,0x00ff ;---get transparent--- |
1717 | mov bx,0x00ff ;---get transparent--- |
1718 | mov cl,byte[esi+3] ;pro |
1718 | mov cl,byte[esi+3] ;pro |
1719 | xor ch,ch |
1719 | xor ch,ch |
1720 | sub bx,cx ;256-pro |
1720 | sub bx,cx ;256-pro |
1721 | ;---blye--- |
1721 | ;---blye--- |
1722 | xor ah,ah |
1722 | xor ah,ah |
1723 | mov al,byte[esi] |
1723 | mov al,byte[esi] |
1724 | imul ax,bx |
1724 | imul ax,bx |
1725 | xor dh,dh |
1725 | xor dh,dh |
1726 | mov dl,byte[edi] |
1726 | mov dl,byte[edi] |
1727 | imul dx,cx |
1727 | imul dx,cx |
1728 | add ax,dx |
1728 | add ax,dx |
1729 | mov byte[edi],ah |
1729 | mov byte[edi],ah |
1730 | ;---green--- |
1730 | ;---green--- |
1731 | xor ah,ah |
1731 | xor ah,ah |
1732 | mov al,byte[esi+1] |
1732 | mov al,byte[esi+1] |
1733 | imul ax,bx |
1733 | imul ax,bx |
1734 | xor dh,dh |
1734 | xor dh,dh |
1735 | mov dl,byte[edi+1] |
1735 | mov dl,byte[edi+1] |
1736 | imul dx,cx |
1736 | imul dx,cx |
1737 | add ax,dx |
1737 | add ax,dx |
1738 | mov byte[edi+1],ah |
1738 | mov byte[edi+1],ah |
1739 | ;---red--- |
1739 | ;---red--- |
1740 | xor ah,ah |
1740 | xor ah,ah |
1741 | mov al,byte[esi+2] |
1741 | mov al,byte[esi+2] |
1742 | imul ax,bx |
1742 | imul ax,bx |
1743 | xor dh,dh |
1743 | xor dh,dh |
1744 | mov dl,byte[edi+2] |
1744 | mov dl,byte[edi+2] |
1745 | imul dx,cx |
1745 | imul dx,cx |
1746 | add ax,dx |
1746 | add ax,dx |
1747 | mov byte[edi+2],ah |
1747 | mov byte[edi+2],ah |
1748 | 1748 | ||
1749 | pop dx cx bx ax |
1749 | pop dx cx bx ax |
1750 | ret |
1750 | ret |
1751 | 1751 | ||
1752 | ;äãªæ¨ï ª®¯¨àã¥â ¨§®¡à ¦¥¨¥ ¨§ ¡ãä¥à buf_source (32b) ¢ buf_destination (24b) |
1752 | ;äãªæ¨ï ª®¯¨àã¥â ¨§®¡à ¦¥¨¥ ¨§ ¡ãä¥à buf_source (32b) ¢ buf_destination (24b) |
1753 | ; 㪠§ë¢ îâáï ª®®à¤¨ âë ¢áâ ¢ª¨ ¡ãä¥à buf_source ®â®á¨â¥«ì® buf_destination |
1753 | ; 㪠§ë¢ îâáï ª®®à¤¨ âë ¢áâ ¢ª¨ ¡ãä¥à buf_source ®â®á¨â¥«ì® buf_destination |
1754 | ; ¯à¨ ª®¯¨à®¢ ¨¨ ãç¨âë¢ ¥âáï ¯à®§à ç®áâì |
1754 | ; ¯à¨ ª®¯¨à®¢ ¨¨ ãç¨âë¢ ¥âáï ¯à®§à ç®áâì |
1755 | align 4 |
1755 | align 4 |
1756 | proc buf_bit_blt_transp, buf_destination:dword, coord_x:dword, coord_y:dword, buf_source:dword |
1756 | proc buf_bit_blt_transp, buf_destination:dword, coord_x:dword, coord_y:dword, buf_source:dword |
1757 | locals |
1757 | locals |
1758 | right_bytes dd ? |
1758 | right_bytes dd ? |
1759 | endl |
1759 | endl |
1760 | pushad |
1760 | pushad |
1761 | 1761 | ||
1762 | mov edi,[buf_source] |
1762 | mov edi,[buf_source] |
1763 | cmp buf2d_bits,32 |
1763 | cmp buf2d_bits,32 |
1764 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1764 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1765 | mov eax,buf2d_w |
1765 | mov eax,buf2d_w |
1766 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1766 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1767 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1767 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1768 | 1768 | ||
1769 | mov edi,[buf_destination] |
1769 | mov edi,[buf_destination] |
1770 | cmp buf2d_bits,24 |
1770 | cmp buf2d_bits,24 |
1771 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1771 | jne .copy_end ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1772 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1772 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1773 | mov ecx,[coord_y] |
1773 | mov ecx,[coord_y] |
1774 | cmp ecx,ebx |
1774 | cmp ecx,ebx |
1775 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1775 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1776 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1776 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1777 | cmp ecx,ebx |
1777 | cmp ecx,ebx |
1778 | jle @f |
1778 | jle @f |
1779 | sub ecx,ebx |
1779 | sub ecx,ebx |
1780 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1780 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1781 | @@: |
1781 | @@: |
1782 | mov ebx,buf2d_w |
1782 | mov ebx,buf2d_w |
1783 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1783 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1784 | imul ecx,[coord_y] |
1784 | imul ecx,[coord_y] |
1785 | add ecx,[coord_x] |
1785 | add ecx,[coord_x] |
1786 | lea ecx,[ecx+ecx*2] |
1786 | lea ecx,[ecx+ecx*2] |
1787 | add ecx,buf2d_data |
1787 | add ecx,buf2d_data |
1788 | sub ebx,eax |
1788 | sub ebx,eax |
1789 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1789 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1790 | 1790 | ||
1791 | mov [right_bytes],0 |
1791 | mov [right_bytes],0 |
1792 | mov ecx,[coord_x] |
1792 | mov ecx,[coord_x] |
1793 | cmp ecx,ebx |
1793 | cmp ecx,ebx |
1794 | jl @f |
1794 | jl @f |
1795 | sub ecx,ebx |
1795 | sub ecx,ebx |
1796 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1796 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1797 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1797 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1798 | shl ecx,2 ;ecx - ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1798 | shl ecx,2 ;ecx - ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1799 | mov [right_bytes],ecx |
1799 | mov [right_bytes],ecx |
1800 | @@: |
1800 | @@: |
1801 | 1801 | ||
1802 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1802 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1803 | 1803 | ||
1804 | cld |
1804 | cld |
1805 | cmp [right_bytes],0 |
1805 | cmp [right_bytes],0 |
1806 | jg .copy_1 |
1806 | jg .copy_1 |
1807 | .copy_0: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1807 | .copy_0: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1808 | mov ecx,eax |
1808 | mov ecx,eax |
1809 | @@: |
1809 | @@: |
1810 | call combine_colors |
1810 | call combine_colors |
1811 | add edi,3 |
1811 | add edi,3 |
1812 | add esi,4 |
1812 | add esi,4 |
1813 | loop @b |
1813 | loop @b |
1814 | add edi,ebx |
1814 | add edi,ebx |
1815 | dec edx |
1815 | dec edx |
1816 | cmp edx,0 |
1816 | cmp edx,0 |
1817 | jg .copy_0 |
1817 | jg .copy_0 |
1818 | jmp .copy_end |
1818 | jmp .copy_end |
1819 | .copy_1: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1819 | .copy_1: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1820 | mov ecx,eax |
1820 | mov ecx,eax |
1821 | @@: |
1821 | @@: |
1822 | call combine_colors |
1822 | call combine_colors |
1823 | add edi,3 |
1823 | add edi,3 |
1824 | add esi,4 |
1824 | add esi,4 |
1825 | loop @b |
1825 | loop @b |
1826 | add edi,ebx |
1826 | add edi,ebx |
1827 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1827 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1828 | dec edx |
1828 | dec edx |
1829 | cmp edx,0 |
1829 | cmp edx,0 |
1830 | jg .copy_1 |
1830 | jg .copy_1 |
1831 | 1831 | ||
1832 | .copy_end: |
1832 | .copy_end: |
1833 | popad |
1833 | popad |
1834 | ret |
1834 | ret |
1835 | endp |
1835 | endp |
1836 | 1836 | ||
1837 | ;input: |
1837 | ;input: |
1838 | ; ebx - color1 |
1838 | ; ebx - color1 |
1839 | ; esi = pointer to transparent |
1839 | ; esi = pointer to transparent |
1840 | ; edi = pointer to background color2 |
1840 | ; edi = pointer to background color2 |
1841 | ;output: |
1841 | ;output: |
1842 | ; [edi] = combine color |
1842 | ; [edi] = combine color |
1843 | align 4 |
1843 | align 4 |
1844 | combine_colors_2: |
1844 | combine_colors_2: |
1845 | push ax ebx cx dx si |
1845 | push ax ebx cx dx si |
1846 | mov cl,byte[esi] ;pro |
1846 | mov cl,byte[esi] ;pro |
1847 | xor ch,ch |
1847 | xor ch,ch |
1848 | mov si,0x00ff ;---get transparent--- |
1848 | mov si,0x00ff ;---get transparent--- |
1849 | sub si,cx ;256-pro |
1849 | sub si,cx ;256-pro |
1850 | 1850 | ||
1851 | ;---blye--- |
1851 | ;---blye--- |
1852 | mov al,bl |
1852 | mov al,bl |
1853 | xor ah,ah |
1853 | xor ah,ah |
1854 | shr ebx,8 |
1854 | shr ebx,8 |
1855 | imul ax,si |
1855 | imul ax,si |
1856 | xor dh,dh |
1856 | xor dh,dh |
1857 | mov dl,byte[edi] |
1857 | mov dl,byte[edi] |
1858 | imul dx,cx |
1858 | imul dx,cx |
1859 | add ax,dx |
1859 | add ax,dx |
1860 | mov byte[edi],ah |
1860 | mov byte[edi],ah |
1861 | ;---green--- |
1861 | ;---green--- |
1862 | mov al,bl |
1862 | mov al,bl |
1863 | xor ah,ah |
1863 | xor ah,ah |
1864 | shr ebx,8 |
1864 | shr ebx,8 |
1865 | imul ax,si |
1865 | imul ax,si |
1866 | xor dh,dh |
1866 | xor dh,dh |
1867 | mov dl,byte[edi+1] |
1867 | mov dl,byte[edi+1] |
1868 | imul dx,cx |
1868 | imul dx,cx |
1869 | add ax,dx |
1869 | add ax,dx |
1870 | mov byte[edi+1],ah |
1870 | mov byte[edi+1],ah |
1871 | ;---red--- |
1871 | ;---red--- |
1872 | mov al,bl |
1872 | mov al,bl |
1873 | xor ah,ah |
1873 | xor ah,ah |
1874 | imul ax,si |
1874 | imul ax,si |
1875 | xor dh,dh |
1875 | xor dh,dh |
1876 | mov dl,byte[edi+2] |
1876 | mov dl,byte[edi+2] |
1877 | imul dx,cx |
1877 | imul dx,cx |
1878 | add ax,dx |
1878 | add ax,dx |
1879 | mov byte[edi+2],ah |
1879 | mov byte[edi+2],ah |
1880 | 1880 | ||
1881 | pop si dx cx ebx ax |
1881 | pop si dx cx ebx ax |
1882 | ret |
1882 | ret |
1883 | 1883 | ||
1884 | ;äãªæ¨ï ª®¯¨àã¥â ¨§®¡à ¦¥¨¥ ¨§ ¡ãä¥à buf_source (8b) ¢ buf_destination (24b) |
1884 | ;äãªæ¨ï ª®¯¨àã¥â ¨§®¡à ¦¥¨¥ ¨§ ¡ãä¥à buf_source (8b) ¢ buf_destination (24b) |
1885 | ; 㪠§ë¢ îâáï ª®®à¤¨ âë ¢áâ ¢ª¨ ¡ãä¥à buf_source ®â®á¨â¥«ì® buf_destination |
1885 | ; 㪠§ë¢ îâáï ª®®à¤¨ âë ¢áâ ¢ª¨ ¡ãä¥à buf_source ®â®á¨â¥«ì® buf_destination |
1886 | align 4 |
1886 | align 4 |
1887 | proc buf_bit_blt_alpha, buf_destination:dword, coord_x:dword, coord_y:dword, buf_source:dword, color:dword |
1887 | proc buf_bit_blt_alpha, buf_destination:dword, coord_x:dword, coord_y:dword, buf_source:dword, color:dword |
1888 | locals |
1888 | locals |
1889 | right_bytes dd ? |
1889 | right_bytes dd ? |
1890 | dest_w_bytes dd ? ;ª®««¨ç¥á⢮ ¡ ©â ¢ ¡ãä¥à¥ ¯à¨¥¬¨ª¥ ¯® è¨à¨¥ - è¨à¨ ¢áâ ¢«ï¥¬®© ª à⨪¨ |
1890 | dest_w_bytes dd ? ;ª®««¨ç¥á⢮ ¡ ©â ¢ ¡ãä¥à¥ ¯à¨¥¬¨ª¥ ¯® è¨à¨¥ - è¨à¨ ¢áâ ¢«ï¥¬®© ª à⨪¨ |
1891 | endl |
1891 | endl |
1892 | pushad |
1892 | pushad |
1893 | 1893 | ||
1894 | mov edi,[buf_source] |
1894 | mov edi,[buf_source] |
1895 | cmp buf2d_bits,8 |
1895 | cmp buf2d_bits,8 |
1896 | jne .error1 ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1896 | jne .error1 ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1897 | mov eax,buf2d_w |
1897 | mov eax,buf2d_w |
1898 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1898 | mov edx,buf2d_h ;¢ëá®â ª®¯¨à㥬®© ª à⨪¨ |
1899 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1899 | mov esi,buf2d_data ;¤ ë¥ ª®¯¨à㥬®© ª à⨪¨ |
1900 | 1900 | ||
1901 | mov edi,[buf_destination] |
1901 | mov edi,[buf_destination] |
1902 | cmp buf2d_bits,24 |
1902 | cmp buf2d_bits,24 |
1903 | jne .error2 ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1903 | jne .error2 ;ä®à¬ â ¡ãä¥à ¥ ¯®®¤¥à¦¨¢ ¥âáï |
1904 | mov ebx,[coord_x] ;¢ ebx ¢à¥¬¥® áâ ¢¨¬ ®âáâ㯠¨§®¡à ¦¥¨ï (¤«ï ¯à®¢¥àª¨) |
1904 | mov ebx,[coord_x] ;¢ ebx ¢à¥¬¥® áâ ¢¨¬ ®âáâ㯠¨§®¡à ¦¥¨ï (¤«ï ¯à®¢¥àª¨) |
1905 | cmp ebx,buf2d_w ;¯à®¢¥à塞 ¢« §¨â «¨ ¨§®¡à ¦¥¨¥ ¯® è¨à¨¥ |
1905 | cmp ebx,buf2d_w ;¯à®¢¥à塞 ¢« §¨â «¨ ¨§®¡à ¦¥¨¥ ¯® è¨à¨¥ |
1906 | jge .copy_end ;¥á«¨ ¨§®¡à ¦¥¨¥ ¯®«®áâìî ¢ë« §¨â § ¯à ¢ãî áâ®à®ã |
1906 | jge .copy_end ;¥á«¨ ¨§®¡à ¦¥¨¥ ¯®«®áâìî ¢ë« §¨â § ¯à ¢ãî áâ®à®ã |
1907 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1907 | mov ebx,buf2d_h ;ebx - ¢ëá®â ®á®¢®£® ¡ãä¥à |
1908 | mov ecx,[coord_y] |
1908 | mov ecx,[coord_y] |
1909 | cmp ecx,ebx |
1909 | cmp ecx,ebx |
1910 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1910 | jge .copy_end ;¥á«¨ ª®®à¤¨ â 'y' ¡®«ìè¥ ¢ëá®âë ¡ãä¥à |
1911 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1911 | add ecx,edx ;ecx - ¨¦ïï ª®®à¤¨ â ª®¯¨à㥬®© ª à⨪¨ |
1912 | cmp ecx,ebx |
1912 | cmp ecx,ebx |
1913 | jle @f |
1913 | jle @f |
1914 | sub ecx,ebx |
1914 | sub ecx,ebx |
1915 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1915 | sub edx,ecx ;㬥ìè ¥¬ ¢ëá®âã ª®¯¨à㥬®© ª à⨪¨, ¢ á«ãç¥ ª®£¤ ® ¢ë« §¨â § ¨¦îî £à ¨æã |
1916 | @@: |
1916 | @@: |
1917 | mov ebx,buf2d_w |
1917 | mov ebx,buf2d_w |
1918 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1918 | mov ecx,ebx ;ecx ¨á¯®«ì§ã¥¬ ¤«ï ¢à¥¬¥ëå 楫¥© |
1919 | imul ecx,[coord_y] |
1919 | imul ecx,[coord_y] |
1920 | add ecx,[coord_x] |
1920 | add ecx,[coord_x] |
1921 | lea ecx,[ecx+ecx*2] |
1921 | lea ecx,[ecx+ecx*2] |
1922 | add ecx,buf2d_data |
1922 | add ecx,buf2d_data |
1923 | sub ebx,eax |
1923 | sub ebx,eax |
1924 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1924 | mov edi,ecx ;edi 㪠§ â¥«ì ¤ ë¥ ¡ãä¥à , ªã¤ ¡ã¤¥â ¯à®¨§¢®¤¨âáï ª®¯¨à®¢ ¨¥ |
1925 | 1925 | ||
1926 | mov [right_bytes],0 |
1926 | mov [right_bytes],0 |
1927 | mov ecx,[coord_x] |
1927 | mov ecx,[coord_x] |
1928 | cmp ecx,ebx |
1928 | cmp ecx,ebx |
1929 | jl @f |
1929 | jl @f |
1930 | sub ecx,ebx |
1930 | sub ecx,ebx |
1931 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1931 | sub eax,ecx ;㪮à 稢 ¥¬ ª®¯¨à㥬ãî áâபã |
1932 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1932 | add ebx,ecx ;㤫¨ï¥¬ áâப㠤«ï ᤢ¨£ £« ¢®© ª à⨪¨ ¡ãä¥à |
1933 | ;ecx - ç¨á«® ¯¨ªá¥«¥© ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1933 | ;ecx - ç¨á«® ¯¨ªá¥«¥© ¢ 1-© áâப¥ ª à⨪¨, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî áâ®à®ã |
1934 | mov [right_bytes],ecx |
1934 | mov [right_bytes],ecx |
1935 | @@: |
1935 | @@: |
1936 | 1936 | ||
1937 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1937 | lea ebx,[ebx+ebx*2] ;ª®««¨ç¥á⢮ ¡ ©â ¢ 1-© áâப¥ ¡ãä¥à ¬¨ãá ç¨á«® ¡ ©â ¢ 1-© áâப¥ ª®¯¨à㥬®© ª à⨪¨ |
1938 | mov [dest_w_bytes],ebx |
1938 | mov [dest_w_bytes],ebx |
1939 | mov ebx,[color] |
1939 | mov ebx,[color] |
1940 | 1940 | ||
1941 | cld |
1941 | cld |
1942 | cmp [right_bytes],0 |
1942 | cmp [right_bytes],0 |
1943 | jg .copy_1 |
1943 | jg .copy_1 |
1944 | .copy_0: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1944 | .copy_0: ;¯à®á⮥ ª®¯¨à®¢ ¨¥ |
1945 | mov ecx,eax |
1945 | mov ecx,eax |
1946 | @@: |
1946 | @@: |
1947 | call combine_colors_2 |
1947 | call combine_colors_2 |
1948 | add edi,3 |
1948 | add edi,3 |
1949 | inc esi |
1949 | inc esi |
1950 | loop @b |
1950 | loop @b |
1951 | add edi,[dest_w_bytes] |
1951 | add edi,[dest_w_bytes] |
1952 | dec edx |
1952 | dec edx |
1953 | cmp edx,0 |
1953 | cmp edx,0 |
1954 | jg .copy_0 |
1954 | jg .copy_0 |
1955 | jmp .copy_end |
1955 | jmp .copy_end |
1956 | .copy_1: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1956 | .copy_1: ;¥ ¯à®á⮥ ª®¯¨à®¢ ¨¥ (ª à⨪ ¢ë« §¨â § ¯à ¢ãî áâ®à®ã) |
1957 | mov ecx,eax |
1957 | mov ecx,eax |
1958 | @@: |
1958 | @@: |
1959 | call combine_colors_2 |
1959 | call combine_colors_2 |
1960 | add edi,3 |
1960 | add edi,3 |
1961 | inc esi |
1961 | inc esi |
1962 | loop @b |
1962 | loop @b |
1963 | add edi,[dest_w_bytes] |
1963 | add edi,[dest_w_bytes] |
1964 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1964 | add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ § ¯à ¢ãî £à ¨æã |
1965 | dec edx |
1965 | dec edx |
1966 | cmp edx,0 |
1966 | cmp edx,0 |
1967 | jg .copy_1 |
1967 | jg .copy_1 |
1968 | 1968 | ||
1969 | jmp .copy_end |
1969 | jmp .copy_end |
1970 | .error1: |
1970 | .error1: |
1971 | stdcall print_err,sz_buf2d_bit_blt_alpha,txt_err_n8b |
1971 | stdcall print_err,sz_buf2d_bit_blt_alpha,txt_err_n8b |
1972 | jmp .copy_end |
1972 | jmp .copy_end |
1973 | .error2: |
1973 | .error2: |
1974 | stdcall print_err,sz_buf2d_bit_blt_alpha,txt_err_n24b |
1974 | stdcall print_err,sz_buf2d_bit_blt_alpha,txt_err_n24b |
1975 | .copy_end: |
1975 | .copy_end: |
1976 | popad |
1976 | popad |
1977 | ret |
1977 | ret |
1978 | endp |
1978 | endp |
1979 | 1979 | ||
1980 | ;¯à¥®¡à §®¢ ¨¥ 8-¡¨â®£® ¡ãä¥à à §¬¥à®¬ 16*16 ¢ à §¬¥à 1*256 ᨬ¢®«®¢ |
1980 | ;¯à¥®¡à §®¢ ¨¥ 8-¡¨â®£® ¡ãä¥à à §¬¥à®¬ 16*16 ¢ à §¬¥à 1*256 ᨬ¢®«®¢ |
1981 | align 4 |
1981 | align 4 |
1982 | proc buf_convert_text_matrix, buf_struc:dword |
1982 | proc buf_convert_text_matrix, buf_struc:dword |
1983 | locals |
1983 | locals |
1984 | tmp_mem dd ? |
1984 | tmp_mem dd ? |
1985 | c1 dw ? |
1985 | c1 dw ? |
1986 | c2 dd ? |
1986 | c2 dd ? |
1987 | c3 dw ? |
1987 | c3 dw ? |
1988 | endl |
1988 | endl |
1989 | pushad |
1989 | pushad |
1990 | mov edi,dword[buf_struc] |
1990 | mov edi,dword[buf_struc] |
1991 | cmp buf2d_bits,8 |
1991 | cmp buf2d_bits,8 |
1992 | jne .error |
1992 | jne .error |
1993 | mov ecx,buf2d_h |
1993 | mov ecx,buf2d_h |
1994 | mov ebx,ecx |
1994 | mov ebx,ecx |
1995 | shr ebx,4 ;¯à¥¤¯®« £ ¥¬ çâ® ¢ ¡ãä¥à¥ 16 áâப á ᨬ¢®« ¬¨, ¯®â®¬ã ¤¥«¨¬ 2^4 |
1995 | shr ebx,4 ;¯à¥¤¯®« £ ¥¬ çâ® ¢ ¡ãä¥à¥ 16 áâப á ᨬ¢®« ¬¨, ¯®â®¬ã ¤¥«¨¬ 2^4 |
1996 | mov edx,buf2d_w |
1996 | mov edx,buf2d_w |
1997 | imul ecx,edx ;ecx = size 8 b |
1997 | imul ecx,edx ;ecx = size 8 b |
1998 | invoke mem.alloc,ecx ;¢ë¤¥«ï¥¬ ¢à¥¬¥ãî ¯ ¬ïâì |
1998 | invoke mem.alloc,ecx ;¢ë¤¥«ï¥¬ ¢à¥¬¥ãî ¯ ¬ïâì |
1999 | mov [tmp_mem],eax ;eax - new memory |
1999 | mov [tmp_mem],eax ;eax - new memory |
2000 | 2000 | ||
2001 | shr edx,4 ;¯à¥¤¯®« £ ¥¬ çâ® ¢ ¡ãä¥à¥ 16 ª®«®®ª á ᨬ¢®« ¬¨, ¯®â®¬ã ¤¥«¨¬ 2^4 |
2001 | shr edx,4 ;¯à¥¤¯®« £ ¥¬ çâ® ¢ ¡ãä¥à¥ 16 ª®«®®ª á ᨬ¢®« ¬¨, ¯®â®¬ã ¤¥«¨¬ 2^4 |
2002 | mov eax,ebx |
2002 | mov eax,ebx |
2003 | imul ebx,edx ;¢ëç¨á«ï¥¬ ª®®«¨ç¥á⢮ ¯¨ªá¥«¥© 1 ᨬ¢®« |
2003 | imul ebx,edx ;¢ëç¨á«ï¥¬ ª®®«¨ç¥á⢮ ¯¨ªá¥«¥© 1 ᨬ¢®« |
2004 | ;eax = bhe - ¢ëá®â ¡ãª¢ë |
2004 | ;eax = bhe - ¢ëá®â ¡ãª¢ë |
2005 | ;ebx = bwi*bhe - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ 1-© ¡ãª¢¥ |
2005 | ;ebx = bwi*bhe - ª®««¨ç¥á⢮ ¯¨ªá¥«¥© ¢ 1-© ¡ãª¢¥ |
2006 | ;edx = bwi - è¨à¨ ¡ãª¢ë |
2006 | ;edx = bwi - è¨à¨ ¡ãª¢ë |
2007 | ;ecx,esi,edi - ¨á¯®«ì§ãîâáï ¢ 横«¥ .c_0 |
2007 | ;ecx,esi,edi - ¨á¯®«ì§ãîâáï ¢ 横«¥ .c_0 |
2008 | shr buf2d_w,4 |
2008 | shr buf2d_w,4 |
2009 | shl buf2d_h,4 ;¯à¥®¡à §®¢ë¢ ¥¬ à §¬¥àë ¡ãä¥à |
2009 | shl buf2d_h,4 ;¯à¥®¡à §®¢ë¢ ¥¬ à §¬¥àë ¡ãä¥à |
2010 | 2010 | ||
2011 | cld |
2011 | cld |
2012 | mov esi,buf2d_data |
2012 | mov esi,buf2d_data |
2013 | mov edi,[tmp_mem] |
2013 | mov edi,[tmp_mem] |
2014 | mov word[c3],16 |
2014 | mov word[c3],16 |
2015 | .c_3: |
2015 | .c_3: |
2016 | mov dword[c2],eax |
2016 | mov dword[c2],eax |
2017 | .c_2: |
2017 | .c_2: |
2018 | mov word[c1],16 |
2018 | mov word[c1],16 |
2019 | .c_1: |
2019 | .c_1: |
2020 | mov ecx,edx ;.c_0: |
2020 | mov ecx,edx ;.c_0: |
2021 | rep movsb |
2021 | rep movsb |
2022 | add edi,ebx |
2022 | add edi,ebx |
2023 | sub edi,edx ;edi+=(bwi*bhe-bwi) |
2023 | sub edi,edx ;edi+=(bwi*bhe-bwi) |
2024 | dec word[c1] |
2024 | dec word[c1] |
2025 | cmp word[c1],0 |
2025 | cmp word[c1],0 |
2026 | jg .c_1 |
2026 | jg .c_1 |
2027 | add edi,edx |
2027 | add edi,edx |
2028 | shl ebx,4 |
2028 | shl ebx,4 |
2029 | sub edi,ebx ;edi-=(16*bwi*bhe-bwi) |
2029 | sub edi,ebx ;edi-=(16*bwi*bhe-bwi) |
2030 | shr ebx,4 |
2030 | shr ebx,4 |
2031 | dec dword[c2] |
2031 | dec dword[c2] |
2032 | cmp dword[c2],0 |
2032 | cmp dword[c2],0 |
2033 | jg .c_2 |
2033 | jg .c_2 |
2034 | sub edi,ebx |
2034 | sub edi,ebx |
2035 | shl ebx,4 |
2035 | shl ebx,4 |
2036 | add edi,ebx ;edi+=(15*bwi*bhe) |
2036 | add edi,ebx ;edi+=(15*bwi*bhe) |
2037 | shr ebx,4 |
2037 | shr ebx,4 |
2038 | dec word[c3] |
2038 | dec word[c3] |
2039 | cmp word[c3],0 |
2039 | cmp word[c3],0 |
2040 | jg .c_3 |
2040 | jg .c_3 |
2041 | 2041 | ||
2042 | mov edi,dword[buf_struc] ;ª®¯¨à®¢ ¨¥ ®¢®© ¬ âà¨æë ¢ ®á®¢®© ¡ãä¥à |
2042 | mov edi,dword[buf_struc] ;ª®¯¨à®¢ ¨¥ ®¢®© ¬ âà¨æë ¢ ®á®¢®© ¡ãä¥à |
2043 | mov edi,buf2d_data |
2043 | mov edi,buf2d_data |
2044 | mov esi,[tmp_mem] |
2044 | mov esi,[tmp_mem] |
2045 | mov ecx,ebx |
2045 | mov ecx,ebx |
2046 | shl ecx,8 |
2046 | shl ecx,8 |
2047 | rep movsb |
2047 | rep movsb |
2048 | invoke mem.free,[tmp_mem] ;ç¨á⨬ ¢à¥¬¥ãî ¯ ¬ïâì |
2048 | invoke mem.free,[tmp_mem] ;ç¨á⨬ ¢à¥¬¥ãî ¯ ¬ïâì |
2049 | jmp .end_conv |
2049 | jmp .end_conv |
2050 | .error: |
2050 | .error: |
2051 | stdcall print_err,sz_buf2d_convert_text_matrix,txt_err_n8b |
2051 | stdcall print_err,sz_buf2d_convert_text_matrix,txt_err_n8b |
2052 | .end_conv: |
2052 | .end_conv: |
2053 | popad |
2053 | popad |
2054 | ret |
2054 | ret |
2055 | endp |
2055 | endp |
2056 | 2056 | ||
2057 | align 4 |
2057 | align 4 |
2058 | buf_s_matr buf_2d_header ? ;«®ª «ì ï ¬ âà¨æ ᨬ¢®« |
2058 | buf_s_matr buf_2d_header ? ;«®ª «ì ï ¬ âà¨æ ᨬ¢®« |
2059 | 2059 | ||
2060 | align 4 |
2060 | align 4 |
2061 | proc buf_draw_text, buf_struc:dword, buf_t_matr:dword, text:dword, coord_x:dword, coord_y:dword, color:dword |
2061 | proc buf_draw_text, buf_struc:dword, buf_t_matr:dword, text:dword, coord_x:dword, coord_y:dword, color:dword |
2062 | locals |
2062 | locals |
2063 | buf_t_matr_offs dd ? |
2063 | buf_t_matr_offs dd ? |
2064 | endl |
2064 | endl |
2065 | pushad |
2065 | pushad |
2066 | mov edi,dword[buf_struc] |
2066 | mov edi,dword[buf_struc] |
2067 | cmp buf2d_bits,24 |
2067 | cmp buf2d_bits,24 |
2068 | jne .error2 |
2068 | jne .error2 |
2069 | mov edi,dword[buf_t_matr] |
2069 | mov edi,dword[buf_t_matr] |
2070 | cmp buf2d_bits,8 |
2070 | cmp buf2d_bits,8 |
2071 | jne .error1 |
2071 | jne .error1 |
2072 | mov edx,buf2d_data |
2072 | mov edx,buf2d_data |
2073 | mov [buf_t_matr_offs],edx |
2073 | mov [buf_t_matr_offs],edx |
2074 | mov ecx,BUF_STRUCT_SIZE ;ª®¯¨à㥬 áâàãªâãàã ⥪á⮢®© ¬ âà¨æë |
2074 | mov ecx,BUF_STRUCT_SIZE ;ª®¯¨à㥬 áâàãªâãàã ⥪á⮢®© ¬ âà¨æë |
2075 | mov esi,edi |
2075 | mov esi,edi |
2076 | lea edi,[buf_s_matr] |
2076 | lea edi,[buf_s_matr] |
2077 | cld |
2077 | cld |
2078 | rep movsb |
2078 | rep movsb |
2079 | lea edi,[buf_s_matr] |
2079 | lea edi,[buf_s_matr] |
2080 | shr buf2d_h,8 ;¤¥«¨¬ ¢ëá®âã ᨬ¢®«ì®£® ¡ãä¥à 256, ¤«ï 宦¤¥¨ï ¢ëá®âë 1-£® ᨬ¢®« |
2080 | shr buf2d_h,8 ;¤¥«¨¬ ¢ëá®âã ᨬ¢®«ì®£® ¡ãä¥à 256, ¤«ï 宦¤¥¨ï ¢ëá®âë 1-£® ᨬ¢®« |
2081 | mov ebx,buf2d_h ;¡¥à¥¬ ¢ëá®âã ᨬ¢®« |
2081 | mov ebx,buf2d_h ;¡¥à¥¬ ¢ëá®âã ᨬ¢®« |
2082 | mov ecx,buf2d_w ;¡¥à¥¬ è¨à¨ã ᨬ¢®« |
2082 | mov ecx,buf2d_w ;¡¥à¥¬ è¨à¨ã ᨬ¢®« |
2083 | 2083 | ||
2084 | mov eax,[coord_x] |
2084 | mov eax,[coord_x] |
2085 | mov esi,[text] |
2085 | mov esi,[text] |
2086 | cmp byte[esi],0 |
2086 | cmp byte[esi],0 |
2087 | je .end_draw ;¥á«¨ ¯ãáâ ï áâப |
2087 | je .end_draw ;¥á«¨ ¯ãáâ ï áâப |
2088 | @@: |
2088 | @@: |
2089 | xor edx,edx |
2089 | xor edx,edx |
2090 | mov dl,byte[esi] ;¡¥à¥¬ ª®¤ ᨬ¢®« |
2090 | mov dl,byte[esi] ;¡¥à¥¬ ª®¤ ᨬ¢®« |
2091 | imul edx,ebx ;㬮¦ ¥¬ ¥£® ¢ëá®âã ᨬ¢®« |
2091 | imul edx,ebx ;㬮¦ ¥¬ ¥£® ¢ëá®âã ᨬ¢®« |
2092 | imul edx,ecx ;㬮¦ ¥¬ è¨à¨ã ᨬ¢®« |
2092 | imul edx,ecx ;㬮¦ ¥¬ è¨à¨ã ᨬ¢®« |
2093 | add edx,[buf_t_matr_offs] ;¯à¨¡ ¢«ï¥¬ ᬥ饨¥ 0-£® ᨬ¢®« , â. ¥. ¯®«ãç ¥âáï ᬥ饨¥ ¢ë¢®¤¨¬®£® ᨬ¢®« |
2093 | add edx,[buf_t_matr_offs] ;¯à¨¡ ¢«ï¥¬ ᬥ饨¥ 0-£® ᨬ¢®« , â. ¥. ¯®«ãç ¥âáï ᬥ饨¥ ¢ë¢®¤¨¬®£® ᨬ¢®« |
2094 | mov buf2d_data,edx ;¢ «®ª «ìë© ¡ãä¥à ᨬ¢®« , áâ ¢¨¬ 㪠§ ⥫ì ã¦ë© ᨬ¢®« ¨§ ¡ãä¥à buf_t_matr |
2094 | mov buf2d_data,edx ;¢ «®ª «ìë© ¡ãä¥à ᨬ¢®« , áâ ¢¨¬ 㪠§ ⥫ì ã¦ë© ᨬ¢®« ¨§ ¡ãä¥à buf_t_matr |
2095 | stdcall buf_bit_blt_alpha, [buf_struc], eax,[coord_y], edi,[color] |
2095 | stdcall buf_bit_blt_alpha, [buf_struc], eax,[coord_y], edi,[color] |
2096 | add eax,ecx |
2096 | add eax,ecx |
2097 | .new_s: |
2097 | .new_s: |
2098 | inc esi |
2098 | inc esi |
2099 | cmp byte[esi],13 |
2099 | cmp byte[esi],13 |
2100 | jne .no_13 |
2100 | jne .no_13 |
2101 | mov eax,[coord_x] |
2101 | mov eax,[coord_x] |
2102 | add [coord_y],ebx |
2102 | add [coord_y],ebx |
2103 | jmp .new_s |
2103 | jmp .new_s |
2104 | .no_13: |
2104 | .no_13: |
2105 | cmp byte[esi],0 |
2105 | cmp byte[esi],0 |
2106 | jne @b |
2106 | jne @b |
2107 | jmp .end_draw |
2107 | jmp .end_draw |
2108 | .error1: |
2108 | .error1: |
2109 | stdcall print_err,sz_buf2d_draw_text,txt_err_n8b |
2109 | stdcall print_err,sz_buf2d_draw_text,txt_err_n8b |
2110 | jmp .end_draw |
2110 | jmp .end_draw |
2111 | .error2: |
2111 | .error2: |
2112 | stdcall print_err,sz_buf2d_draw_text,txt_err_n24b |
2112 | stdcall print_err,sz_buf2d_draw_text,txt_err_n24b |
2113 | .end_draw: |
2113 | .end_draw: |
2114 | popad |
2114 | popad |
2115 | ret |
2115 | ret |
2116 | endp |
2116 | endp |
2117 | 2117 | ||
2118 | align 4 |
2118 | align 4 |
2119 | proc print_err, fun:dword, mes:dword ;¢ë¢®¤¨¬ á®®¡é¥¨¥ ®¡ 訡ª¥ ¤®áªã ®â« ¤ª¨ |
2119 | proc print_err, fun:dword, mes:dword ;¢ë¢®¤¨¬ á®®¡é¥¨¥ ®¡ 訡ª¥ ¤®áªã ®â« ¤ª¨ |
2120 | pushad |
2120 | pushad |
2121 | mov eax,63 |
2121 | mov eax,63 |
2122 | mov ebx,1 |
2122 | mov ebx,1 |
2123 | 2123 | ||
2124 | mov esi,[fun] |
2124 | mov esi,[fun] |
2125 | @@: |
2125 | @@: |
2126 | mov cl,byte[esi] |
2126 | mov cl,byte[esi] |
2127 | int 0x40 |
2127 | int 0x40 |
2128 | inc esi |
2128 | inc esi |
2129 | cmp byte[esi],0 |
2129 | cmp byte[esi],0 |
2130 | jne @b |
2130 | jne @b |
2131 | mov cl,':' |
2131 | mov cl,':' |
2132 | int 0x40 |
2132 | int 0x40 |
2133 | mov cl,' ' |
2133 | mov cl,' ' |
2134 | int 0x40 |
2134 | int 0x40 |
2135 | mov esi,[mes] |
2135 | mov esi,[mes] |
2136 | @@: |
2136 | @@: |
2137 | mov cl,byte[esi] |
2137 | mov cl,byte[esi] |
2138 | int 0x40 |
2138 | int 0x40 |
2139 | inc esi |
2139 | inc esi |
2140 | cmp byte[esi],0 |
2140 | cmp byte[esi],0 |
2141 | jne @b |
2141 | jne @b |
2142 | popad |
2142 | popad |
2143 | ret |
2143 | ret |
2144 | endp |
2144 | endp |
2145 | 2145 | ||
2146 | ;input: |
2146 | ;input: |
2147 | ; ebp+8 = p0 |
2147 | ; ebp+8 = p0 |
2148 | ; ebp+12 = p1 |
2148 | ; ebp+12 = p1 |
2149 | align 4 |
2149 | align 4 |
2150 | line_len4i: |
2150 | line_len4i: |
2151 | push ebp |
2151 | push ebp |
2152 | mov ebp,esp |
2152 | mov ebp,esp |
2153 | finit |
2153 | finit |
2154 | fild word [ebp+8] |
2154 | fild word [ebp+8] |
2155 | fisub word [ebp+12] |
2155 | fisub word [ebp+12] |
2156 | fmul st0,st0 ;st0=x^2 |
2156 | fmul st0,st0 ;st0=x^2 |
2157 | fild word [ebp+10] |
2157 | fild word [ebp+10] |
2158 | fisub word [ebp+14] |
2158 | fisub word [ebp+14] |
2159 | fmul st0,st0 ;st0=y^2 |
2159 | fmul st0,st0 ;st0=y^2 |
2160 | fadd st0,st1 |
2160 | fadd st0,st1 |
2161 | fsqrt |
2161 | fsqrt |
2162 | fstp dword [ebp+12] |
2162 | fstp dword [ebp+12] |
2163 | pop ebp |
2163 | pop ebp |
2164 | ret 4 ;8 |
2164 | ret 4 ;8 |
2165 | 2165 | ||
2166 | align 4 |
2166 | align 4 |
2167 | proc buf_cruve_bezier, buffer:dword, coord_p0:dword,coord_p1:dword,coord_p2:dword, color:dword |
2167 | proc buf_curve_bezier, buffer:dword, coord_p0:dword,coord_p1:dword,coord_p2:dword, color:dword |
2168 | locals |
2168 | locals |
2169 | delt_t dd ? |
2169 | delt_t dd ? |
2170 | opr_param dd ? |
2170 | opr_param dd ? |
2171 | v_poi_0 dd ? |
2171 | v_poi_0 dd ? |
2172 | endl |
2172 | endl |
2173 | pushad |
2173 | pushad |
2174 | 2174 | ||
2175 | ;float t, xt,yt; |
2175 | ;float t, xt,yt; |
2176 | ;for(t=.0;t<1.;t+=.005){ |
2176 | ;for(t=.0;t<1.;t+=.005){ |
2177 | ; xt=pow(1.-t,2)*x0+2*t*(1.-t)*x1+pow(t,2)*x2; |
2177 | ; xt=pow(1.-t,2)*x0+2*t*(1.-t)*x1+pow(t,2)*x2; |
2178 | ; yt=pow(1.-t,2)*y0+2*t*(1.-t)*y1+pow(t,2)*y2; |
2178 | ; yt=pow(1.-t,2)*y0+2*t*(1.-t)*y1+pow(t,2)*y2; |
2179 | ; dc.SetPixel(xt,yt,255L); |
2179 | ; dc.SetPixel(xt,yt,255L); |
2180 | ;} |
2180 | ;} |
2181 | 2181 | ||
2182 | mov edx,[color] ;set cruve color |
2182 | mov edx,[color] ;set curve color |
2183 | mov edi,[buffer] |
2183 | mov edi,[buffer] |
2184 | xor ebx,ebx |
2184 | xor ebx,ebx |
2185 | xor ecx,ecx |
2185 | xor ecx,ecx |
2186 | 2186 | ||
2187 | finit |
2187 | finit |
2188 | 2188 | ||
2189 | ; calculate delta t |
2189 | ; calculate delta t |
2190 | stdcall line_len4i, dword[coord_p1],dword[coord_p0] |
2190 | stdcall line_len4i, dword[coord_p1],dword[coord_p0] |
2191 | fadd dword[esp] |
2191 | fadd dword[esp] |
2192 | add esp,4 ;pop ... |
2192 | add esp,4 ;pop ... |
2193 | 2193 | ||
2194 | stdcall line_len4i, dword[coord_p2],dword[coord_p1] |
2194 | stdcall line_len4i, dword[coord_p2],dword[coord_p1] |
2195 | fadd dword[esp] |
2195 | fadd dword[esp] |
2196 | add esp,4 ;pop ... |
2196 | add esp,4 ;pop ... |
2197 | 2197 | ||
2198 | fadd st0,st0 ; len*=2 |
2198 | fadd st0,st0 ; len*=2 |
2199 | ftst |
2199 | ftst |
2200 | fstsw ax |
2200 | fstsw ax |
2201 | 2201 | ||
2202 | fld1 |
2202 | fld1 |
2203 | sahf |
2203 | sahf |
2204 | jle @f ;¨§¡¥£ ¥¬ ¤¥«¥¨ï 0 |
2204 | jle @f ;¨§¡¥£ ¥¬ ¤¥«¥¨ï 0 |
2205 | fdiv st0,st1 |
2205 | fdiv st0,st1 |
2206 | @@: |
2206 | @@: |
2207 | fstp dword[delt_t] |
2207 | fstp dword[delt_t] |
2208 | 2208 | ||
2209 | finit |
2209 | finit |
2210 | 2210 | ||
2211 | ;fild word[coord_p2+2] ;y2 |
2211 | ;fild word[coord_p2+2] ;y2 |
2212 | fild word[coord_p1+2] ;y1 |
2212 | fild word[coord_p1+2] ;y1 |
2213 | fild word[coord_p0+2] ;y0 |
2213 | fild word[coord_p0+2] ;y0 |
2214 | fild word[coord_p2] ;x2 |
2214 | fild word[coord_p2] ;x2 |
2215 | fild word[coord_p1] ;x1 |
2215 | fild word[coord_p1] ;x1 |
2216 | fild word[coord_p0] ;x0 |
2216 | fild word[coord_p0] ;x0 |
2217 | fld dword[delt_t] |
2217 | fld dword[delt_t] |
2218 | fldz ;t=.0 |
2218 | fldz ;t=.0 |
2219 | 2219 | ||
2220 | @@: |
2220 | @@: |
2221 | fld1 |
2221 | fld1 |
2222 | fsub st0,st1 ;1.-t |
2222 | fsub st0,st1 ;1.-t |
2223 | fmul st0,st0 ;pow(1.-t,2) |
2223 | fmul st0,st0 ;pow(1.-t,2) |
2224 | fmul st0,st3 ;...*x0 |
2224 | fmul st0,st3 ;...*x0 |
2225 | fstp dword[opr_param] |
2225 | fstp dword[opr_param] |
2226 | 2226 | ||
2227 | fld1 |
2227 | fld1 |
2228 | fsub st0,st1 ;1.-t |
2228 | fsub st0,st1 ;1.-t |
2229 | fmul st0,st1 ;(1.-t)*t |
2229 | fmul st0,st1 ;(1.-t)*t |
2230 | fadd st0,st0 |
2230 | fadd st0,st0 |
2231 | fmul st0,st4 ;...*x1 |
2231 | fmul st0,st4 ;...*x1 |
2232 | mov esi,dword[opr_param] |
2232 | mov esi,dword[opr_param] |
2233 | fstp dword[opr_param] |
2233 | fstp dword[opr_param] |
2234 | 2234 | ||
2235 | fldz |
2235 | fldz |
2236 | fadd st0,st1 ;0+t |
2236 | fadd st0,st1 ;0+t |
2237 | fmul st0,st0 ;t*t |
2237 | fmul st0,st0 ;t*t |
2238 | fmul st0,st5 ;...*x2 |
2238 | fmul st0,st5 ;...*x2 |
2239 | 2239 | ||
2240 | fadd dword[opr_param] |
2240 | fadd dword[opr_param] |
2241 | mov dword[opr_param],esi |
2241 | mov dword[opr_param],esi |
2242 | fadd dword[opr_param] |
2242 | fadd dword[opr_param] |
2243 | fistp word[v_poi_0] ;x |
2243 | fistp word[v_poi_0] ;x |
2244 | 2244 | ||
2245 | fld1 |
2245 | fld1 |
2246 | fsub st0,st1 ;1.-t |
2246 | fsub st0,st1 ;1.-t |
2247 | fmul st0,st0 ;pow(1.-t,2) |
2247 | fmul st0,st0 ;pow(1.-t,2) |
2248 | fmul st0,st6 ;...*y0 |
2248 | fmul st0,st6 ;...*y0 |
2249 | fstp dword[opr_param] |
2249 | fstp dword[opr_param] |
2250 | 2250 | ||
2251 | fld1 |
2251 | fld1 |
2252 | fsub st0,st1 ;1.-t |
2252 | fsub st0,st1 ;1.-t |
2253 | fmul st0,st1 ;(1.-t)*t |
2253 | fmul st0,st1 ;(1.-t)*t |
2254 | fadd st0,st0 |
2254 | fadd st0,st0 |
2255 | fmul st0,st7 ;...*y1 |
2255 | fmul st0,st7 ;...*y1 |
2256 | mov esi,dword[opr_param] |
2256 | mov esi,dword[opr_param] |
2257 | fstp dword[opr_param] |
2257 | fstp dword[opr_param] |
2258 | 2258 | ||
2259 | fldz |
2259 | fldz |
2260 | fadd st0,st1 ;0+t |
2260 | fadd st0,st1 ;0+t |
2261 | fmul st0,st0 ;t*t |
2261 | fmul st0,st0 ;t*t |
2262 | fimul word[coord_p2+2] ;...*y2 |
2262 | fimul word[coord_p2+2] ;...*y2 |
2263 | 2263 | ||
2264 | fadd dword[opr_param] |
2264 | fadd dword[opr_param] |
2265 | mov dword[opr_param],esi |
2265 | mov dword[opr_param],esi |
2266 | fadd dword[opr_param] |
2266 | fadd dword[opr_param] |
2267 | fistp word[v_poi_0+2] ;y |
2267 | fistp word[v_poi_0+2] ;y |
2268 | 2268 | ||
2269 | mov eax,1 |
2269 | mov eax,1 |
2270 | mov bx,word[v_poi_0+2] |
2270 | mov bx,word[v_poi_0+2] |
2271 | mov cx,word[v_poi_0] |
2271 | mov cx,word[v_poi_0] |
2272 | call draw_pixel |
2272 | call draw_pixel |
2273 | 2273 | ||
2274 | fadd st0,st1 ;t+dt |
2274 | fadd st0,st1 ;t+dt |
2275 | 2275 | ||
2276 | fld1 |
2276 | fld1 |
2277 | fcomp |
2277 | fcomp |
2278 | fstsw ax |
2278 | fstsw ax |
2279 | sahf |
2279 | sahf |
2280 | jae @b |
2280 | jae @b |
2281 | 2281 | ||
2282 | popad |
2282 | popad |
2283 | ret |
2283 | ret |
2284 | endp |
2284 | endp |
2285 | 2285 | ||
2286 | txt_err_n8b db 'need buffer 8 bit',13,10,0 |
2286 | txt_err_n8b db 'need buffer 8 bit',13,10,0 |
2287 | txt_err_n24b db 'need buffer 24 bit',13,10,0 |
2287 | txt_err_n24b db 'need buffer 24 bit',13,10,0 |
2288 | 2288 | ||
2289 | align 16 |
2289 | align 16 |
2290 | EXPORTS: |
2290 | EXPORTS: |
2291 | dd sz_lib_init, lib_init |
2291 | dd sz_lib_init, lib_init |
2292 | dd sz_buf2d_create, buf_create |
2292 | dd sz_buf2d_create, buf_create |
2293 | dd sz_buf2d_create_f_img, buf_create_f_img |
2293 | dd sz_buf2d_create_f_img, buf_create_f_img |
2294 | dd sz_buf2d_clear, buf_clear |
2294 | dd sz_buf2d_clear, buf_clear |
2295 | dd sz_buf2d_draw, buf_draw_buf |
2295 | dd sz_buf2d_draw, buf_draw_buf |
2296 | dd sz_buf2d_delete, buf_delete |
2296 | dd sz_buf2d_delete, buf_delete |
2297 | dd sz_buf2d_line, buf_line_brs |
2297 | dd sz_buf2d_line, buf_line_brs |
2298 | dd sz_buf2d_rect_by_size, buf_rect_by_size |
2298 | dd sz_buf2d_rect_by_size, buf_rect_by_size |
2299 | dd sz_buf2d_filled_rect_by_size, buf_filled_rect_by_size |
2299 | dd sz_buf2d_filled_rect_by_size, buf_filled_rect_by_size |
2300 | dd sz_buf2d_circle, buf_circle |
2300 | dd sz_buf2d_circle, buf_circle |
2301 | dd sz_buf2d_img_hdiv2, buf_img_hdiv2 |
2301 | dd sz_buf2d_img_hdiv2, buf_img_hdiv2 |
2302 | dd sz_buf2d_img_wdiv2, buf_img_wdiv2 |
2302 | dd sz_buf2d_img_wdiv2, buf_img_wdiv2 |
2303 | dd sz_buf2d_conv_24_to_8, buf_conv_24_to_8 |
2303 | dd sz_buf2d_conv_24_to_8, buf_conv_24_to_8 |
2304 | dd sz_buf2d_conv_24_to_32, buf_conv_24_to_32 |
2304 | dd sz_buf2d_conv_24_to_32, buf_conv_24_to_32 |
2305 | dd sz_buf2d_bit_blt, buf_bit_blt |
2305 | dd sz_buf2d_bit_blt, buf_bit_blt |
2306 | dd sz_buf2d_bit_blt_transp, buf_bit_blt_transp |
2306 | dd sz_buf2d_bit_blt_transp, buf_bit_blt_transp |
2307 | dd sz_buf2d_bit_blt_alpha, buf_bit_blt_alpha |
2307 | dd sz_buf2d_bit_blt_alpha, buf_bit_blt_alpha |
2308 | dd sz_buf2d_cruve_bezier, buf_cruve_bezier |
2308 | dd sz_buf2d_curve_bezier, buf_curve_bezier |
2309 | dd sz_buf2d_convert_text_matrix, buf_convert_text_matrix |
2309 | dd sz_buf2d_convert_text_matrix, buf_convert_text_matrix |
2310 | dd sz_buf2d_draw_text, buf_draw_text |
2310 | dd sz_buf2d_draw_text, buf_draw_text |
2311 | dd sz_buf2d_crop_color, buf_crop_color |
2311 | dd sz_buf2d_crop_color, buf_crop_color |
2312 | dd sz_buf2d_offset_h, buf_offset_h |
2312 | dd sz_buf2d_offset_h, buf_offset_h |
2313 | dd sz_buf2d_flood_fill, buf_flood_fill |
2313 | dd sz_buf2d_flood_fill, buf_flood_fill |
2314 | dd 0,0 |
2314 | dd 0,0 |
2315 | sz_lib_init db 'lib_init',0 |
2315 | sz_lib_init db 'lib_init',0 |
2316 | sz_buf2d_create db 'buf2d_create',0 |
2316 | sz_buf2d_create db 'buf2d_create',0 |
2317 | sz_buf2d_create_f_img db 'buf2d_create_f_img',0 |
2317 | sz_buf2d_create_f_img db 'buf2d_create_f_img',0 |
2318 | sz_buf2d_clear db 'buf2d_clear',0 ;®ç¨á⪠¡ãä¥à 㪠§ ë¬ æ¢¥â®¬ |
2318 | sz_buf2d_clear db 'buf2d_clear',0 ;®ç¨á⪠¡ãä¥à 㪠§ ë¬ æ¢¥â®¬ |
2319 | sz_buf2d_draw db 'buf2d_draw',0 |
2319 | sz_buf2d_draw db 'buf2d_draw',0 |
2320 | sz_buf2d_delete db 'buf2d_delete',0 |
2320 | sz_buf2d_delete db 'buf2d_delete',0 |
2321 | sz_buf2d_line db 'buf2d_line',0 ;à¨á®¢ ¨¥ «¨¨¨ |
2321 | sz_buf2d_line db 'buf2d_line',0 ;à¨á®¢ ¨¥ «¨¨¨ |
2322 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 ;à¨á®¢ ¨¥ à ¬ª¨ ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2322 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 ;à¨á®¢ ¨¥ à ¬ª¨ ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2323 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 ;à¨á®¢ ¨¥ § «¨â®£® ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2323 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 ;à¨á®¢ ¨¥ § «¨â®£® ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2324 | sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ¨¥ ®ªà㦮á⨠|
2324 | sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ¨¥ ®ªà㦮á⨠|
2325 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® ¢ëá®â¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2325 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® ¢ëá®â¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2326 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® è¨à¨¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2326 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® è¨à¨¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2327 | sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 |
2327 | sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 |
2328 | sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 |
2328 | sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 |
2329 | sz_buf2d_bit_blt db 'buf2d_bit_blt',0 |
2329 | sz_buf2d_bit_blt db 'buf2d_bit_blt',0 |
2330 | sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 |
2330 | sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 |
2331 | sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 |
2331 | sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 |
2332 | sz_buf2d_cruve_bezier db 'buf2d_cruve_bezier',0 |
2332 | sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 |
2333 | sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 |
2333 | sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 |
2334 | sz_buf2d_draw_text db 'buf2d_draw_text',0 |
2334 | sz_buf2d_draw_text db 'buf2d_draw_text',0 |
2335 | sz_buf2d_crop_color db 'buf2d_crop_color',0 |
2335 | sz_buf2d_crop_color db 'buf2d_crop_color',0 |
2336 | sz_buf2d_offset_h db 'buf2d_offset_h',0 |
2336 | sz_buf2d_offset_h db 'buf2d_offset_h',0 |
2337 | sz_buf2d_flood_fill db 'buf2d_flood_fill',01.;t+=.005){ |
2337 | sz_buf2d_flood_fill db 'buf2d_flood_fill',01.;t+=.005){ |
2338 | ;>0) |
2338 | ;>0) |
2339 | >0) |
2339 | >0) |
2340 | >0) |
2340 | >0) |
2341 | >0) |
2341 | >0) |
2342 | >0) |
2342 | >0) |
2343 | > |
2343 | > |