Commit 7094ff35 authored by Mike Reed's avatar Mike Reed Committed by Android Git Automerger
Browse files

am 5fee0e9c: am 2cf237c9: refresh from skia/trunk, adds paint bit for bitmapfonts

Merge commit '5fee0e9c'

* commit '5fee0e9c':
  refresh from skia/trunk, adds paint bit for bitmapfonts
parents 917d8f7c 5fee0e9c
......@@ -109,10 +109,11 @@ public:
kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positioning
kDevKernText_Flag = 0x100, //!< mask to enable device kerning text
kLCDRenderText_Flag = 0x200, //!< mask to enable subpixel glyph renderering
kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap strikes
// when adding extra flags, note that the fFlags member is specified
// with a bit-width and you'll have to expand it.
kAllFlags = 0x3FF
kAllFlags = 0x7FF
};
/** Return the paint's flags. Use the Flag enum to test flag values.
......@@ -190,6 +191,17 @@ public:
*/
void setLCDRenderText(bool subpixelRender);
bool isEmbeddedBitmapText() const
{
return SkToBool(this->getFlags() & kEmbeddedBitmapText_Flag);
}
/** Helper for setFlags(), setting or clearing the kEmbeddedBitmapText_Flag bit
@param useEmbeddedBitmapText true to set the kEmbeddedBitmapText bit in the paint's flags,
false to clear it.
*/
void setEmbeddedBitmapText(bool useEmbeddedBitmapText);
/** Helper for getFlags(), returning true if kUnderlineText_Flag bit is set
@return true if the underlineText bit is set in the paint's flags.
*/
......@@ -802,7 +814,7 @@ private:
SkColor fColor;
SkScalar fWidth;
SkScalar fMiterLimit;
unsigned fFlags : 10;
unsigned fFlags : 11;
unsigned fTextAlign : 2;
unsigned fCapType : 2;
unsigned fJoinType : 2;
......
......@@ -154,6 +154,7 @@ public:
// up with the SkPaint::Hinting enum.
kHintingBit1_Flag = 0x10,
kHintingBit2_Flag = 0x20,
kEmbeddedBitmapText_Flag = 0x40,
};
private:
enum {
......@@ -169,6 +170,10 @@ public:
uint8_t fMaskFormat;
uint8_t fStrokeJoin;
uint8_t fFlags;
// Warning: when adding members note that the size of this structure
// must be a multiple of 4. SkDescriptor requires that its arguments be
// multiples of four and this structure is put in an SkDescriptor in
// SkPaint::MakeRec.
void getMatrixFrom2x2(SkMatrix*) const;
void getLocalMatrix(SkMatrix*) const;
......
......@@ -155,6 +155,11 @@ void SkPaint::setLCDRenderText(bool doLCDRender)
this->setFlags(SkSetClearMask(fFlags, doLCDRender, kLCDRenderText_Flag));
}
void SkPaint::setEmbeddedBitmapText(bool doEmbeddedBitmapText)
{
this->setFlags(SkSetClearMask(fFlags, doEmbeddedBitmapText, kEmbeddedBitmapText_Flag));
}
void SkPaint::setLinearText(bool doLinearText)
{
this->setFlags(SkSetClearMask(fFlags, doLinearText, kLinearText_Flag));
......@@ -1235,6 +1240,8 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
rec->fFlags = SkToU8(flags);
rec->setHinting(computeHinting(paint));
if (paint.isEmbeddedBitmapText())
rec->fFlags |= SkScalerContext::kEmbeddedBitmapText_Flag;
/* Allow the fonthost to modify our rec before we use it as a key into the
cache. This way if we're asking for something that they will ignore,
......
......@@ -377,12 +377,8 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
break;
}
if (fRec.fMaskFormat != SkMask::kBW_Format) {
// If the user requested anti-aliasing then we don't use bitmap
// strikes in the font. The consensus among our Japanese users is
// that this results in the best quality.
if ((fRec.fFlags & SkScalerContext::kEmbeddedBitmapText_Flag) == 0)
loadFlags |= FT_LOAD_NO_BITMAP;
}
fLoadGlyphFlags = loadFlags;
}
......@@ -724,7 +720,9 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
dst += dstRowBytes;
}
} else if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO &&
glyph.fMaskFormat == SkMask::kA8_Format) {
(glyph.fMaskFormat == SkMask::kA8_Format ||
glyph.fMaskFormat == SkMask::kHorizontalLCD_Format ||
glyph.fMaskFormat == SkMask::kVerticalLCD_Format)) {
for (int y = 0; y < fFace->glyph->bitmap.rows; ++y) {
uint8_t byte = 0;
int bits = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment