Chromium Code Reviews| Index: ui/gfx/win/direct_write.cc |
| diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc |
| index 207b2c165b542c7811512add11e6e93d759403e3..16f705574524eb2b9090f5fa0923877efaece6e1 100644 |
| --- a/ui/gfx/win/direct_write.cc |
| +++ b/ui/gfx/win/direct_write.cc |
| @@ -21,6 +21,12 @@ |
| namespace gfx { |
| namespace win { |
| +namespace { |
| + |
| +static bool dwrite_enabled = false; |
| + |
| +} |
| + |
| bool ShouldUseDirectWrite() { |
| // If the flag is currently on, and we're on Win7 or above, we enable |
| // DirectWrite. Skia does not require the additions to DirectWrite in QFE |
| @@ -103,10 +109,15 @@ void MaybeInitializeDirectWrite() { |
| // interface fails with E_INVALIDARG on certain Windows 7 gold versions |
| // (6.1.7600.*). We should just use GDI in these cases. |
| SkFontMgr* direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory.get()); |
| - if (direct_write_font_mgr) { |
| - SetDefaultSkiaFactory(direct_write_font_mgr); |
| - gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); |
| - } |
| + if (!direct_write_font_mgr) |
| + return; |
| + dwrite_enabled = true; |
|
msw
2014/12/10 23:55:50
Why can't callers check ShouldUseDirectWrite?
ckocagil
2014/12/11 01:07:11
Because some processes can choose not to initializ
msw
2014/12/11 23:30:12
Okay, fair enough.
|
| + SetDefaultSkiaFactory(direct_write_font_mgr); |
| + gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); |
| +} |
| + |
| +bool IsDirectWriteEnabled() { |
| + return dwrite_enabled; |
| } |
| } // namespace win |