diff --git a/ChangeLog b/ChangeLog index aa3af0532..b71643d29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-02-22 Werner Lemberg + + [pshinter] Use macros for (unsigned) flags, not enumerations. + + * src/pshinter/pshalgo.h (PSH_Hint_Flags): Replace with macros. + Updated. + * src/pshinter/pshrec.h (PS_Hint_Flags): Replace with macros. + 2015-02-22 Werner Lemberg * src/pshinter/pshrec.c: Simplify. diff --git a/src/pshinter/pshalgo.h b/src/pshinter/pshalgo.h index 3751acaf8..8373e5ec2 100644 --- a/src/pshinter/pshalgo.h +++ b/src/pshinter/pshalgo.h @@ -30,15 +30,12 @@ FT_BEGIN_HEADER /* handle to Hint structure */ typedef struct PSH_HintRec_* PSH_Hint; - /* hint bit-flags */ - typedef enum PSH_Hint_Flags_ - { - PSH_HINT_GHOST = PS_HINT_FLAG_GHOST, - PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM, - PSH_HINT_ACTIVE = 4, - PSH_HINT_FITTED = 8 - } PSH_Hint_Flags; + /* hint bit-flags */ +#define PSH_HINT_GHOST PS_HINT_FLAG_GHOST +#define PSH_HINT_BOTTOM PS_HINT_FLAG_BOTTOM +#define PSH_HINT_ACTIVE 4U +#define PSH_HINT_FITTED 8U #define psh_hint_is_active( x ) ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 ) @@ -49,6 +46,7 @@ FT_BEGIN_HEADER #define psh_hint_deactivate( x ) (x)->flags &= ~PSH_HINT_ACTIVE #define psh_hint_set_fitted( x ) (x)->flags |= PSH_HINT_FITTED + /* hint structure */ typedef struct PSH_HintRec_ { @@ -112,14 +110,12 @@ FT_BEGIN_HEADER #define PSH_DIR_IS_VERTICAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL ) - /* the following bit-flags are computed once by the glyph */ - /* analyzer, for both dimensions */ - enum - { - PSH_POINT_OFF = 1, /* point is off the curve */ - PSH_POINT_SMOOTH = 2, /* point is smooth */ - PSH_POINT_INFLEX = 4 /* point is inflection */ - }; + /* the following bit-flags are computed once by the glyph */ + /* analyzer, for both dimensions */ +#define PSH_POINT_OFF 1U /* point is off the curve */ +#define PSH_POINT_SMOOTH 2U /* point is smooth */ +#define PSH_POINT_INFLEX 4U /* point is inflection */ + #define psh_point_is_smooth( p ) ( (p)->flags & PSH_POINT_SMOOTH ) #define psh_point_is_off( p ) ( (p)->flags & PSH_POINT_OFF ) @@ -129,17 +125,16 @@ FT_BEGIN_HEADER #define psh_point_set_off( p ) (p)->flags |= PSH_POINT_OFF #define psh_point_set_inflex( p ) (p)->flags |= PSH_POINT_INFLEX + /* the following bit-flags are re-computed for each dimension */ - enum - { - PSH_POINT_STRONG = 16, /* point is strong */ - PSH_POINT_FITTED = 32, /* point is already fitted */ - PSH_POINT_EXTREMUM = 64, /* point is local extremum */ - PSH_POINT_POSITIVE = 128, /* extremum has positive contour flow */ - PSH_POINT_NEGATIVE = 256, /* extremum has negative contour flow */ - PSH_POINT_EDGE_MIN = 512, /* point is aligned to left/bottom stem edge */ - PSH_POINT_EDGE_MAX = 1024 /* point is aligned to top/right stem edge */ - }; +#define PSH_POINT_STRONG 16U /* point is strong */ +#define PSH_POINT_FITTED 32U /* point is already fitted */ +#define PSH_POINT_EXTREMUM 64U /* point is local extremum */ +#define PSH_POINT_POSITIVE 128U /* extremum has positive contour flow */ +#define PSH_POINT_NEGATIVE 256U /* extremum has negative contour flow */ +#define PSH_POINT_EDGE_MIN 512U /* point is aligned to left/bottom stem edge */ +#define PSH_POINT_EDGE_MAX 1024U /* point is aligned to top/right stem edge */ + #define psh_point_is_strong( p ) ( (p)->flags2 & PSH_POINT_STRONG ) #define psh_point_is_fitted( p ) ( (p)->flags2 & PSH_POINT_FITTED ) diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h index 9106bc867..2b1ad9493 100644 --- a/src/pshinter/pshrec.h +++ b/src/pshinter/pshrec.h @@ -61,12 +61,8 @@ FT_BEGIN_HEADER /* hint flags */ - typedef enum PS_Hint_Flags_ - { - PS_HINT_FLAG_GHOST = 1, - PS_HINT_FLAG_BOTTOM = 2 - - } PS_Hint_Flags; +#define PS_HINT_FLAG_GHOST 1U +#define PS_HINT_FLAG_BOTTOM 2U /* hint descriptor */