OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
sky
2014/10/10 21:32:25
nit: same comment about no (c).
ananta
2014/10/10 21:38:55
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/win/direct_write.h" | |
6 #include "base/basictypes.h" | |
sky
2014/10/10 21:32:25
nit: newline between 5/6.
ananta
2014/10/10 21:38:55
Done.
| |
7 #include "base/command_line.h" | |
8 #include "base/metrics/field_trial.h" | |
9 #include "base/win/windows_version.h" | |
10 #include "ui/gfx/switches.h" | |
11 #include "ui/gfx/win/dpi.h" | |
12 | |
13 namespace gfx { | |
14 | |
sky
2014/10/10 21:32:25
nit: no newline.
ananta
2014/10/10 21:38:55
Done.
| |
15 namespace win { | |
16 | |
17 bool ShouldUseDirectWrite() { | |
18 // If the flag is currently on, and we're on Win7 or above, we enable | |
19 // DirectWrite. Skia does not require the additions to DirectWrite in QFE | |
20 // 2670838, but a simple 'better than XP' check is not enough. | |
21 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
22 return false; | |
23 | |
24 base::win::OSInfo::VersionNumber os_version = | |
25 base::win::OSInfo::GetInstance()->version_number(); | |
26 if ((os_version.major == 6) && (os_version.minor == 1)) { | |
27 // We can't use DirectWrite for pre-release versions of Windows 7. | |
28 if (os_version.build < 7600) | |
29 return false; | |
30 } | |
31 // If forced off, don't use it. | |
32 const base::CommandLine& command_line = | |
33 *base::CommandLine::ForCurrentProcess(); | |
34 if (command_line.HasSwitch(switches::kDisableDirectWrite)) | |
35 return false; | |
36 | |
37 // Can't use GDI on HiDPI. | |
38 if (gfx::GetDPIScale() > 1.0f) | |
39 return true; | |
40 | |
41 // Otherwise, check the field trial. | |
42 const std::string group_name = | |
43 base::FieldTrialList::FindFullName("DirectWrite"); | |
44 return group_name != "Disabled"; | |
45 } | |
46 | |
47 } // namespace win | |
48 } // namespace gfx | |
OLD | NEW |