Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1072)

Unified Diff: src/ports/SkFontHost_win_dw.cpp

Issue 309503002: Put DirectWrite bitmap fix behind the SK_IGNORE_DWRITE_BITMAP_FIX flag. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win_dw.cpp
===================================================================
--- src/ports/SkFontHost_win_dw.cpp (revision 14915)
+++ src/ports/SkFontHost_win_dw.cpp (working copy)
@@ -741,11 +741,24 @@
// If the scale is negative, this means the matrix will do the flip anyway.
SkScalar realTextSize = SkScalarAbs(GA.get(SkMatrix::kMScaleY));
// Due to floating point math, the lower bits are suspect. Round carefully.
+#ifdef SK_IGNORE_DWRITE_BITMAP_FIX
+ SkScalar roundedTextSize = SkScalarRoundToScalar(realTextSize * 64.0f) / 64.0f;
+ SkScalar gdiTextSize = SkScalarFloorToScalar(roundedTextSize);
+#else
SkScalar gdiTextSize = SkScalarRoundToScalar(realTextSize * 64.0f) / 64.0f;
+#endif
if (gdiTextSize == 0) {
gdiTextSize = SK_Scalar1;
}
+#ifdef SK_IGNORE_DWRITE_BITMAP_FIX
+ bool hasBitmap = fRec.fFlags & SkScalerContext::kEmbeddedBitmapText_Flag &&
+ hasBitmapStrike(typeface, SkScalarTruncToInt(gdiTextSize));
+ bool axisAligned = isAxisAligned(fRec);
+ bool isBiLevel = SkMask::kBW_Format == fRec.fMaskFormat || (hasBitmap && axisAligned);
+
+ if (isBiLevel) {
+#else
bool bitmapRequested = SkToBool(fRec.fFlags & SkScalerContext::kEmbeddedBitmapText_Flag);
bool hasBitmap = false;
bool axisAlignedBitmap = false;
@@ -756,12 +769,13 @@
// If the user requested aliased, do so with aliased compatible metrics.
if (SkMask::kBW_Format == fRec.fMaskFormat) {
+#endif
fTextSizeRender = gdiTextSize;
fRenderingMode = DWRITE_RENDERING_MODE_ALIASED;
fTextureType = DWRITE_TEXTURE_ALIASED_1x1;
fTextSizeMeasure = gdiTextSize;
fMeasuringMode = DWRITE_MEASURING_MODE_GDI_CLASSIC;
-
+#ifndef SK_IGNORE_DWRITE_BITMAP_FIX
// If we can use a bitmap, use gdi classic rendering and measurement.
// This will not always provide a bitmap, but matches expected behavior.
} else if (hasBitmap && axisAlignedBitmap) {
@@ -770,7 +784,7 @@
fTextureType = DWRITE_TEXTURE_CLEARTYPE_3x1;
fTextSizeMeasure = gdiTextSize;
fMeasuringMode = DWRITE_MEASURING_MODE_GDI_CLASSIC;
-
+#endif
// If rotated but the horizontal text could have used a bitmap,
// render high quality rotated glyphs but measure using bitmap metrics.
} else if (hasBitmap) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698