2 * $Source: s:/prj/tech/libsrc/dev2d/RCS/rsd.h $
5 * $Date: 1996/04/10 17:00:40 $
7 * Constants and macros for RSD8 bitmap processing.
10 * Revision 1.1 1996/04/10 17:00:40 KEVIN
13 * Revision 1.2 1993/10/26 02:14:30 kevin
14 * Changed algorithm so that rsd_src is never advanced
15 * past the end of the bitmap. (It stays pointed to the
16 * end when the end is reached.)
18 * Revision 1.1 1992/11/12 13:51:29 kaboom
34 /* this is a pretty specific-use macro for getting the next rsd token from an
35 rsd input buffer. the source buffer has to be named rsd_src, the token's
36 code goes in rsd_code, and the count for the operation goes in rsd_count.
37 after a call of this macro, rsd_src is advanced to the actual data for the
38 code (pixel data for dump, run value for run) if there is any, or to the
39 beginning of the next token (for skip). */
40 #define RSD_GET_TOKEN() \
42 if (*rsd_src == 0) /* run */ \
45 rsd_count = rsd_src[1]; \
47 /* mprintf ("run %d ",count); */ \
49 else if (*rsd_src < 0x80) /* dump */ \
51 rsd_code = RSD_DUMP; \
52 rsd_count = *rsd_src; \
54 /* mprintf ("dump %d ",count); */ \
56 else if (*rsd_src != 0x80) /* skip */ \
58 rsd_code = RSD_SKIP; \
59 rsd_count = *rsd_src & 0x7f; \
61 /* mprintf ("skip %d ",count); */ \
65 ushort *rsd_usrc = (ushort *)++rsd_src; \
67 if (*rsd_usrc >= 0x8000) \
69 if (*rsd_usrc >= 0xc000) /* long run */ \
72 rsd_count = *rsd_usrc & 0x3fff; \
74 /* mprintf ("run %d ",count); */ \
76 else /* long dump */ \
78 rsd_code = RSD_DUMP; \
79 rsd_count = *rsd_usrc & 0x7fff; \
81 /* mprintf ("dump %d ",count); */ \
84 else if (*rsd_usrc != 0) /* long skip */ \
86 rsd_code = RSD_SKIP; \
87 rsd_count = *rsd_usrc; \
89 /* mprintf ("skip %d ",count); */ \
92 /* subsequent uses of RSD_GET_TOKEN should also return to rsd_done.*/ \
93 rsd_code = RSD_SKIP; \