diff --git a/Src/Network.cpp b/Src/Network.cpp index 3e2147a..ad73974 100644 --- a/Src/Network.cpp +++ b/Src/Network.cpp @@ -68,93 +68,6 @@ Network::~Network() free(this->diff_buf); } -size_t Network::EncodeDisplayRaw(struct NetworkUpdate *dst, Uint8 *screen, - int x_start, int y_start) -{ - const int raw_w = SQUARE_W / 2; - - dst->type = DISPLAY_UPDATE_RAW; - for (int y = y_start; y < y_start + SQUARE_H; y++) - { - for (int x = x_start; x < x_start + SQUARE_W; x += 2) - { - Uint8 a = screen[ y * DISPLAY_X + x ]; - Uint8 b = screen[ y * DISPLAY_X + (x + 1) ]; - - dst->data[ (y - y_start) * raw_w + (x - x_start) / 2 ] = - (a << 4) | b; - } - } - - return RAW_SIZE; -} - -size_t Network::EncodeDisplayDiff(struct NetworkUpdate *dst, Uint8 *screen, - Uint8 *remote, int x_start, int y_start) -{ - size_t out = 0; - size_t len = 0; - - dst->type = DISPLAY_UPDATE_DIFF; - - for (int y = y_start; y < y_start + SQUARE_H; y++) - { - for (int x = x_start; x < x_start + SQUARE_W; x++) - { - Uint8 s = screen[ y * DISPLAY_X + x ]; - Uint8 r = remote[ y * DISPLAY_X + x ]; - - if (r != s || len >= 255) - { - dst->data[out] = len; - dst->data[out + 1] = s; - out += 2; - len = 0; - } - len++; - } - } - - return out; -} - -size_t Network::EncodeDisplayRLE(struct NetworkUpdate *dst, Uint8 *screen, - int x_start, int y_start) -{ - size_t out = 0; - size_t len = 0; - Uint8 color = screen[ y_start * DISPLAY_X + x_start ]; - - dst->type = DISPLAY_UPDATE_RLE; - - for (int y = y_start; y < y_start + SQUARE_H; y++) - { - for (int x = x_start; x < x_start + SQUARE_W; x++) - { - if (color != screen[ y * DISPLAY_X + x ] || - len >= 255) - { - dst->data[out] = len; - dst->data[out + 1] = color; - out += 2; - - len = 0; - color = screen[ y * DISPLAY_X + x]; - } - len++; - } - } - if (len != 0) - { - dst->data[out] = len; - dst->data[out + 1] = color; - - out += 2; - } - - return out; -} - size_t Network::EncodeSoundRLE(struct NetworkUpdate *dst, Uint8 *buffer, size_t buf_len) { diff --git a/Src/Network.h b/Src/Network.h index 08b764b..4bd2de3 100644 --- a/Src/Network.h +++ b/Src/Network.h @@ -71,15 +71,6 @@ public: protected: size_t DecodeSoundUpdate(struct NetworkUpdate *src, char *buf); - size_t EncodeDisplayDiff(struct NetworkUpdate *dst, Uint8 *screen, - int x, int y); - - size_t EncodeDisplayDiff(struct NetworkUpdate *dst, Uint8 *screen, - Uint8 *remote, int x, int y); - size_t EncodeDisplayRLE(struct NetworkUpdate *dst, Uint8 *screen, - int x, int y); - size_t EncodeDisplayRaw(struct NetworkUpdate *dst, Uint8 *screen, - int x, int y); size_t EncodeSoundRLE(struct NetworkUpdate *dst, Uint8 *buffer, size_t len); size_t EncodeSoundRaw(struct NetworkUpdate *dst,