Subversion Repositories Kolibri OS

Rev

Rev 255 | Rev 1643 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
255 heavyiron 1
;----------------------------------------------------------
2
;--------Move picture from array to work screeen-----------
3
;----------------------------------------------------------
4
MovePictureToWorkScreen:
5
 
6
	call cleare_screen
7
 
8
	mov eax,[Picture_SizeX]
9
	mov ebx,[Picture_SizeY]
10
	mov ecx,[MaxWorkScreen_SizeX]
11
	mov edx,[MaxWorkScreen_SizeY]
12
	mov esi,[k]
13
	imul eax,esi
14
	imul ebx,esi
15
 
16
	cmp eax,ecx
17
	jle lab1
18
	mov eax,[MaxWorkScreen_SizeX]
19
	mov [WorkScreen_SizeX],eax
20
	jmp lab2
21
	lab1:
22
	mov [WorkScreen_SizeX],eax
23
	lab2:
24
 
25
	cmp ebx,edx
26
	jle lab3
27
	mov ebx,[MaxWorkScreen_SizeY]
28
	mov [WorkScreen_SizeY],ebx
29
	jmp lab4
30
	lab3:
31
	mov [WorkScreen_SizeY],ebx
32
	lab4:
33
 
34
	mov eax,[WorkScreen_SizeX]
35
	mov ebx,[k]
36
	cdq
37
	idiv ebx
38
	mov [CounterX],eax
39
	mov eax,[WorkScreen_SizeY]
40
	cdq
41
	idiv ebx
42
	mov [CounterY],eax
43
 
44
	mov eax,[WorkScreen_SizeX]
45
	mov ecx,eax
46
	mov ebx,[k]
47
	cdq
48
	idiv ebx
49
	imul eax,ebx
50
	sub ecx,eax
51
	lea ecx,[ecx+ecx*2]
52
	;
53
	mov eax,[WorkScreen_SizeX]
54
	mov ebx,[k]
55
	dec ebx
56
	imul eax,ebx
57
	lea eax,[eax+eax*2]
58
	add eax,ecx
59
	mov [OffsetYWorkScreen],eax
60
 
61
 
62
	mov ebx,[Picture_SizeX]
63
	mov eax,[CounterX]
64
	sub ebx,eax
65
	lea ebx,[ebx+ebx*2]
66
	mov [OffsetYPicture],ebx
67
 
68
	mov eax,[WorkScreen_SizeX]
69
	mov ebx,[k]
70
	sub eax,ebx
71
	lea eax,[eax+eax*2]
72
	mov [OffsetYBigPixel],eax
73
 
74
	mov eax,[PosX]
75
	mov ebx,[PosY]
76
	mov ecx,[Picture_SizeX]
77
	imul ecx,ebx
78
	add eax,ecx
79
	lea eax,[eax+eax*2]
80
	add eax,[PointerToPicture]
81
 
82
 
83
	mov ebx,[ScreenPointer]
84
 
85
	mov edi,[CounterY]
86
 
87
	;if size of picture natural(mastab is 1) than move picture to work screen
88
	cmp [k],1
89
	jne no_zoom_1_
90
	screen_y_1:
91
	    mov esi,[CounterX]
92
	    screen_x_1:
93
	      mov ecx,[eax]
94
	      and ecx,0xffffff
95
	      mov ebp,ecx
96
	      shr ecx,16
97
		   mov [ebx],bp
98
		   mov [ebx+2],cl
99
	      add ebx,3;
100
	      add eax,3
101
	    dec esi
102
	    jnz screen_x_1
103
	    add eax,[OffsetYPicture]
104
	    add ebx,[OffsetYWorkScreen]
105
	dec edi
106
	jnz screen_y_1
107
	jmp fps
108
	no_zoom_1_:
109
 
110
	cmp [k],2
111
	jne no_zoom_2
112
 
113
	screen_y_2:
114
	    mov esi,[CounterX]
115
	    screen_x_2:
116
	      mov ecx,[eax]
