| 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/font_render_params.h" |
| 6 |
| 7 #include <memory> |
| 8 |
| 5 #include "base/bind.h" | 9 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 7 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 8 #include "base/macros.h" | 12 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 11 #include "base/win/registry.h" | 14 #include "base/win/registry.h" |
| 12 #include "ui/gfx/font_render_params.h" | |
| 13 #include "ui/gfx/win/direct_write.h" | 15 #include "ui/gfx/win/direct_write.h" |
| 14 #include "ui/gfx/win/singleton_hwnd_observer.h" | 16 #include "ui/gfx/win/singleton_hwnd_observer.h" |
| 15 | 17 |
| 16 namespace gfx { | 18 namespace gfx { |
| 17 | 19 |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| 20 FontRenderParams::SubpixelRendering GetSubpixelRenderingGeometry() { | 22 FontRenderParams::SubpixelRendering GetSubpixelRenderingGeometry() { |
| 21 DISPLAY_DEVICE display_device = {sizeof(DISPLAY_DEVICE)}; | 23 DISPLAY_DEVICE display_device = {sizeof(DISPLAY_DEVICE)}; |
| 22 for (int i = 0; EnumDisplayDevices(nullptr, i, &display_device, 0); ++i) { | 24 for (int i = 0; EnumDisplayDevices(nullptr, i, &display_device, 0); ++i) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 CachedFontRenderParams() {} | 89 CachedFontRenderParams() {} |
| 88 ~CachedFontRenderParams() {} | 90 ~CachedFontRenderParams() {} |
| 89 | 91 |
| 90 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { | 92 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { |
| 91 if (message == WM_SETTINGCHANGE) { | 93 if (message == WM_SETTINGCHANGE) { |
| 92 params_.reset(); | 94 params_.reset(); |
| 93 singleton_hwnd_observer_.reset(nullptr); | 95 singleton_hwnd_observer_.reset(nullptr); |
| 94 } | 96 } |
| 95 } | 97 } |
| 96 | 98 |
| 97 scoped_ptr<FontRenderParams> params_; | 99 std::unique_ptr<FontRenderParams> params_; |
| 98 scoped_ptr<SingletonHwndObserver> singleton_hwnd_observer_; | 100 std::unique_ptr<SingletonHwndObserver> singleton_hwnd_observer_; |
| 99 | 101 |
| 100 DISALLOW_COPY_AND_ASSIGN(CachedFontRenderParams); | 102 DISALLOW_COPY_AND_ASSIGN(CachedFontRenderParams); |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 } // namespace | 105 } // namespace |
| 104 | 106 |
| 105 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, | 107 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, |
| 106 std::string* family_out) { | 108 std::string* family_out) { |
| 107 if (family_out) | 109 if (family_out) |
| 108 NOTIMPLEMENTED(); | 110 NOTIMPLEMENTED(); |
| 109 // Customized font rendering settings are not supported, only defaults. | 111 // Customized font rendering settings are not supported, only defaults. |
| 110 return CachedFontRenderParams::GetInstance()->GetParams(); | 112 return CachedFontRenderParams::GetInstance()->GetParams(); |
| 111 } | 113 } |
| 112 | 114 |
| 113 } // namespace gfx | 115 } // namespace gfx |
| OLD | NEW |