Subversion Repositories Kolibri OS

Rev

Rev 1643 | 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
 
6341 IgorA 254
	mcall SF_PUT_IMAGE
1643 mario79 255
	ret
255 heavyiron 256
;----------------------------------------------------------
257
;--------------------clear screen--------------------------
258
;----------------------------------------------------------
259
cleare_screen:
6341 IgorA 260
	mov edi,[ScreenPointer]
261
	mov ebx,[WorkScreen_SizeX]
262
	imul ebx,[WorkScreen_SizeY]
263
	lea ebx,[ebx+ebx*2]
264
	mov eax,0xffffffff
265
	mov ecx,ebx
266
	shr ecx,2
267
	rep stosd
268
	mov ecx,ebx
269
	and ecx,3
270
	rep stosb
255 heavyiron 271
	ret
272
;----------------------------------------------------------
273
;-------------cleare work arrea(work screen)---------------
274
;----------------------------------------------------------
275
cleare_work_arrea:
6341 IgorA 276
	mov edi,[PointerToPicture]
277
	mov ebx,[Picture_SizeX]
278
	imul ebx,[Picture_SizeY]
279
	lea ebx,[ebx+ebx*2]
280
	mov eax,0xffffffff
281
	mov ecx,ebx
282
	shr ecx,2
283
	rep stosd
284
	mov ecx,ebx
285
	and ecx,3
286
	rep stosb
255 heavyiron 287
	ret
288
;-----------------------------------------------------------
289
;calculate position work screen on a picture
290
;-----------------------------------------------------------
291
CalculatePositionScreen:
1643 mario79 292
	mov	eax,[Picture_SizeX]
293
	mov	ebx,[Picture_SizeY]
294
	mov	ecx,[CounterX]
295
	mov	edx,[CounterY]
296
	sub	eax,ecx
297
	sub	ebx,edx
298
	cmp	[PosX],eax
299
	jle	no_limit_screen_x
300
	mov	[PosX],eax
255 heavyiron 301
 
1643 mario79 302
no_limit_screen_x:
303
	cmp	[PosY],ebx
304
	jle	no_limit_screen_y
305
	mov	[PosY],ebx
255 heavyiron 306
 
1643 mario79 307
no_limit_screen_y:
308
	cmp	[PosX],0
309
	jns	no_minimum_screen_x
310
	mov	[PosX],0
255 heavyiron 311
 
1643 mario79 312
no_minimum_screen_x:
313
	cmp	[PosY],0
314
	jns	no_minimum_screen_y
315
	mov	[PosY],0
255 heavyiron 316
 
1643 mario79 317
no_minimum_screen_y:
318
	ret
255 heavyiron 319
;-----------------------------------------------------------
320
;-----------calculate cordinats on work picture--------------
321
;-----------------------------------------------------------
322
GetScreenCordinats:
1643 mario79 323
	mov	eax,[MouseX]
324
	mov	ebx,[MouseY]
325
	sub	eax,9
326
	sub	ebx,87
327
	mov	ecx,[k]
255 heavyiron 328
	cdq
1643 mario79 329
	idiv	ecx
330
	mov	[ScreenX],eax
331
	mov	eax,ebx
255 heavyiron 332
	cdq
1643 mario79 333
	idiv	ecx
334
	mov	[ScreenY],eax
255 heavyiron 335
	ret