Subversion Repositories Kolibri OS

Rev

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