Subversion Repositories Kolibri OS

Rev

Rev 1958 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1958 Rev 2163
1
;---------------------------------------------------------------------
1
;---------------------------------------------------------------------
2
invert_left_to_right:
2
invert_left_to_right:
3
	mov ebx,3
3
	mov ebx,3
4
	jmp  rotate_counter_clockwise.1
4
	jmp  rotate_counter_clockwise.1
5
;---------------------------------------------------------------------
5
;---------------------------------------------------------------------
6
invert_up_to_down:
6
invert_up_to_down:
7
	mov ebx,4
7
	mov ebx,4
8
	jmp  rotate_counter_clockwise.1
8
	jmp  rotate_counter_clockwise.1
9
;---------------------------------------------------------------------
9
;---------------------------------------------------------------------
10
rotate_clockwise:
10
rotate_clockwise:
11
	mov ebx,1
11
	mov ebx,1
12
	jmp  rotate_counter_clockwise.1
12
	jmp  rotate_counter_clockwise.1
13
;---------------------------------------------------------------------
13
;---------------------------------------------------------------------
14
rotate_counter_clockwise:
14
rotate_counter_clockwise:
15
	mov ebx,2
15
	mov ebx,2
16
.1:
16
.1:
17
	mov  eax,[soi]
17
	mov  eax,[soi]
18
	test eax,eax
18
	test eax,eax
19
	jz   still
19
	jz   still
20
	
20
	
21
	mov  eax,[RAW1_pointer]
21
	mov  eax,[RAW1_pointer]
22
	test eax,eax
22
	test eax,eax
23
	jz   @f
23
	jz   @f
24
	cmp  [Total_Repeat_N],1
24
	cmp  [Total_Repeat_N],1
25
	ja   still
25
	ja   still
26
@@:
26
@@:
27
 
27
 
28
	push  ebx
28
	push  ebx
29
	call  proc_position_correct
29
	call  proc_position_correct
30
	mov  eax,[vertical_position_coorect]
30
	mov  eax,[vertical_position_coorect]
31
	mov  ebx,[horizontal_position_coorect]
31
	mov  ebx,[horizontal_position_coorect]
32
	mov  [horizontal_position_coorect],eax
32
	mov  [horizontal_position_coorect],eax
33
	mov  [vertical_position_coorect],ebx
33
	mov  [vertical_position_coorect],ebx
34
	pop  ebx
34
	pop  ebx
35
;	mov eax,image_file
35
;	mov eax,image_file
36
; ebx - direction
36
; ebx - direction
37
; 1 - clockwise, 2 - counter clockwise
37
; 1 - clockwise, 2 - counter clockwise
38
; 3 - Left&Right, 4 - Up&Down
38
; 3 - Left&Right, 4 - Up&Down
39
	push	ebx
39
	push	ebx
40
	push	dword image_file
40
	push	dword image_file
41
;	call [plugin_rotate]
41
;	call [plugin_rotate]
42
	call [rotate_Start]
42
	call [rotate_Start]
43
    mov  ebx,[raw_pointer]
43
	mov  ebx,[raw_pointer]
44
    mov  eax,[ebx+4]
44
	mov  eax,[ebx+4]
45
    mov  [img_width],eax
45
	mov  [img_width],eax
46
    mov  eax,[ebx+8]
46
	mov  eax,[ebx+8]
47
    mov  [img_high],eax
47
	mov  [img_high],eax
48
	call convert.img_resolution_ok
48
	call convert.img_resolution_ok
49
	jmp  kopen.1
49
	jmp  kopen.1
50
;---------------------------------------------------------------------
50
;---------------------------------------------------------------------
51
calculate_arrows_offset:
51
calculate_arrows_offset:
52
	mov  eax,[arrows_offset]
52
	mov  eax,[arrows_offset]
53
	imul eax,[scaling_mode]
53
	imul eax,[scaling_mode]
54
	mov  ebx,100
54
	mov  ebx,100
55
	xor  edx,edx
55
	xor  edx,edx
56
	div  ebx
56
	div  ebx
57
	mov  [scroll_bar_data_vertical.ar_offset],eax
57
	mov  [scroll_bar_data_vertical.ar_offset],eax
58
	mov  [scroll_bar_data_horizontal.ar_offset],eax
58
	mov  [scroll_bar_data_horizontal.ar_offset],eax
59
	ret
59
	ret
60
;---------------------------------------------------------------------
60
;---------------------------------------------------------------------
61
no_scaling:
61
no_scaling:
62
	mov  eax,scaling_mode
62
	mov  eax,scaling_mode
63
	cmp  [eax],dword 100
63
	cmp  [eax],dword 100
64
	je   still
64
	je   still
65
.1:
65
.1:
66
	mov  [eax],dword 100
66
	mov  [eax],dword 100
67
	mov  [zoom_factors],dword zoom_factors.100
67
	mov  [zoom_factors],dword zoom_factors.100
68
	mov  eax,[eax]
68
	mov  eax,[eax]
69
	jmp   zoom_plus.2
69
	jmp   zoom_plus.2
70
	
-
 
71
;	call calculate_arrows_offset
-
 
72
;	call draw_zoom_factors
-
 
73
;	jmp  red
-
 
74
;---------------------------------------------------------------------
70
;---------------------------------------------------------------------
75
scaling:
71
scaling:
76
	mov  eax,[soi]
72
	mov  eax,[soi]
77
	test eax,eax
73
	test eax,eax
78
	jz   still
74
	jz   still
79
	mov  eax,scaling_mode
75
	mov  eax,scaling_mode
80
	xor  ebx,ebx
76
	xor  ebx,ebx
81
	cmp  [eax],ebx  ;dword 0
77
	cmp  [eax],ebx  ;dword 0
82
	je   still
78
	je   still
83
	mov  [eax],ebx  ;dword 0
79
	mov  [eax],ebx  ;dword 0
84
	mov  [zoom_factors],dword zoom_factors.1
80
	mov  [zoom_factors],dword zoom_factors.1
85
	call .1
81
	call .1
