use enum in getHinting() function, rather than hard-coded constants



git-svn-id: http://skia.googlecode.com/svn/trunk@290 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-07-27 16:39:38 +00:00
parent e4d0bc0b57
commit e2ca20740b
3 changed files with 10 additions and 6 deletions

View File

@ -138,13 +138,13 @@ public:
what will actually be done. This is an optimization so that the font
cache does not contain different recs (i.e. keys) that in reality map to
the same output.
A lazy (but valid) fonthost can do nothing in its FilterRec routine.
*/
static void FilterRec(SkScalerContext::Rec* rec);
///////////////////////////////////////////////////////////////////////////
/** Return the number of tables in the font
*/
static int CountTables(SkFontID);

View File

@ -126,7 +126,7 @@ struct SkMask {
kJustRenderImage_CreateMode, //!< render into preallocate mask
kComputeBoundsAndRenderImage_CreateMode //!< compute bounds, alloc image and render into it
};
static bool FormatIsLCD(Format fm) {
return kHorizontalLCD_Format == fm || kVerticalLCD_Format == fm;
}

View File

@ -155,6 +155,11 @@ public:
kHintingBit1_Flag = 0x10,
kHintingBit2_Flag = 0x20,
};
private:
enum {
kHintingMask = kHintingBit1_Flag | kHintingBit2_Flag
};
public:
struct Rec {
uint32_t fFontID;
SkScalar fTextSize, fPreScaleX, fPreSkewX;
@ -170,12 +175,11 @@ public:
void getSingleMatrix(SkMatrix*) const;
SkPaint::Hinting getHinting() const {
return static_cast<SkPaint::Hinting>((fFlags >> 4) & 3);
return static_cast<SkPaint::Hinting>((fFlags & kHintingMask) >> 4);
}
void setHinting(SkPaint::Hinting hinting) {
fFlags = (fFlags & ~(kHintingBit1_Flag | kHintingBit2_Flag)) |
(static_cast<int>(hinting) << 4);
fFlags = (fFlags & ~kHintingMask) | (hinting << 4);
}
SkMask::Format getFormat() const {