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

« back to all changes in this revision

Viewing changes to ica/win32/src/vncEncoder.h

  • 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
//  Copyright (C) 2001 Constantin Kaplinsky. All Rights Reserved.
 
2
//  Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
 
3
//  Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
 
4
//
 
5
//  This file is part of the VNC system.
 
6
//
 
7
//  The VNC system is free software; you can redistribute it and/or modify
 
8
//  it under the terms of the GNU General Public License as published by
 
9
//  the Free Software Foundation; either version 2 of the License, or
 
10
//  (at your option) any later version.
 
11
//
 
12
//  This program is distributed in the hope that it will be useful,
 
13
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
//  GNU General Public License for more details.
 
16
//
 
17
//  You should have received a copy of the GNU General Public License
 
18
//  along with this program; if not, write to the Free Software
 
19
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 
20
//  USA.
 
21
//
 
22
// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
 
23
//
 
24
// If the source code for the VNC system is not available from the place 
 
25
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
 
26
// the authors on vnc@uk.research.att.com for information on obtaining it.
 
27
 
 
28
 
 
29
// vncEncoder object
 
30
 
 
31
// The vncEncoder object encodes regions of a display buffer for sending
 
32
// to a client
 
33
 
 
34
class vncEncoder;
 
35
 
 
36
#if !defined(RFBENCODER_DEFINED)
 
37
#define RFBENCODER_DEFINED
 
38
#pragma once
 
39
 
 
40
#include "vncBuffer.h"
 
41
#include "translate.h"
 
42
 
 
43
// Class definition
 
44
 
 
45
class vncEncoder
 
46
{
 
47
// Fields
 
48
public:
 
49
 
 
50
// Methods
 
51
public:
 
52
        // Create/Destroy methods
 
53
        vncEncoder();
 
54
        virtual ~vncEncoder();
 
55
 
 
56
        // Initialisation
 
57
        virtual void Init();
 
58
 
 
59
        // A method to return the encoding name, used by the LogStats() method
 
60
        virtual const char* GetEncodingName() { return "Raw"; }
 
61
 
 
62
        // Central method for outputing encoding statistics
 
63
        virtual void LogStats();
 
64
 
 
65
        // Encoder stats used by the buffer object
 
66
        virtual UINT RequiredBuffSize(UINT width, UINT height);
 
67
        virtual UINT NumCodedRects(RECT &rect);
 
68
 
 
69
        // Translation & encoding routines
 
70
        //  - Source is the base address of the ENTIRE SCREEN buffer.
 
71
        //    The Translate routine compensates automatically for the desired rectangle.
 
72
        //  - Dest is the base address to encode the rect to.  The rect will be encoded
 
73
        //    into a contiguous region of the buffer.
 
74
        virtual void Translate(BYTE *source, BYTE *dest, const RECT &rect);
 
75
        virtual UINT EncodeRect(BYTE *source, BYTE *dest, const RECT &rect, int offsetx, int offsety);
 
76
        virtual UINT EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &rect, int offsetx, int offsety);
 
77
 
 
78
        // Additional translation function for cursor shape data (overloaded!)
 
79
        void Translate(BYTE *source, BYTE *dest, int w, int h, int bytesPerRow);
 
80
 
 
81
        // Translation handling
 
82
        BOOL SetLocalFormat(rfbPixelFormat &pixformat, int width, int height);
 
83
        BOOL SetRemoteFormat(rfbPixelFormat &pixformat);
 
84
 
 
85
        // Configuring encoder
 
86
        void SetCompressLevel(int level);
 
87
        void SetQualityLevel(int level);
 
88
        void EnableXCursor(BOOL enable) { m_use_xcursor = enable; }
 
89
        void EnableRichCursor(BOOL enable) { m_use_richcursor = enable; }
 
90
        void EnableLastRect(BOOL enable) { m_use_lastrect = enable; }
 
91
 
 
92
        // Colour map handling
 
93
        BOOL GetRemotePalette(RGBQUAD *quadlist, UINT ncolours);
 
94
 
 
95
        // Supporting cursor shape updates
 
96
        BOOL SendEmptyCursorShape(VSocket *outConn);
 
97
        BOOL SendCursorShape(VSocket *outConn, vncDesktop *desktop);
 
98
 
 
99
protected:
 
100
        BOOL SetTranslateFunction();
 
101
 
 
102
        // Supporting cursor shape updates
 
103
        BOOL SendXCursorShape(VSocket *outConn, BYTE *mask, int xhot,int yhot,int width,int height);
 
104
        BOOL SendRichCursorShape(VSocket *outConn, BYTE *mbits, BYTE *cbits, int xhot,int yhot,int width,int height);
 
105
        void FixCursorMask(BYTE *mbits, BYTE *cbits, int width, int height, int width_bytes);
 
106
 
 
107
// Implementation
 
108
protected:
 
109
        rfbTranslateFnType      m_transfunc;                    // Translator function
 
110
        char*                           m_transtable;                   // Colour translation LUT
 
111
        char*                           m_localpalette;                 // Palette info if client is palette-based
 
112
        rfbPixelFormat          m_localformat;                  // Pixel Format info
 
113
        rfbPixelFormat          m_remoteformat;                 // Client pixel format info
 
114
        rfbPixelFormat          m_transformat;                  // Internal format used for translation (usually == client format)
 
115
        int                                     m_bytesPerRow;                  // Number of bytes per row locally
 
116
        int                                     dataSize;                               // Total size of raw data encoded
 
117
        int                                     rectangleOverhead;              // Total size of rectangle header data
 
118
        int                                     encodedSize;                    // Total size of encoded data
 
119
        int                                     transmittedSize;                // Total amount of data sent
 
120
 
 
121
        int                                     m_compresslevel;                // Encoding-specific compression level (if needed).
 
122
        int                                     m_qualitylevel;                 // Image quality level for lossy JPEG compression.
 
123
        BOOL                            m_use_xcursor;                  // XCursor cursor shape updates allowed.
 
124
        BOOL                            m_use_richcursor;               // RichCursor cursor shape updates allowed.
 
125
        BOOL                            m_use_lastrect;                 // LastRect pseudo-encoding allowed.
 
126
};
 
127
 
 
128
#endif // vncENCODER_DEFINED