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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 params_out->subpixel_rendering = ConvertFontconfigRgba(fc_rgba); | 184 params_out->subpixel_rendering = ConvertFontconfigRgba(fc_rgba); |
185 } | 185 } |
186 | 186 |
187 return true; | 187 return true; |
188 } | 188 } |
189 | 189 |
190 // Serialize |query| into a string and hash it to a value suitable for use as a | 190 // Serialize |query| into a string and hash it to a value suitable for use as a |
191 // cache key. | 191 // cache key. |
192 uint32 HashFontRenderParamsQuery(const FontRenderParamsQuery& query) { | 192 uint32 HashFontRenderParamsQuery(const FontRenderParamsQuery& query) { |
193 return base::Hash(base::StringPrintf( | 193 return base::Hash(base::StringPrintf( |
194 "%d|%d|%d|%d|%s|%f", query.for_web_contents, query.pixel_size, | 194 "%d|%d|%d|%s|%f", query.pixel_size, query.point_size, query.style, |
195 query.point_size, query.style, JoinString(query.families, ',').c_str(), | 195 JoinString(query.families, ',').c_str(), query.device_scale_factor)); |
196 query.device_scale_factor)); | |
197 } | 196 } |
198 | 197 |
199 } // namespace | 198 } // namespace |
200 | 199 |
201 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, | 200 FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query, |
202 std::string* family_out) { | 201 std::string* family_out) { |
203 FontRenderParamsQuery actual_query(query); | 202 FontRenderParamsQuery actual_query(query); |
204 if (actual_query.device_scale_factor == 0) { | 203 if (actual_query.device_scale_factor == 0) { |
205 #if defined(OS_CHROMEOS) | 204 #if defined(OS_CHROMEOS) |
206 actual_query.device_scale_factor = device_scale_factor_for_internal_display; | 205 actual_query.device_scale_factor = device_scale_factor_for_internal_display; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 float GetFontRenderParamsDeviceScaleFactor() { | 279 float GetFontRenderParamsDeviceScaleFactor() { |
281 return device_scale_factor_for_internal_display; | 280 return device_scale_factor_for_internal_display; |
282 } | 281 } |
283 | 282 |
284 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 283 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
285 device_scale_factor_for_internal_display = device_scale_factor; | 284 device_scale_factor_for_internal_display = device_scale_factor; |
286 } | 285 } |
287 #endif | 286 #endif |
288 | 287 |
289 } // namespace gfx | 288 } // namespace gfx |
OLD | NEW |