Subversion Repositories Kolibri OS

Rev

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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                 ;;
  3. ;; Copyright (C) KolibriOS team 2010-2015. All rights reserved.    ;;
  4. ;; Distributed under terms of the GNU General Public License       ;;
  5. ;;                                                                 ;;
  6. ;;  VNC client for KolibriOS                                       ;;
  7. ;;                                                                 ;;
  8. ;;  Written by hidnplayr@kolibrios.org                             ;;
  9. ;;                                                                 ;;
  10. ;;          GNU GENERAL PUBLIC LICENSE                             ;;
  11. ;;             Version 2, June 1991                                ;;
  12. ;;                                                                 ;;
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14.  
  15. encoding_copyrect:
  16.  
  17.         DEBUGF  1,"CopyRect\n"
  18.  
  19.   @@:
  20.         lea     eax, [esi+4]
  21.         cmp     [datapointer], eax
  22.         jae     @f
  23.         call    read_data.more
  24.         jmp     @b
  25.   @@:
  26.  
  27.         push    esi
  28.  
  29.         movzx   eax, word[esi+2]                        ; [src.y]
  30.         xchg    al, ah
  31.         movzx   ebx, [screen.width]
  32.         mul     ebx                                     ; [screen.width]*[src.y]
  33.         movzx   ebx, word[esi]                          ; [src.x]
  34.         xchg    bl, bh
  35.         add     eax, ebx                                ; [screen.width]*[src.y]+[src.x]
  36.         lea     esi, [framebuffer_data+eax*3]           ; esi = framebuffer_data+([screen.width]*[src.y]+[src.x])*3
  37.  
  38.         movzx   eax, [rectangle.y]
  39.         movzx   ebx, [screen.width]
  40.         mul     ebx                                     ; [screen.width]*[rectangle.y]
  41.         movzx   ebx, [rectangle.x]
  42.         add     eax, ebx                                ; [screen.width]*[rectangle.y]+[rectangle.x]
  43.         lea     edi, [framebuffer_data+eax*3]           ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
  44.  
  45.         movzx   eax, [screen.width]
  46.         sub     ax, [rectangle.width]
  47.         lea     ebp, [eax*3]                            ; ebp = ([screen.width]-[rectangle.width])*3
  48.  
  49.         cmp     esi, edi
  50.         ja      .copy
  51.  
  52.         ; source pixels come before destination in buffer, copy backwards
  53.         movzx   eax, [rectangle.height]
  54.         movzx   edx, [screen.width]
  55.         mul     edx
  56.         lea     eax, [eax*3-1]
  57.         add     esi, eax
  58.         add     edi, eax
  59.  
  60.         neg     ebp
  61.         std
  62.   .copy:
  63.  
  64.         movzx   edx, [rectangle.height]
  65.         movzx   ecx, [rectangle.width]
  66.         lea     ecx, [ecx*3]
  67.   .lineloop:
  68.         push    ecx
  69.         rep     movsb
  70.         pop     ecx
  71.  
  72.         add     esi, ebp
  73.         add     edi, ebp
  74.         dec     edx
  75.         jnz     .lineloop
  76.  
  77.         pop     esi
  78.         add     esi, 4
  79.         cld
  80.         jmp     next_rectangle