Subversion Repositories Kolibri OS

Rev

Rev 5708 | 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+eax*3]                ; esi = framebuffer_data+([screen.width]*[src.y]+[src.x])*3
  37.  
  38.         mov     eax, [rectangle.y]
  39.         movzx   ebx, [screen.width]
  40.         mul     ebx                                     ; [screen.width]*[rectangle.y]
  41.         add     eax, [rectangle.x]                      ; [screen.width]*[rectangle.y]+[rectangle.x]
  42.         lea     edi, [framebuffer+eax*3]                ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
  43.  
  44.         movzx   eax, [screen.width]
  45.         sub     eax, [rectangle.width]
  46.         lea     ebp, [eax*3]                            ; ebp = ([screen.width]-[rectangle.width])*3
  47.  
  48.         cmp     esi, edi
  49.         ja      .not_backwards
  50.  
  51. ; Source pixels come before destination in buffer, copy backwards.
  52.         DEBUGF  1,"backwards\n"
  53.         mov     eax, [rectangle.height]
  54.         dec     eax
  55.         movzx   edx, [screen.width]
  56.         mul     edx
  57.         add     eax, [rectangle.width]
  58.         lea     eax, [eax*3-1]                          ; eax = (([rectangle.height]-1)*[screen.width]+[rectangle.width])*3-1
  59.         add     esi, eax
  60.         add     edi, eax
  61.         neg     ebp
  62.         std
  63.   .not_backwards:
  64.  
  65. ; Do the actual copying
  66.         mov     eax, [rectangle.width]
  67.         lea     eax, [eax*3]
  68.         mov     ebx, eax
  69.         and     eax, 11b
  70.         shr     ebx, 2
  71.         mov     edx, [rectangle.height]
  72.   .lineloop:
  73.         mov     ecx, eax
  74.         rep movsb
  75.         mov     ecx, ebx
  76.         rep movsd
  77.         add     esi, ebp
  78.         add     edi, ebp
  79.         dec     edx
  80.         jnz     .lineloop
  81.  
  82.         pop     esi
  83.         add     esi, 4
  84.         cld
  85.         jmp     next_rectangle