[goocanvas] Fixes to work with new GTK+ drawing code. Bug #700674.
- From: Damon Chaplin <damon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goocanvas] Fixes to work with new GTK+ drawing code. Bug #700674.
- Date: Thu, 18 Jul 2013 21:01:39 +0000 (UTC)
commit 8f2c634d12d05ef2e7fdaf41f4e6bd7a28894e58
Author: Damon Chaplin <damon gnome org>
Date: Thu Jul 18 21:59:04 2013 +0100
Fixes to work with new GTK+ drawing code. Bug #700674.
ChangeLog | 6 ++++++
src/goocanvas.c | 35 +++++++++++++++++++++++++++++++----
2 files changed, 37 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a26f355..d8066d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-18 Damon Chaplin <damon gnome org>
+
+ * src/goocanvas.c (paint_static_items, goo_canvas_draw): tried to
+ fix drawing code to work with new GTK+ 3.9 drawing code. I'm not sure
+ it is 100% there yet, but the demo seems OK.
+
2013-03-28 Murray Cumming <murrayc murrayc com>
Fix some introspection generation warnings.
diff --git a/src/goocanvas.c b/src/goocanvas.c
index d636fc5..507e6fa 100644
--- a/src/goocanvas.c
+++ b/src/goocanvas.c
@@ -2718,10 +2718,23 @@ paint_static_items (GooCanvas *canvas,
GooCanvasBounds *clip_bounds)
{
GooCanvasPrivate *priv = GOO_CANVAS_GET_PRIVATE (canvas);
+ guint major_gtk_version, minor_gtk_version;
+ gboolean gtk_3_9 = FALSE;
+
+ major_gtk_version = gtk_get_major_version ();
+ minor_gtk_version = gtk_get_minor_version ();
+ if (major_gtk_version > 3
+ || (major_gtk_version == 3 && minor_gtk_version >= 9))
+ gtk_3_9 = TRUE;
cairo_save (cr);
- cairo_identity_matrix (cr);
- cairo_translate (cr, -priv->static_window_x, -priv->static_window_y);
+ if (!gtk_3_9)
+ cairo_identity_matrix (cr);
+ /* FIXME: I'm not sure what we should be doing with 3.9. It doesn't seem
+ to flicker anyway. Maybe we aren't using X for scrolling windows any more
+ so we don't need to worry about redrawing before scrolling etc. */
+ if (!gtk_3_9)
+ cairo_translate (cr, -priv->static_window_x, -priv->static_window_y);
/* FIXME: Uses pixels at present - use canvas units instead? */
goo_canvas_item_paint (priv->static_root_item, cr, clip_bounds, 1.0);
cairo_restore (cr);
@@ -2733,8 +2746,17 @@ goo_canvas_draw (GtkWidget *widget,
cairo_t *cr)
{
GooCanvas *canvas = GOO_CANVAS (widget);
+ GooCanvasPrivate *priv = GOO_CANVAS_GET_PRIVATE (canvas);
GooCanvasBounds clip_bounds, bounds, root_item_bounds;
double x1, y1, x2, y2;
+ guint major_gtk_version, minor_gtk_version;
+ gboolean gtk_3_9 = FALSE;
+
+ major_gtk_version = gtk_get_major_version ();
+ minor_gtk_version = gtk_get_minor_version ();
+ if (major_gtk_version > 3
+ || (major_gtk_version == 3 && minor_gtk_version >= 9))
+ gtk_3_9 = TRUE;
if (!gtk_cairo_should_draw_window (cr, canvas->canvas_window))
return FALSE;
@@ -2756,7 +2778,8 @@ goo_canvas_draw (GtkWidget *widget,
cairo_save (cr);
/* Get rid of the translation passed in by GTK+. We use our own. */
- cairo_identity_matrix (cr);
+ if (!gtk_3_9)
+ cairo_identity_matrix (cr);
/* Set our default drawing settins - antialias, line width. */
goo_canvas_setup_cairo_context (canvas, cr);
@@ -2778,9 +2801,13 @@ goo_canvas_draw (GtkWidget *widget,
goo_canvas_convert_from_window_pixels (canvas, &bounds.x1, &bounds.y1);
goo_canvas_convert_from_window_pixels (canvas, &bounds.x2, &bounds.y2);
+ if (gtk_3_9)
+ cairo_translate (cr, priv->window_x, priv->window_y);
+
/* Get rid of the current clip, as it uses the wrong coordinate space.
FIXME: Maybe we should always set a clip with the new GTK+ drawing code. */
- cairo_reset_clip (cr);
+ if (!gtk_3_9)
+ cairo_reset_clip (cr);
/* Translate it to use the canvas pixel offsets (used when the canvas is
smaller than the window and the anchor isn't set to NORTH_WEST). */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]