2 * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this software; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 * rre.c - handle RRE encoding.
23 * This file shouldn't be compiled directly. It is included multiple times by
24 * rfbproto.c, each time with a different definition of the macro BPP. For
25 * each value of BPP, this file defines a function which handles an RRE
26 * encoded rectangle with BPP bits per pixel.
29 #define HandleRREBPP CONCAT2E(HandleRRE,BPP)
30 #define CARDBPP CONCAT3E(uint,BPP,_t)
33 HandleRREBPP (rfbClient* client, int rx, int ry, int rw, int rh)
40 if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbRREHeader))
43 hdr.nSubrects = rfbClientSwap32IfLE(hdr.nSubrects);
45 if (!ReadFromRFBServer(client, (char *)&pix, sizeof(pix)))
48 FillRectangle(client, rx, ry, rw, rh, pix);
50 for (i = 0; i < hdr.nSubrects; i++) {
51 if (!ReadFromRFBServer(client, (char *)&pix, sizeof(pix)))
54 if (!ReadFromRFBServer(client, (char *)&subrect, sz_rfbRectangle))
57 subrect.x = rfbClientSwap16IfLE(subrect.x);
58 subrect.y = rfbClientSwap16IfLE(subrect.y);
59 subrect.w = rfbClientSwap16IfLE(subrect.w);
60 subrect.h = rfbClientSwap16IfLE(subrect.h);
62 FillRectangle(client, rx+subrect.x, ry+subrect.y, subrect.w, subrect.h, pix);