diff options
author | Mike Reed <reed@google.com> | 2009-07-24 15:53:43 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2009-07-27 12:40:11 -0400 |
commit | af2616552738d653d5453915d3236e7154b868cd (patch) | |
tree | 2adf051e4585ac1afd72b3c91cdd0ed1e0bfb438 /include/core/SkScalerContext.h | |
parent | 8db6227fff273d07b62767a9f25dc5a625bd9f63 (diff) | |
download | external_skia-af2616552738d653d5453915d3236e7154b868cd.zip external_skia-af2616552738d653d5453915d3236e7154b868cd.tar.gz external_skia-af2616552738d653d5453915d3236e7154b868cd.tar.bz2 |
refresh from trunk
check-point for lcd text rendering
Diffstat (limited to 'include/core/SkScalerContext.h')
-rw-r--r-- | include/core/SkScalerContext.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h index b06a443..29c28f7 100644 --- a/include/core/SkScalerContext.h +++ b/include/core/SkScalerContext.h @@ -136,34 +136,59 @@ struct SkGlyph { } void toMask(SkMask* mask) const; + + /** Given a glyph which is has a mask format of LCD or VerticalLCD, take + the A8 plane in fImage and produce a valid LCD plane from it. + */ + void expandA8ToLCD() const; }; class SkScalerContext { public: - enum Hints { - kNo_Hints, - kSubpixel_Hints, - kNormal_Hints - }; enum Flags { kFrameAndFill_Flag = 0x01, kDevKernText_Flag = 0x02, kGammaForBlack_Flag = 0x04, // illegal to set both Gamma flags - kGammaForWhite_Flag = 0x08 // illegal to set both Gamma flags + kGammaForWhite_Flag = 0x08, // illegal to set both Gamma flags + // together, these two flags resulting in a two bit value which matches + // up with the SkPaint::Hinting enum. + kHintingBit1_Flag = 0x10, + kHintingBit2_Flag = 0x20, + }; +private: + enum { + kHintingMask = kHintingBit1_Flag | kHintingBit2_Flag }; +public: struct Rec { uint32_t fFontID; SkScalar fTextSize, fPreScaleX, fPreSkewX; SkScalar fPost2x2[2][2]; SkScalar fFrameWidth, fMiterLimit; - uint8_t fHints; + bool fSubpixelPositioning; uint8_t fMaskFormat; uint8_t fStrokeJoin; uint8_t fFlags; - + void getMatrixFrom2x2(SkMatrix*) const; void getLocalMatrix(SkMatrix*) const; void getSingleMatrix(SkMatrix*) const; + + SkPaint::Hinting getHinting() const { + return static_cast<SkPaint::Hinting>((fFlags & kHintingMask) >> 4); + } + + void setHinting(SkPaint::Hinting hinting) { + fFlags = (fFlags & ~kHintingMask) | (hinting << 4); + } + + SkMask::Format getFormat() const { + return static_cast<SkMask::Format>(fMaskFormat); + } + + bool isLCD() const { + return SkMask::FormatIsLCD(this->getFormat()); + } }; SkScalerContext(const SkDescriptor* desc); |