| Index: ui/gfx/win/direct_write.cc
|
| diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc
|
| index 38c926a9bd11da661c3e66b614c177427a6bf6ae..bcdbd32ed2b674386681d9ab9008429a8a361936 100644
|
| --- a/ui/gfx/win/direct_write.cc
|
| +++ b/ui/gfx/win/direct_write.cc
|
| @@ -21,6 +21,8 @@
|
| namespace gfx {
|
| namespace win {
|
|
|
| +base::win::ScopedComPtr<IDWriteFactory> factory_;
|
| +
|
| namespace {
|
|
|
| static bool dwrite_enabled = false;
|
| @@ -81,13 +83,10 @@ void MaybeInitializeDirectWrite() {
|
| if (!dwrite_create_factory_proc)
|
| return;
|
|
|
| - base::win::ScopedComPtr<IDWriteFactory> factory;
|
| -
|
| // Failure to create the DirectWrite factory indicates a corrupt dll.
|
| if (FAILED(dwrite_create_factory_proc(
|
| - DWRITE_FACTORY_TYPE_SHARED,
|
| - __uuidof(IDWriteFactory),
|
| - reinterpret_cast<IUnknown**>(factory.Receive()))))
|
| + DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
|
| + reinterpret_cast<IUnknown**>(factory_.Receive()))))
|
| return;
|
|
|
| // The skia call to create a new DirectWrite font manager instance can fail
|
| @@ -95,17 +94,23 @@ void MaybeInitializeDirectWrite() {
|
| // factory. The GetSystemFontCollection method in the IDWriteFactory
|
| // 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());
|
| + SkFontMgr* direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory_.get());
|
| if (!direct_write_font_mgr)
|
| return;
|
| dwrite_enabled = true;
|
| SetDefaultSkiaFactory(direct_write_font_mgr);
|
| - gfx::PlatformFontWin::SetDirectWriteFactory(factory.get());
|
| + gfx::PlatformFontWin::SetDirectWriteFactory(factory_.get());
|
| }
|
|
|
| bool IsDirectWriteEnabled() {
|
| return dwrite_enabled;
|
| }
|
|
|
| +void GetDWriteFactory(IDWriteFactory** factory) {
|
| + MaybeInitializeDirectWrite();
|
| + base::win::ScopedComPtr<IDWriteFactory> factory_ref = factory_;
|
| + *factory = factory_ref.Detach();
|
| +}
|
| +
|
| } // namespace win
|
| } // namespace gfx
|
|
|