| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/win/direct_write.h" | 5 #include "ui/gfx/win/direct_write.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void CreateDWriteFactory(IDWriteFactory** factory) { | 22 void CreateDWriteFactory(IDWriteFactory** factory) { |
| 23 base::win::ScopedComPtr<IUnknown> factory_unknown; | 23 base::win::ScopedComPtr<IUnknown> factory_unknown; |
| 24 HRESULT hr = | 24 HRESULT hr = |
| 25 DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), | 25 DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), |
| 26 factory_unknown.Receive()); | 26 factory_unknown.Receive()); |
| 27 if (FAILED(hr)) { | 27 if (FAILED(hr)) { |
| 28 base::debug::Alias(&hr); | 28 base::debug::Alias(&hr); |
| 29 CHECK(false); | 29 CHECK(false); |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 factory_unknown.QueryInterface<IDWriteFactory>(factory); | 32 factory_unknown.CopyTo(factory); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void MaybeInitializeDirectWrite() { | 35 void MaybeInitializeDirectWrite() { |
| 36 static bool tried_dwrite_initialize = false; | 36 static bool tried_dwrite_initialize = false; |
| 37 if (tried_dwrite_initialize) | 37 if (tried_dwrite_initialize) |
| 38 return; | 38 return; |
| 39 tried_dwrite_initialize = true; | 39 tried_dwrite_initialize = true; |
| 40 | 40 |
| 41 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 41 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 42 switches::kDisableDirectWriteForUI)) { | 42 switches::kDisableDirectWriteForUI)) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 sk_sp<SkFontMgr> direct_write_font_mgr = | 57 sk_sp<SkFontMgr> direct_write_font_mgr = |
| 58 SkFontMgr_New_DirectWrite(factory.Get()); | 58 SkFontMgr_New_DirectWrite(factory.Get()); |
| 59 if (!direct_write_font_mgr) | 59 if (!direct_write_font_mgr) |
| 60 return; | 60 return; |
| 61 SetDefaultSkiaFactory(std::move(direct_write_font_mgr)); | 61 SetDefaultSkiaFactory(std::move(direct_write_font_mgr)); |
| 62 gfx::PlatformFontWin::SetDirectWriteFactory(factory.Get()); | 62 gfx::PlatformFontWin::SetDirectWriteFactory(factory.Get()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace win | 65 } // namespace win |
| 66 } // namespace gfx | 66 } // namespace gfx |
| OLD | NEW |