Subversion Repositories Kolibri OS

Rev

Rev 3450 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
205 heavyiron 1
save_file:
2
pusha
1098 Lrz 3
        bt      dword [flags],0
4
        jnc     .not_shooted
205 heavyiron 5
 
1608 mario79 6
        cmp     byte [fname_buf],0
1098 Lrz 7
        je      .no_file_name
205 heavyiron 8
 
1098 Lrz 9
        mov     edi,sign_n_input
10
        call    zstr_to_int
11
        mov     [sign_n],al
205 heavyiron 12
 
1098 Lrz 13
        ; генерируем имя файла
14
        xor     eax,eax
15
        mov     ecx,1056
16
        mov     edi,file_name
17
        rep     stosb   ; заполняем нулями
205 heavyiron 18
 
1608 mario79 19
        mov     esi,fname_buf
1098 Lrz 20
        mov     edi,file_name
205 heavyiron 21
.next:
1098 Lrz 22
        mov     ah,[esi]
23
        test    ah,ah
24
        jz      .str_end
25
        cmp     ah,'*'
26
        jne     .no_insert_number
27
        jmp     .insert_number
205 heavyiron 28
.no_insert_number:
1098 Lrz 29
        mov     [edi],ah
30
        inc     edi
31
        inc     esi
32
        jmp     .next
205 heavyiron 33
.insert_number:
1098 Lrz 34
        bt      word [ch6.flags],1
35
        jnc     @f
36
        mov     eax,[cur_number]
37
        movsx   ebx,byte [sign_n]
38
        push    ebx
39
        call    int_to_str
40
        pop     ebx
41
        add     edi,ebx
205 heavyiron 42
@@:
1098 Lrz 43
        inc     esi
44
        jmp     .next
205 heavyiron 45
.str_end:
46
 
6763 IgorA 47
        mcall   SF_SYS_MISC, SSF_MEM_FREE, [sf_buf.bmp_header]
1098 Lrz 48
 
6763 IgorA 49
	;create image struct
50
	movsx ebx,word[scr_buf.width]
51
	movsx edx,word[scr_buf.height]
52
	stdcall [img_create], ebx, edx, Image.bpp24
53
	mov [sf_buf.bmp_area],eax
54
	test eax,eax
55
	jz @f
56
		;copy foto to image buffer
57
		mov edi,[eax+Image.Data]
58
		mov esi,[scr_buf.ptr]
59
		movsx ecx,word[scr_buf.width]
60
		movsx edx,word[scr_buf.height]
61
		imul ecx,edx
62
		imul ecx,3
63
		rep movsb
1098 Lrz 64
 
6763 IgorA 65
		;encode image
66
		stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0
67
		test eax,eax
68
		jz @f
1098 Lrz 69
 
6763 IgorA 70
		mov [sf_buf.bmp_header],eax
71
		mov [sf_buf.end],ecx
72
	@@:
73
	stdcall [img_destroy], [sf_buf.bmp_area]
307 Lrz 74
 
1098 Lrz 75
        ; заполняем структуру для сохранения файла
76
        mov     ebp,fs_struc
6763 IgorA 77
        mov     [ebp],dword SSF_CREATE_FILE
1098 Lrz 78
 
79
        mov     eax,[sf_buf.bmp_header]
6763 IgorA 80
        mov     ecx,[sf_buf.end]
81
        mov     [ebp+12],ecx ;file size
1098 Lrz 82
        mov     [ebp+16],eax
83
        mov     [ebp+21],dword file_name
84
 
6763 IgorA 85
        draw_status saving
86
        mcall   SF_FILE, fs_struc
1098 Lrz 87
 
88
        test    eax,eax
89
        jne     save_error
205 heavyiron 90
 
1098 Lrz 91
        inc     dword [cur_number]
92
        call    draw_number
205 heavyiron 93
 
1098 Lrz 94
        draw_status saved_ok
205 heavyiron 95
 
96
popa
97
ret
98
 
99
.no_file_name:
1098 Lrz 100
        draw_status no_file_name
205 heavyiron 101
popa
102
ret
103
 
104
.not_shooted:
1098 Lrz 105
        draw_status not_shooted
205 heavyiron 106
popa
107
ret
108
 
109
save_error:
1098 Lrz 110
        cmp     al,5
111
        jne     @f
112
        mov     [status.text],dword bad_file_name
205 heavyiron 113
@@:
1098 Lrz 114
        cmp     al,8
115
        jne     @f
116
        mov     [status.text],dword disk_filled
205 heavyiron 117
@@:
118
 
1098 Lrz 119
        cmp     al,9
120
        jne     @f
121
        mov     [status.text],dword bad_fat_table
205 heavyiron 122
@@:
123
 
1098 Lrz 124
        cmp     al,10
125
        jne     @f
126
        mov     [status.text],dword ac_den
205 heavyiron 127
@@:
128
 
1098 Lrz 129
        cmp     al,11
130
        jne     @f
131
        mov     [status.text],dword device_er
205 heavyiron 132
@@:
1098 Lrz 133
        call    send_draw_status
205 heavyiron 134
popa
135
ret