--- sourceforge.net/trunk/rdesktop/bitmap.c 2000/07/25 12:34:29 9 +++ sourceforge.net/trunk/rdesktop/bitmap.c 2000/10/08 01:59:25 19 @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "includes.h" +#include "rdesktop.h" #define CVAL(p) (*(p++)) #define SVAL(p) ((*((p++) + 1) << 8) | CVAL(p)) @@ -30,11 +30,11 @@ unsigned char *input, int size) { unsigned char *end = input + size; - unsigned char *prevline, *line = NULL; + unsigned char *prevline = NULL, *line = NULL; int opcode, count, offset, isfillormix, x = width; - int lastopcode = -1, insertmix = False; - uint8 code, colour1, colour2, mask, mixmask; - uint8 mix = 0xff; + int lastopcode = -1, insertmix = False, bicolour = False; + uint8 code, colour1 = 0, colour2 = 0; + uint8 mixmask, mask = 0, mix = 0xff; while (input < end) { @@ -88,7 +88,8 @@ switch (opcode) { case 0: /* Fill */ - if ((lastopcode == opcode) && (x != width)) + if ((lastopcode == opcode) + && !((x == width) && (prevline == NULL))) insertmix = True; break; case 8: /* Bicolour */ @@ -177,7 +178,19 @@ break; case 8: /* Bicolour */ - REPEAT(line[x] = colour1; line[++x] = colour2) + REPEAT( + if (bicolour) + { + line[x] = colour2; + bicolour = False; + } + else + { + line[x] = colour1; + bicolour = True; + count++; + } + ) break; case 13: /* White */