86
	call draw_zoom_factors
82
	call draw_zoom_factors
87
	jmp  still
83
	jmp  still
88
;---------------------------
84
;---------------------------
89
.compens_x:
85
.compens_x:
90
	call .get_x_y
86
	call .get_x_y
91
	xor  ecx,ecx
87
	xor  ecx,ecx
92
	mov  cx,[wa_high_1]
88
	mov  cx,[wa_high_1]
93
	imul eax,ecx
89
	imul eax,ecx
94
	xor  edx,edx
90
	xor  edx,edx
95
	div  ebx
91
	div  ebx
96
	ret
92
	ret
97
;---------------------------
93
;---------------------------
98
.compens_y:
94
.compens_y:
99
	call .get_x_y
95
	call .get_x_y
100
	xchg eax,ebx
96
	xchg eax,ebx
101
	xor  ecx,ecx
97
	xor  ecx,ecx
102
	mov  cx,[wa_width_1]
98
	mov  cx,[wa_width_1]
103
	imul eax,ecx
99
	imul eax,ecx
104
	xor  edx,edx
100
	xor  edx,edx
105
	div  ebx
101
	div  ebx
106
	ret
102
	ret
107
;---------------------------
103
;---------------------------
108
.get_x_y:
104
.get_x_y:
109
    mov  ebx,[raw_pointer]
105
    mov  ebx,[raw_pointer]
110
    mov  eax,[ebx+4]
106
    mov  eax,[ebx+4]
111
	mov  ebx,[ebx+8]
107
	mov  ebx,[ebx+8]
112
	ret
108
	ret
113
;---------------------------
109
;---------------------------
114
.fill_for_L_R:
110
.fill_for_L_R:
115
	cmp   [no_fill],1
111
	cmp   [no_fill],1
116
	je   @f
112
	je   @f
117
;	xor  eax,eax
-
 
118
;	mov  [no_fill],al
-
 
119
;	ret
-
 
120
;@@:
-
 
121
	pusha
113
	pusha
122
	mov   ebx,[image_start_coordinates]
114
	mov   ebx,[image_start_coordinates]
123
	mov   ecx,ebx
115
	mov   ecx,ebx
124
	shl   ecx,16
116
	shl   ecx,16
125
	mov   bx,ax
117
	mov   bx,ax
126
	mov   cx,[wa_high_1]
118
	mov   cx,[wa_high_1]
127
	mcall 13,,,[fill_color] ;0xffffff
119
	mcall 13,,,[fill_color] ;0xffffff
128
	mov   ax,bx
120
	mov   ax,bx
129
	ror   ebx,16
121
	ror   ebx,16
130
	add   bx,ax
122
	add   bx,ax
131
	add   bx,[wa_width_2]
123
	add   bx,[wa_width_2]
132
	mov   ax,[wa_width_1]
124
	mov   ax,[wa_width_1]
133
;	add   ax,5
-
 
134
	sub   ax,bx
125
	sub   ax,bx
135
	rol   ebx,16
126
	rol   ebx,16
136
	mov   bx,ax
127
	mov   bx,ax
137
	mcall 13,,,[fill_color]  ;0xffffff
128
	mcall 13,,,[fill_color]  ;0xffffff
138
	popa
129
	popa
139
@@:
130
@@:
140
	ret
131
	ret
141
;---------------------------
132
;---------------------------
142
.fill_for_U_D:
133
.fill_for_U_D:
143
	cmp   [no_fill],1
134
	cmp   [no_fill],1
144
	je   @f
135
	je   @f
145
;	xor  eax,eax
-
 
146
;	mov  [no_fill],al
-
 
147
;	ret
-
 
148
;@@:
-
 
149
	pusha
136
	pusha
150
	mov   ebx,[image_start_coordinates]
137
	mov   ebx,[image_start_coordinates]
151
	mov   ecx,ebx
138
	mov   ecx,ebx
152
	shl   ecx,16
139
	shl   ecx,16
153
	mov   cx,ax
140
	mov   cx,ax
154
	mov   bx,[wa_width_1]
141
	mov   bx,[wa_width_1]
155
	mcall 13,,,[fill_color]  ;0xffffff
142
	mcall 13,,,[fill_color]  ;0xffffff
156
	mov   ax,cx
143
	mov   ax,cx
157
	ror   ecx,16
144
	ror   ecx,16
158
	add   cx,ax
145
	add   cx,ax
159
	add   cx,[wa_high_2]
146
	add   cx,[wa_high_2]
160
	mov   ax,[wa_high_1]
147
	mov   ax,[wa_high_1]
161
	add   ax,28  ;50
148
	add   ax,28  ;50
162
	sub   ax,cx
149
	sub   ax,cx
163
	rol   ecx,16
150
	rol   ecx,16
164
	mov   cx,ax
151
	mov   cx,ax
165
	mcall 13,,,[fill_color]  ;0xffffff
152
	mcall 13,,,[fill_color]  ;0xffffff
166
	popa
153
	popa
167
@@:
154
@@:
168
	ret
155
	ret
169
;---------------------------
156
;---------------------------
170
.1:
157
.1:
171
	call .get_x_y
158
	call .get_x_y
172
	cmp  eax,ebx
159
	cmp  eax,ebx
173
	jb  .y
160
	jb  .y
174
;---------------------------
161
;---------------------------
175
.x:
162
.x:
176
	call .compens_y
163
	call .compens_y
177
	cmp  ax,[wa_high_1]
164
	cmp  ax,[wa_high_1]
178
	jbe @f
165
	jbe @f
179
	call .compens_x
166
	call .compens_x
180
	mov  [wa_width_2],ax
167
	mov  [wa_width_2],ax
181
	jmp  .4
168
	jmp  .4
182
@@:
169
@@:
183
	mov  [wa_high_2],ax
170
	mov  [wa_high_2],ax
184
	jmp  .4
171
	jmp  .4
185
;---------------------------
172
;---------------------------
186
.y:
173
.y:
187
	call .compens_x
174
	call .compens_x
188
	cmp  ax,[wa_width_1]
