Chromium Code Reviews| Index: ui/gfx/font_render_params_linux.cc |
| diff --git a/ui/gfx/font_render_params_linux.cc b/ui/gfx/font_render_params_linux.cc |
| index 5698f0d76cd08ffb85d42092918fdc5ed7051d38..1b5fc0ed1b4bf6341215915218c604fe3c5d885e 100644 |
| --- a/ui/gfx/font_render_params_linux.cc |
| +++ b/ui/gfx/font_render_params_linux.cc |
| @@ -16,8 +16,10 @@ |
| #include "base/strings/string_util.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/synchronization/lock.h" |
| +#include "ui/gfx/display.h" |
| #include "ui/gfx/font.h" |
| #include "ui/gfx/linux_font_delegate.h" |
| +#include "ui/gfx/screen.h" |
| #include "ui/gfx/switches.h" |
| namespace gfx { |
| @@ -64,11 +66,7 @@ base::LazyInstance<SynchronizedCache>::Leaky g_synchronized_cache = |
| bool IsBrowserTextSubpixelPositioningEnabled( |
|
msw
2015/03/19 19:30:43
nit: maybe inline this now?
stapelberg
2015/03/19 19:39:25
Done.
|
| const FontRenderParamsQuery& query) { |
| -#if defined(OS_CHROMEOS) |
| return query.device_scale_factor > 1.0f; |
| -#else |
| - return false; |
| -#endif |
| } |
| // Converts Fontconfig FC_HINT_STYLE to FontRenderParams::Hinting. |
| @@ -208,10 +206,19 @@ uint32 HashFontRenderParamsQuery(const FontRenderParamsQuery& query) { |
| FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, |
| std::string* family_out) { |
| FontRenderParamsQuery actual_query(query); |
| + if (actual_query.device_scale_factor == 0) { |
| #if defined(OS_CHROMEOS) |
| - if (actual_query.device_scale_factor == 0) |
| actual_query.device_scale_factor = device_scale_factor_for_internal_display; |
| +#else |
| + // Linux does not support per-display DPI, so we use a slightly simpler |
| + // code path than on Chrome OS to figure out the device scale factor. |
| + gfx::Screen* screen = gfx::Screen::GetNativeScreen(); |
| + if (screen) { |
| + gfx::Display display = screen->GetPrimaryDisplay(); |
| + actual_query.device_scale_factor = display.device_scale_factor(); |
| + } |
| #endif |
| + } |
| const uint32 hash = HashFontRenderParamsQuery(actual_query); |
| SynchronizedCache* synchronized_cache = g_synchronized_cache.Pointer(); |