Subversion Repositories Kolibri OS

Rev

Rev 5677 | 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. pixel_to_24bpp:         ; returns in ecx, destroys eax, ebx
  16. ; Convert pixel to 24BPP
  17.         mov     bl, 85
  18.         mov     al, [esi]
  19.         shr     al, 4
  20.         and     al, 3
  21.         mul     bl
  22.         mov     cl, al
  23.         mov     al, [esi]
  24.         shr     al, 2
  25.         and     al, 3
  26.         mul     bl
  27.         mov     ch, al
  28.         mov     al, [esi]
  29.         and     al, 3
  30.         mul     bl
  31.         shl     ecx, 8
  32.         mov     cl, al
  33.  
  34.         ret
  35.  
  36. encoding_RRE:
  37.  
  38.         DEBUGF  1,"RRE\n"
  39.  
  40.   @@:
  41.         lea     eax, [esi+5]
  42.         cmp     [datapointer], eax
  43.         jae     @f
  44.         call    read_data.more
  45.         jmp     @b
  46.   @@:
  47.  
  48.         lodsd
  49.         bswap   eax
  50.         mov     [subrectangles], eax
  51.  
  52.         call    pixel_to_24bpp
  53.  
  54.         movzx   eax, [screen.width]
  55.         mul     [rectangle.y]                           ; [screen.width]*[rectangle.y]
  56.         add     eax, [rectangle.x]                      ; [screen.width]*[rectangle.y]+[rectangle.x]
  57.         lea     edi, [framebuffer_data+eax*3]           ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
  58.  
  59.         movzx   eax, [screen.width]
  60.         sub     eax, [rectangle.width]
  61.         lea     ebp, [eax*3]                            ; ebp = ([screen.width]-[rectangle.width])*3
  62.  
  63.         push    edi
  64.         mov     eax, ecx
  65.         mov     edx, [rectangle.height]
  66.   .lineloop:
  67.         mov     ecx, [rectangle.width]
  68.   .pixelloop:
  69.         stosw
  70.         rol     eax, 16
  71.         stosb
  72.         rol     eax, 16
  73.         dec     ecx
  74.         jnz     .pixelloop
  75.         add     edi, ebp
  76.         dec     edx
  77.         jnz     .lineloop
  78.         pop     edi
  79.  
  80.   .subrectangle:
  81.   @@:
  82.         lea     eax, [esi+9]
  83.         cmp     [datapointer], eax
  84.         jae     @f
  85.         call    read_data.more
  86.         jmp     @b
  87.   @@:
  88.  
  89.         call    pixel_to_24bpp
  90.  
  91.         xor     eax, eax
  92.         lodsw
  93.         xchg    al, ah
  94.         mov     [subrectangle.x], eax
  95.         lodsw
  96.         xchg    al, ah
  97.         mov     [subrectangle.y], eax
  98.         lodsw
  99.         xchg    al, ah
  100.         mov     [subrectangle.height], eax
  101.         lodsw
  102.         xchg    al, ah
  103.         mov     [subrectangle.width], eax
  104.  
  105.         push    edi
  106.         mov     eax, [rectangle.width]
  107.         mul     [subrectangle.y]
  108.         add     eax, [subrectangle.x]
  109.         add     edi, eax
  110.  
  111.         mov     eax, ecx
  112.         mov     edx, [subrectangle.height]
  113.   .lineloop2:
  114.         mov     ecx, [subrectangle.width]
  115.   .pixelloop2:
  116.         stosw
  117.         rol     eax, 16
  118.         stosb
  119.         rol     eax, 16
  120.         dec     ecx
  121.         jnz     .pixelloop2
  122.         add     edi, ebp
  123.         dec     edx
  124.         jnz     .lineloop2
  125.  
  126.         pop     edi
  127.  
  128.         dec     [subrectangles]
  129.         jnz     .subrectangle
  130.         jmp     next_rectangle