[gimp/gtk3-port: 18/228] app: port virtual functions to GTK+ 3.0 API
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 18/228] app: port virtual functions to GTK+ 3.0 API
- Date: Sun, 6 Jan 2013 14:47:06 +0000 (UTC)
commit fa13cf9ef70e3dab9077226fb5ba5e747b475828
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 15 13:05:53 2010 +0200
app: port virtual functions to GTK+ 3.0 API
app/widgets/gimpcellrendererdashes.c | 72 +++++++++++---------------
app/widgets/gimpcellrendererviewable.c | 88 ++++++++++++++------------------
2 files changed, 70 insertions(+), 90 deletions(-)
---
diff --git a/app/widgets/gimpcellrendererdashes.c b/app/widgets/gimpcellrendererdashes.c
index 1de5635..c6b4bce 100644
--- a/app/widgets/gimpcellrendererdashes.c
+++ b/app/widgets/gimpcellrendererdashes.c
@@ -43,28 +43,27 @@ enum
};
-static void gimp_cell_renderer_dashes_finalize (GObject *object);
-static void gimp_cell_renderer_dashes_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_cell_renderer_dashes_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_cell_renderer_dashes_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *rectangle,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height);
-static void gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
- GdkWindow *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+static void gimp_cell_renderer_dashes_finalize (GObject *object);
+static void gimp_cell_renderer_dashes_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_cell_renderer_dashes_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_cell_renderer_dashes_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ const GdkRectangle *rectangle,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height);
+static void gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
+ cairo_t *cr,
+ GtkWidget *widget,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
@@ -140,13 +139,13 @@ gimp_cell_renderer_dashes_set_property (GObject *object,
}
static void
-gimp_cell_renderer_dashes_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
+gimp_cell_renderer_dashes_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ const GdkRectangle *cell_area,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height)
{
gfloat xalign, yalign;
gint xpad, ypad;
@@ -188,18 +187,16 @@ gimp_cell_renderer_dashes_get_size (GtkCellRenderer *cell,
static void
gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GimpCellRendererDashes *dashes = GIMP_CELL_RENDERER_DASHES (cell);
GtkStyle *style = gtk_widget_get_style (widget);
GtkStateType state;
gint xpad, ypad;
- cairo_t *cr;
gint width;
gint x, y;
@@ -232,11 +229,6 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
y = cell_area->y + (cell_area->height - DASHES_HEIGHT) / 2;
width = cell_area->width - 2 * xpad;
- cr = gdk_cairo_create (window);
-
- gdk_cairo_rectangle (cr, expose_area);
- cairo_clip (cr);
-
for (x = 0; x < width + BLOCK_WIDTH; x += BLOCK_WIDTH)
{
guint index = ((guint) x / BLOCK_WIDTH) % N_SEGMENTS;
@@ -251,8 +243,6 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
gdk_cairo_set_source_color (cr, &style->text[state]);
cairo_fill (cr);
-
- cairo_destroy (cr);
}
GtkCellRenderer *
diff --git a/app/widgets/gimpcellrendererviewable.c b/app/widgets/gimpcellrendererviewable.c
index 2115f08..3c3fcef 100644
--- a/app/widgets/gimpcellrendererviewable.c
+++ b/app/widgets/gimpcellrendererviewable.c
@@ -47,35 +47,34 @@ enum
};
-static void gimp_cell_renderer_viewable_finalize (GObject *object);
-static void gimp_cell_renderer_viewable_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_cell_renderer_viewable_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_cell_renderer_viewable_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *rectangle,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height);
-static void gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
- GdkWindow *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+static void gimp_cell_renderer_viewable_finalize (GObject *object);
+static void gimp_cell_renderer_viewable_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_cell_renderer_viewable_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_cell_renderer_viewable_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ const GdkRectangle *rectangle,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height);
+static void gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
+ cairo_t *cr,
+ GtkWidget *widget,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
-static gboolean gimp_cell_renderer_viewable_activate (GtkCellRenderer *cell,
- GdkEvent *event,
- GtkWidget *widget,
- const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+static gboolean gimp_cell_renderer_viewable_activate (GtkCellRenderer *cell,
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
@@ -224,13 +223,13 @@ gimp_cell_renderer_viewable_set_property (GObject *object,
}
static void
-gimp_cell_renderer_viewable_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
+gimp_cell_renderer_viewable_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ const GdkRectangle *cell_area,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height)
{
GimpCellRendererViewable *cellviewable;
gfloat xalign, yalign;
@@ -281,11 +280,10 @@ gimp_cell_renderer_viewable_get_size (GtkCellRenderer *cell,
static void
gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
- GdkWindow *window,
+ cairo_t *cr,
GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GimpCellRendererViewable *cellviewable;
@@ -294,8 +292,6 @@ gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
if (cellviewable->renderer)
{
- cairo_t *cr;
-
if (! (flags & GTK_CELL_RENDERER_SELECTED))
{
/* this is an ugly hack. The cell state should be passed to
@@ -308,17 +304,11 @@ gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
gimp_view_renderer_remove_idle (cellviewable->renderer);
}
- cr = gdk_cairo_create (window);
- gdk_cairo_rectangle (cr, expose_area);
- cairo_clip (cr);
-
cairo_translate (cr, cell_area->x, cell_area->y);
gimp_view_renderer_draw (cellviewable->renderer, widget, cr,
cell_area->width,
cell_area->height);
-
- cairo_destroy (cr);
}
}
@@ -327,8 +317,8 @@ gimp_cell_renderer_viewable_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GimpCellRendererViewable *cellviewable;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]