summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-10-18 12:26:02 +0200
committerJasmine Hassan <[email protected]>2012-11-13 06:25:03 +0200
commitadfba98c507fd731a96a0551176050b697c14379 (patch)
tree51e41ce64c7494341a5329ea3a93fbd6b54f8191 /eel
parent51cc028ce329709ad18a1bafcfeafe09d042e1f6 (diff)
downloadcaja-adfba98c507fd731a96a0551176050b697c14379.tar.bz2
caja-adfba98c507fd731a96a0551176050b697c14379.tar.xz
[eel] port EelCanvas to cairo drawing
http://git.gnome.org/browse/nautilus/commit/?id=759f3401bee333caf6d0ae6ae9820cdadda440e4
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-canvas.c77
-rw-r--r--eel/eel-canvas.h13
2 files changed, 9 insertions, 81 deletions
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 43c111f6..7b1b39dd 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -2367,8 +2367,6 @@ eel_canvas_realize (GtkWidget *widget)
/* Create our own temporary pixmap gc and realize all the items */
- canvas->pixmap_gc = gdk_gc_new (gtk_layout_get_bin_window (&canvas->layout));
-
(* EEL_CANVAS_ITEM_GET_CLASS (canvas->root)->realize) (canvas->root);
}
@@ -2388,9 +2386,6 @@ eel_canvas_unrealize (GtkWidget *widget)
(* EEL_CANVAS_ITEM_GET_CLASS (canvas->root)->unrealize) (canvas->root);
- g_object_unref (canvas->pixmap_gc);
- canvas->pixmap_gc = NULL;
-
if (GTK_WIDGET_CLASS (canvas_parent_class)->unrealize)
(* GTK_WIDGET_CLASS (canvas_parent_class)->unrealize) (widget);
}
@@ -3067,14 +3062,16 @@ static void
eel_canvas_draw_background (EelCanvas *canvas,
int x, int y, int width, int height)
{
+ cairo_t *cr;
+
+ cr = gdk_cairo_create (gtk_layout_get_bin_window (&canvas->layout));
+
/* By default, we use the style background. */
- gdk_gc_set_foreground (canvas->pixmap_gc,
- &gtk_widget_get_style (GTK_WIDGET (canvas))->bg[GTK_STATE_NORMAL]);
- gdk_draw_rectangle (gtk_layout_get_bin_window (&canvas->layout),
- canvas->pixmap_gc,
- TRUE,
- x, y,
- width, height);
+ gdk_cairo_set_source_color (cr, &gtk_widget_get_style (GTK_WIDGET (canvas))->bg[GTK_STATE_NORMAL]);
+ cairo_rectangle (cr, x, y, width, height);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
}
static void
@@ -3685,8 +3682,6 @@ eel_canvas_world_to_window (EelCanvas *canvas, double worldx, double worldy,
int
eel_canvas_get_color (EelCanvas *canvas, const char *spec, GdkColor *color)
{
- GdkColormap *colormap;
-
g_return_val_if_fail (EEL_IS_CANVAS (canvas), FALSE);
g_return_val_if_fail (color != NULL, FALSE);
@@ -3701,63 +3696,9 @@ eel_canvas_get_color (EelCanvas *canvas, const char *spec, GdkColor *color)
gdk_color_parse (spec, color);
- colormap = gtk_widget_get_colormap (GTK_WIDGET (canvas));
-
- gdk_rgb_find_color (colormap, color);
-
return TRUE;
}
-/**
- * eel_canvas_get_color_pixel:
- * @canvas: A canvas.
- * @rgba: RGBA color specification.
- *
- * Allocates a color from the RGBA value passed into this function. The alpha
- * opacity value is discarded, since normal X colors do not support it.
- *
- * Return value: Allocated pixel value corresponding to the specified color.
- **/
-gulong
-eel_canvas_get_color_pixel (EelCanvas *canvas, guint rgba)
-{
- GdkColormap *colormap;
- GdkColor color;
-
- g_return_val_if_fail (EEL_IS_CANVAS (canvas), 0);
-
- color.red = ((rgba & 0xff000000) >> 16) + ((rgba & 0xff000000) >> 24);
- color.green = ((rgba & 0x00ff0000) >> 8) + ((rgba & 0x00ff0000) >> 16);
- color.blue = (rgba & 0x0000ff00) + ((rgba & 0x0000ff00) >> 8);
- color.pixel = 0;
-
- colormap = gtk_widget_get_colormap (GTK_WIDGET (canvas));
-
- gdk_rgb_find_color (colormap, &color);
-
- return color.pixel;
-}
-
-
-/* FIXME: This function is not useful anymore */
-/**
- * eel_canvas_set_stipple_origin:
- * @canvas: A canvas.
- * @gc: GC on which to set the stipple origin.
- *
- * Sets the stipple origin of the specified GC as is appropriate for the canvas,
- * so that it will be aligned with other stipple patterns used by canvas items.
- * This is typically only needed by item implementations.
- **/
-void
-eel_canvas_set_stipple_origin (EelCanvas *canvas, GdkGC *gc)
-{
- g_return_if_fail (EEL_IS_CANVAS (canvas));
- g_return_if_fail (GDK_IS_GC (gc));
-
- gdk_gc_set_ts_origin (gc, 0, 0);
-}
-
static gboolean
boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index 2f799c39..453cdaee 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -372,9 +372,6 @@ extern "C" {
/* If non-NULL, the currently focused item */
EelCanvasItem *focused_item;
- /* GC for temporary draw pixmap */
- GdkGC *pixmap_gc;
-
/* Event on which selection of current item is based */
GdkEvent pick_event;
@@ -527,16 +524,6 @@ extern "C" {
*/
int eel_canvas_get_color (EelCanvas *canvas, const char *spec, GdkColor *color);
- /* Allocates a color from the RGB value passed into this function. */
- gulong eel_canvas_get_color_pixel (EelCanvas *canvas,
- guint rgba);
-
-
- /* Sets the stipple origin of the specified gc so that it will be aligned with
- * all the stipples used in the specified canvas. This is intended for use only
- * by canvas item implementations.
- */
- void eel_canvas_set_stipple_origin (EelCanvas *canvas, GdkGC *gc);
#ifdef __cplusplus
}