Subversion Repositories Kolibri OS

Rev

Rev 5677 | Rev 5722 | 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_raw:
  16.  
  17.         DEBUGF  1,"RAW\n"
  18.  
  19.         mov     eax, [rectangle.width]
  20.         mov     ebx, [rectangle.height]
  21.         mul     ebx
  22. if BITS_PER_PIXEL = 16
  23.         shl     eax, 1
  24. else if BITS_PER_PIXEL = 24
  25.         lea     eax, [eax*2+eax]
  26. end if
  27.   @@:
  28.         push    eax
  29.         add     eax, esi
  30.         cmp     [datapointer], eax
  31.         jae     @f
  32.         call    read_data.more
  33.         pop     eax
  34.         jmp     @b
  35.   @@:
  36.         pop     eax
  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_data+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.         mov     edx, [rectangle.height]
  49.  
  50.   .lineloop:
  51.         mov     ecx, [rectangle.width]
  52. if BITS_PER_PIXEL = 24
  53.         lea     ecx, [ecx*2+ecx]
  54. end if
  55.  
  56. if BITS_PER_PIXEL = 8
  57.   .pixelloop:
  58.         mov     bl, 85
  59.         mov     al, [esi]
  60.         shr     al, 6
  61.         and     al, 3
  62.         mul     bl
  63.         stosb                   ; blue
  64.         mov     bl, 36
  65.         mov     al, [esi]
  66.         shr     al, 3
  67.         and     al, 7
  68.         mul     bl
  69.         stosb                   ; green
  70.         mov     al, [esi]
  71.         and     al, 7
  72.         mul     bl
  73.         stosb                   ; red
  74.         inc     esi
  75.         dec     ecx
  76.         jnz     .pixelloop
  77. else if BITS_PER_PIXEL = 16
  78.   .pixelloop:
  79.         lodsw
  80.         mov     bx, ax
  81.         shl     al, 3
  82.         and     al, 0xf8
  83.         stosb                   ; blue
  84.         mov     ax, bx
  85.         shr     ax, 3
  86.         and     al, 0xfc
  87.         stosb                   ; green
  88.         mov     al, bh
  89.         and     al, 0xf8
  90.         stosb                   ; red
  91.         dec     ecx
  92.         jnz     .pixelloop
  93. else if BITS_PER_PIXEL = 24
  94.         rep movsb
  95. end if
  96.  
  97.         add     edi, ebp
  98.         dec     edx
  99.         jnz     .lineloop
  100.         jmp     next_rectangle
  101.