diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-03-14 15:59:46 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-14 16:03:42 +0200 |
commit | c0397269fcab67e9acd4fdcbc29f24d79ed0ef39 (patch) | |
tree | 41ac251e5a595a37b832a61626723a89258bb018 /common/rfb/ZRLEEncoder.h | |
parent | a088f1ab3923482998174b9db8949cf06d0761af (diff) | |
download | tigervnc-c0397269fcab67e9acd4fdcbc29f24d79ed0ef39.tar.gz tigervnc-c0397269fcab67e9acd4fdcbc29f24d79ed0ef39.zip |
Move image encoding logic into a central EncodeManager class
This allows us to apply a lot more server logic
independently of which encoder is in use.
Most of this class are things moved over from the
Tight encoder.
Diffstat (limited to 'common/rfb/ZRLEEncoder.h')
-rw-r--r-- | common/rfb/ZRLEEncoder.h | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/common/rfb/ZRLEEncoder.h b/common/rfb/ZRLEEncoder.h index b006821d..d61bab17 100644 --- a/common/rfb/ZRLEEncoder.h +++ b/common/rfb/ZRLEEncoder.h @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright 2014 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,8 +29,51 @@ namespace rfb { public: ZRLEEncoder(SConnection* conn); virtual ~ZRLEEncoder(); - virtual void writeRect(const Rect& r, PixelBuffer* pb); - private: + + virtual bool isSupported(); + + virtual void writeRect(const PixelBuffer* pb, const Palette& palette); + virtual void writeSolidRect(int width, int height, + const PixelFormat& pf, + const rdr::U8* colour); + + protected: + void writePaletteTile(const Rect& tile, const PixelBuffer* pb, + const Palette& palette); + void writePaletteRLETile(const Rect& tile, const PixelBuffer* pb, + const Palette& palette); + void writeRawTile(const Rect& tile, const PixelBuffer* pb, + const Palette& palette); + + void writePalette(const PixelFormat& pf, const Palette& palette); + + void writePixels(const rdr::U8* buffer, const PixelFormat& pf, + unsigned int count); + + protected: + // Preprocessor generated, optimised methods + + void writePaletteTile(int width, int height, + const rdr::U8* buffer, int stride, + const PixelFormat& pf, const Palette& palette); + void writePaletteTile(int width, int height, + const rdr::U16* buffer, int stride, + const PixelFormat& pf, const Palette& palette); + void writePaletteTile(int width, int height, + const rdr::U32* buffer, int stride, + const PixelFormat& pf, const Palette& palette); + + void writePaletteRLETile(int width, int height, + const rdr::U8* buffer, int stride, + const PixelFormat& pf, const Palette& palette); + void writePaletteRLETile(int width, int height, + const rdr::U16* buffer, int stride, + const PixelFormat& pf, const Palette& palette); + void writePaletteRLETile(int width, int height, + const rdr::U32* buffer, int stride, + const PixelFormat& pf, const Palette& palette); + + protected: rdr::ZlibOutStream zos; rdr::MemOutStream mos; }; |