Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: ui/gfx/win/direct_write.cc

Issue 644813004: Move the ShouldUseDirectWrite function from sandbox_win.cc/.h to ui/gfx/win/dpi.cc/.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/win/direct_write.cc
diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b9c03353d031d2eb10663e6b00b5cf260c671c87
--- /dev/null
+++ b/ui/gfx/win/direct_write.cc
@@ -0,0 +1,48 @@
+// 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.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/win/direct_write.h"
+#include "base/basictypes.h"
sky 2014/10/10 21:32:25 nit: newline between 5/6.
ananta 2014/10/10 21:38:55 Done.
+#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
+#include "base/win/windows_version.h"
+#include "ui/gfx/switches.h"
+#include "ui/gfx/win/dpi.h"
+
+namespace gfx {
+
sky 2014/10/10 21:32:25 nit: no newline.
ananta 2014/10/10 21:38:55 Done.
+namespace win {
+
+bool ShouldUseDirectWrite() {
+ // If the flag is currently on, and we're on Win7 or above, we enable
+ // DirectWrite. Skia does not require the additions to DirectWrite in QFE
+ // 2670838, but a simple 'better than XP' check is not enough.
+ if (base::win::GetVersion() < base::win::VERSION_WIN7)
+ return false;
+
+ base::win::OSInfo::VersionNumber os_version =
+ base::win::OSInfo::GetInstance()->version_number();
+ if ((os_version.major == 6) && (os_version.minor == 1)) {
+ // We can't use DirectWrite for pre-release versions of Windows 7.
+ if (os_version.build < 7600)
+ return false;
+ }
+ // If forced off, don't use it.
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kDisableDirectWrite))
+ return false;
+
+ // Can't use GDI on HiDPI.
+ if (gfx::GetDPIScale() > 1.0f)
+ return true;
+
+ // Otherwise, check the field trial.
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("DirectWrite");
+ return group_name != "Disabled";
+}
+
+} // namespace win
+} // namespace gfx
« ui/gfx/win/direct_write.h ('K') | « ui/gfx/win/direct_write.h ('k') | ui/gfx/win/dpi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698