| 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 "chrome/browser/ui/libgtkui/gtk_ui.h" | 5 #include "chrome/browser/ui/libgtkui/gtk_ui.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <pango/pango.h> | 8 #include <pango/pango.h> |
| 9 #include <X11/Xcursor/Xcursor.h> | 9 #include <X11/Xcursor/Xcursor.h> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "chrome/grit/theme_resources.h" | 39 #include "chrome/grit/theme_resources.h" |
| 40 #include "components/grit/components_scaled_resources.h" | 40 #include "components/grit/components_scaled_resources.h" |
| 41 #include "printing/features/features.h" | 41 #include "printing/features/features.h" |
| 42 #include "third_party/skia/include/core/SkBitmap.h" | 42 #include "third_party/skia/include/core/SkBitmap.h" |
| 43 #include "third_party/skia/include/core/SkCanvas.h" | 43 #include "third_party/skia/include/core/SkCanvas.h" |
| 44 #include "third_party/skia/include/core/SkColor.h" | 44 #include "third_party/skia/include/core/SkColor.h" |
| 45 #include "third_party/skia/include/core/SkShader.h" | 45 #include "third_party/skia/include/core/SkShader.h" |
| 46 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 47 #include "ui/display/display.h" | 47 #include "ui/display/display.h" |
| 48 #include "ui/gfx/canvas.h" | 48 #include "ui/gfx/canvas.h" |
| 49 #include "ui/gfx/font_render_params.h" |
| 49 #include "ui/gfx/geometry/rect.h" | 50 #include "ui/gfx/geometry/rect.h" |
| 50 #include "ui/gfx/geometry/size.h" | 51 #include "ui/gfx/geometry/size.h" |
| 51 #include "ui/gfx/image/image.h" | 52 #include "ui/gfx/image/image.h" |
| 52 #include "ui/gfx/image/image_skia_source.h" | 53 #include "ui/gfx/image/image_skia_source.h" |
| 53 #include "ui/gfx/skbitmap_operations.h" | 54 #include "ui/gfx/skbitmap_operations.h" |
| 54 #include "ui/gfx/skia_util.h" | 55 #include "ui/gfx/skia_util.h" |
| 55 #include "ui/gfx/x/x11_types.h" | 56 #include "ui/gfx/x/x11_types.h" |
| 56 #include "ui/native_theme/native_theme.h" | 57 #include "ui/native_theme/native_theme.h" |
| 57 #include "ui/resources/grit/ui_resources.h" | 58 #include "ui/resources/grit/ui_resources.h" |
| 58 #include "ui/views/controls/button/blue_button.h" | 59 #include "ui/views/controls/button/blue_button.h" |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 | 942 |
| 942 if (theme) | 943 if (theme) |
| 943 XcursorSetTheme(gfx::GetXDisplay(), theme); | 944 XcursorSetTheme(gfx::GetXDisplay(), theme); |
| 944 if (size) | 945 if (size) |
| 945 XcursorSetDefaultSize(gfx::GetXDisplay(), size); | 946 XcursorSetDefaultSize(gfx::GetXDisplay(), size); |
| 946 | 947 |
| 947 g_free(theme); | 948 g_free(theme); |
| 948 } | 949 } |
| 949 | 950 |
| 950 void GtkUi::UpdateDefaultFont() { | 951 void GtkUi::UpdateDefaultFont() { |
| 952 gfx::SetFontRenderParamsDeviceScaleFactor(device_scale_factor_); |
| 953 |
| 951 GtkWidget* fake_label = gtk_label_new(nullptr); | 954 GtkWidget* fake_label = gtk_label_new(nullptr); |
| 952 g_object_ref_sink(fake_label); // Remove the floating reference. | 955 g_object_ref_sink(fake_label); // Remove the floating reference. |
| 953 PangoContext* pc = gtk_widget_get_pango_context(fake_label); | 956 PangoContext* pc = gtk_widget_get_pango_context(fake_label); |
| 954 const PangoFontDescription* desc = pango_context_get_font_description(pc); | 957 const PangoFontDescription* desc = pango_context_get_font_description(pc); |
| 955 | 958 |
| 956 // Use gfx::FontRenderParams to select a family and determine the rendering | 959 // Use gfx::FontRenderParams to select a family and determine the rendering |
| 957 // settings. | 960 // settings. |
| 958 gfx::FontRenderParamsQuery query; | 961 gfx::FontRenderParamsQuery query; |
| 959 query.families = | 962 query.families = |
| 960 base::SplitString(pango_font_description_get_family(desc), ",", | 963 base::SplitString(pango_font_description_get_family(desc), ",", |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 | 1027 |
| 1025 float GtkUi::GetDeviceScaleFactor() const { | 1028 float GtkUi::GetDeviceScaleFactor() const { |
| 1026 return device_scale_factor_; | 1029 return device_scale_factor_; |
| 1027 } | 1030 } |
| 1028 | 1031 |
| 1029 } // namespace libgtkui | 1032 } // namespace libgtkui |
| 1030 | 1033 |
| 1031 views::LinuxUI* BuildGtkUi() { | 1034 views::LinuxUI* BuildGtkUi() { |
| 1032 return new libgtkui::GtkUi; | 1035 return new libgtkui::GtkUi; |
| 1033 } | 1036 } |
| OLD | NEW |