aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar agl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-01-04 18:27:55 +0000
committerGravatar agl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-01-04 18:27:55 +0000
commite95c91e6d9201d50d0b84fbc3d2f53f92f753e0b (patch)
tree44689f5d69a8ccfb0794653d02db0b9ce89a1615 /src
parent030d8e68e2478b783ecf089265b3d4ec8c3be2f8 (diff)
Add flag to enable bitmap strikes.
http://codereview.appspot.com/183096 git-svn-id: http://skia.googlecode.com/svn/trunk@466 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPaint.cpp6
-rw-r--r--src/ports/SkFontHost_FreeType.cpp9
2 files changed, 10 insertions, 5 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 2432ee3059..589b1c711c 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -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));
@@ -1218,6 +1223,7 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
rec->fFlags = SkToU8(flags);
rec->setHinting(computeHinting(paint));
+ rec->fUseEmbeddedBitmapText = paint.isEmbeddedBitmapText();
/* 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,
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index c7e310e4ce..5eb36f6ded 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -376,10 +376,7 @@ 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.fUseEmbeddedBitmapText) {
loadFlags |= FT_LOAD_NO_BITMAP;
}
@@ -708,7 +705,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;