175
	cmp  ax,[wa_width_1]
189
	jbe  @f
176
	jbe  @f
190
	call .compens_y
177
	call .compens_y
191
	mov  [wa_high_2],ax
178
	mov  [wa_high_2],ax
192
	jmp  .4
179
	jmp  .4
193
@@:
180
@@:
194
	mov  [wa_width_2],ax
181
	mov  [wa_width_2],ax
195
;---------------------------
182
;---------------------------
196
.4:
183
.4:
197
	mov bx,[wa_width_2]
184
	mov bx,[wa_width_2]
198
	shl ebx,16
185
	shl ebx,16
199
	mov bx,[wa_high_2]
186
	mov bx,[wa_high_2]
200
 
187
 
201
	xor  ecx,ecx
188
	xor  ecx,ecx
202
.5:
189
.5:
203
 
190
 
204
;	mov  eax,ebx
191
;	mov  eax,ebx
205
;	and  eax,0xffff
192
;	and  eax,0xffff
206
;	mov  [test1],eax
193
;	mov  [test1],eax
207
 
194
 
208
;	mov  eax,ebx
195
;	mov  eax,ebx
209
;	shr  eax,16
196
;	shr  eax,16
210
;	mov  [test2],eax
197
;	mov  [test2],eax
211
 
198
 
212
;	mov  eax,ecx
199
;	mov  eax,ecx
213
;	and  eax,0xffff
200
;	and  eax,0xffff
214
;	mov  [test3],eax
201
;	mov  [test3],eax
215
 
202
 
216
;	mov  eax,ecx
203
;	mov  eax,ecx
217
;	shr  eax,16
204
;	shr  eax,16
218
;	mov  [test4],eax
205
;	mov  [test4],eax
219
 
206
 
220
;	mov eax,image_file
207
;	mov eax,image_file
221
;	mov  edx,[scaling_mode]
208
;	mov  edx,[scaling_mode]
222
	movzx  esi,byte [filtering_flag]
209
	movzx  esi,byte [filtering_flag]
223
;	mov  edi,[background_color]
210
;	mov  edi,[background_color]
-
 
211
 
224
 
212
	push	dword 0				; eax - crop size
225
	push	dword [background_color]	;edi - background color
213
	push	dword [background_color]	; edi - background color
226
	push	esi	; esi - filtering
214
	push	esi				; esi - filtering
227
	push	dword [scaling_mode]	;edx - scaling mode
215
	push	dword [scaling_mode]		; edx - scaling mode
228
	push	ecx	; ecx - start_coordinates
216
	push	ecx				; ecx - start_coordinates
229
	push	ebx	; ebx - new_size
217
	push	ebx				; ebx - new_size
230
	push	dword image_file	;eax -  convert data table
218
	push	dword image_file		; eax -  convert data table
231
	
219
 
232
;	pusha
220
;	pusha
233
;	mcall 26,9
221
;	mcall 26,9
234
;	mov  [test1],eax
222
;	mov  [test1],eax
235
;	popa
223
;	popa
236
 
224
 
237
	call [Scaling_Start]
225
	call [Scaling_Start]
238
 
226
 
239
;	pusha
227
;	pusha
240
;	mcall 26,9
228
;	mcall 26,9
241
;	mov  ebx,[test1]
229
;	mov  ebx,[test1]
242
;	sub  eax,ebx
230
;	sub  eax,ebx
243
;	cmp  [test2],0
231
;	cmp  [test2],0
244
;	je  @f
232
;	je  @f
245
;	add  eax,[test2]
233
;	add  eax,[test2]
246
;	shr  eax,1
234
;	shr  eax,1
247
;	cmp  eax,[test3]
235
;	cmp  eax,[test3]
248
;	jbe  @f
236
;	jbe  @f
249
;	mov  [test3],eax
237
;	mov  [test3],eax
250
;@@:
238
;@@:
251
;	mov  [test2],eax
239
;	mov  [test2],eax
252
;	popa
240
;	popa
253
 
241
 
254
	mov  ecx,ebx
242
	mov  ecx,ebx
255
 
243
 
256
	mov  edx,[image_start_coordinates]
244
	mov  edx,[image_start_coordinates]
257
 
245
 
258
    mov  eax,edx
246
	mov  eax,edx
259
    shl  eax,16
247
	shl  eax,16
260
    mov  ax,cx
248
	mov  ax,cx
261
    mov  [scroll_bar_data_vertical.y],eax
249
	mov  [scroll_bar_data_vertical.y],eax
262
 
250
	
263
    mov  eax,edx
251
	mov  eax,edx
264
    mov  ebx,ecx
252
	mov  ebx,ecx
265
    shr  ebx,16
253
	shr  ebx,16
266
    mov  ax,bx
254
	mov  ax,bx
267
    mov  [scroll_bar_data_horizontal.x],eax
255
	mov  [scroll_bar_data_horizontal.x],eax
268
 
256
 
269
;	call correct_cur_area
257
;	call correct_cur_area
270
 
258
 
271
;	movzx eax,[wa_width_1]
259
;	movzx eax,[wa_width_1]
272
;	mov  [test1],eax
260
;	mov  [test1],eax
273
;	movzx eax,[wa_width_2]
261
;	movzx eax,[wa_width_2]
274
;	mov  [test2],eax
262
;	mov  [test2],eax
275
 
263
 
276
;	movzx eax,[wa_high_1]
264
;	movzx eax,[wa_high_1]
277
;	mov  [test3],eax
265
;	mov  [test3],eax
278
;	movzx eax,[wa_high_2]
266
;	movzx eax,[wa_high_2]
279
;	mov  [test4],eax
267
;	mov  [test4],eax
280
 
268
 
281
	xor  eax,eax
269
	xor  eax,eax
282
	mov  ax,[wa_width_1]
270
	mov  ax,[wa_width_1]
283
	sub  ax,[wa_width_2]
271
	sub  ax,[wa_width_2]
284
	shr  ax,1
272
	shr  ax,1
285
	test ax,ax
273
	test ax,ax
286
	jz  @f
