Subversion Repositories Kolibri OS

Rev

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