Subversion Repositories Kolibri OS

Rev

Rev 6763 | 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     [sign_n],4
  10.  
  11.         ; £¥­¥à¨à㥬 ¨¬ï ä ©« 
  12.         xor     eax,eax
  13.         mov     ecx,1056
  14.         mov     edi,file_name
  15.         rep     stosb   ; § ¯®«­ï¥¬ ­ã«ï¬¨
  16.  
  17.         mov     esi,fname_buf
  18.         mov     edi,file_name
  19. .next:
  20.         mov     ah,[esi]
  21.         test    ah,ah
  22.         jz      .str_end
  23.         cmp     ah,'*'
  24.         jne     .no_insert_number
  25.         jmp     .insert_number
  26. .no_insert_number:
  27.         mov     [edi],ah
  28.         inc     edi
  29.         inc     esi
  30.         jmp     .next
  31. .insert_number:
  32.         bt      word [ch6.flags],1
  33.         jnc     @f
  34.         mov     eax,[cur_number]
  35.         movsx   ebx,byte [sign_n]
  36.         push    ebx
  37.         call    int_to_str
  38.         pop     ebx
  39.         add     edi,ebx
  40. @@:
  41.         inc     esi
  42.         jmp     .next
  43. .str_end:
  44.  
  45.         mcall   SF_SYS_MISC, SSF_MEM_FREE, [sf_buf.bmp_header]
  46.  
  47.         ;create image struct
  48.         movsx ebx,word[scr_buf.width]
  49.         movsx edx,word[scr_buf.height]
  50.         stdcall [img_create], ebx, edx, Image.bpp24
  51.         mov [sf_buf.bmp_area],eax
  52.         test eax,eax
  53.         jz @f
  54.                 ;copy foto to image buffer
  55.                 mov edi,[eax+Image.Data]
  56.                 mov esi,[scr_buf.ptr]
  57.                 movsx ecx,word[scr_buf.width]
  58.                 movsx edx,word[scr_buf.height]
  59.                 imul ecx,edx
  60.                 imul ecx,3
  61.                 rep movsb
  62.  
  63.                 ;encode image
  64.                 stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0
  65.                 test eax,eax
  66.                 jz @f
  67.  
  68.                 mov [sf_buf.bmp_header],eax
  69.                 mov [sf_buf.end],ecx
  70.         @@:
  71.         stdcall [img_destroy], [sf_buf.bmp_area]
  72.  
  73.         ; § ¯®«­ï¥¬ áâàãªâãàã ¤«ï á®åà ­¥­¨ï ä ©« 
  74.         mov     ebp,fs_struc
  75.         mov     [ebp],dword SSF_CREATE_FILE
  76.  
  77.         mov     eax,[sf_buf.bmp_header]
  78.         mov     ecx,[sf_buf.end]
  79.         mov     [ebp+12],ecx ;file size
  80.         mov     [ebp+16],eax
  81.         mov     [ebp+21],dword file_name
  82.  
  83.         draw_status saving
  84.         mcall   SF_FILE, fs_struc
  85.  
  86.         test    eax,eax
  87.         jne     save_error
  88.  
  89.         inc     dword [cur_number]
  90.         call    draw_number
  91.  
  92.         draw_status saved_ok
  93.  
  94. popa
  95. ret
  96.  
  97. .no_file_name:
  98.         draw_status no_file_name
  99. popa
  100. ret
  101.  
  102. .not_shooted:
  103.         draw_status not_shooted
  104. popa
  105. ret
  106.  
  107. save_error:
  108.         cmp     al,5
  109.         jne     @f
  110.         mov     [status.text],dword bad_file_name
  111. @@:
  112.         cmp     al,8
  113.         jne     @f
  114.         mov     [status.text],dword disk_filled
  115. @@:
  116.  
  117.         cmp     al,9
  118.         jne     @f
  119.         mov     [status.text],dword bad_fat_table
  120. @@:
  121.  
  122.         cmp     al,10
  123.         jne     @f
  124.         mov     [status.text],dword ac_den
  125. @@:
  126.  
  127.         cmp     al,11
  128.         jne     @f
  129.         mov     [status.text],dword device_er
  130. @@:
  131.         call    send_draw_status
  132. popa
  133. ret