1 | /************************************************************************ |
---|
2 | * |
---|
3 | * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. |
---|
4 | * |
---|
5 | * This is free software; you can redistribute it and/or modify |
---|
6 | * it under the terms of the GNU General Public License as published by |
---|
7 | * the Free Software Foundation; either version 2 of the License, or |
---|
8 | * (at your option) any later version. |
---|
9 | * |
---|
10 | * This software is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | * GNU General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU General Public License |
---|
16 | * along with this software; if not, write to the Free Software |
---|
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
---|
18 | * USA. |
---|
19 | ************************************************************************/ |
---|
20 | |
---|
21 | /* |
---|
22 | * rre.c - handle RRE encoding. |
---|
23 | * |
---|
24 | * This file shouldn't be compiled directly. It is included multiple times by |
---|
25 | * rfbproto.c, each time with a different definition of the macro BPP. For |
---|
26 | * each value of BPP, this file defines a function which handles an RRE |
---|
27 | * encoded rectangle with BPP bits per pixel. |
---|
28 | */ |
---|
29 | |
---|
30 | #ifdef HandleRREBPP |
---|
31 | #undef HandleRREBPP |
---|
32 | #endif |
---|
33 | #ifdef CARDBPP |
---|
34 | #undef CARDBPP |
---|
35 | #endif |
---|
36 | |
---|
37 | #define HandleRREBPP CONCAT2E(HandleRRE,BPP) |
---|
38 | #define ReceiveRREBPP CONCAT2E(ReceiveRRE,BPP) |
---|
39 | #define flushRREBPP CONCAT2E(flushRRE,BPP) |
---|
40 | #define CARDBPP CONCAT2E(CARD,BPP) |
---|
41 | |
---|
42 | Bool |
---|
43 | VNCViewer::HandleRREBPP (sgVNCViewer *ct, int rx, int ry, int rw, int rh) |
---|
44 | { |
---|
45 | rfbRREHeader hdr; |
---|
46 | int i; |
---|
47 | CARDBPP pix; |
---|
48 | rfbRectangle subrect; |
---|
49 | |
---|
50 | if (!ReadFromRFBServer((char *)&hdr, sz_rfbRREHeader)) |
---|
51 | return False; |
---|
52 | |
---|
53 | hdr.nSubrects = Swap32IfLE(hdr.nSubrects); |
---|
54 | |
---|
55 | if (!ReadFromRFBServer((char *)&pix, sizeof(pix))) |
---|
56 | return False; |
---|
57 | |
---|
58 | ct->FillToScreen(pix, rx, ry, rw, rh); |
---|
59 | |
---|
60 | for (i = 0; i < hdr.nSubrects; i++) { |
---|
61 | if (!ReadFromRFBServer((char *)&pix, sizeof(pix))) |
---|
62 | return False; |
---|
63 | |
---|
64 | if (!ReadFromRFBServer((char *)&subrect, sz_rfbRectangle)) |
---|
65 | return False; |
---|
66 | |
---|
67 | subrect.x = Swap16IfLE(subrect.x); |
---|
68 | subrect.y = Swap16IfLE(subrect.y); |
---|
69 | subrect.w = Swap16IfLE(subrect.w); |
---|
70 | subrect.h = Swap16IfLE(subrect.h); |
---|
71 | |
---|
72 | ct->FillToScreen(pix, rx + subrect.x, ry + subrect.y, |
---|
73 | subrect.w, subrect.h); |
---|
74 | } |
---|
75 | |
---|
76 | return True; |
---|
77 | } |
---|
78 | |
---|