Subversion Repositories Kolibri OS

Rev

Rev 1958 | 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]
2163 mario79 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
1951 mario79 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
scaling:
72
	mov  eax,[soi]
73
	test eax,eax
74
	jz   still
75
	mov  eax,scaling_mode
76
	xor  ebx,ebx
77
	cmp  [eax],ebx  ;dword 0
78
	je   still
79
	mov  [eax],ebx  ;dword 0
80
	mov  [zoom_factors],dword zoom_factors.1
81
	call .1
82
	call draw_zoom_factors
83
	jmp  still
84
;---------------------------
85
.compens_x:
86
	call .get_x_y
87
	xor  ecx,ecx
88
	mov  cx,[wa_high_1]
89
	imul eax,ecx
90
	xor  edx,edx
91
	div  ebx
92
	ret
93
;---------------------------
94
.compens_y:
95
	call .get_x_y
96
	xchg eax,ebx
97
	xor  ecx,ecx
98
	mov  cx,[wa_width_1]
99
	imul eax,ecx
100
	xor  edx,edx
101
	div  ebx
102
	ret
103
;---------------------------
104
.get_x_y:
105
    mov  ebx,[raw_pointer]
106
    mov  eax,[ebx+4]
107
	mov  ebx,[ebx+8]
108
	ret
109
;---------------------------
110
.fill_for_L_R:
111
	cmp   [no_fill],1
112
	je   @f
113
	pusha
114
	mov   ebx,[image_start_coordinates]
115
	mov   ecx,ebx
116
	shl   ecx,16
117
	mov   bx,ax
118
	mov   cx,[wa_high_1]
119
	mcall 13,,,[fill_color] ;0xffffff
120
	mov   ax,bx
121
	ror   ebx,16
122
	add   bx,ax
123
	add   bx,[wa_width_2]
124
	mov   ax,[wa_width_1]
125
	sub   ax,bx
126
	rol   ebx,16
127
	mov   bx,ax
128
	mcall 13,,,[fill_color]  ;0xffffff
129
	popa
130
@@:
131
	ret
132
;---------------------------
133
.fill_for_U_D:
134
	cmp   [no_fill],1
135
	je   @f
136
	pusha
137
	mov   ebx,[image_start_coordinates]
138
	mov   ecx,ebx
139
	shl   ecx,16
140
	mov   cx,ax
141
	mov   bx,[wa_width_1]
142
	mcall 13,,,[fill_color]  ;0xffffff
143
	mov   ax,cx
144
	ror   ecx,16
145
	add   cx,ax
146
	add   cx,[wa_high_2]
147
	mov   ax,[wa_high_1]
148
	add   ax,28  ;50
149
	sub   ax,cx
150
	rol   ecx,16
151
	mov   cx,ax
152
	mcall 13,,,[fill_color]  ;0xffffff
153
	popa
154
@@:
155
	ret
156
;---------------------------
157
.1:
158
	call .get_x_y
159
	cmp  eax,ebx
160
	jb  .y
161
;---------------------------
162
.x:
163
	call .compens_y
164
	cmp  ax,[wa_high_1]
165
	jbe @f
166
	call .compens_x
167
	mov  [wa_width_2],ax
168
	jmp  .4
169
@@:
170
	mov  [wa_high_2],ax
171
	jmp  .4
172
;---------------------------
173
.y:
174
	call .compens_x
175
	cmp  ax,[wa_width_1]
176
	jbe  @f
177
	call .compens_y
178
	mov  [wa_high_2],ax
179
	jmp  .4
180
@@:
181
	mov  [wa_width_2],ax
182
;---------------------------
183
.4:
184
	mov bx,[wa_width_2]
185
	shl ebx,16
186
	mov bx,[wa_high_2]
187
 
188
	xor  ecx,ecx
189
.5:
190
 
191
;	mov  eax,ebx
192
;	and  eax,0xffff
193
;	mov  [test1],eax
194
 
195
;	mov  eax,ebx
196
;	shr  eax,16
197
;	mov  [test2],eax
198
 
199
;	mov  eax,ecx
200
;	and  eax,0xffff
201
;	mov  [test3],eax
202
 
203
;	mov  eax,ecx
204
;	shr  eax,16
205
;	mov  [test4],eax
206
 
1958 mario79 207
;	mov eax,image_file
208
;	mov  edx,[scaling_mode]
1951 mario79 209
	movzx  esi,byte [filtering_flag]
1958 mario79 210
;	mov  edi,[background_color]
211
 
2163 mario79 212
	push	dword 0				; eax - crop size
213
	push	dword [background_color]	; edi - background color
214
	push	esi				; esi - filtering
215
	push	dword [scaling_mode]		; edx - scaling mode
216
	push	ecx				; ecx - start_coordinates
217
	push	ebx				; ebx - new_size
218
	push	dword image_file		; eax -  convert data table
219
 
1951 mario79 220
;	pusha
221
;	mcall 26,9
222
;	mov  [test1],eax
223
;	popa
224
 
