Subversion Repositories Kolibri OS

Rev

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

  1. ;---------------------------------------------------------------------
  2. ; ÓÑÒÀÍÎÂÈÒÜ ÔÎÍ
  3. background:
  4.         cmp     [soi],0
  5.         je      .end
  6.  
  7.         cmp     [bgrmode],dword 2
  8.         ja      .stretch_crop
  9.  
  10.         mov     ecx,[img_width] ;       øèðèíà
  11.         test    ecx,ecx
  12.         jz      .end
  13.         mov     edx,[img_high]  ; âûñîòà 
  14.         test    edx,edx
  15.         jz      .end
  16.         mcall   15,1    ; set size
  17.  
  18.         mov     esi,ecx
  19.         imul    esi,edx
  20.         lea     esi,[esi*3]
  21.         mov     ecx,[soi]
  22.  
  23.         xor     edx,edx
  24.  
  25.         cmp     [img_resolution],24
  26.         je      @f
  27.        
  28.         push    dword image_file
  29.         call    [convert_Conv_24b]
  30.        
  31.         mov     ecx,[raw_pointer_2]
  32.         add     ecx,44
  33.         mcall   15,5            ;15,5 set data
  34.         mcall   68,13,[raw_pointer_2]
  35.         jmp     .set_mode
  36. @@:
  37.         mcall   15,5            ; 15,5 set data
  38. .set_mode:
  39.         mcall   15,4,[bgrmode]  ; 15,4 set mode
  40.         dec     ebx             ; 15,3 redraw background
  41.         mcall
  42. .end:
  43.         ret
  44. ;---------------------------------------------------------------------
  45. .stretch_crop:
  46. ;       cmp     [bgrmode],dword 3
  47. ;       jne     .stretch_inscribe
  48.         xor     eax,eax
  49.         mov     [stretch_start_coordinates],eax
  50.    
  51.         mcall   14
  52.  
  53.         mov     ebx,eax
  54.         and     eax,0xffff
  55.         inc     eax
  56.         mov     [screen_high],eax
  57.         shr     ebx,16
  58.         inc     ebx
  59.         mov     [screen_width],ebx
  60.        
  61.         xchg    eax,ebx
  62.         call    calculate_relation
  63.         mov     [screen_relation],eax
  64.        
  65.         mov     eax,[img_width]
  66.         mov     ebx,[img_high]
  67.         call    calculate_relation
  68.         mov     [picture_relation],eax
  69.        
  70.         cmp     eax,[screen_relation]
  71.         jb      @f
  72. ; Y = Yimg
  73. ; X = Yimg*Xscreen/Yscreen
  74.         mov     eax,[img_high]
  75.         mov     [stretch_img_high],eax
  76.         mov     eax,[img_high]
  77.         imul    eax,dword [screen_width]
  78.         mov     ebx,[screen_high]
  79.         call    integer_division       
  80.         mov     [stretch_img_width],eax
  81.         mov     ebx,[img_width]
  82.         sub     ebx,eax
  83.         shr     ebx,1
  84.         mov     [stretch_start_coordinates.x],bx
  85.         jmp     .continue
  86. @@:
  87. ; X = Ximg
  88. ; Y = Ximg*Yscreen/Xscreen
  89.         mov     eax,[img_width]
  90.         mov     [stretch_img_width],eax
  91.         mov     eax,[img_width]
  92.         imul    eax,dword [screen_high]
  93.         mov     ebx,[screen_width]
  94.         call    integer_division
  95.         mov     [stretch_img_high],eax
  96.         mov     ebx,[img_high]
  97.         sub     ebx,eax
  98.         shr     ebx,1
  99.         mov     [stretch_start_coordinates.y],bx
  100. .continue:
  101.         mov     ebx,[screen_width]
  102.         shl     ebx,16
  103.         add     ebx,[screen_high]
  104.        
  105.         mov     eax,[stretch_img_width]
  106.         shl     eax,16
  107.         add     eax,[stretch_img_high] 
  108.        
  109.         push    dword eax                       ; eax - crop size
  110.         push    dword 0                         ; edi - background color
  111.         push    dword 1                         ; esi - filtering
  112.         push    dword 0                         ; edx - scaling mode
  113.         push    dword [stretch_start_coordinates]       ; ecx - start_coordinates
  114.         push    ebx                             ; ebx - new_size
  115.         push    dword image_file                ; eax -  convert data table
  116.  
  117.         call    [Scaling_Start]
  118.         call    background_1
  119.         ret
  120.        
  121. ;---------------------------------------------------------------------
  122. ;.stretch_inscribe:
  123. ;       ret
  124. ;---------------------------------------------------------------------
  125. background_1:
  126.         mov     ecx,[screen_width]      ;[crop_img_width]       ; øèðèíà
  127.         test    ecx,ecx
  128.         jz      .end
  129.         mov     edx,[screen_high]       ;[crop_img_high]        ; âûñîòà 
  130.         test    edx,edx
  131.         jz      .end
  132.         mcall   15,1    ; set size
  133.  
  134.         mov     esi,ecx
  135.         imul    esi,edx
  136.         lea     esi,[esi*3]
  137.         mov     ecx,[raw_pointer_2]     ;[soi]
  138.         mov     eax,[ecx+28]
  139.         add     ecx,eax
  140.  
  141.         xor     edx,edx
  142.  
  143.         mov     eax,[raw_pointer_2]
  144.         mov     eax,[eax+12]            ;overall depth of the pixel
  145.         cmp     al,24
  146.         je      @f
  147.  
  148.         mov     eax,[raw_pointer_2]
  149.         mov     [crop_raw_pointer],eax
  150.        
  151.         push    dword crop_image_file
  152.         call    [convert_Conv_24b]
  153.        
  154.         mov     ecx,[crop_raw_pointer_2]
  155.         add     ecx,44
  156.         mcall   15,5            ;15,5 set data
  157.         mcall   68,13,[crop_raw_pointer_2]
  158.         jmp     .set_mode
  159. @@:
  160.         mcall   15,5            ; 15,5 set data
  161. .set_mode:
  162.         xor     ecx,ecx
  163.         inc     ecx
  164. ;       mov     ecx,[bgrmode]
  165.         mcall   15,4            ; 15,4 set mode
  166.         dec     ebx             ; 15,3 redraw background
  167.         mcall
  168. .end:
  169.         mov     ecx,[raw_pointer_2]
  170.         mcall   68,13
  171.         ret
  172. ;---------------------------------------------------------------------