[4] | 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 | * corre.c - handle CoRRE 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 a CoRRE |
---|
| 27 | * encoded rectangle with BPP bits per pixel. |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifdef HandleRREBPP |
---|
| 31 | #undef HandleRREBPP |
---|
| 32 | #endif |
---|
| 33 | #ifdef ReceiveRREBPP |
---|
| 34 | #undef ReceiveeRREBPP |
---|
| 35 | #endif |
---|
| 36 | #ifdef flushRREBPP |
---|
| 37 | #undef flushRREBPP |
---|
| 38 | #endif |
---|
| 39 | #ifdef CARDBPP |
---|
| 40 | #undef CARDBPP |
---|
| 41 | #endif |
---|
| 42 | #ifdef HandleCoRREBPP |
---|
| 43 | #undef HandleCoRREBPP |
---|
| 44 | #endif |
---|
| 45 | |
---|
| 46 | #define HandleCoRREBPP CONCAT2E(HandleCoRRE,BPP) |
---|
| 47 | #define ReceiveCoRREBPP CONCAT2E(ReceiveCoRRE,BPP) |
---|
| 48 | #define flushCoRREBPP CONCAT2E(flushCoRRE,BPP) |
---|
| 49 | #define CARDBPP CONCAT2E(CARD,BPP) |
---|
| 50 | |
---|
| 51 | Bool |
---|
| 52 | VNCViewer::HandleCoRREBPP (sgVNCViewer *ct, int rx, int ry, int rw, int rh) |
---|
| 53 | { |
---|
| 54 | rfbRREHeader hdr; |
---|
| 55 | int i; |
---|
| 56 | CARDBPP pix; |
---|
| 57 | CARD8 *ptr; |
---|
| 58 | int x, y, w, h; |
---|
| 59 | |
---|
| 60 | if (!ReadFromRFBServer((char *)&hdr, sz_rfbRREHeader)) |
---|
| 61 | return False; |
---|
| 62 | |
---|
| 63 | hdr.nSubrects = Swap32IfLE(hdr.nSubrects); |
---|
| 64 | |
---|
| 65 | if (!ReadFromRFBServer((char *)&pix, sizeof(pix))) |
---|
| 66 | return False; |
---|
| 67 | |
---|
| 68 | ct->FillToScreen(pix, rx, ry, rw, rh); |
---|
| 69 | |
---|
| 70 | if (!ReadFromRFBServer(buffer, hdr.nSubrects * (4 + (BPP / 8)))) |
---|
| 71 | return False; |
---|
| 72 | |
---|
| 73 | ptr = (CARD8 *)buffer; |
---|
| 74 | |
---|
| 75 | for (i = 0; i < hdr.nSubrects; i++) { |
---|
| 76 | pix = *(CARDBPP *)ptr; |
---|
| 77 | ptr += BPP/8; |
---|
| 78 | x = *ptr++; |
---|
| 79 | y = *ptr++; |
---|
| 80 | w = *ptr++; |
---|
| 81 | h = *ptr++; |
---|
| 82 | |
---|
| 83 | ct->FillToScreen(pix, rx + x, ry + y, w, h); |
---|
| 84 | } |
---|
| 85 | return True; |
---|
| 86 | } |
---|
| 87 | |
---|