Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
5666 hidnplayr 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
 
5668 hidnplayr 15
encoding_CopyRect:
5666 hidnplayr 16
 
5670 hidnplayr 17
        DEBUGF  2,"CopyRect\n"
5666 hidnplayr 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
 
5668 hidnplayr 38
        mov     eax, [rectangle.y]
5666 hidnplayr 39
        movzx   ebx, [screen.width]
40
        mul     ebx                                     ; [screen.width]*[rectangle.y]
5668 hidnplayr 41
        mov     ebx, [rectangle.x]
5666 hidnplayr 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]
5668 hidnplayr 46
        sub     eax, [rectangle.width]
5666 hidnplayr 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
5668 hidnplayr 53
        mov     eax, [rectangle.height]
5666 hidnplayr 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
 
5668 hidnplayr 64
        mov     edx, [rectangle.height]
65
        mov     ecx, [rectangle.width]
5666 hidnplayr 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