274
	jz  @f
287
	shl  eax,16
275
	shl  eax,16
288
	add  edx,eax
276
	add  edx,eax
289
	shr  eax,16
277
	shr  eax,16
290
	call .fill_for_L_R
278
	call .fill_for_L_R
291
@@:
279
@@:
292
	mov  ax,[wa_high_1]
280
	mov  ax,[wa_high_1]
293
	sub  ax,[wa_high_2]
281
	sub  ax,[wa_high_2]
294
	shr  ax,1
282
	shr  ax,1
295
	test ax,ax
283
	test ax,ax
296
	jz  @f
284
	jz  @f
297
	add  edx,eax
285
	add  edx,eax
298
	call .fill_for_U_D
286
	call .fill_for_U_D
299
@@:
287
@@:
300
	mov   esi,[img_resolution]
288
;	mov   esi,[img_resolution]
301
    cmp   [img_resolution_2],15
289
;	cmp   [img_resolution_2],15
302
    jne  @f
290
;	jne  @f
303
	mov  esi,15
291
;	mov  esi,15
304
@@:
292
;@@:
-
 
293
	mov	eax,[raw_pointer_2]
-
 
294
	mov	esi,[eax+12]
-
 
295
	
305
	mov  eax,[raw_pointer]
296
	mov  eax,[raw_pointer]
306
	mov  edi,[eax+20]
297
	mov  edi,[eax+20]
307
	add  edi,eax
298
	add  edi,eax
308
;	mov  edi,[img_palette]
299
;	mov  edi,[img_palette]
-
 
300
 
309
	xor  ebp,ebp
301
	xor  ebp,ebp
310
 
302
 
311
	mov  ebx,[raw_pointer_2]
303
	mov  ebx,[raw_pointer_2]
-
 
304
	mov	eax,[ebx+28]
-
 
305
	add	ebx,eax
312
 
306
 
313
	mov  eax,ecx
307
	mov  eax,ecx
314
	test ax,ax
308
	test ax,ax
315
	jz   .no_draw  ;@f
309
	jz   .no_draw  ;@f
316
	shr  eax,16
310
	shr  eax,16
317
	test eax,eax
311
	test eax,eax
318
	jz   .no_draw ;@f
312
	jz   .no_draw ;@f
319
	
313
 
320
	cmp  [filtering_flag],0
314
;	cmp  [filtering_flag],0
321
	je   @f
315
;	je   @f
322
	cmp  esi,8
316
;	cmp  esi,8
323
	jne  @f
317
;	jne  @f
324
	mov  esi,24
318
;	mov  esi,24
325
@@:
319
;@@:
326
	mcall 65
320
	mcall 65
327
.no_draw:
321
.no_draw:
328
;	mov  eax,ecx
322
;	mov  eax,ecx
329
;	shr  eax,16
323
;	shr  eax,16
330
;	mov  [test1],eax
324
;	mov  [test1],eax
331
;	
325
;	
332
;	mov  eax,ecx
326
;	mov  eax,ecx
333
;	and  eax,0xffff
327
;	and  eax,0xffff
334
;	mov  [test2],eax
328
;	mov  [test2],eax
335
;
329
;
336
;	mov  eax,edx
330
;	mov  eax,edx
337
;	shr  eax,16
331
;	shr  eax,16
338
;	mov  [test3],eax
332
;	mov  [test3],eax
339
;	
333
;	
340
;	mov  eax,edx
334
;	mov  eax,edx
341
;	and  eax,0xffff
335
;	and  eax,0xffff
342
;	mov  [test4],eax
336
;	mov  [test4],eax
343
 
-
 
344
	push ebx
337
 
345
	call draw_file_name_to_work_area
-
 
346
	pop  ebx
338
	call draw_file_name_to_work_area
347
	mov  ecx,ebx  ;[raw_pointer_2]
-
 
348
	mcall 68,13
339
	mcall 68,13,[raw_pointer_2]
349
	
340
	
350
	
341
	
351
	xor  eax,eax
342
	xor  eax,eax
352
	mov  ax,[wa_width_2]
343
	mov  ax,[wa_width_2]
-
 
344
	
-
 
345
	mov  ebx,[img_width]
353
;	imul eax,100
346
;	imul eax,100
-
 
347
	call	calculate_relation
-
 
348
	mov  [zoom_auto_factor],eax
-
 
349
	
-
 
350
	ret
-
 
351
;---------------------------------------------------------------------
-
 
352
calculate_relation:
-
 
353
; relation = X*100/Y
-
 
354
; eax = eax*100/ebx
354
; ÅÀÕ = ÅÀÕ * 100
355
; ÅÀÕ = ÅÀÕ * 100
355
    shl eax,2      ; óìíîæåíèå íà 4
356
	shl	eax,2      ; óìíîæåíèå íà 4
356
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
357
	lea	eax,[eax+eax*4] ; óìíîæåíèå íà 5
357
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
358
	lea	eax,[eax+eax*4] ; óìíîæåíèå íà 5
358
	mov  ebx,[img_width]
359
integer_division:
-
 
360
; eax = eax/ebx
359
	test ebx,ebx
361
	test	ebx,ebx
360
	jnz  @f
362
	jnz	@f
361
	inc  ebx
363
	inc	ebx
362
@@:
364
@@:
363
	xor  edx,edx
365
	xor	edx,edx
364
	div  ebx
366
	div	ebx
365
	shl  edx,1
367
;	shl	edx,1
366
	cmp  ebx,edx
368
;	cmp	ebx,edx
367
	jb   @f
369
;	jb	@f
368
	inc  eax
370
;	inc	eax
369
@@:
371
;@@:
370
	mov  [zoom_auto_factor],eax
-
 
371
	
-
 
372
	ret
372
	ret
373
;---------------------------------------------------------------------
373
;---------------------------------------------------------------------
374
calculation_next_value_plus:
374
calculation_next_value_plus:
375
	mov  ebx,[zoom_auto_factor]
375
	mov  ebx,[zoom_auto_factor]
376
	mov  ecx,zoom_factors.min
