Subversion Repositories Kolibri OS

Rev

Rev 307 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;esi - screen size
  2. ;edi - pointer to image
  3. csi_width equ [esi+2]
  4. csi_height equ [esi]
  5. csi_bitspp equ [esi+4]
  6. csi_bytesps equ [esi+6]
  7.  
  8.  
  9. copy_screen_to_image:
  10. pusha
  11.         xor     edx,edx
  12.         xor     ecx,ecx
  13.         xor     ebx,ebx
  14.  
  15.         bt      dword [use_rect.flags],1
  16.         jc      copy_area
  17.  
  18.         cmp     csi_bitspp,word 24
  19.         je      .next_str_24
  20.         cmp     csi_bitspp,word 16
  21.         je      .next_str_16
  22.  
  23. .next_str_32:
  24.         push    edx ebx
  25.         xor     ebx,ebx
  26. @@:
  27.         ;push    eax
  28.         mov     eax,[gs:edx]
  29.         mov     [edi+ecx],ax
  30.         shr     eax,8
  31.         mov     [edi+ecx+2],ah
  32.         ;pop     eax
  33.         add     ecx,3
  34.         add     edx,4;eax
  35.         inc     bx
  36.         cmp     bx,csi_width
  37.         jl     @b
  38.         pop     ebx edx
  39.         add     edx,csi_bytesps
  40.         inc     bx
  41.         cmp     bx,csi_height
  42.         jl      .next_str_32
  43. popa
  44. ret
  45.  
  46. .next_str_24:
  47.         push    edx ebx
  48.         xor     ebx,ebx
  49. @@:
  50.         ;push    eax
  51.         mov     eax,[gs:edx]
  52.         mov     [edi+ecx],ax
  53.         shr     eax,8
  54.         mov     [edi+ecx+2],ah
  55.         ;pop     eax
  56.         add     ecx,3
  57.         add     edx,3;eax
  58.         inc     bx
  59.         cmp     bx,csi_width
  60.         jl     @b
  61.         pop     ebx edx
  62.         add     edx,csi_bytesps
  63.         inc     bx
  64.         cmp     bx,csi_height
  65.         jl      .next_str_24
  66. popa
  67. ret
  68.  
  69. .next_str_16:
  70.         push    edx ebx
  71.         xor     ebx,ebx
  72. @@:
  73.         ;push    eax
  74.         mov     eax,[gs:edx]
  75.         shl     eax, 3
  76.         ror     eax, 8
  77.         shl     ax, 2
  78.         ror     eax, 8
  79.         shl     al, 3
  80.         mov     [edi+ecx+2],al
  81.         rol     eax, 16
  82.         mov     [edi+ecx],ax
  83.         ;pop     eax
  84.         add     ecx,3
  85.         add     edx,2
  86.         inc     bx
  87.         cmp     bx,csi_width
  88.         jl     @b
  89.         pop     ebx edx
  90.         add     edx,csi_bytesps
  91.         inc     bx
  92.         cmp     bx,csi_height
  93.         jl      .next_str_16
  94. popa
  95. ret
  96.  
  97. copy_area:
  98.         mov     eax,[scr.bytesps]
  99.         mov     ebx,eax
  100.         movzx   ecx,word [rect.top]
  101.         mul     ecx
  102.         movzx   ecx,word [rect.width]
  103.         shl     ecx,2
  104.         sub     ebx,ecx
  105.         movzx   ecx,word [rect.left]
  106.         shl     ecx,2
  107.         add     eax,ecx
  108.         movzx   ecx,word [rect.height]
  109.         mov     edx,eax
  110. .next_str:
  111.         movzx   esi,word [rect.width]
  112. .next_pixel:
  113.         mov     eax,[gs:edx]
  114.         mov     [edi],ax
  115.         shr     eax,8
  116.         mov     [edi+2],ah
  117.         add     edx,4
  118.         add     edi,3
  119.         dec     esi
  120.         jnz     .next_pixel
  121.         add     edx,ebx
  122.         loop    .next_str
  123. popa
  124. ret