117
	      and ecx,0xffffff
118
	      mov ebp,ecx
119
	      shr ecx,16
120
	      mov edx,ebx
121
		   mov [edx],bp
122
		   mov [edx+2],cl
123
		   mov [edx+3],bp
124
		   mov [edx+3+2],cl
125
		   add edx,3*2
126
		   add edx,[OffsetYBigPixel]
127
		   mov [edx],bp
128
		   mov [edx+2],cl
129
		   mov [edx+3],bp
130
		   mov [edx+3+2],cl
131
		   add edx,3*2
132
		   add edx,[OffsetYBigPixel]
133
	      add ebx,3*2
134
	      add eax,3
135
	    dec esi
136
	    jnz screen_x_2
137
	    add eax,[OffsetYPicture]
138
	    add ebx,[OffsetYWorkScreen]
139
	dec edi
140
	jnz screen_y_2
141
	jmp fps
142
	no_zoom_2:
143
 
144
	cmp [k],4
145
	jne no_zoom_4
146
	screen_y_4:
147
	    mov esi,[CounterX]
148
	    screen_x_4:
149
	      mov ecx,[eax]
150
	      and ecx,0xffffff
151
	      mov ebp,ecx
152
	      shr ecx,16
153
	      mov edx,ebx
154
		   mov [edx],bp
155
		   mov [edx+2],cl
156
		   mov [edx+3],bp
157
		   mov [edx+3+2],cl
158
		   mov [edx+6],bp
159
		   mov [edx+6+2],cl
160
		   mov [edx+9],bp
161
		   mov [edx+9+2],cl
162
		   add edx,3*4
163
		   add edx,[OffsetYBigPixel]
164
		   mov [edx],bp
165
		   mov [edx+2],cl
166
		   mov [edx+3],bp
167
		   mov [edx+3+2],cl
168
		   mov [edx+6],bp
169
		   mov [edx+6+2],cl
170
		   mov [edx+9],bp
171
		   mov [edx+9+2],cl
172
		   add edx,3*4
173
		   add edx,[OffsetYBigPixel]
174
		   mov [edx],bp
175
		   mov [edx+2],cl
176
		   mov [edx+3],bp
177
		   mov [edx+3+2],cl
178
		   mov [edx+6],bp
179
		   mov [edx+6+2],cl
180
		   mov [edx+9],bp
181
		   mov [edx+9+2],cl
182
		   add edx,3*4
183
		   add edx,[OffsetYBigPixel]
184
		   mov [edx],bp
185
		   mov [edx+2],cl
186
		   mov [edx+3],bp
187
		   mov [edx+3+2],cl
188
		   mov [edx+6],bp
189
		   mov [edx+6+2],cl
190
		   mov [edx+9],bp
191
		   mov [edx+9+2],cl
192
		   add edx,3*4
193
		   add edx,[OffsetYBigPixel]
194
	      add ebx,4*3
195
	      add eax,3
196
	    dec esi
197
	    jnz screen_x_4
198
	    add eax,[OffsetYPicture]
199
	    add ebx,[OffsetYWorkScreen]
200
	dec edi
201
	jnz screen_y_4
202
	jmp fps
203
	no_zoom_4:
204
	;if zoom more than 4
205
	screen_y:
206
	    mov esi,[CounterX]
207
	    screen_x:
208
	      mov ecx,[eax]
209
	      and ecx,0xffffff
210
	      mov ebp,ecx
211
	      shr ecx,16
212
	      push ebx
213
	      push eax
214
	      mov edx,[k]
215
	      big_pixel_y:
216
		 mov eax,[k]
217
		 big_pixel_x:
218
		   mov [ebx],bp
219
		   mov [ebx+2],cl
220
		   add ebx,3
221
		 dec eax
222
		 jnz big_pixel_x
223
		 add ebx,[OffsetYBigPixel]
224
	      dec edx
225
	      jnz big_pixel_y
226
	      pop eax
227
	      pop ebx
228
	      mov edx,[k]
