Subversion Repositories Kolibri OS

Rev

Rev 1040 | Rev 1087 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1040 Rev 1080
Line 7... Line 7...
7
;-----------------------------------------------------------------------------
7
;-----------------------------------------------------------------------------
Line 8... Line 8...
8
 
8
 
9
FALSE = 0
9
FALSE = 0
Line 10... Line 10...
10
TRUE  = 1
10
TRUE  = 1
11
 
11
 
12
include '../../../../../proc32.inc'
12
include '../../../proc32.inc'
Line 13... Line 13...
13
include '../../../../../macros.inc'
13
include '../../../macros.inc'
14
include 'dll.inc'
14
include 'dll.inc'
Line 65... Line 65...
65
 
65
 
66
red:
66
red:
Line 67... Line 67...
67
	call	draw_window
67
	call	draw_window
-
 
68
 
-
 
69
still:
-
 
70
	mov	eax, [image]
-
 
71
	test	byte [eax + Image.Flags], Image.IsAnimated
-
 
72
	push	10
-
 
73
	pop	eax
-
 
74
	jz	@f
-
 
75
	mcall	26, 9
-
 
76
	mov	edx, [cur_frame]
-
 
77
	mov	ebx, [cur_frame_time]
-
 
78
	add	ebx, [edx + Image.Delay]
-
 
79
	sub	ebx, eax
-
 
80
	cmp	ebx, [edx + Image.Delay]
-
 
81
	ja	red_update_frame
-
 
82
	test	ebx, ebx
-
 
83
	jz	red_update_frame
-
 
84
	push	23
68
 
85
	pop	eax
69
still:
86
  @@:
-
 
87
	mcall
70
	mcall	10
88
	dec	eax
71
	dec	eax
89
	js	red_update_frame
72
	jz	red
90
	jz	red
Line 73... Line 91...
73
	dec	eax
91
	dec	eax
74
	jnz	button
92
	jnz	button
75
 
93
 
Line -... Line 94...
-
 
94
key:
-
 
95
	mcall	2
-
 
96
	jmp	still
-
 
97
 
-
 
98
red_update_frame:
-
 
99
	mov	eax, [cur_frame]
-
 
100
	mov	eax, [eax + Image.Next]
-
 
101
	test	eax, eax
-
 
102
	jnz	@f
-
 
103
	mov	eax, [image]
-
 
104
  @@:
-
 
105
	mov	[cur_frame], eax
-
 
106
	mcall	26, 9
-
 
107
	mov	[cur_frame_time], eax
76
  key:
108
	mcall	9, procinfo, -1
77
	mcall	2
109
	call	draw_cur_frame
78
	jmp	still
110
	jmp	still
Line 79... Line 111...
79
 
111
 
Line 139... Line 171...
139
	invoke	img.destroy
171
	invoke	img.destroy
140
	call	free_directory
172
	call	free_directory
141
	jmp	red
173
	jmp	red
142
    .restore_old:
174
    .restore_old:
143
	pop	[image]
175
	pop	[image]
-
 
176
	call	init_frame
144
	jmp	still
177
	jmp	still
Line 145... Line 178...
145
 
178
 
146
	; set background
179
	; set background
147
    @@:
180
    @@:
Line 200... Line 233...
200
;	jz	exit
233
;	jz	exit
201
	invoke	img.decode, [img_data], [img_data_len]
234
	invoke	img.decode, [img_data], [img_data_len]
202
	or	eax, eax
235
	or	eax, eax
203
	jz	.error
236
	jz	.error
204
	cmp	[image], 0
237
	cmp	[image], 0
-
 
238
	pushf
205
	mov	[image], eax
239
	mov	[image], eax
-
 
240
	call	init_frame
-
 
241
	popf
206
	call	update_image_sizes
242
	call	update_image_sizes
207
	call	free_img_data
243
	call	free_img_data
208
	clc
244
	clc
209
	ret
245
	ret
Line 333... Line 369...
333
	invoke	img.destroy
369
	invoke	img.destroy
334
.ret:
370
.ret:
335
	ret
371
	ret
336
.notfound:
372
.notfound:
337
	pop	[image]
373
	pop	[image]
-
 
374
	call	init_frame
338
	ret
375
	ret
Line 339... Line 376...
339
 
376
 
340
next_image:
377
next_image:
341
	call	load_directory
378
	call	load_directory
Line 395... Line 432...
395
	invoke	img.destroy
432
	invoke	img.destroy
396
.ret:
433
.ret:
397
	ret
434
	ret
398
.notfound:
435
.notfound:
399
	pop	[image]
436
	pop	[image]
-
 
437
	call	init_frame
400
	ret
438
	ret
Line 401... Line 439...
401
 
439
 
402
load_directory:
440
load_directory:
403
	cmp	[directory_ptr], 0
441
	cmp	[directory_ptr], 0
Line 526... Line 564...
526
free_directory:
564
free_directory:
527
	mcall	68, 13, [directory_ptr]
565
	mcall	68, 13, [directory_ptr]
528
	and	[directory_ptr], 0
566
	and	[directory_ptr], 0
529
	ret
567
	ret
Line -... Line 568...
-
 
568
 
-
 
569
init_frame:
-
 
570
	push	eax
