/[rdesktop]/sourceforge.net/trunk/rdesktop/bitmap.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/bitmap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25 by matty, Sat Jan 6 03:47:04 2001 UTC revision 28 by matty, Wed Jun 20 13:54:48 2001 UTC
# Line 23  Line 23 
23  #define CVAL(p)   (*(p++))  #define CVAL(p)   (*(p++))
24  #define SVAL(p)   ((*((p++) + 1) << 8) | CVAL(p))  #define SVAL(p)   ((*((p++) + 1) << 8) | CVAL(p))
25    
26  #define REPEAT(statement) { while ((count > 0) && (x < width)) { statement; count--; x++; } }  #define UNROLL8(exp) { exp exp exp exp exp exp exp exp }
27  #define MASK_UPDATE() { mixmask <<= 1; if (mixmask == 0) { mask = CVAL(input); mixmask = 1; } }  
28    #define REPEAT(statement) \
29    { \
30            while((count & ~0x7) && ((x+8) < width)) \
31                    UNROLL8( statement; count--; x++; ); \
32            \
33            while((count > 0) && (x < width)) { statement; count--; x++; } \
34    }
35    
36    #define MASK_UPDATE() \
37    { \
38            mixmask <<= 1; \
39            if (mixmask == 0) \
40            { \
41                    mask = fom_mask ? fom_mask : CVAL(input); \
42                    mixmask = 1; \
43            } \
44    }
45    
46  BOOL  BOOL
47  bitmap_decompress(unsigned char *output, int width, int height,  bitmap_decompress(unsigned char *output, int width, int height,
# Line 36  bitmap_decompress(unsigned char *output, Line 53  bitmap_decompress(unsigned char *output,
53          int lastopcode = -1, insertmix = False, bicolour = False;          int lastopcode = -1, insertmix = False, bicolour = False;
54          uint8 code, colour1 = 0, colour2 = 0;          uint8 code, colour1 = 0, colour2 = 0;
55          uint8 mixmask, mask = 0, mix = 0xff;          uint8 mixmask, mask = 0, mix = 0xff;
56            int fom_mask = 0;
57    
58          while (input < end)          while (input < end)
59          {          {
60                    fom_mask = 0;
61                  code = CVAL(input);                  code = CVAL(input);
62                  opcode = code >> 4;                  opcode = code >> 4;
63    
# Line 55  bitmap_decompress(unsigned char *output, Line 74  bitmap_decompress(unsigned char *output,
74    
75                          case 0xf:                          case 0xf:
76                                  opcode = code & 0xf;                                  opcode = code & 0xf;
77                                  count = (opcode < 13) ? SVAL(input) : 1;                                  if (opcode < 9)
78                                            count = SVAL(input);
79                                    else
80                                            count = (opcode < 0xb) ? 8 : 1;
81                                  offset = 0;                                  offset = 0;
82                                  break;                                  break;
83    
# Line 85  bitmap_decompress(unsigned char *output, Line 107  bitmap_decompress(unsigned char *output,
107                  }                  }
108    
109                  /* Read preliminary data */                  /* Read preliminary data */
                 mixmask = 0;  
110                  switch (opcode)                  switch (opcode)
111                  {                  {
112                          case 0: /* Fill */                          case 0: /* Fill */
# Line 103  bitmap_decompress(unsigned char *output, Line 124  bitmap_decompress(unsigned char *output,
124                                  mix = CVAL(input);                                  mix = CVAL(input);
125                                  opcode -= 5;                                  opcode -= 5;
126                                  break;                                  break;
127                            case 9: /* FillOrMix_1 */
128                                    mask = 0x03;
129                                    opcode = 0x02;
130                                    fom_mask = 3;
131                                    break;
132                            case 0x0a:      /* FillOrMix_2 */
133                                    mask = 0x05;
134                                    opcode = 0x02;
135                                    fom_mask = 5;
136                                    break;
137    
138                  }                  }
139    
140                  lastopcode = opcode;                  lastopcode = opcode;
141                    mixmask = 0;
142    
143                  /* Output body */                  /* Output body */
144                  while (count > 0)                  while (count > 0)
# Line 201  bitmap_decompress(unsigned char *output, Line 235  bitmap_decompress(unsigned char *output,
235                                          );                                          );
236                                          break;                                          break;
237    
238                                  case 13:        /* White */                                  case 0xd:       /* White */
239                                          REPEAT(line[x] = 0xff);                                          REPEAT(line[x] = 0xff);
240                                          break;                                          break;
241    
242                                  case 14:        /* Black */                                  case 0xe:       /* Black */
243                                          REPEAT(line[x] = 0x00);                                          REPEAT(line[x] = 0x00);
244                                          break;                                          break;
245    

Legend:
Removed from v.25  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26