[gimp] app: port virtual functions to GTK+ 3.0 API
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: port virtual functions to GTK+ 3.0 API
- Date: Sun, 20 May 2018 19:10:17 +0000 (UTC)
commit 5ddb81272f4a0d8ac49c490183181daf6572c744
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 6ce28b9..3dea4db 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);
@@ -220,13 +219,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;
@@ -277,11 +276,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;
@@ -290,8 +288,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
@@ -304,17 +300,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);
}
}
@@ -323,8 +313,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]