~ubuntu-branches/debian/lenny/italc/lenny

« back to all changes in this revision

Viewing changes to client/demoviewer/rre.c

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Winnertz
  • Date: 2008-06-17 13:46:54 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080617134654-cl0gi4u524cv1ici
Tags: 1:1.0.9~rc3-1
* Package new upstream version
  - upstream ported the code to qt4.4 (Closes: #481974)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
3
 
 *
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.
8
 
 *
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.
13
 
 *
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,
17
 
 *  USA.
18
 
 */
19
 
 
20
 
/*
21
 
 * rre.c - handle RRE encoding.
22
 
 *
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.
27
 
 */
28
 
 
29
 
#define HandleRREBPP CONCAT2E(HandleRRE,BPP)
30
 
#define CARDBPP CONCAT2E(CARD,BPP)
31
 
 
32
 
static Bool
33
 
HandleRREBPP (int rx, int ry, int rw, int rh)
34
 
{
35
 
  rfbRREHeader hdr;
36
 
  XGCValues gcv;
37
 
  int i;
38
 
  CARDBPP pix;
39
 
  rfbRectangle subrect;
40
 
 
41
 
  if (!ReadFromRFBServer((char *)&hdr, sz_rfbRREHeader))
42
 
    return False;
43
 
 
44
 
  hdr.nSubrects = Swap32IfLE(hdr.nSubrects);
45
 
 
46
 
  if (!ReadFromRFBServer((char *)&pix, sizeof(pix)))
47
 
    return False;
48
 
 
49
 
#if (BPP == 8)
50
 
  gcv.foreground = (appData.useBGR233 ? BGR233ToPixel[pix] : pix);
51
 
#else
52
 
  gcv.foreground = pix;
53
 
#endif
54
 
 
55
 
  XChangeGC(dpy, gc, GCForeground, &gcv);
56
 
  XFillRectangle(dpy, desktopWin, gc, rx, ry, rw, rh);
57
 
 
58
 
  for (i = 0; i < hdr.nSubrects; i++) {
59
 
    if (!ReadFromRFBServer((char *)&pix, sizeof(pix)))
60
 
      return False;
61
 
 
62
 
    if (!ReadFromRFBServer((char *)&subrect, sz_rfbRectangle))
63
 
      return False;
64
 
 
65
 
    subrect.x = Swap16IfLE(subrect.x);
66
 
    subrect.y = Swap16IfLE(subrect.y);
67
 
    subrect.w = Swap16IfLE(subrect.w);
68
 
    subrect.h = Swap16IfLE(subrect.h);
69
 
 
70
 
#if (BPP == 8)
71
 
    gcv.foreground = (appData.useBGR233 ? BGR233ToPixel[pix] : pix);
72
 
#else
73
 
    gcv.foreground = pix;
74
 
#endif
75
 
 
76
 
    XChangeGC(dpy, gc, GCForeground, &gcv);
77
 
    XFillRectangle(dpy, desktopWin, gc, rx + subrect.x, ry + subrect.y,
78
 
                   subrect.w, subrect.h);
79
 
  }
80
 
 
81
 
  return True;
82
 
}