Subversion Repositories Kolibri OS

Rev

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

  1. save_file:
  2. pusha
  3.         bt      dword [flags],0
  4.         jnc     .not_shooted
  5.  
  6.         cmp     byte [fname_buf],0
  7.         je      .no_file_name
  8.  
  9.         mov     edi,sign_n_input
  10.         call    zstr_to_int
  11.         mov     [sign_n],al
  12.  
  13.         ; £¥­¥à¨à㥬 ¨¬ï ä ©« 
  14.         xor     eax,eax
  15.         mov     ecx,1056
  16.         mov     edi,file_name
  17.         rep     stosb   ; § ¯®«­ï¥¬ ­ã«ï¬¨
  18.  
  19.         mov     esi,fname_buf
  20.         mov     edi,file_name
  21. .next:
  22.         mov     ah,[esi]
  23.         test    ah,ah
  24.         jz      .str_end
  25.         cmp     ah,'*'
  26.         jne     .no_insert_number
  27.         jmp     .insert_number
  28. .no_insert_number:
  29.         mov     [edi],ah
  30.         inc     edi
  31.         inc     esi
  32.         jmp     .next
  33. .insert_number:
  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
  42. @@:
  43.         inc     esi
  44.         jmp     .next
  45. .str_end:
  46.  
  47.         mcall   SF_SYS_MISC, SSF_MEM_FREE, [sf_buf.bmp_header]
  48.  
  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
  64.  
  65.                 ;encode image
  66.                 stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0
  67.                 test eax,eax
  68.                 jz @f
  69.  
  70.                 mov [sf_buf.bmp_header],eax
  71.                 mov [sf_buf.end],ecx
  72.         @@:
  73.         stdcall [img_destroy], [sf_buf.bmp_area]
  74.  
  75.         ; § ¯®«­ï¥¬ áâàãªâãàã ¤«ï á®åà ­¥­¨ï ä ©« 
  76.         mov     ebp,fs_struc
  77.         mov     [ebp],dword SSF_CREATE_FILE
  78.  
  79.         mov     eax,[sf_buf.bmp_header]
  80.         mov     ecx,[sf_buf.end]
  81.         mov     [ebp+12],ecx ;file size
  82.         mov     [ebp+16],eax
  83.         mov     [ebp+21],dword file_name
  84.  
  85.         draw_status saving
  86.         mcall   SF_FILE, fs_struc
  87.  
  88.         test    eax,eax
  89.         jne     save_error
  90.  
  91.         inc     dword [cur_number]
  92.         call    draw_number
  93.  
  94.         draw_status saved_ok
  95.  
  96. popa
  97. ret
  98.  
  99. .no_file_name:
  100.         draw_status no_file_name
  101. popa
  102. ret
  103.  
  104. .not_shooted:
  105.         draw_status not_shooted
  106. popa
  107. ret
  108.  
  109. save_error:
  110.         cmp     al,5
  111.         jne     @f
  112.         mov     [status.text],dword bad_file_name
  113. @@:
  114.         cmp     al,8
  115.         jne     @f
  116.         mov     [status.text],dword disk_filled
  117. @@:
  118.  
  119.         cmp     al,9
  120.         jne     @f
  121.         mov     [status.text],dword bad_fat_table
  122. @@:
  123.  
  124.         cmp     al,10
  125.         jne     @f
  126.         mov     [status.text],dword ac_den
  127. @@:
  128.  
  129.         cmp     al,11
  130.         jne     @f
  131.         mov     [status.text],dword device_er
  132. @@:
  133.         call    send_draw_status
  134. popa
  135. ret