[goocanvas/new-api] 2010-06-28 Damon Chaplin <damon gnome org>



commit 769fba9a1be1f30cf29c3086aef2aca99488b80a
Author: Damon Chaplin <damon gnome org>
Date:   Mon Jun 28 20:57:22 2010 +0100

    2010-06-28  Damon Chaplin  <damon gnome org>
    
    	    * src/goocanvastable.c (goo_canvas_table_size_allocate_pass3):
    	    handle RTL direction when clipping children. Though it should
    	    possibly clip off the left of the child rather than the left.

 ChangeLog            |    6 ++++++
 src/goocanvastable.c |   19 ++++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2753883..fce75ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-06-28  Damon Chaplin  <damon gnome org>
 
+	* src/goocanvastable.c (goo_canvas_table_size_allocate_pass3):
+	handle RTL direction when clipping children. Though it should
+	possibly clip off the left of the child rather than the left.
+
+2010-06-28  Damon Chaplin  <damon gnome org>
+
 	* src/goocanvas.c: added "before-initial-expose" flag which we use
 	to ignore any redraw requests before the initial expose (since we
 	know the entire canvas needs redrawing anyway). This speeds up the
diff --git a/src/goocanvastable.c b/src/goocanvastable.c
index e5b0b22..50d4bf2 100644
--- a/src/goocanvastable.c
+++ b/src/goocanvastable.c
@@ -1658,11 +1658,6 @@ goo_canvas_table_size_allocate_pass3 (GooCanvasTable *table,
   if (simple->canvas)
     direction = gtk_widget_get_direction (GTK_WIDGET (simple->canvas));
 
-  /* FIXME: Testing. This doesn't work for the clipped shapes in the demo. */
-#if 0
-  direction = GTK_TEXT_DIR_RTL;
-#endif
-
   for (i = 0; i < table->children->len; i++)
     {
       child = &g_array_index (table->children, GooCanvasTableChild, i);
@@ -2114,11 +2109,12 @@ goo_canvas_table_paint (GooCanvasItem         *item,
   GooCanvasItem *child;
   gboolean check_clip = FALSE, clip;
   gint start_column, end_column, start_row, end_row, i, j;
-  gdouble x, y, end_x, end_y;
+  gdouble x, y, end_x, end_y, clip_width, clip_height;
   gdouble frame_width, frame_height;
   gdouble line_start, line_end;
   gdouble spacing, half_spacing_before, half_spacing_after;
   gboolean old_grid_line_visibility, cur_grid_line_visibility;
+  GtkTextDirection direction = GTK_TEXT_DIR_NONE;
 
   /* Skip the item if the bounds don't intersect the expose rectangle. */
   if (simple->bounds.x1 > bounds->x2 || simple->bounds.x2 < bounds->x1
@@ -2131,6 +2127,9 @@ goo_canvas_table_paint (GooCanvasItem         *item,
 	  && simple->canvas->scale < simple->visibility_threshold))
     return;
 
+  if (simple->canvas)
+    direction = gtk_widget_get_direction (GTK_WIDGET (simple->canvas));
+
   /* Paint all the items in the group. */
   cairo_save (cr);
   if (simple->transform)
@@ -2372,8 +2371,14 @@ goo_canvas_table_paint (GooCanvasItem         *item,
 	  /* Only clip the child if it may have been shrunk. */
 	  if (clip)
 	    {
+	      clip_width = end_x - x;
+	      clip_height = end_y - y;
+
+	      if (direction == GTK_TEXT_DIR_RTL)
+		x = layout_data->allocated_size[HORZ] - clip_width - x;
+
 	      cairo_save (cr);
-	      cairo_rectangle (cr, x, y, end_x - x, end_y - y);
+	      cairo_rectangle (cr, x, y, clip_width, clip_height);
 	      cairo_clip (cr);
 	    }
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]