diff options
author | Jasmine Hassan <[email protected]> | 2012-10-18 11:55:38 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-11-13 06:25:02 +0200 |
commit | 550088d1a2c753fde171f8cb2d6d2fa97ddef4ea (patch) | |
tree | 9a6ffeda5587f2d4ac792a6469218094783200cf /eel | |
parent | cd3a526a667083e24dd0d98c9b33ee42dd85f081 (diff) | |
download | caja-550088d1a2c753fde171f8cb2d6d2fa97ddef4ea.tar.bz2 caja-550088d1a2c753fde171f8cb2d6d2fa97ddef4ea.tar.xz |
[eel] port EelBackground to cairo drawing
http://git.gnome.org/browse/nautilus/commit/?id=28b6813b77c4776b789231d3c64be3be01748608
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-background.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c index 33803f58..98c85163 100644 --- a/eel/eel-background.c +++ b/eel/eel-background.c @@ -390,7 +390,6 @@ eel_background_ensure_realized (EelBackground *background, GdkWindow *window) background->details->default_color = style->bg[GTK_STATE_NORMAL]; } - gdk_rgb_find_color (style->colormap, &(background->details->default_color)); } /* If the window size is the same as last time, don't update */ @@ -491,10 +490,8 @@ eel_background_expose (GtkWidget *widget, int window_width; int window_height; GdkPixmap *pixmap; - GdkGC *gc; - GdkGCValues gc_values; - GdkGCValuesMask value_mask; GdkWindow *widget_window; + cairo_t *cr; EelBackground *background; @@ -511,30 +508,22 @@ eel_background_expose (GtkWidget *widget, pixmap = eel_background_get_pixmap_and_color (background, widget_window, &color); + cr = gdk_cairo_create (widget_window); - if (pixmap) - { - gc_values.tile = pixmap; - gc_values.ts_x_origin = 0; - gc_values.ts_y_origin = 0; - gc_values.fill = GDK_TILED; - value_mask = GDK_GC_FILL | GDK_GC_TILE | GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN; + if (pixmap) { + gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); + cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT); + } else { + gdk_cairo_set_source_color (cr, &color); } - else - { - gdk_rgb_find_color (gtk_widget_get_colormap (widget), &color); - gc_values.foreground = color; - gc_values.fill = GDK_SOLID; - value_mask = GDK_GC_FILL | GDK_GC_FOREGROUND; - } - - gc = gdk_gc_new_with_values (widget_window, &gc_values, value_mask); - gdk_gc_set_clip_rectangle (gc, &event->area); + gdk_cairo_rectangle (cr, &event->area); + cairo_clip (cr); - gdk_draw_rectangle (widget_window, gc, TRUE, 0, 0, window_width, window_height); + cairo_rectangle (cr, 0, 0, window_width, window_height); + cairo_fill (cr); - g_object_unref (gc); + cairo_destroy (cr); if (pixmap) { @@ -814,8 +803,6 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget) style = gtk_widget_get_style (widget); - gdk_rgb_find_color (style->colormap, &color); - if (EEL_IS_CANVAS (widget)) { window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); |