225
	call [Scaling_Start]
226
 
227
;	pusha
228
;	mcall 26,9
229
;	mov  ebx,[test1]
230
;	sub  eax,ebx
231
;	cmp  [test2],0
232
;	je  @f
233
;	add  eax,[test2]
234
;	shr  eax,1
235
;	cmp  eax,[test3]
236
;	jbe  @f
237
;	mov  [test3],eax
238
;@@:
239
;	mov  [test2],eax
240
;	popa
241
 
242
	mov  ecx,ebx
243
 
244
	mov  edx,[image_start_coordinates]
245
 
2163 mario79 246
	mov  eax,edx
247
	shl  eax,16
248
	mov  ax,cx
249
	mov  [scroll_bar_data_vertical.y],eax
250
 
251
	mov  eax,edx
252
	mov  ebx,ecx
253
	shr  ebx,16
254
	mov  ax,bx
255
	mov  [scroll_bar_data_horizontal.x],eax
1951 mario79 256
 
257
;	call correct_cur_area
258
 
259
;	movzx eax,[wa_width_1]
260
;	mov  [test1],eax
261
;	movzx eax,[wa_width_2]
262
;	mov  [test2],eax
263
 
264
;	movzx eax,[wa_high_1]
265
;	mov  [test3],eax
266
;	movzx eax,[wa_high_2]
267
;	mov  [test4],eax
268
 
269
	xor  eax,eax
270
	mov  ax,[wa_width_1]
271
	sub  ax,[wa_width_2]
272
	shr  ax,1
273
	test ax,ax
274
	jz  @f
275
	shl  eax,16
276
	add  edx,eax
277
	shr  eax,16
278
	call .fill_for_L_R
279
@@:
280
	mov  ax,[wa_high_1]
281
	sub  ax,[wa_high_2]
282
	shr  ax,1
283
	test ax,ax
284
	jz  @f
285
	add  edx,eax
286
	call .fill_for_U_D
287
@@:
2163 mario79 288
;	mov   esi,[img_resolution]
289
;	cmp   [img_resolution_2],15
290
;	jne  @f
291
;	mov  esi,15
292
;@@:
293
	mov	eax,[raw_pointer_2]
294
	mov	esi,[eax+12]
295
 
1951 mario79 296
	mov  eax,[raw_pointer]
297
	mov  edi,[eax+20]
298
	add  edi,eax
299
;	mov  edi,[img_palette]
2163 mario79 300
 
1951 mario79 301
	xor  ebp,ebp
302
 
303
	mov  ebx,[raw_pointer_2]
2163 mario79 304
	mov	eax,[ebx+28]
305
	add	ebx,eax
1951 mario79 306
 
307
	mov  eax,ecx
308
	test ax,ax
309
	jz   .no_draw  ;@f
310
	shr  eax,16
311
	test eax,eax
312
	jz   .no_draw ;@f
2163 mario79 313
 
314
;	cmp  [filtering_flag],0
315
;	je   @f
316
;	cmp  esi,8
317
;	jne  @f
318
;	mov  esi,24
319
;@@:
1951 mario79 320
	mcall 65
321
.no_draw:
322
;	mov  eax,ecx
323
;	shr  eax,16
324
;	mov  [test1],eax
325
;
326
;	mov  eax,ecx
327
;	and  eax,0xffff
328
;	mov  [test2],eax
329
;
330
;	mov  eax,edx
331
;	shr  eax,16
332
;	mov  [test3],eax
333
;
334
;	mov  eax,edx
335
;	and  eax,0xffff
336
;	mov  [test4],eax
337
 
338
	call draw_file_name_to_work_area
2163 mario79 339
	mcall 68,13,[raw_pointer_2]
1951 mario79 340
 
341
 
342
	xor  eax,eax
343
	mov  ax,[wa_width_2]
2163 mario79 344
 
345
	mov  ebx,[img_width]
1951 mario79 346
;	imul eax,100
2163 mario79 347
	call	calculate_relation
1951 mario79 348
	mov  [zoom_auto_factor],eax
349
 
350
	ret
351
;---------------------------------------------------------------------
2163 mario79 352
calculate_relation:
353
; relation = X*100/Y
354
; eax = eax*100/ebx
355
; ЕАХ = ЕАХ * 100
356
	shl	eax,2      ; умножение на 4
357
	lea	eax,[eax+eax*4] ; умножение на 5
358
	lea	eax,[eax+eax*4] ; умножение на 5
359
integer_division:
360
; eax = eax/ebx
361
	test	ebx,ebx
362
	jnz	@f
363
	inc	ebx
364
@@:
365
	xor	edx,edx
366
	div	ebx
367
;	shl	edx,1
368
;	cmp	ebx,edx
369
;	jb	@f
370
;	inc	eax
371
;@@:
372
	ret
373
;---------------------------------------------------------------------
1951 mario79 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
;---------------------------------------------------------------------