Index:
[thread]
[date]
[subject]
[author]
From: Marcus Sundberg <e94_msu@elixir.e.kth.se>
To : ggi-develop@eskimo.com
Date: Tue, 14 Jul 1998 01:00:01 +0200
New ggi_graphtype
Hi!
In the true spirit of DTJC I have implemented a new ggi_graphtype
scheme after looking through the libggi-issues document:
#define GGI_AUTO (0)
typedef uint32 ggi_graphtype;
#define GT_DEPTH_MASK 0x000000ff
#define GT_ACCESS_MASK 0x0000ff00
#define GT_SUBSCHEME_MASK 0x00ff0000
#define GT_SCHEME_MASK 0xff000000
#define GT_DEPTH_SHIFT (0)
#define GT_ACCESS_SHIFT (8)
#define GT_SUBSCHEME_SHIFT (16)
#define GT_SCHEME_SHIFT (24)
/* Macros to extract info from a ggi_graphtype. */
#define GT_DEPTH(x) (((x) & GT_DEPTH_MASK) >> GT_DEPTH_SHIFT)
#define GT_ACCESS(x) (((x) & GT_ACCESS_MASK) >> GT_ACCESS_SHIFT)
#define GT_SUBSCHEME(x) ((x) & GT_SUBSCHEME_MASK)
#define GT_SCHEME(x) ((x) & GT_SCHEME_MASK)
/* Enumerated schemes */
#define GT_TEXT ((0x01) << GT_SCHEME_SHIFT)
#define GT_RGB ((0x02) << GT_SCHEME_SHIFT)
#define GT_GREYSCALE ((0x03) << GT_SCHEME_SHIFT)
/* Scheme flags */
#define GT_INDEXED ((1<<7) << GT_SCHEME_SHIFT)
/* Subschemes */
#define GT_SUB_LSB_NORMAL ((0x01) << GT_SUBSCHEME_SHIFT)
#define GT_SUB_MSB_NORMAL ((0x02) << GT_SUBSCHEME_SHIFT)
#define GT_SUB_LSB_REVERSE ((0x03) << GT_SUBSCHEME_SHIFT)
#define GT_SUB_MSB_REVERSE ((0x04) << GT_SUBSCHEME_SHIFT)
/* Macro that constructs a graphtype */
#define GT_CONSTRUCT(depth,scheme,access) \
( (depth) | \
(scheme) | \
((access) << GT_ACCESS_SHIFT) )
/* Common graphtypes */
#define GT_TEXT16 GT_CONSTRUCT(16,GT_TEXT,16)
#define GT_TEXT32 GT_CONSTRUCT(32,GT_TEXT,32)
#define GT_1BIT GT_CONSTRUCT(1, GT_GREYSCALE, 1)
#define GT_4BIT GT_CONSTRUCT(4, GT_RGB | GT_INDEXED, 4)
#define GT_8BIT GT_CONSTRUCT(8, GT_RGB | GT_INDEXED, 8)
#define GT_15BIT GT_CONSTRUCT(15, GT_RGB, 16)
#define GT_16BIT GT_CONSTRUCT(16, GT_RGB, 16)
#define GT_24BIT GT_CONSTRUCT(24, GT_RGB, 24)
#define GT_32BIT GT_CONSTRUCT(24, GT_RGB, 32)
#define GT_AUTO (0)
#define GT_INVALID (0xffffffff)
#if 0
#define MASK(X) GM_##X = (1 << GT_##X)
typedef enum
{ MASK(TEXT16),
MASK(TEXT32),
MASK(1BIT),
MASK(4BIT),
MASK(8BIT),
MASK(15BIT),
MASK(16BIT),
MASK(24BIT),
MASK(32BIT),
GM_ALL = ((1 << GT_LAST) - 1)
} ggi_graphmask;
#undef MASK
#else
#define ggi_graphmask ggi_graphmask_does_not_exist_anymore
#endif
#ifdef NEED_GRAPHTYPE_SYMS
#define GRAPHTYPE(X) ("THIS CODE NEEDS FIXING FOR THE NEW GT_* SCHEME!")
#endif
My comments:
* Changing GGI_AUTO to 0 is genarally a Good Thing as it will simplify lots
of things and doesn't break any source-compability.
* Having GT_INDEXED as a flag instead of a searate scheme is also the right
thing to do as you can have both indexed and non-indexed RGB, greyscale,
YUV or whatever modes.
* The MSB/LSB part of the subscheme should cause no confusion. The
NORMAL/REVERSE part refers to RBG or BGR style pixelformats.
This is the two parts that users is likely to want to change.
And If we should ever feel the need to have more combinations we
have 5 bits left in the subscheme.
* The GT_CONSTRUCT macro doesn't take a subscheme argument as you simply
'or' an eventual subscheme together with the scheme.
* This scheme will maintain source compability for all apps, unless they
do something special (Everything in demos/ worked out-of-the-box, except
checkmode.c which took 2 mins to fix).
* I've not added entrys for YUV, CMYK, FNUL, GROK or DIRT colorspaces, and
neither the 5red17blue10unused3alpha8green subscheme supported by
WizBang graphicboards, simply because that there's no driver supporting
them yet. When the need arises for those they can easily be plugged in
without breaking anything.
Your comments?
Unless anyone finds any important flaw in this scheme that can't be
fixed without breaking anything I'll commit this tomorrow so we can
start updating targets and drivers.
//Marcus
Index:
[thread]
[date]
[subject]
[author]