376
	mov  ecx,zoom_factors.min
377
	sub  ecx,4
377
	sub  ecx,4
378
@@:
378
@@:
379
	add  ecx,4
379
	add  ecx,4
380
	cmp  ecx,dword zoom_factors.max
380
	cmp  ecx,dword zoom_factors.max
381
	jae  .max	
381
	jae  .max	
382
	mov  eax,[ecx]
382
	mov  eax,[ecx]
383
	cmp  eax,ebx
383
	cmp  eax,ebx
384
	jb   @r
384
	jb   @r
385
@@:
385
@@:
386
	mov  eax,zoom_factors
386
	mov  eax,zoom_factors
387
	mov  [eax],ecx
387
	mov  [eax],ecx
388
;	jmp  zoom_plus.1
388
;	jmp  zoom_plus.1
389
	ret
389
	ret
390
.max:
390
.max:
391
	mov  ecx,dword zoom_factors.max
391
	mov  ecx,dword zoom_factors.max
392
	jmp  @r
392
	jmp  @r
393
;---------------------------------------------------------------------
393
;---------------------------------------------------------------------
394
calculation_next_value_minus:
394
calculation_next_value_minus:
395
	mov  ebx,[zoom_auto_factor]
395
	mov  ebx,[zoom_auto_factor]
396
	mov  ecx,zoom_factors.max
396
	mov  ecx,zoom_factors.max
397
	add  ecx,4
397
	add  ecx,4
398
@@:
398
@@:
399
	sub  ecx,4
399
	sub  ecx,4
400
	cmp  ecx,dword zoom_factors.min
400
	cmp  ecx,dword zoom_factors.min
401
	jbe  .min	
401
	jbe  .min	
402
	mov  eax,[ecx]
402
	mov  eax,[ecx]
403
	cmp  eax,ebx
403
	cmp  eax,ebx
404
	ja   @r
404
	ja   @r
405
@@:
405
@@:
406
	mov  eax,zoom_factors
406
	mov  eax,zoom_factors
407
	mov  [eax],ecx
407
	mov  [eax],ecx
408
;	jmp  zoom_plus.1
408
;	jmp  zoom_plus.1
409
	ret
409
	ret
410
.min:
410
.min:
411
	mov  ecx,dword zoom_factors.min
411
	mov  ecx,dword zoom_factors.min
412
	jmp  @r
412
	jmp  @r
413
;---------------------------------------------------------------------
413
;---------------------------------------------------------------------
414
proc_position_correct:
414
proc_position_correct:
415
	mov  [position_coorect],1
415
	mov  [position_coorect],1
416
	mov  eax,[scroll_bar_data_vertical.max_area]
416
	mov  eax,[scroll_bar_data_vertical.max_area]
417
	xor  ebx,ebx
417
	xor  ebx,ebx
418
	mov  bx,[wa_high_1]
418
	mov  bx,[wa_high_1]
419
	shr  ebx,1
419
	shr  ebx,1
420
	shl  eax,8
420
	shl  eax,8
421
	add  ebx,[scroll_bar_data_vertical.position]
421
	add  ebx,[scroll_bar_data_vertical.position]
422
	test ebx,ebx
422
	test ebx,ebx
423
	jnz  @f
423
	jnz  @f
424
	inc  ebx
424
	inc  ebx
425
@@:
425
@@:
426
	xor  edx,edx
426
	xor  edx,edx
427
	div  ebx
427
	div  ebx
428
	mov  [vertical_position_coorect],eax
428
	mov  [vertical_position_coorect],eax
429
 
429
 
430
	mov  eax,[scroll_bar_data_horizontal.max_area]
430
	mov  eax,[scroll_bar_data_horizontal.max_area]
431
	xor  ebx,ebx
431
	xor  ebx,ebx
432
	mov  bx,[wa_width_1]
432
	mov  bx,[wa_width_1]
433
	shr ebx,1
433
	shr ebx,1
434
	shl  eax,8
434
	shl  eax,8
435
	add  ebx,[scroll_bar_data_horizontal.position]
435
	add  ebx,[scroll_bar_data_horizontal.position]
436
	test ebx,ebx
436
	test ebx,ebx
437
	jnz  @f
437
	jnz  @f
438
	inc  ebx
438
	inc  ebx
439
@@:
439
@@:
440
	xor  edx,edx
440
	xor  edx,edx
441
	div  ebx
441
	div  ebx
442
	mov  [horizontal_position_coorect],eax
442
	mov  [horizontal_position_coorect],eax
443
	ret
443
	ret
444
;---------------------------------------------------------------------
444
;---------------------------------------------------------------------
445
zoom_plus:
445
zoom_plus:
446
;	cmp  [scaling_mode],dword 0
446
;	cmp  [scaling_mode],dword 0
447
	mov  eax,[scaling_mode]
447
	mov  eax,[scaling_mode]
448
	test eax,eax
448
	test eax,eax
449
;	jz   no_scaling.1
449
;	jz   no_scaling.1
450
;	jz   calculation_next_value_plus
450
;	jz   calculation_next_value_plus
451
	jnz  @f
451
	jnz  @f
452
	call  calculation_next_value_plus
452
	call  calculation_next_value_plus
453
	jmp  .1
453
	jmp  .1
454
@@:
454
@@:
455
;	jne  @f
455
;	jne  @f
456
;	mov  [scaling_mode],dword 100
456
;	mov  [scaling_mode],dword 100
457
;	mov  [zoom_factors],dword zoom_factors.100
457
;	mov  [zoom_factors],dword zoom_factors.100
458
;	call  draw_zoom_factors
458
;	call  draw_zoom_factors
459
;	jmp  red
459
;	jmp  red
460
;@@:
460
;@@:
461
	mov  eax,zoom_factors
461
	mov  eax,zoom_factors
462
	cmp  [eax],dword zoom_factors.max
462
	cmp  [eax],dword zoom_factors.max
463
	jae  still
463
	jae  still
464
	add  [eax],dword 4
464
	add  [eax],dword 4
465
.1:
465
.1:
466
	mov  eax,[eax]
