Detect that we're drawing to a device that has per-pixel alpha, and if so,
disable LCD text.
Add experimental flag to force AA in fontscaler (windows-only). Hope to remove
this later.
git-svn-id: http://skia.googlecode.com/svn/trunk@2387 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 69f86cc..c88ad9a 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -219,12 +219,13 @@
///////////////////////////////////////////////////////////////////////////////
bool SkDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
- if (!paint.isLCDRenderText()) {
+ if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
// we're cool with the paint as is
return false;
}
if (SkBitmap::kARGB_8888_Config != fBitmap.config() ||
+ !fBitmap.isOpaque() ||
paint.getShader() ||
paint.getXfermode() || // unless its srcover
paint.getMaskFilter() ||
@@ -235,6 +236,10 @@
paint.getStyle() != SkPaint::kFill_Style) {
// turn off lcd
flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag;
+#ifdef SK_BUILD_FOR_WIN
+ // flag that we *really* want AA
+ flags->fFlags |= SkPaint::kForceAAText_Flag;
+#endif
flags->fHinting = paint.getHinting();
return true;
}