diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-07-09 16:44:11 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-14 16:03:41 +0200 |
commit | 0c9bd4b0ba28f5aab8b1f3e2eb8d83e01915e2b8 (patch) | |
tree | 500f61ee230d30fa1f8e955214c698e86b69e2f4 /common/rfb/ZRLEEncoder.cxx | |
parent | 126e56420e47d72cc950d03976ee57d1efda436e (diff) | |
download | tigervnc-0c9bd4b0ba28f5aab8b1f3e2eb8d83e01915e2b8.tar.gz tigervnc-0c9bd4b0ba28f5aab8b1f3e2eb8d83e01915e2b8.zip |
Use PixelBuffer objects as the interface for encoders and decoders
This avoid a lot of unnecessary middle men. This also pushes the
responsibility for pixel format conversion into the encoders and
decoders. The new bufferFromBuffer() is used for direct conversion,
rather than PixelTransformer/TransImageGetter.
Diffstat (limited to 'common/rfb/ZRLEEncoder.cxx')
-rw-r--r-- | common/rfb/ZRLEEncoder.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index 968edcfb..54613e2d 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -17,7 +17,6 @@ */ #include <rdr/OutStream.h> #include <rfb/Exception.h> -#include <rfb/TransImageGetter.h> #include <rfb/encodings.h> #include <rfb/ConnParams.h> #include <rfb/SMsgWriter.h> @@ -69,22 +68,22 @@ ZRLEEncoder::~ZRLEEncoder() { } -void ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig) +void ZRLEEncoder::writeRect(const Rect& r, PixelBuffer* pb) { + const PixelFormat& pf = conn->cp.pf(); + rdr::U8* imageBuf = conn->writer()->getImageBuf(64 * 64 * 4 + 4); mos.clear(); - switch (conn->cp.pf().bpp) { + switch (pf.bpp) { case 8: - zrleEncode8(r, &mos, &zos, imageBuf, ig); + zrleEncode8(r, &mos, &zos, imageBuf, pf, pb); break; case 16: - zrleEncode16(r, &mos, &zos, imageBuf, ig); + zrleEncode16(r, &mos, &zos, imageBuf, pf, pb); break; case 32: { - const PixelFormat& pf = conn->cp.pf(); - Pixel maxPixel = pf.pixelFromRGB((rdr::U16)-1, (rdr::U16)-1, (rdr::U16)-1); bool fitsInLS3Bytes = maxPixel < (1<<24); bool fitsInMS3Bytes = (maxPixel & 0xff) == 0; @@ -92,16 +91,16 @@ void ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig) if ((fitsInLS3Bytes && pf.isLittleEndian()) || (fitsInMS3Bytes && pf.isBigEndian())) { - zrleEncode24A(r, &mos, &zos, imageBuf, ig); + zrleEncode24A(r, &mos, &zos, imageBuf, pf, pb); } else if ((fitsInLS3Bytes && pf.isBigEndian()) || (fitsInMS3Bytes && pf.isLittleEndian())) { - zrleEncode24B(r, &mos, &zos, imageBuf, ig); + zrleEncode24B(r, &mos, &zos, imageBuf, pf, pb); } else { - zrleEncode32(r, &mos, &zos, imageBuf, ig); + zrleEncode32(r, &mos, &zos, imageBuf, pf, pb); } break; } |