466
	mov  eax,[eax]
467
	mov  eax,[eax]
467
	mov  eax,[eax]
468
.2:	
468
.2:	
469
	mov  [scaling_mode],eax
469
	mov  [scaling_mode],eax
470
 
470
 
471
	mov  [correct_scrollbar_100_flag],1
471
	mov  [correct_scrollbar_100_flag],1
472
	call calculate_arrows_offset
472
	call calculate_arrows_offset
473
	
473
	
474
	call  proc_position_correct
474
	call  proc_position_correct
475
 
475
 
476
    call  drawimage
476
    call  drawimage
477
	
477
	
478
	call  set_draw_scrollbar_all
478
	call  set_draw_scrollbar_all
479
    call  draw_scrollbars
479
    call  draw_scrollbars
480
	call  set_nodraw_scrollbar_all
480
	call  set_nodraw_scrollbar_all
481
	
481
	
482
	call  draw_zoom_factors
482
	call  draw_zoom_factors
483
	jmp  still
483
	jmp  still
484
 
484
 
485
zoom_all:
485
zoom_all:
486
;******************************
486
;******************************
487
	mov  eax,wa_width_1
487
	mov  eax,wa_width_1
488
	mov  eax,[eax]
488
	mov  eax,[eax]
489
	push eax
489
	push eax
490
	mov  eax,wa_high_1
490
	mov  eax,wa_high_1
491
	mov  eax,[eax]
491
	mov  eax,[eax]
492
	push eax
492
	push eax
493
;******************************
493
;******************************
494
	cmp  [position_coorect],0
494
	cmp  [position_coorect],0
495
	je   .correct_end
495
	je   .correct_end
496
	mov  [position_coorect],0
496
	mov  [position_coorect],0
497
	mov  eax,[scroll_bar_data_vertical.max_area]
497
	mov  eax,[scroll_bar_data_vertical.max_area]
498
;	xor  ebx,ebx
498
;	xor  ebx,ebx
499
;	mov  bx,[wa_high_1]
499
;	mov  bx,[wa_high_1]
500
;	shr  ebx,1
500
;	shr  ebx,1
501
;	add  eax,ebx  ;[scroll_bar_data_vertical.cur_area]
501
;	add  eax,ebx  ;[scroll_bar_data_vertical.cur_area]
502
	shl  eax,8
502
	shl  eax,8
503
	mov  ebx,[vertical_position_coorect]
503
	mov  ebx,[vertical_position_coorect]
504
	test ebx,ebx
504
	test ebx,ebx
505
	jnz  @f
505
	jnz  @f
506
	inc  ebx
506
	inc  ebx
507
@@:
507
@@:
508
	xor  edx,edx
508
	xor  edx,edx
509
	div  ebx
509
	div  ebx
510
;	shr  eax,8
510
;	shr  eax,8
511
	xor  ebx,ebx
511
	xor  ebx,ebx
512
	mov  bx,[wa_high_1]
512
	mov  bx,[wa_high_1]
513
	shr  ebx,1
513
	shr  ebx,1
514
	cmp  eax,ebx
514
	cmp  eax,ebx
515
	jae  @f
515
	jae  @f
516
	xor  eax,eax
516
	xor  eax,eax
517
	jmp  .position_vertical_correct
517
	jmp  .position_vertical_correct
518
@@:
518
@@:
519
	sub  eax,ebx
519
	sub  eax,ebx
520
.position_vertical_correct:
520
.position_vertical_correct:
521
	mov  [scroll_bar_data_vertical.position],eax
521
	mov  [scroll_bar_data_vertical.position],eax
522
	
522
	
523
	mov  eax,[scroll_bar_data_horizontal.max_area]
523
	mov  eax,[scroll_bar_data_horizontal.max_area]
524
;	xor  ebx,ebx
524
;	xor  ebx,ebx
525
;	mov  bx,[wa_width_1]
525
;	mov  bx,[wa_width_1]
526
;	shr  ebx,1
526
;	shr  ebx,1
527
;	add  eax,ebx  ;[scroll_bar_data_horizontal.cur_area]
527
;	add  eax,ebx  ;[scroll_bar_data_horizontal.cur_area]
528
	shl  eax,8
528
	shl  eax,8
529
	mov  ebx,[horizontal_position_coorect]
529
	mov  ebx,[horizontal_position_coorect]
530
	test ebx,ebx
530
	test ebx,ebx
531
	jnz  @f
531
	jnz  @f
532
	inc  ebx
532
	inc  ebx
533
@@:
533
@@:
534
	xor  edx,edx
534
	xor  edx,edx
535
	div  ebx
535
	div  ebx
536
;	shr  eax,8
536
;	shr  eax,8
537
	xor  ebx,ebx
537
	xor  ebx,ebx
538
	mov  bx,[wa_width_1]
538
	mov  bx,[wa_width_1]
539
	shr  ebx,1
539
	shr  ebx,1
540
	cmp  eax,ebx
540
	cmp  eax,ebx
541
	jae  @f
541
	jae  @f
542
	xor  eax,eax
542
	xor  eax,eax
543
	jmp  .position_horizontal_correct
543
	jmp  .position_horizontal_correct
544
@@:
544
@@:
545
	sub  eax,ebx
545
	sub  eax,ebx
546
.position_horizontal_correct:
546
.position_horizontal_correct:
547
	mov  [scroll_bar_data_horizontal.position],eax
547
	mov  [scroll_bar_data_horizontal.position],eax
548
	
548
	
549
.correct_end:
549
.correct_end:
550
 
550
 
551
;****************************************************************************
551
;****************************************************************************
552
; Vertical SCROLLBAR
552
; Vertical SCROLLBAR
553
; At a case of resizing of the window
553
; At a case of resizing of the window
554
; Check the position of a runner has crossed a limit
554
; Check the position of a runner has crossed a limit
555
;****************************************************************************
555
;****************************************************************************
556
    mov  eax,[scroll_bar_data_vertical.max_area]
556
    mov  eax,[scroll_bar_data_vertical.max_area]
