[goocanvas] Another attempt at fixing the drawing code.
- From: Damon Chaplin <damon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goocanvas] Another attempt at fixing the drawing code.
- Date: Sun, 27 Oct 2013 12:05:55 +0000 (UTC)
commit b0079edfd7957f176a2c596bafec2f2c4e91e09a
Author: Damon Chaplin <damon gnome org>
Date: Sun Oct 27 12:04:53 2013 +0000
Another attempt at fixing the drawing code.
ChangeLog | 13 +++++++++++++
src/goocanvas.c | 40 ++++++----------------------------------
2 files changed, 19 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f217106..0aeac82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2013-10-25 Damon Chaplin <damon gnome org>
+
+ * src/goocanvas.c (paint_static_items, goo_canvas_draw): another
+ attempt at fixing the drawing code. Now it uses the transform & clip
+ from the given cairo_t and the code seems to work OK for both the old
+ GTK+ and GTK+ 3.10. Bug #700674.
+
+ The only problem now is the "Large Items" page in the demo, which
+ only works up to ~23 bit int window size rather than 31 bit.
+
+ Note also that X isn't used for scrolling in GTK+ any more, and if
+ we want fast scrolling there is a new method used in GTK+.
+
2013-09-27 Damon Chaplin <damon gnome org>
* demo/demo-grabs.c (on_widget_draw): draw simple rects for the widgets
diff --git a/src/goocanvas.c b/src/goocanvas.c
index 507e6fa..f89efa9 100644
--- a/src/goocanvas.c
+++ b/src/goocanvas.c
@@ -2718,23 +2718,8 @@ 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);
- 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);
@@ -2749,14 +2734,6 @@ goo_canvas_draw (GtkWidget *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;
@@ -2775,11 +2752,12 @@ goo_canvas_draw (GtkWidget *widget,
cairo_clip_extents (cr, &clip_bounds.x1, &clip_bounds.y1,
&clip_bounds.x2, &clip_bounds.y2);
- cairo_save (cr);
+#if 0
+ g_print ("In goo_canvas_draw extents: %g,%g - %g,%g\n",
+ clip_bounds.x1, clip_bounds.y1, clip_bounds.x2, clip_bounds.y2);
+#endif
- /* Get rid of the translation passed in by GTK+. We use our own. */
- if (!gtk_3_9)
- cairo_identity_matrix (cr);
+ cairo_save (cr);
/* Set our default drawing settins - antialias, line width. */
goo_canvas_setup_cairo_context (canvas, cr);
@@ -2801,13 +2779,7 @@ 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. */
- if (!gtk_3_9)
- cairo_reset_clip (cr);
+ cairo_translate (cr, priv->window_x, priv->window_y);
/* 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]