229
	      lea edx,[edx+edx*2]
230
	      add ebx,edx
231
	      add eax,3
232
	    dec esi
233
	    jnz screen_x
234
	    add eax,[OffsetYPicture]
235
	    add ebx,[OffsetYWorkScreen]
236
	dec edi
237
	jnz screen_y
238
 
239
	 fps:
240
	 ;mov eax,18
241
	 ;mov ebx,14
485 heavyiron 242
	 ;mcall
255 heavyiron 243
 
244
	 mov eax,7
245
	 mov ebx,[ScreenPointer]
246
	 mov ecx,[WorkScreen_SizeX]
247
	 mov edx,[WorkScreen_SizeY]
248
	 shl ecx,16
249
	 add ecx,edx
250
	 mov edx,8*65536+20+15+49+5+1
485 heavyiron 251
	 mcall
255 heavyiron 252
 
253
	 ret
254
;----------------------------------------------------------
255
;--------------------clear screen--------------------------
256
;----------------------------------------------------------
257
cleare_screen:
258
 
259
	mov eax,[ScreenPointer]
260
	mov ebx,[WorkScreen_SizeX]
261
	imul ebx,[WorkScreen_SizeY]
262
	lea ebx,[ebx+ebx*2]
263
	shr ebx,3
264
	inc ebx
265
	mov esi,0xffffff
266
 
267
	clear_screen_loop:
268
 
269
	  mov [eax],esi
270
	  mov [eax+3],esi
271
	  mov [eax+6],si
272
	  add eax,4+4
273
 
274
	dec ebx
275
	jnz clear_screen_loop
276
	ret
277
;----------------------------------------------------------
278
;-------------cleare work arrea(work screen)---------------
279
;----------------------------------------------------------
280
cleare_work_arrea:
281
 
282
	mov eax,[PointerToPicture]
283
	mov ebx,[Picture_SizeX]
284
	imul ebx,[Picture_SizeY]
285
	lea ebx,[ebx+ebx*2]
286
	shr ebx,3
287
	inc ebx
288
	mov esi,0xffffff
289
 
290
	clear_work_arrea_loop:
291
 
292
	  mov [eax],esi
293
	  mov [eax+3],esi
294
	  mov [eax+6],si
295
	  add eax,4+4
296
 
297
	dec ebx
298
	jnz clear_work_arrea_loop
299
	ret
300
;-----------------------------------------------------------
301
;calculate position work screen on a picture
302
;-----------------------------------------------------------
303
CalculatePositionScreen:
304
 
305
	 mov eax,[Picture_SizeX]
306
	 mov ebx,[Picture_SizeY]
307
	 mov ecx,[CounterX]
308
	 mov edx,[CounterY]
309
	 sub eax,ecx
310
	 sub ebx,edx
311
 
312
	 cmp [PosX],eax
313
	 jle no_limit_screen_x
314
	 mov [PosX],eax
315
	 no_limit_screen_x:
316
 
317
	 cmp [PosY],ebx
318
	 jle no_limit_screen_y
319
	 mov [PosY],ebx
320
	 no_limit_screen_y:
321
 
322
	 cmp [PosX],0
323
	 jns no_minimum_screen_x
324
	 mov [PosX],0
325
	 no_minimum_screen_x:
326
 
327
	 cmp [PosY],0
328
	 jns no_minimum_screen_y
329
	 mov [PosY],0
330
	 no_minimum_screen_y:
331
 
332
	 ret
333
;-----------------------------------------------------------
334
;-----------calculate cordinats on work picture--------------
335
;-----------------------------------------------------------
336
GetScreenCordinats:
337
 
338
	mov eax,[MouseX]
339
	mov ebx,[MouseY]
340
	sub eax,9
341
	sub ebx,87
342
 
343
	mov ecx,[k]
344
	cdq
345
	idiv ecx
346
	mov [ScreenX],eax
347
	mov eax,ebx
348
	cdq
349
	idiv ecx
350
	mov [ScreenY],eax
351
 
352
	ret