-
 
571
	mov	eax, [image]
-
 
572
	mov	[cur_frame], eax
-
 
573
	test	byte [eax + Image.Flags], Image.IsAnimated
-
 
574
	jz	@f
-
 
575
	push	ebx
-
 
576
	mcall	26, 9
-
 
577
	pop	ebx
-
 
578
	mov	[cur_frame_time], eax
-
 
579
@@:
-
 
580
	pop	eax
-
 
581
	ret
530
 
582
 
531
draw_window:
583
draw_window:
532
	cmp	[bFirstDraw], 0
584
	cmp	[bFirstDraw], 0
533
	jz	.posok
585
	jz	.posok
534
	or	ecx, -1
586
	or	ecx, -1
Line 646... Line 698...
646
	add	edx, 25 * 65536
698
	add	edx, 25 * 65536
647
	mcall	, buttons+rotccwbtn*20
699
	mcall	, buttons+rotccwbtn*20
648
	add	edx, 25 * 65536
700
	add	edx, 25 * 65536
649
	mcall	, buttons+rot180btn*20
701
	mcall	, buttons+rot180btn*20
Line 650... Line 702...
650
 
702
 
651
	mov	ebx, [image]
-
 
652
	mov	ecx, [procinfo+62]
-
 
653
	sub	ecx, 4
-
 
654
	mov	ebp, [ebx + Image.Width]
-
 
655
	cmp	ecx, ebp
-
 
656
	jb	@f
-
 
657
	mov	ecx, ebp
-
 
658
@@:
-
 
659
	sub	ebp, ecx
-
 
660
	mov	edx, [procinfo+66]
-
 
661
	sub	edx, 34
-
 
662
	cmp	edx, [ebx + Image.Height]
-
 
663
	jb	@f
-
 
664
	mov	edx, [ebx + Image.Height]
-
 
665
@@:
-
 
666
	shl	ecx, 16
-
 
667
	add	ecx, edx
-
 
668
	__mov	edx, 5, 35
-
 
669
	mov	esi, 8
-
 
670
	cmp	[ebx + Image.Type], Image.bpp8
-
 
671
	jz	.bpp8
-
 
672
	cmp	[ebx + Image.Type], Image.bpp24
-
 
673
	jz	.bpp24
-
 
674
	mov	esi, 32
-
 
675
	shl	ebp, 2
-
 
676
	jmp	@f
-
 
677
.bpp24:
-
 
678
	mov	esi, 24
-
 
679
	lea	ebp, [ebp*3]
-
 
680
.bpp8:
-
 
681
@@:
-
 
682
	mov	edi, [ebx + Image.Palette]
-
 
683
	mov	ebx, [ebx + Image.Data]
-
 
Line 684... Line 703...
684
	mcall	65
703
	call	draw_cur_frame
Line 685... Line 704...
685
 
704
 
686
	mcall	12, 2
705
	mcall	12, 2
Line -... Line 706...
-
 
706
 
-
 
707
.noredraw:
-
 
708
	ret
-
 
709
 
-
 
710
draw_cur_frame:
-
 
711
	push	0	; ypos
-
 
712
	push	0	; xpos
-
 
713
	mov	eax, [procinfo+66]
-
 
714
	sub	eax, 34
-
 
715
	push	eax	; max height
-
 
716
	mov	eax, [procinfo+62]
-
 
717
	sub	eax, 4
-
 
718
	push	eax	; max width
-
 
719
	push	35	; y
-
 
720
	push	5	; x
687
 
721
	push	[cur_frame]
688
.noredraw:
722
	call	[img.draw]
689
	ret
723
	ret
690
 
724
 
691
; void* __stdcall mem.Alloc(unsigned size);
725
; void* __stdcall mem.Alloc(unsigned size);
Line 942... Line 976...
942
	img.is_img  , 'img.is_img' , \
976
	img.is_img  , 'img.is_img' , \
943
	img.to_rgb2 , 'img.to_rgb2', \
977
	img.to_rgb2 , 'img.to_rgb2', \
944
	img.decode  , 'img.decode' , \
978
	img.decode  , 'img.decode' , \
945
	img.flip    , 'img.flip'   , \
979
	img.flip    , 'img.flip'   , \
946
	img.rotate  , 'img.rotate' , \
980
	img.rotate  , 'img.rotate' , \
947
	img.destroy , 'img.destroy'
981
	img.destroy , 'img.destroy', \
-
 
982
	img.draw    , 'img.draw'
Line 948... Line 983...
948
 
983
 
Line 949... Line 984...
949
import  sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
984
import  sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
950
 
985
 
Line 1021... Line 1056...
1021
wnd_height	dd	?
1056
wnd_height	dd	?
1022
draw_width	dd	?
1057
draw_width	dd	?
1023
draw_height	dd	?
1058
draw_height	dd	?
1024
last_name_component	dd	?
1059
last_name_component	dd	?
1025
cur_file_idx	dd	?
1060
cur_file_idx	dd	?
-
 
1061
cur_frame_time	dd	?
-
 
1062
cur_frame	dd	?
Line 1026... Line 1063...
1026
 
1063
 
Line 1027... Line 1064...
1027
ctx dd ?
1064
ctx dd ?
1028
 
1065