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