Chromium Code Reviews| 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 <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <pango/pango.h> | 9 #include <pango/pango.h> |
| 10 #include <pango/pangocairo.h> | 10 #include <pango/pangocairo.h> |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 // Font settings that we initialize once and then use when drawing text in | 32 // Font settings that we initialize once and then use when drawing text in |
| 33 // DrawStringInt(). | 33 // DrawStringInt(). |
| 34 static cairo_font_options_t* cairo_font_options = NULL; | 34 static cairo_font_options_t* cairo_font_options = NULL; |
| 35 | 35 |
| 36 // Update |cairo_font_options| based on GtkSettings, allocating it if needed. | 36 // Update |cairo_font_options| based on GtkSettings, allocating it if needed. |
| 37 static void UpdateCairoFontOptions() { | 37 static void UpdateCairoFontOptions() { |
| 38 if (!cairo_font_options) | 38 if (!cairo_font_options) |
| 39 cairo_font_options = cairo_font_options_create(); | 39 cairo_font_options = cairo_font_options_create(); |
| 40 | 40 |
| 41 #if !defined(USE_WAYLAND) | |
| 41 GtkSettings* gtk_settings = gtk_settings_get_default(); | 42 GtkSettings* gtk_settings = gtk_settings_get_default(); |
|
jonathan.backer
2011/07/26 14:56:27
move this down to where it's used and save an #if
| |
| 43 #endif | |
| 42 gint antialias = 0; | 44 gint antialias = 0; |
| 43 gint hinting = 0; | 45 gint hinting = 0; |
| 44 gchar* hint_style = NULL; | 46 gchar* hint_style = NULL; |
| 45 gchar* rgba_style = NULL; | 47 gchar* rgba_style = NULL; |
| 48 #if !defined(USE_WAYLAND) | |
| 46 g_object_get(gtk_settings, | 49 g_object_get(gtk_settings, |
| 47 "gtk-xft-antialias", &antialias, | 50 "gtk-xft-antialias", &antialias, |
| 48 "gtk-xft-hinting", &hinting, | 51 "gtk-xft-hinting", &hinting, |
| 49 "gtk-xft-hintstyle", &hint_style, | 52 "gtk-xft-hintstyle", &hint_style, |
| 50 "gtk-xft-rgba", &rgba_style, | 53 "gtk-xft-rgba", &rgba_style, |
| 51 NULL); | 54 NULL); |
| 55 #endif | |
| 52 | 56 |
| 53 // g_object_get() doesn't tell us whether the properties were present or not, | 57 // g_object_get() doesn't tell us whether the properties were present or not, |
| 54 // but if they aren't (because gnome-settings-daemon isn't running), we'll get | 58 // but if they aren't (because gnome-settings-daemon isn't running), we'll get |
| 55 // NULL values for the strings. | 59 // NULL values for the strings. |
| 56 if (hint_style && rgba_style) { | 60 if (hint_style && rgba_style) { |
| 57 if (!antialias) { | 61 if (!antialias) { |
| 58 cairo_font_options_set_antialias(cairo_font_options, | 62 cairo_font_options_set_antialias(cairo_font_options, |
| 59 CAIRO_ANTIALIAS_NONE); | 63 CAIRO_ANTIALIAS_NONE); |
| 60 } else if (strcmp(rgba_style, "none") == 0) { | 64 } else if (strcmp(rgba_style, "none") == 0) { |
| 61 cairo_font_options_set_antialias(cairo_font_options, | 65 cairo_font_options_set_antialias(cairo_font_options, |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); | 451 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
| 448 cairo_paint(cr); | 452 cairo_paint(cr); |
| 449 } | 453 } |
| 450 | 454 |
| 451 ui::TextureID CanvasSkia::GetTextureID() { | 455 ui::TextureID CanvasSkia::GetTextureID() { |
| 452 // TODO(wjmaclean) | 456 // TODO(wjmaclean) |
| 453 return 0; | 457 return 0; |
| 454 } | 458 } |
| 455 | 459 |
| 456 } // namespace gfx | 460 } // namespace gfx |
| OLD | NEW |