| Index: Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
|
| diff --git a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
|
| index 30f96c67ca626dc6fb0f209be72d796cdf567fe7..c0f6501d4bfd82c7e8b346181402b7787848b868 100644
|
| --- a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
|
| +++ b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
|
| @@ -38,6 +38,7 @@
|
| #include "core/platform/LayoutTestSupport.h"
|
| #include "core/platform/SharedBuffer.h"
|
| #include "core/platform/graphics/FontCache.h"
|
| +#include "core/platform/graphics/GraphicsContext.h"
|
| #include "core/platform/graphics/skia/SkiaFontWin.h"
|
| #include "core/platform/win/HWndDC.h"
|
| #include "public/platform/Platform.h"
|
| @@ -50,14 +51,36 @@
|
|
|
| namespace WebCore {
|
|
|
| -#if !ENABLE(GDI_FONTS_ON_WINDOWS)
|
| -void FontPlatformData::setupPaint(SkPaint* paint) const
|
| +void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) const
|
| {
|
| const float ts = m_size >= 0 ? m_size : 12;
|
| paint->setTextSize(SkFloatToScalar(m_size));
|
| paint->setTypeface(typeface());
|
| +
|
| + // Only set painting flags when we're actually painting.
|
| + if (context) {
|
| + int textFlags = paintTextFlags();
|
| + if (!context->couldUseLCDRenderedText()) {
|
| + textFlags &= ~SkPaint::kLCDRenderText_Flag;
|
| + // If we *just* clear our request for LCD, then GDI seems to
|
| + // sometimes give us AA text, and sometimes give us BW text. Since the
|
| + // original intent was LCD, we want to force AA (rather than BW), so we
|
| + // add a special bit to tell Skia to do its best to avoid the BW: by
|
| + // drawing LCD offscreen and downsampling that to AA.
|
| + textFlags |= SkPaint::kGenA8FromLCD_Flag;
|
| + }
|
| +
|
| + static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag |
|
| + SkPaint::kLCDRenderText_Flag |
|
| + SkPaint::kGenA8FromLCD_Flag;
|
| +
|
| + SkASSERT(!(textFlags & ~textFlagsMask));
|
| + uint32_t flags = paint->getFlags();
|
| + flags &= ~textFlagsMask;
|
| + flags |= textFlags;
|
| + paint->setFlags(flags);
|
| + }
|
| }
|
| -#endif
|
|
|
| // Lookup the current system settings for font smoothing.
|
| // We cache these values for performance, but if the browser has a way to be
|
|
|