557
	xor  ebx,ebx
557
	xor  ebx,ebx
558
	mov  bx,[wa_high_1]
558
	mov  bx,[wa_high_1]
559
	cmp  eax,ebx
559
	cmp  eax,ebx
560
	ja   @f
560
	ja   @f
561
	xor  eax,eax
561
	xor  eax,eax
562
	jmp  .p_5
562
	jmp  .p_5
563
@@:
563
@@:
564
    sub  eax,ebx  ;[scroll_bar_data_vertical.cur_area]
564
    sub  eax,ebx  ;[scroll_bar_data_vertical.cur_area]
565
    cmp  eax,[scroll_bar_data_vertical.position]
565
    cmp  eax,[scroll_bar_data_vertical.position]
566
    jae  @f
566
    jae  @f
567
.p_5:
567
.p_5:
568
    mov  [scroll_bar_data_vertical.position],eax
568
    mov  [scroll_bar_data_vertical.position],eax
569
@@:
569
@@:
570
;****************************************************************************
570
;****************************************************************************
571
; Horizontal SCROLLBAR
571
; Horizontal SCROLLBAR
572
; At a case of resizing of the window
572
; At a case of resizing of the window
573
; Check the position of a runner has crossed a limit
573
; Check the position of a runner has crossed a limit
574
;****************************************************************************
574
;****************************************************************************
575
    mov  eax,[scroll_bar_data_horizontal.max_area]
575
    mov  eax,[scroll_bar_data_horizontal.max_area]
576
	xor  ebx,ebx
576
	xor  ebx,ebx
577
	mov  bx,[wa_width_1]
577
	mov  bx,[wa_width_1]
578
	cmp  eax,ebx
578
	cmp  eax,ebx
579
	ja   @f
579
	ja   @f
580
	xor  eax,eax
580
	xor  eax,eax
581
	jmp  .p_6
581
	jmp  .p_6
582
@@:
582
@@:
583
    sub  eax,ebx  ;[scroll_bar_data_horizontal.cur_area]
583
    sub  eax,ebx  ;[scroll_bar_data_horizontal.cur_area]
584
    cmp  eax,[scroll_bar_data_horizontal.position]
584
    cmp  eax,[scroll_bar_data_horizontal.position]
585
    jae  @f
585
    jae  @f
586
.p_6:
586
.p_6:
587
    mov  [scroll_bar_data_horizontal.position],eax
587
    mov  [scroll_bar_data_horizontal.position],eax
588
@@:
588
@@:
589
;****************************************************************************
589
;****************************************************************************
590
 
590
 
591
	mov   eax,[scroll_bar_data_horizontal.max_area]
591
	mov   eax,[scroll_bar_data_horizontal.max_area]
592
	mov   ebx,[scroll_bar_data_vertical.max_area]
592
	mov   ebx,[scroll_bar_data_vertical.max_area]
593
 
593
 
594
 
594
 
595
	sub   eax,[scroll_bar_data_horizontal.position]   ;100
595
	sub   eax,[scroll_bar_data_horizontal.position]   ;100
596
	sub   ebx,[scroll_bar_data_vertical.position]    ;100
596
	sub   ebx,[scroll_bar_data_vertical.position]    ;100
597
 
597
 
598
	xor   ecx,ecx
598
	xor   ecx,ecx
599
	mov   cx,word [wa_width_1]
599
	mov   cx,word [wa_width_1]
600
	cmp   eax,ecx
600
	cmp   eax,ecx
601
	jbe   @f
601
	jbe   @f
602
	xor   eax,eax
602
	xor   eax,eax
603
	mov   ax,[wa_width_1]
603
	mov   ax,[wa_width_1]
604
@@:
604
@@:
605
	mov   [wa_width_2],ax
605
	mov   [wa_width_2],ax
606
	mov   ecx,eax
606
	mov   ecx,eax
607
	shl   ecx,16
607
	shl   ecx,16
608
	xchg  eax,ebx
608
	xchg  eax,ebx
609
 
609
 
610
	xor   edx,edx
610
	xor   edx,edx
611
	mov   dx,word [wa_high_1]
611
	mov   dx,word [wa_high_1]
612
	cmp   eax,edx
612
	cmp   eax,edx
613
	jbe   @f
613
	jbe   @f
614
	xor   eax,eax
614
	xor   eax,eax
615
	mov   ax,[wa_high_1]
615
	mov   ax,[wa_high_1]
616
@@:
616
@@:
617
	mov   [wa_high_2],ax
617
	mov   [wa_high_2],ax
618
	mov   cx,ax
618
	mov   cx,ax
619
 
619
 
620
	call  correct_cur_area
620
	call  correct_cur_area
621
 
621
 
622
	mov   ebx,ecx
622
	mov   ebx,ecx
623
 
623
 
624
	push eax
624
	push eax
625
	mov  eax,[scroll_bar_data_vertical.max_area]
625
	mov  eax,[scroll_bar_data_vertical.max_area]
626
	cmp  eax,[scroll_bar_data_vertical.cur_area]
626
	cmp  eax,[scroll_bar_data_vertical.cur_area]
627
	jbe  .horizontal  ;@f
627
	jbe  .horizontal  ;@f
628
	mov  ax,[wa_width_1]
628
	mov  ax,[wa_width_1]
629
	sub  ax,[scroll_bar_data_vertical.size_x]
629
	sub  ax,[scroll_bar_data_vertical.size_x]
630
	mov  [wa_width_1],ax
630
	mov  [wa_width_1],ax
631
	cmp  ax,[wa_width_2]
631
	cmp  ax,[wa_width_2]
632
	jae  .horizontal
632
	jae  .horizontal
633
	mov  [wa_width_2],ax
633
	mov  [wa_width_2],ax
634
.horizontal:
634
.horizontal:
635
	mov  eax,[scroll_bar_data_horizontal.max_area]
635
	mov  eax,[scroll_bar_data_horizontal.max_area]
636
	cmp  eax,[scroll_bar_data_horizontal.cur_area]
636
	cmp  eax,[scroll_bar_data_horizontal.cur_area]
