| OLD | NEW |
| 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.h" | 5 #include "ui/gfx/font_render_params.h" |
| 6 | 6 |
| 7 #include <fontconfig/fontconfig.h> | 7 #include <fontconfig/fontconfig.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/containers/mru_cache.h" | 10 #include "base/containers/mru_cache.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 28 // A device scale factor for an internal display (if any) | 28 // A device scale factor for an internal display (if any) |
| 29 // that is used to determine if subpixel positioning should be used. | 29 // that is used to determine if subpixel positioning should be used. |
| 30 float device_scale_factor_for_internal_display = 1.0f; | 30 float device_scale_factor_for_internal_display = 1.0f; |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 // Number of recent GetFontRenderParams() results to cache. | 33 // Number of recent GetFontRenderParams() results to cache. |
| 34 const size_t kCacheSize = 64; | 34 const size_t kCacheSize = 256; |
| 35 | 35 |
| 36 // Cached result from a call to GetFontRenderParams(). | 36 // Cached result from a call to GetFontRenderParams(). |
| 37 struct QueryResult { | 37 struct QueryResult { |
| 38 QueryResult(const FontRenderParams& params, const std::string& family) | 38 QueryResult(const FontRenderParams& params, const std::string& family) |
| 39 : params(params), | 39 : params(params), |
| 40 family(family) { | 40 family(family) { |
| 41 } | 41 } |
| 42 ~QueryResult() {} | 42 ~QueryResult() {} |
| 43 | 43 |
| 44 FontRenderParams params; | 44 FontRenderParams params; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 float GetFontRenderParamsDeviceScaleFactor() { | 284 float GetFontRenderParamsDeviceScaleFactor() { |
| 285 return device_scale_factor_for_internal_display; | 285 return device_scale_factor_for_internal_display; |
| 286 } | 286 } |
| 287 | 287 |
| 288 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 288 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
| 289 device_scale_factor_for_internal_display = device_scale_factor; | 289 device_scale_factor_for_internal_display = device_scale_factor; |
| 290 } | 290 } |
| 291 #endif | 291 #endif |
| 292 | 292 |
| 293 } // namespace gfx | 293 } // namespace gfx |
| OLD | NEW |