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

Side by Side Diff: ui/gfx/font_render_params_linux.cc

Issue 231583002: linux: Use subpixel positioning for forced scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_linux.h" 5 #include "ui/gfx/font_render_params_linux.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gfx/display.h"
9 #include "ui/gfx/switches.h" 10 #include "ui/gfx/switches.h"
10 11
11 #if defined(TOOLKIT_GTK) 12 #if defined(TOOLKIT_GTK)
12 #include <gtk/gtk.h> 13 #include <gtk/gtk.h>
13 #else 14 #else
14 #include <fontconfig/fontconfig.h> 15 #include <fontconfig/fontconfig.h>
15 #endif 16 #endif
16 17
17 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS) 18 #if defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS)
18 #include "ui/gfx/linux_font_delegate.h" 19 #include "ui/gfx/linux_font_delegate.h"
19 #endif 20 #endif
20 21
21 namespace gfx { 22 namespace gfx {
22 23
23 namespace { 24 namespace {
24 25
25 bool SubpixelPositioningRequested(bool renderer) { 26 bool SubpixelPositioningRequested(bool renderer) {
26 return CommandLine::ForCurrentProcess()->HasSwitch( 27 if (renderer) {
27 renderer ? 28 return CommandLine::ForCurrentProcess()->HasSwitch(
28 switches::kEnableWebkitTextSubpixelPositioning : 29 switches::kEnableWebkitTextSubpixelPositioning) ||
29 switches::kEnableBrowserTextSubpixelPositioning); 30 (Display::HasForceDeviceScaleFactor() &&
31 Display::GetForcedDeviceScaleFactor() != 1.0);
32 } else {
oshima 2014/04/09 20:11:46 optional nit: you can omit else.
Daniel Erat 2014/04/09 20:14:41 Done.
33 return CommandLine::ForCurrentProcess()->HasSwitch(
34 switches::kEnableBrowserTextSubpixelPositioning);
35 }
30 } 36 }
31 37
32 // Initializes |params| with the system's default settings. |renderer| is true 38 // Initializes |params| with the system's default settings. |renderer| is true
33 // when setting WebKit renderer defaults. 39 // when setting WebKit renderer defaults.
34 void LoadDefaults(FontRenderParams* params, bool renderer) { 40 void LoadDefaults(FontRenderParams* params, bool renderer) {
35 #if defined(TOOLKIT_GTK) 41 #if defined(TOOLKIT_GTK)
36 params->antialiasing = true; 42 params->antialiasing = true;
37 // TODO(wangxianzhu): autohinter is now true to keep original behavior 43 // TODO(wangxianzhu): autohinter is now true to keep original behavior
38 // of WebKit, but it might not be the best value. 44 // of WebKit, but it might not be the best value.
39 params->autohinter = true; 45 params->autohinter = true;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 LoadDefaults(&default_params, /* renderer */ true); 160 LoadDefaults(&default_params, /* renderer */ true);
155 loaded_defaults = true; 161 loaded_defaults = true;
156 return default_params; 162 return default_params;
157 } 163 }
158 164
159 bool GetDefaultWebkitSubpixelPositioning() { 165 bool GetDefaultWebkitSubpixelPositioning() {
160 return SubpixelPositioningRequested(true); 166 return SubpixelPositioningRequested(true);
161 } 167 }
162 168
163 } // namespace gfx 169 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698