637
	jbe  .finish   ;@f
637
	jbe  .finish   ;@f
638
	mov  ax,[wa_high_1]
638
	mov  ax,[wa_high_1]
639
	sub  ax,[scroll_bar_data_horizontal.size_y]
639
	sub  ax,[scroll_bar_data_horizontal.size_y]
640
	mov  [wa_high_1],ax
640
	mov  [wa_high_1],ax
641
	cmp  ax,[wa_high_2]
641
	cmp  ax,[wa_high_2]
642
	jae  .finish
642
	jae  .finish
643
	mov  [wa_high_2],ax
643
	mov  [wa_high_2],ax
644
.finish:   ;@@:
644
.finish:   ;@@:
645
	pop  eax
645
	pop  eax
646
 
646
 
647
	mov  cx,[wa_width_2]
647
	mov  cx,[wa_width_2]
648
	shl ecx,16
648
	shl ecx,16
649
	mov  cx,[wa_high_2]
649
	mov  cx,[wa_high_2]
650
 
650
 
651
	call  correct_cur_area
651
	call  correct_cur_area
652
 
652
 
653
	mov   ebx,ecx
653
	mov   ebx,ecx
654
 
654
 
655
	mov  eax,[scroll_bar_data_horizontal.position]
655
	mov  eax,[scroll_bar_data_horizontal.position]
656
 
656
 
657
;	imul eax,100
657
;	imul eax,100
658
; ÅÀÕ = ÅÀÕ * 100
658
; ÅÀÕ = ÅÀÕ * 100
659
    shl eax,2      ; óìíîæåíèå íà 4
659
    shl eax,2      ; óìíîæåíèå íà 4
660
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
660
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
661
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
661
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
662
	push ebx
662
	push ebx
663
	mov  ebx,[scaling_mode]
663
	mov  ebx,[scaling_mode]
664
	xor  edx,edx
664
	xor  edx,edx
665
	div  ebx
665
	div  ebx
666
 
666
 
667
;	shl  edx,1
667
;	shl  edx,1
668
;	cmp  edx,ebx
668
;	cmp  edx,ebx
669
;	jb  @f
669
;	jb  @f
670
;	inc  eax
670
;	inc  eax
671
;@@:
671
;@@:
672
 
672
 
673
	pop  ebx
673
	pop  ebx
674
 
674
 
675
	mov  ecx,eax
675
	mov  ecx,eax
676
	shl  ecx,16
676
	shl  ecx,16
677
 
677
 
678
	mov  eax,[scroll_bar_data_vertical.position]
678
	mov  eax,[scroll_bar_data_vertical.position]
679
 
679
 
680
;	imul eax,100
680
;	imul eax,100
681
; ÅÀÕ = ÅÀÕ * 100
681
; ÅÀÕ = ÅÀÕ * 100
682
    shl eax,2      ; óìíîæåíèå íà 4
682
    shl eax,2      ; óìíîæåíèå íà 4
683
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
683
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
684
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
684
    lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
685
	push ebx
685
	push ebx
686
	mov  ebx,[scaling_mode]
686
	mov  ebx,[scaling_mode]
687
	xor  edx,edx
687
	xor  edx,edx
688
	div  ebx
688
	div  ebx
689
 
689
 
690
;	shl  edx,1
690
;	shl  edx,1
691
;	cmp  edx,ebx
691
;	cmp  edx,ebx
692
;	jb  @f
692
;	jb  @f
693
;	inc  eax
693
;	inc  eax
694
;@@:
694
;@@:
695
 
695
 
696
	pop  ebx
696
	pop  ebx
697
 
697
 
698
	mov  cx,ax
698
	mov  cx,ax
699
 
699
 
700
	call   scaling.5
700
	call   scaling.5
701
;******************************
701
;******************************
702
	pop  eax
702
	pop  eax
703
	mov  ebx,wa_high_1
703
	mov  ebx,wa_high_1
704
	mov  [ebx],eax
704
	mov  [ebx],eax
705
 
705
 
706
	pop  eax
706
	pop  eax
707
	mov  ebx,wa_width_1
707
	mov  ebx,wa_width_1
708
	mov  [ebx],eax
708
	mov  [ebx],eax
709
;******************************
709
;******************************
710
 
710
 
711
	ret
711
	ret
712
;---------------------------------------------------------------------
712
;---------------------------------------------------------------------
713
zoom_minus:
713
zoom_minus:
714
;	cmp  [scaling_mode],dword 0
714
;	cmp  [scaling_mode],dword 0
715
	mov  eax,[scaling_mode]
715
	mov  eax,[scaling_mode]
716
	test eax,eax
716
	test eax,eax
717
;	jz   no_scaling.1
717
;	jz   no_scaling.1
718
;	jz   calculation_next_value_minus
718
;	jz   calculation_next_value_minus
719
	jnz  @f
719
	jnz  @f
720
	call  calculation_next_value_minus
720
	call  calculation_next_value_minus
721
	jmp  zoom_plus.1
721
	jmp  zoom_plus.1
722
@@:
722
@@:
723
;	je   no_scaling.1
723
;	je   no_scaling.1
724
;	jne  @f
724
;	jne  @f
725
;	mov  [scaling_mode],dword 100
725
;	mov  [scaling_mode],dword 100
726
;	mov  [zoom_factors],dword zoom_factors.100
726
;	mov  [zoom_factors],dword zoom_factors.100
727
;	call  draw_zoom_factors
727
;	call  draw_zoom_factors
728
;	jmp  red
728
;	jmp  red
729
;@@:
729
;@@:
730
	mov  eax,zoom_factors
730
	mov  eax,zoom_factors
731
	cmp  [eax],dword zoom_factors.min
731
	cmp  [eax],dword zoom_factors.min
732
	jbe  still
732
	jbe  still
733
	sub  [eax],dword 4
733
	sub  [eax],dword 4
734
	jmp   zoom_plus.1
734
	jmp   zoom_plus.1
735
;---------------------------------------------------------------------
735
;---------------------------------------------------------------------