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" | 5 #include "ui/gfx/font_render_params.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 for (int i = 0; EnumDisplayDevices(nullptr, i, &display_device, 0); ++i) { | 24 for (int i = 0; EnumDisplayDevices(nullptr, i, &display_device, 0); ++i) { |
25 // TODO(scottmg): We only support the primary device currently. | 25 // TODO(scottmg): We only support the primary device currently. |
26 if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { | 26 if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { |
27 base::FilePath trimmed = | 27 base::FilePath trimmed = |
28 base::FilePath(display_device.DeviceName).BaseName(); | 28 base::FilePath(display_device.DeviceName).BaseName(); |
29 base::win::RegKey key( | 29 base::win::RegKey key( |
30 HKEY_LOCAL_MACHINE, | 30 HKEY_LOCAL_MACHINE, |
31 (L"SOFTWARE\\Microsoft\\Avalon.Graphics\\" + trimmed.value()).c_str(), | 31 (L"SOFTWARE\\Microsoft\\Avalon.Graphics\\" + trimmed.value()).c_str(), |
32 KEY_READ); | 32 KEY_READ); |
33 DWORD pixel_structure; | 33 DWORD pixel_structure; |
34 if (key.ReadValueDW(L"PixelStructure", &pixel_structure) == | 34 if (key.Valid() && key.ReadValueDW(L"PixelStructure", &pixel_structure) == |
35 ERROR_SUCCESS) { | 35 ERROR_SUCCESS) { |
36 if (pixel_structure == 1) | 36 if (pixel_structure == 1) |
37 return FontRenderParams::SUBPIXEL_RENDERING_RGB; | 37 return FontRenderParams::SUBPIXEL_RENDERING_RGB; |
38 if (pixel_structure == 2) | 38 if (pixel_structure == 2) |
39 return FontRenderParams::SUBPIXEL_RENDERING_BGR; | 39 return FontRenderParams::SUBPIXEL_RENDERING_BGR; |
40 } | 40 } |
41 break; | 41 break; |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 // No explicit ClearType settings, default to RGB. | 45 // No explicit ClearType settings, default to RGB. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, | 106 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, |
107 std::string* family_out) { | 107 std::string* family_out) { |
108 if (family_out) | 108 if (family_out) |
109 NOTIMPLEMENTED(); | 109 NOTIMPLEMENTED(); |
110 // Customized font rendering settings are not supported, only defaults. | 110 // Customized font rendering settings are not supported, only defaults. |
111 return CachedFontRenderParams::GetInstance()->GetParams(); | 111 return CachedFontRenderParams::GetInstance()->GetParams(); |
112 } | 112 } |
113 | 113 |
114 } // namespace gfx | 114 } // namespace gfx |
OLD | NEW |