Rev 6379 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6379 | Rev 6385 | ||
---|---|---|---|
1 | ;---------------------------------------------------------- |
1 | ;---------------------------------------------------------- |
2 | ;--------Move picture from array to work screeen----------- |
2 | ;--------Move picture from array to work screeen----------- |
3 | ;---------------------------------------------------------- |
3 | ;---------------------------------------------------------- |
4 | MovePictureToWorkScreen: |
4 | MovePictureToWorkScreen: |
5 | call cleare_screen |
5 | call cleare_screen |
6 | mov eax,[Picture_SizeX] |
6 | mov eax,[Picture_SizeX] |
7 | mov ebx,[Picture_SizeY] |
7 | mov ebx,[Picture_SizeY] |
8 | mov ecx,[MaxWorkScreen_SizeX] |
8 | mov ecx,[MaxWorkScreen_SizeX] |
9 | mov edx,[MaxWorkScreen_SizeY] |
9 | mov edx,[MaxWorkScreen_SizeY] |
10 | mov esi,[k] |
10 | mov esi,[k] |
11 | imul eax,esi |
11 | imul eax,esi |
12 | imul ebx,esi |
12 | imul ebx,esi |
13 | cmp eax,ecx |
13 | cmp eax,ecx |
14 | jle lab1 |
14 | jle lab1 |
15 | 15 | ||
16 | mov eax,[MaxWorkScreen_SizeX] |
16 | mov eax,[MaxWorkScreen_SizeX] |
17 | mov [WorkScreen_SizeX],eax |
17 | mov [WorkScreen_SizeX],eax |
18 | jmp lab2 |
18 | jmp lab2 |
19 | 19 | ||
20 | lab1: |
20 | lab1: |
21 | mov [WorkScreen_SizeX],eax |
21 | mov [WorkScreen_SizeX],eax |
22 | 22 | ||
23 | lab2: |
23 | lab2: |
24 | cmp ebx,edx |
24 | cmp ebx,edx |
25 | jle lab3 |
25 | jle lab3 |
26 | mov ebx,[MaxWorkScreen_SizeY] |
26 | mov ebx,[MaxWorkScreen_SizeY] |
27 | mov [WorkScreen_SizeY],ebx |
27 | mov [WorkScreen_SizeY],ebx |
28 | jmp lab4 |
28 | jmp lab4 |
29 | 29 | ||
30 | lab3: |
30 | lab3: |
31 | mov [WorkScreen_SizeY],ebx |
31 | mov [WorkScreen_SizeY],ebx |
32 | 32 | ||
33 | lab4: |
33 | lab4: |
34 | mov eax,[WorkScreen_SizeX] |
34 | mov eax,[WorkScreen_SizeX] |
35 | mov ebx,[k] |
35 | mov ebx,[k] |
36 | cdq |
36 | cdq |
37 | idiv ebx |
37 | idiv ebx |
38 | mov [CounterX],eax |
38 | mov [CounterX],eax |
39 | mov eax,[WorkScreen_SizeY] |
39 | mov eax,[WorkScreen_SizeY] |
40 | cdq |
40 | cdq |
41 | idiv ebx |
41 | idiv ebx |
42 | mov [CounterY],eax |
42 | mov [CounterY],eax |
43 | 43 | ||
44 | mov eax,[WorkScreen_SizeX] |
44 | mov eax,[WorkScreen_SizeX] |
45 | mov ecx,eax |
45 | mov ecx,eax |
46 | mov ebx,[k] |
46 | mov ebx,[k] |
47 | cdq |
47 | cdq |
48 | idiv ebx |
48 | idiv ebx |
49 | imul eax,ebx |
49 | imul eax,ebx |
50 | sub ecx,eax |
50 | sub ecx,eax |
51 | lea ecx,[ecx+ecx*2] |
51 | lea ecx,[ecx+ecx*2] |
52 | 52 | ||
53 | mov eax,[WorkScreen_SizeX] |
53 | mov eax,[WorkScreen_SizeX] |
54 | mov ebx,[k] |
54 | mov ebx,[k] |
55 | dec ebx |
55 | dec ebx |
56 | imul eax,ebx |
56 | imul eax,ebx |
57 | lea eax,[eax+eax*2] |
57 | lea eax,[eax+eax*2] |
58 | add eax,ecx |
58 | add eax,ecx |
59 | mov [OffsetYWorkScreen],eax |
59 | mov [OffsetYWorkScreen],eax |
60 | 60 | ||
61 | mov ebx,[Picture_SizeX] |
61 | mov ebx,[Picture_SizeX] |
62 | mov eax,[CounterX] |
62 | mov eax,[CounterX] |
63 | sub ebx,eax |
63 | sub ebx,eax |
64 | lea ebx,[ebx+ebx*2] |
64 | lea ebx,[ebx+ebx*2] |
65 | mov [OffsetYPicture],ebx |
65 | mov [OffsetYPicture],ebx |
66 | 66 | ||
67 | mov eax,[WorkScreen_SizeX] |
67 | mov eax,[WorkScreen_SizeX] |
68 | mov ebx,[k] |
68 | mov ebx,[k] |
69 | sub eax,ebx |
69 | sub eax,ebx |
70 | lea eax,[eax+eax*2] |
70 | lea eax,[eax+eax*2] |
71 | mov [OffsetYBigPixel],eax |
71 | mov [OffsetYBigPixel],eax |
72 | 72 | ||
73 | mov eax,[PosX] |
73 | mov eax,[PosX] |
74 | mov ebx,[PosY] |
74 | mov ebx,[PosY] |
75 | mov ecx,[Picture_SizeX] |
75 | mov ecx,[Picture_SizeX] |
76 | imul ecx,ebx |
76 | imul ecx,ebx |
77 | add eax,ecx |
77 | add eax,ecx |
78 | lea eax,[eax+eax*2] |
78 | lea eax,[eax+eax*2] |
79 | add eax,[PointerToPicture] |
79 | add eax,[PointerToPicture] |
80 | 80 | ||
81 | mov ebx,[ScreenPointer] |
81 | mov ebx,[ScreenPointer] |
82 | mov edi,[CounterY] |
82 | mov edi,[CounterY] |
83 | 83 | ||
84 | ;if size of picture natural(mastab is 1) than move picture to work screen |
84 | ;if size of picture natural(mastab is 1) than move picture to work screen |
85 | cmp [k],1 |
85 | cmp [k],1 |
86 | jne no_zoom_1_ |
86 | jne no_zoom_1_ |
87 | 87 | ||
88 | screen_y_1: |
88 | screen_y_1: |
89 | mov esi,[CounterX] |
89 | mov esi,[CounterX] |
90 | 90 | ||
91 | screen_x_1: |
91 | screen_x_1: |
92 | mov ecx,[eax] |
92 | mov ecx,[eax] |
93 | mov ebp,ecx |
93 | mov ebp,ecx |
94 | shr ecx,16 |
94 | shr ecx,16 |
95 | mov [ebx],bp |
95 | mov [ebx],bp |
96 | mov [ebx+2],cl |
96 | mov [ebx+2],cl |
97 | add ebx,3 |
97 | add ebx,3 |
98 | add eax,3 |
98 | add eax,3 |
99 | dec esi |
99 | dec esi |
100 | jnz screen_x_1 |
100 | jnz screen_x_1 |
101 | add eax,[OffsetYPicture] |
101 | add eax,[OffsetYPicture] |
102 | add ebx,[OffsetYWorkScreen] |
102 | add ebx,[OffsetYWorkScreen] |
103 | dec edi |
103 | dec edi |
104 | jnz screen_y_1 |
104 | jnz screen_y_1 |
105 | jmp fps |
105 | jmp fps |
106 | 106 | ||
107 | no_zoom_1_: |
107 | no_zoom_1_: |
108 | cmp [k],2 |
108 | cmp [k],2 |
109 | jne no_zoom_2 |
109 | jne no_zoom_2 |
110 | 110 | ||
111 | screen_y_2: |
111 | screen_y_2: |
112 | mov esi,[CounterX] |
112 | mov esi,[CounterX] |
113 | 113 | ||
114 | screen_x_2: |
114 | screen_x_2: |
115 | mov ecx,[eax] |
115 | mov ecx,[eax] |
116 | mov ebp,ecx |
116 | mov ebp,ecx |
117 | shr ecx,16 |
117 | shr ecx,16 |
118 | mov edx,ebx |
118 | mov edx,ebx |
119 | mov [edx],bp |
119 | mov [edx],bp |
120 | mov [edx+2],cl |
120 | mov [edx+2],cl |
121 | mov [edx+3],bp |
121 | mov [edx+3],bp |
122 | mov [edx+3+2],cl |
122 | mov [edx+3+2],cl |
123 | add edx,3*2 |
123 | add edx,3*2 |
124 | add edx,[OffsetYBigPixel] |
124 | add edx,[OffsetYBigPixel] |
125 | mov [edx],bp |
125 | mov [edx],bp |
126 | mov [edx+2],cl |
126 | mov [edx+2],cl |
127 | mov [edx+3],bp |
127 | mov [edx+3],bp |
128 | mov [edx+3+2],cl |
128 | mov [edx+3+2],cl |
129 | add ebx,3*2 |
129 | add ebx,3*2 |
130 | add eax,3 |
130 | add eax,3 |
131 | dec esi |
131 | dec esi |
132 | jnz screen_x_2 |
132 | jnz screen_x_2 |
133 | add eax,[OffsetYPicture] |
133 | add eax,[OffsetYPicture] |
134 | add ebx,[OffsetYWorkScreen] |
134 | add ebx,[OffsetYWorkScreen] |
135 | dec edi |
135 | dec edi |
136 | jnz screen_y_2 |
136 | jnz screen_y_2 |
137 | jmp fps |
137 | jmp fps |
138 | 138 | ||
139 | no_zoom_2: |
139 | no_zoom_2: |
140 | cmp [k],4 |
140 | cmp [k],4 |
141 | jne no_zoom_4 |
141 | jne no_zoom_4 |
142 | 142 | ||
143 | screen_y_4: |
143 | screen_y_4: |
144 | mov esi,[CounterX] |
144 | mov esi,[CounterX] |
145 | 145 | ||
146 | screen_x_4: |
146 | screen_x_4: |
147 | mov ecx,[eax] |
147 | mov ecx,[eax] |
148 | mov ebp,ecx |
148 | mov ebp,ecx |
149 | shr ecx,16 |
149 | shr ecx,16 |
150 | mov edx,ebx |
150 | mov edx,ebx |
151 | mov [edx],bp |
151 | mov [edx],bp |
152 | mov [edx+2],cl |
152 | mov [edx+2],cl |
153 | mov [edx+3],bp |
153 | mov [edx+3],bp |
154 | mov [edx+3+2],cl |
154 | mov [edx+3+2],cl |
155 | mov [edx+6],bp |
155 | mov [edx+6],bp |
156 | mov [edx+6+2],cl |
156 | mov [edx+6+2],cl |
157 | mov [edx+9],bp |
157 | mov [edx+9],bp |
158 | mov [edx+9+2],cl |
158 | mov [edx+9+2],cl |
159 | add edx,3*4 |
159 | add edx,3*4 |
160 | add edx,[OffsetYBigPixel] |
160 | add edx,[OffsetYBigPixel] |
161 | mov [edx],bp |
161 | mov [edx],bp |
162 | mov [edx+2],cl |
162 | mov [edx+2],cl |
163 | mov [edx+3],bp |
163 | mov [edx+3],bp |
164 | mov [edx+3+2],cl |
164 | mov [edx+3+2],cl |
165 | mov [edx+6],bp |
165 | mov [edx+6],bp |
166 | mov [edx+6+2],cl |
166 | mov [edx+6+2],cl |
167 | mov [edx+9],bp |
167 | mov [edx+9],bp |
168 | mov [edx+9+2],cl |
168 | mov [edx+9+2],cl |
169 | add edx,3*4 |
169 | add edx,3*4 |
170 | add edx,[OffsetYBigPixel] |
170 | add edx,[OffsetYBigPixel] |
171 | mov [edx],bp |
171 | mov [edx],bp |
172 | mov [edx+2],cl |
172 | mov [edx+2],cl |
173 | mov [edx+3],bp |
173 | mov [edx+3],bp |
174 | mov [edx+3+2],cl |
174 | mov [edx+3+2],cl |
175 | mov [edx+6],bp |
175 | mov [edx+6],bp |
176 | mov [edx+6+2],cl |
176 | mov [edx+6+2],cl |
177 | mov [edx+9],bp |
177 | mov [edx+9],bp |
178 | mov [edx+9+2],cl |
178 | mov [edx+9+2],cl |
179 | add edx,3*4 |
179 | add edx,3*4 |
180 | add edx,[OffsetYBigPixel] |
180 | add edx,[OffsetYBigPixel] |
181 | mov [edx],bp |
181 | mov [edx],bp |
182 | mov [edx+2],cl |
182 | mov [edx+2],cl |
183 | mov [edx+3],bp |
183 | mov [edx+3],bp |
184 | mov [edx+3+2],cl |
184 | mov [edx+3+2],cl |
185 | mov [edx+6],bp |
185 | mov [edx+6],bp |
186 | mov [edx+6+2],cl |
186 | mov [edx+6+2],cl |
187 | mov [edx+9],bp |
187 | mov [edx+9],bp |
188 | mov [edx+9+2],cl |
188 | mov [edx+9+2],cl |
189 | add ebx,4*3 |
189 | add ebx,4*3 |
190 | add eax,3 |
190 | add eax,3 |
191 | dec esi |
191 | dec esi |
192 | jnz screen_x_4 |
192 | jnz screen_x_4 |
193 | add eax,[OffsetYPicture] |
193 | add eax,[OffsetYPicture] |
194 | add ebx,[OffsetYWorkScreen] |
194 | add ebx,[OffsetYWorkScreen] |
195 | dec edi |
195 | dec edi |
196 | jnz screen_y_4 |
196 | jnz screen_y_4 |
197 | jmp fps |
197 | jmp fps |
198 | 198 | ||
199 | no_zoom_4: |
199 | no_zoom_4: |
200 | ;if zoom more than 4 |
200 | ;if zoom more than 4 |
201 | screen_y: |
201 | screen_y: |
202 | mov esi,[CounterX] |
202 | mov esi,[CounterX] |
203 | 203 | ||
204 | screen_x: |
204 | screen_x: |
205 | mov ecx,[eax] |
205 | mov ecx,[eax] |
206 | mov ebp,ecx |
206 | mov ebp,ecx |
207 | shr ecx,16 |
207 | shr ecx,16 |
208 | ;--------------------------------------------------------- |
208 | ;--------------------------------------------------------- |
209 | push ebx eax |
209 | push ebx eax |
210 | mov edx,[k] |
210 | mov edx,[k] |
211 | 211 | ||
212 | big_pixel_y: |
212 | big_pixel_y: |
213 | mov eax,[k] |
213 | mov eax,[k] |
214 | 214 | ||
215 | big_pixel_x: |
215 | big_pixel_x: |
216 | mov [ebx],bp |
216 | mov [ebx],bp |
217 | mov [ebx+2],cl |
217 | mov [ebx+2],cl |
218 | add ebx,3 |
218 | add ebx,3 |
219 | dec eax |
219 | dec eax |
220 | jnz big_pixel_x |
220 | jnz big_pixel_x |
221 | add ebx,[OffsetYBigPixel] |
221 | add ebx,[OffsetYBigPixel] |
222 | dec edx |
222 | dec edx |
223 | jnz big_pixel_y |
223 | jnz big_pixel_y |
224 | pop eax ebx |
224 | pop eax ebx |
225 | ;--------------------------------------------------------- |
225 | ;--------------------------------------------------------- |
226 | mov edx,[k] |
226 | mov edx,[k] |
227 | lea edx,[edx+edx*2] |
227 | lea edx,[edx+edx*2] |
228 | add ebx,edx |
228 | add ebx,edx |
229 | add eax,3 |
229 | add eax,3 |
230 | dec esi |
230 | dec esi |
231 | jnz screen_x |
231 | jnz screen_x |
232 | add eax,[OffsetYPicture] |
232 | add eax,[OffsetYPicture] |
233 | add ebx,[OffsetYWorkScreen] |
233 | add ebx,[OffsetYWorkScreen] |
234 | dec edi |
234 | dec edi |
235 | jnz screen_y |
235 | jnz screen_y |
236 | 236 | ||
237 | fps: |
237 | fps: |
238 | ;calculate selection rect |
238 | ;calculate selection rect |
239 | cmp [instrument_used],1 |
239 | cmp [crossing],0 |
240 | jne .no_selection_rect |
240 | je .no_selection_rect |
241 | mov edx,[rectangular_shade_y] |
241 | mov edx,[rectangular_shade_y] |
242 | sub edx,[PosY] |
242 | sub edx,[PosY] |
243 | mov ecx,[rectangular_shade_x] |
243 | mov ecx,[rectangular_shade_x] |
244 | sub ecx,[PosX] |
244 | sub ecx,[PosX] |
245 | mov ebx,[OldY] |
245 | mov ebx,[crossing_old_y] |
246 | sub ebx,[PosY] |
246 | sub ebx,[PosY] |
247 | mov eax,[OldX] |
247 | mov eax,[crossing_old_x] |
248 | sub eax,[PosX] |
248 | sub eax,[PosX] |
249 | cmp [k],1 |
249 | cmp [k],1 |
250 | je .zo_1 |
250 | je .zo_1 |
251 | cmp eax,ecx |
251 | cmp eax,ecx |
252 | jle @f |
252 | jle @f |
253 | xchg eax,ecx |
253 | xchg eax,ecx |
254 | @@: |
254 | @@: |
255 | cmp ebx,edx |
255 | cmp ebx,edx |
256 | jle @f |
256 | jle @f |
257 | xchg ebx,edx |
257 | xchg ebx,edx |
258 | @@: |
258 | @@: |
259 | inc eax |
259 | inc eax |
260 | inc ebx |
260 | inc ebx |
261 | imul eax,[k] |
261 | imul eax,[k] |
262 | imul ebx,[k] |
262 | imul ebx,[k] |
263 | imul ecx,[k] |
263 | imul ecx,[k] |
264 | imul edx,[k] |
264 | imul edx,[k] |
265 | dec eax |
265 | dec eax |
266 | dec ebx |
266 | dec ebx |
267 | .zo_1: |
267 | .zo_1: |
268 | stdcall draw_selection_rect, eax,ebx,ecx,edx |
268 | stdcall draw_selection_rect, eax,ebx,ecx,edx |
269 | .no_selection_rect: |
269 | .no_selection_rect: |
270 | 270 | ||
271 | mov ecx,[WorkScreen_SizeX] |
271 | mov ecx,[WorkScreen_SizeX] |
272 | shl ecx,16 |
272 | shl ecx,16 |
273 | add ecx,[WorkScreen_SizeY] |
273 | add ecx,[WorkScreen_SizeY] |
274 | mov edx,((ci_edit_wnd_x_pos+ci_edit_wnd_border) shl 16)\ |
274 | mov edx,((ci_edit_wnd_x_pos+ci_edit_wnd_border) shl 16)\ |
275 | + (ci_edit_wnd_y_pos+ci_edit_wnd_border) |
275 | + (ci_edit_wnd_y_pos+ci_edit_wnd_border) |
276 | mcall SF_PUT_IMAGE, [ScreenPointer] |
276 | mcall SF_PUT_IMAGE, [ScreenPointer] |
277 | ret |
277 | ret |
278 | ;---------------------------------------------------------- |
278 | ;---------------------------------------------------------- |
279 | align 4 |
279 | align 4 |
280 | proc draw_selection_rect, x0:dword, y0:dword, x1:dword, y1:dword |
280 | proc draw_selection_rect, x0:dword, y0:dword, x1:dword, y1:dword |
281 | mov eax,0xffff3fff ;2:2 |
281 | mov eax,0xffff3fff ;2:2 |
282 | mov edx,0xff1f ;1:1 |
282 | mov edx,0xff1f ;1:1 |
283 | 283 | ||
284 | mov edi,[x0] |
284 | mov edi,[x0] |
285 | mov ebx,[y0] |
285 | mov ebx,[y0] |
286 | mov ecx,[x1] |
286 | mov ecx,[x1] |
287 | cmp edi,ecx |
287 | cmp edi,ecx |
288 | jle @f |
288 | jle @f |
289 | xchg edi,ecx |
289 | xchg edi,ecx |
290 | @@: |
290 | @@: |
291 | call draw_line_h |
291 | call draw_line_h |
292 | mov ebx,[y1] |
292 | mov ebx,[y1] |
293 | call draw_line_h |
293 | call draw_line_h |
294 | 294 | ||
295 | mov edi,[x0] |
295 | mov edi,[x0] |
296 | mov ecx,[y0] |
296 | mov ecx,[y0] |
297 | cmp ebx,ecx |
297 | cmp ebx,ecx |
298 | jle @f |
298 | jle @f |
299 | xchg ebx,ecx |
299 | xchg ebx,ecx |
300 | @@: |
300 | @@: |
301 | call draw_line_w |
301 | call draw_line_w |
302 | mov edi,[x1] |
302 | mov edi,[x1] |
303 | call draw_line_w |
303 | call draw_line_w |
304 | ret |
304 | ret |
305 | endp |
305 | endp |
306 | 306 | ||
307 | ;input: |
307 | ;input: |
308 | ; eax - color1(g,r):color2(g,r) |
308 | ; eax - color1(g,r):color2(g,r) |
309 | ; dx - color1(b):color2(b) |
309 | ; dx - color1(b):color2(b) |
310 | ; edi - x0 |
310 | ; edi - x0 |
311 | ; ebx - y0 |
311 | ; ebx - y0 |
312 | ; ecx - x1 (x1 >= x0) |
312 | ; ecx - x1 (x1 >= x0) |
313 | align 4 |
313 | align 4 |
314 | draw_line_h: |
314 | draw_line_h: |
315 | cmp edi,ecx |
315 | cmp edi,ecx |
316 | je .end_f |
316 | je .end_f |
317 | cmp ecx,1 |
317 | cmp ecx,1 |
318 | jl .end_f |
318 | jl .end_f |
319 | cmp edi,[WorkScreen_SizeX] |
319 | cmp edi,[WorkScreen_SizeX] |
320 | jge .end_f |
320 | jge .end_f |
321 | cmp ebx,0 |
321 | cmp ebx,0 |
322 | jl .end_f |
322 | jl .end_f |
323 | cmp ebx,[WorkScreen_SizeY] |
323 | cmp ebx,[WorkScreen_SizeY] |
324 | jge .end_f |
324 | jge .end_f |
325 | push ebx ecx edi |
325 | push ebx ecx edi |
326 | cmp ecx,[WorkScreen_SizeX] |
326 | cmp ecx,[WorkScreen_SizeX] |
327 | jl @f |
327 | jl @f |
328 | mov ecx,[WorkScreen_SizeX] |
328 | mov ecx,[WorkScreen_SizeX] |
329 | @@: |
329 | @@: |
330 | cmp edi,0 |
330 | cmp edi,0 |
331 | jge @f |
331 | jge @f |
332 | xor edi,edi |
332 | xor edi,edi |
333 | @@: |
333 | @@: |
334 | sub ecx,edi |
334 | sub ecx,edi |
335 | imul ebx,[WorkScreen_SizeX] |
335 | imul ebx,[WorkScreen_SizeX] |
336 | add edi,ebx |
336 | add edi,ebx |
337 | lea edi,[edi+edi*2] |
337 | lea edi,[edi+edi*2] |
338 | add edi,[ScreenPointer] |
338 | add edi,[ScreenPointer] |
339 | cld |
339 | cld |
340 | .line_t: |
340 | .line_t: |
341 | stosw |
341 | stosw |
342 | mov byte[edi],dl |
342 | mov byte[edi],dl |
343 | inc edi |
343 | inc edi |
344 | bt ecx,1 |
344 | bt ecx,1 |
345 | jc @f |
345 | jc @f |
346 | bt ecx,0 |
346 | bt ecx,0 |
347 | jc @f |
347 | jc @f |
348 | ror eax,16 |
348 | ror eax,16 |
349 | ror dx,8 |
349 | ror dx,8 |
350 | @@: |
350 | @@: |
351 | dec ecx |
351 | dec ecx |
352 | jnz .line_t |
352 | jnz .line_t |
353 | pop edi ecx ebx |
353 | pop edi ecx ebx |
354 | .end_f: |
354 | .end_f: |
355 | ret |
355 | ret |
356 | 356 | ||
357 | ;input: |
357 | ;input: |
358 | ; eax - color1(g,r):color2(g,r) |
358 | ; eax - color1(g,r):color2(g,r) |
359 | ; dx - color1(b):color2(b) |
359 | ; dx - color1(b):color2(b) |
360 | ; edi - x0 |
360 | ; edi - x0 |
361 | ; ebx - y0 |
361 | ; ebx - y0 |
362 | ; ecx - y1 (y1 >= y0) |
362 | ; ecx - y1 (y1 >= y0) |
363 | align 4 |
363 | align 4 |
364 | draw_line_w: |
364 | draw_line_w: |
365 | cmp edi,0 |
365 | cmp edi,0 |
366 | jl .end_f |
366 | jl .end_f |
367 | cmp edi,[WorkScreen_SizeX] |
367 | cmp edi,[WorkScreen_SizeX] |
368 | jge .end_f |
368 | jge .end_f |
369 | cmp ebx,ecx |
369 | cmp ebx,ecx |
370 | je .end_f |
370 | je .end_f |
371 | cmp ebx,[WorkScreen_SizeY] |
371 | cmp ebx,[WorkScreen_SizeY] |
372 | jge .end_f |
372 | jge .end_f |
373 | cmp ecx,1 |
373 | cmp ecx,1 |
374 | jl .end_f |
374 | jl .end_f |
375 | push ebx ecx edi |
375 | push ebx ecx edi |
376 | cmp ecx,[WorkScreen_SizeY] |
376 | cmp ecx,[WorkScreen_SizeY] |
377 | jl @f |
377 | jl @f |
378 | mov ecx,[WorkScreen_SizeY] |
378 | mov ecx,[WorkScreen_SizeY] |
379 | @@: |
379 | @@: |
380 | cmp ebx,0 |
380 | cmp ebx,0 |
381 | jge @f |
381 | jge @f |
382 | xor ebx,ebx |
382 | xor ebx,ebx |
383 | @@: |
383 | @@: |
384 | sub ecx,ebx |
384 | sub ecx,ebx |
385 | cmp ecx,1 |
385 | cmp ecx,1 |
386 | jl .end_f |
386 | jl .end_f |
387 | imul ebx,[WorkScreen_SizeX] |
387 | imul ebx,[WorkScreen_SizeX] |
388 | add edi,ebx |
388 | add edi,ebx |
389 | lea edi,[edi+edi*2] |
389 | lea edi,[edi+edi*2] |
390 | add edi,[ScreenPointer] |
390 | add edi,[ScreenPointer] |
391 | mov ebx,[WorkScreen_SizeX] |
391 | mov ebx,[WorkScreen_SizeX] |
392 | lea ebx,[ebx+ebx*2] |
392 | lea ebx,[ebx+ebx*2] |
393 | sub ebx,2 |
393 | sub ebx,2 |
394 | cld |
394 | cld |
395 | .line_r: |
395 | .line_r: |
396 | stosw |
396 | stosw |
397 | mov byte[edi],dl |
397 | mov byte[edi],dl |
398 | add edi,ebx |
398 | add edi,ebx |
399 | bt ecx,1 |
399 | bt ecx,1 |
400 | jc @f |
400 | jc @f |
401 | bt ecx,0 |
401 | bt ecx,0 |
402 | jc @f |
402 | jc @f |
403 | ror eax,16 |
403 | ror eax,16 |
404 | ror dx,8 |
404 | ror dx,8 |
405 | @@: |
405 | @@: |
406 | dec ecx |
406 | dec ecx |
407 | jnz .line_r |
407 | jnz .line_r |
408 | pop edi ecx ebx |
408 | pop edi ecx ebx |
409 | .end_f: |
409 | .end_f: |
410 | ret |
410 | ret |
411 | ;---------------------------------------------------------- |
411 | ;---------------------------------------------------------- |
412 | ;--------------------clear screen-------------------------- |
412 | ;--------------------clear screen-------------------------- |
413 | ;---------------------------------------------------------- |
413 | ;---------------------------------------------------------- |
414 | align 4 |
414 | align 4 |
415 | cleare_screen: |
415 | cleare_screen: |
416 | mov edi,[ScreenPointer] |
416 | mov edi,[ScreenPointer] |
417 | mov ebx,[WorkScreen_SizeX] |
417 | mov ebx,[WorkScreen_SizeX] |
418 | imul ebx,[WorkScreen_SizeY] |
418 | imul ebx,[WorkScreen_SizeY] |
419 | lea ebx,[ebx+ebx*2] |
419 | lea ebx,[ebx+ebx*2] |
420 | mov eax,0xffffffff |
420 | mov eax,0xffffffff |
421 | mov ecx,ebx |
421 | mov ecx,ebx |
422 | shr ecx,2 |
422 | shr ecx,2 |
423 | cld |
423 | cld |
424 | rep stosd |
424 | rep stosd |
425 | mov ecx,ebx |
425 | mov ecx,ebx |
426 | and ecx,3 |
426 | and ecx,3 |
427 | rep stosb |
427 | rep stosb |
428 | ret |
428 | ret |
429 | ;---------------------------------------------------------- |
429 | ;---------------------------------------------------------- |
430 | ;-------------cleare work arrea(work screen)--------------- |
430 | ;-------------cleare work arrea(work screen)--------------- |
431 | ;---------------------------------------------------------- |
431 | ;---------------------------------------------------------- |
432 | cleare_work_arrea: |
432 | cleare_work_arrea: |
433 | mov edi,[PointerToPicture] |
433 | mov edi,[PointerToPicture] |
434 | mov ebx,[Picture_SizeX] |
434 | mov ebx,[Picture_SizeX] |
435 | imul ebx,[Picture_SizeY] |
435 | imul ebx,[Picture_SizeY] |
436 | lea ebx,[ebx+ebx*2] |
436 | lea ebx,[ebx+ebx*2] |
437 | mov eax,0xffffffff |
437 | mov eax,0xffffffff |
438 | mov ecx,ebx |
438 | mov ecx,ebx |
439 | shr ecx,2 |
439 | shr ecx,2 |
440 | cld |
440 | cld |
441 | rep stosd |
441 | rep stosd |
442 | mov ecx,ebx |
442 | mov ecx,ebx |
443 | and ecx,3 |
443 | and ecx,3 |
444 | rep stosb |
444 | rep stosb |
445 | ret |
445 | ret |
446 | ;----------------------------------------------------------- |
446 | ;----------------------------------------------------------- |
447 | ;calculate position work screen on a picture |
447 | ;calculate position work screen on a picture |
448 | ;----------------------------------------------------------- |
448 | ;----------------------------------------------------------- |
449 | CalculatePositionScreen: |
449 | CalculatePositionScreen: |
450 | mov eax,[Picture_SizeX] |
450 | mov eax,[Picture_SizeX] |
451 | sub eax,[CounterX] |
451 | sub eax,[CounterX] |
452 | cmp [PosX],eax |
452 | cmp [PosX],eax |
453 | jle @f |
453 | jle @f |
454 | mov [PosX],eax |
454 | mov [PosX],eax |
455 | @@: |
455 | @@: |
456 | cmp [PosX],0 |
456 | cmp [PosX],0 |
457 | jns @f |
457 | jns @f |
458 | mov [PosX],0 |
458 | mov [PosX],0 |
459 | @@: |
459 | @@: |
460 | mov ebx,[Picture_SizeY] |
460 | mov ebx,[Picture_SizeY] |
461 | sub ebx,[CounterY] |
461 | sub ebx,[CounterY] |
462 | cmp [PosY],ebx |
462 | cmp [PosY],ebx |
463 | jle @f |
463 | jle @f |
464 | mov [PosY],ebx |
464 | mov [PosY],ebx |
465 | @@: |
465 | @@: |
466 | cmp [PosY],0 |
466 | cmp [PosY],0 |
467 | jns @f |
467 | jns @f |
468 | mov [PosY],0 |
468 | mov [PosY],0 |
469 | @@: |
469 | @@: |
470 | ret |
470 | ret |
471 | ;----------------------------------------------------------- |
471 | ;----------------------------------------------------------- |
472 | ;-----------calculate cordinats on work picture-------------- |
472 | ;-----------calculate cordinats on work picture-------------- |
473 | ;----------------------------------------------------------- |
473 | ;----------------------------------------------------------- |
474 | GetScreenCordinats: |
474 | GetScreenCordinats: |
475 | mov eax,[MouseX] |
475 | mov eax,[MouseX] |
476 | mov ebx,[MouseY] |
476 | mov ebx,[MouseY] |
477 | sub eax,ci_edit_wnd_x_pos+ci_edit_wnd_border |
477 | sub eax,ci_edit_wnd_x_pos+ci_edit_wnd_border |
478 | cmp eax,0 |
478 | cmp eax,0 |
479 | jge @f |
479 | jge @f |
480 | xor eax,eax |
480 | xor eax,eax |
481 | @@: |
481 | @@: |
482 | sub ebx,ci_edit_wnd_y_pos+ci_edit_wnd_border |
482 | sub ebx,ci_edit_wnd_y_pos+ci_edit_wnd_border |
483 | cmp ebx,0 |
483 | cmp ebx,0 |
484 | jge @f |
484 | jge @f |
485 | xor ebx,ebx |
485 | xor ebx,ebx |
486 | @@: |
486 | @@: |
487 | mov ecx,[k] |
487 | mov ecx,[k] |
488 | cdq |
488 | cdq |
489 | idiv ecx |
489 | idiv ecx |
490 | mov [ScreenX],eax |
490 | mov [ScreenX],eax |
491 | mov eax,ebx |
491 | mov eax,ebx |
492 | cdq |
492 | cdq |
493 | idiv ecx |
493 | idiv ecx |
494 | mov [ScreenY],eax |
494 | mov [ScreenY],eax |
495 | ret |
495 | ret |