aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/RenderExtension.cpp
diff options
context:
space:
mode:
authorFernando Carvajal <fcarvajal@qindel.com>2016-04-12 11:52:22 +0200
committerFernando Carvajal <fcarvajal@qindel.com>2016-04-12 12:07:53 +0200
commita9be6f59105b7cf29bb799556274dc2c3b3d2af8 (patch)
tree555bfeba04b21dc26df16ee5c26a3ec798d02584 /nxcomp/RenderExtension.cpp
parent2ffe52c5ecb7cf6af111c685eee7f8fcfd1139a9 (diff)
downloadnx-libs-a9be6f59105b7cf29bb799556274dc2c3b3d2af8.tar.gz
nx-libs-a9be6f59105b7cf29bb799556274dc2c3b3d2af8.tar.bz2
nx-libs-a9be6f59105b7cf29bb799556274dc2c3b3d2af8.zip
Remove compatibility code for nxcomp before 3.5.0
As a part of nxcomp's clean-up process, compatibility with old protocol versions has been set now at 3.5.0. This commit removes compatibility code from nxcomp so the minimum supported version changes from 1.5.0 (protocol step 6) to 3.5.0 (protocol step 10). At this moment the removal is not complete and it will be followed by some other commits, in order to get rid of several components and files that are no longer used as they were only needed to work with old protocol versions. Refs: ArcticaProject/nx-libs#108
Diffstat (limited to 'nxcomp/RenderExtension.cpp')
-rw-r--r--nxcomp/RenderExtension.cpp258
1 files changed, 53 insertions, 205 deletions
diff --git a/nxcomp/RenderExtension.cpp b/nxcomp/RenderExtension.cpp
index 79c26e64e..43933748c 100644
--- a/nxcomp/RenderExtension.cpp
+++ b/nxcomp/RenderExtension.cpp
@@ -42,13 +42,6 @@
#include "RenderTrapezoids.h"
#include "RenderTriangles.h"
-#include "RenderCreatePictureCompat.h"
-#include "RenderFreePictureCompat.h"
-#include "RenderPictureClipCompat.h"
-#include "RenderCreateGlyphSetCompat.h"
-#include "RenderCompositeCompat.h"
-#include "RenderCompositeGlyphsCompat.h"
-
//
// Set the verbosity level.
//
@@ -82,46 +75,27 @@ RenderExtensionStore::RenderExtensionStore(StaticCompressor *compressor)
minors_[X_RenderFillRectangles] = new RenderFillRectanglesStore();
minors_[X_RenderAddGlyphs] = new RenderAddGlyphsStore();
- if (control -> isProtoStep7() == 1)
- {
- minors_[X_RenderCreatePicture] = new RenderCreatePictureStore();
- minors_[X_RenderFreePicture] = new RenderFreePictureStore();
- minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore();
- minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore();
- minors_[X_RenderComposite] = new RenderCompositeStore();
- minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore();
- minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore();
- minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore();
-
- minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore();
- minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore();
- minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore();
- minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore();
- minors_[X_RenderTriangles] = new RenderTrianglesStore();
- }
- else
- {
- minors_[X_RenderCreatePicture] = new RenderCreatePictureCompatStore();
- minors_[X_RenderFreePicture] = new RenderFreePictureCompatStore();
- minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipCompatStore();
- minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetCompatStore();
- minors_[X_RenderComposite] = new RenderCompositeCompatStore();
- minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsCompatStore();
- minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsCompatStore();
- minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsCompatStore();
- }
+ // Since ProtoStep7 (#issue 108)
+ minors_[X_RenderCreatePicture] = new RenderCreatePictureStore();
+ minors_[X_RenderFreePicture] = new RenderFreePictureStore();
+ minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore();
+ minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore();
+ minors_[X_RenderComposite] = new RenderCompositeStore();
+ minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore();
+ minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore();
+ minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore();
+
+ minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore();
+ minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore();
+ minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore();
+ minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore();
+ minors_[X_RenderTriangles] = new RenderTrianglesStore();
dataLimit = RENDEREXTENSION_DATA_LIMIT;
dataOffset = RENDEREXTENSION_DATA_OFFSET;
- if (control -> isProtoStep7() == 1)
- {
- cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7;
- }
- else
- {
- cacheSlots = RENDEREXTENSION_CACHE_SLOTS;
- }
+ // Since ProtoStep7 (#issue 108)
+ cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7;
cacheThreshold = RENDEREXTENSION_CACHE_THRESHOLD;
cacheLowerThreshold = RENDEREXTENSION_CACHE_LOWER_THRESHOLD;
@@ -268,204 +242,78 @@ void RenderMinorExtensionStore::encodeLongData(EncodeBuffer &encodeBuffer, const
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeLongData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - offset
- << " bytes of long data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 4)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + i, bigEndian), 32,
- *clientCache -> renderDataCache[c]);
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeLongData(buffer + offset, size - offset);
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Encoded " << size - offset
+ << " bytes of long data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeIntData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - offset
- << " bytes of int data.\n" << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeIntData(buffer + offset, size - offset);
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 2)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(GetUINT(buffer + i, bigEndian), 16,
- *clientCache -> renderDataCache[c]);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Encoded " << size - offset
+ << " bytes of int data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - offset
- << " bytes of text data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- clientCache -> renderTextCompressor.reset();
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(buffer + offset, size - offset);
- const unsigned char *next = buffer + offset;
-
- for (unsigned int i = offset; i < size; i++)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding char with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- clientCache -> renderTextCompressor.
- encodeChar(*next++, encodeBuffer);
- }
+ #ifdef TEST
+ *logofs << name() << ": Encoded " << size - offset
+ << " bytes of text data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeLongData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - offset
- << " bytes of long data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 4)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeLongData(buffer + offset, size - offset);
- decodeBuffer.decodeCachedValue(value, 32,
- *clientCache -> renderDataCache[c]);
-
- PutULONG(value, buffer + i, bigEndian);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded " << size - offset
+ << " bytes of long data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeIntData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - offset
- << " bytes of int data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 2)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeIntData(buffer + offset, size - offset);
- decodeBuffer.decodeCachedValue(value, 16,
- *clientCache -> renderDataCache[c]);
-
- PutUINT(value, buffer + i, bigEndian);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded " << size - offset
+ << " bytes of int data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(buffer + offset, size - offset);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(buffer + offset, size - offset);
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - offset
- << " bytes of text data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- clientCache -> renderTextCompressor.reset();
-
- unsigned char *next = buffer + offset;
-
- for (unsigned int i = offset; i < size; i++)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding char with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- *next++ = clientCache -> renderTextCompressor.
- decodeChar(decodeBuffer);
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded " << size - offset
+ << " bytes of text data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::parseIntData(const Message *message, const unsigned char *buffer,