Subversion Repositories Kolibri OS

Rev

Rev 1957 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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