| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/canvas_skia.h" | 5 #include "ui/gfx/canvas_skia.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include <cairo/cairo.h> | 9 #include <cairo/cairo.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Font settings that we initialize once and then use when drawing text in | 39 // Font settings that we initialize once and then use when drawing text in |
| 40 // DrawStringInt(). | 40 // DrawStringInt(). |
| 41 cairo_font_options_t* cairo_font_options = NULL; | 41 cairo_font_options_t* cairo_font_options = NULL; |
| 42 | 42 |
| 43 // Update |cairo_font_options| based on GtkSettings, allocating it if needed. | 43 // Update |cairo_font_options| based on GtkSettings, allocating it if needed. |
| 44 void UpdateCairoFontOptions() { | 44 void UpdateCairoFontOptions() { |
| 45 if (!cairo_font_options) | 45 if (!cairo_font_options) |
| 46 cairo_font_options = cairo_font_options_create(); | 46 cairo_font_options = cairo_font_options_create(); |
| 47 | 47 |
| 48 GtkSettings* gtk_settings = gtk_settings_get_default(); | |
| 49 gint antialias = 0; | 48 gint antialias = 0; |
| 50 gint hinting = 0; | 49 gint hinting = 0; |
| 51 gchar* hint_style = NULL; | 50 gchar* hint_style = NULL; |
| 52 gchar* rgba_style = NULL; | 51 gchar* rgba_style = NULL; |
| 52 |
| 53 #if !defined(USE_WAYLAND) |
| 54 GtkSettings* gtk_settings = gtk_settings_get_default(); |
| 53 g_object_get(gtk_settings, | 55 g_object_get(gtk_settings, |
| 54 "gtk-xft-antialias", &antialias, | 56 "gtk-xft-antialias", &antialias, |
| 55 "gtk-xft-hinting", &hinting, | 57 "gtk-xft-hinting", &hinting, |
| 56 "gtk-xft-hintstyle", &hint_style, | 58 "gtk-xft-hintstyle", &hint_style, |
| 57 "gtk-xft-rgba", &rgba_style, | 59 "gtk-xft-rgba", &rgba_style, |
| 58 NULL); | 60 NULL); |
| 61 #endif |
| 59 | 62 |
| 60 // g_object_get() doesn't tell us whether the properties were present or not, | 63 // g_object_get() doesn't tell us whether the properties were present or not, |
| 61 // but if they aren't (because gnome-settings-daemon isn't running), we'll get | 64 // but if they aren't (because gnome-settings-daemon isn't running), we'll get |
| 62 // NULL values for the strings. | 65 // NULL values for the strings. |
| 63 if (hint_style && rgba_style) { | 66 if (hint_style && rgba_style) { |
| 64 if (!antialias) { | 67 if (!antialias) { |
| 65 cairo_font_options_set_antialias(cairo_font_options, | 68 cairo_font_options_set_antialias(cairo_font_options, |
| 66 CAIRO_ANTIALIAS_NONE); | 69 CAIRO_ANTIALIAS_NONE); |
| 67 } else if (strcmp(rgba_style, "none") == 0) { | 70 } else if (strcmp(rgba_style, "none") == 0) { |
| 68 cairo_font_options_set_antialias(cairo_font_options, | 71 cairo_font_options_set_antialias(cairo_font_options, |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); | 493 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
| 491 cairo_paint(cr); | 494 cairo_paint(cr); |
| 492 } | 495 } |
| 493 | 496 |
| 494 ui::TextureID CanvasSkia::GetTextureID() { | 497 ui::TextureID CanvasSkia::GetTextureID() { |
| 495 // TODO(wjmaclean) | 498 // TODO(wjmaclean) |
| 496 return 0; | 499 return 0; |
| 497 } | 500 } |
| 498 | 501 |
| 499 } // namespace gfx | 502 } // namespace gfx |
| OLD | NEW |