[goocanvas/new-api] 2010-07-09 Damon Chaplin <damon gnome org>



commit 0b35688ef7f647d508fe7a96a4a5aea371fd3de2
Author: Damon Chaplin <damon gnome org>
Date:   Fri Jul 9 09:52:32 2010 +0100

    2010-07-09  Damon Chaplin  <damon gnome org>
    
    	    * src/goocanvasitemsimple.c (goo_canvas_item_simple_set_stroke_options):
    	    keep a single black pattern rather than recreating one when needed.

 ChangeLog                 |    5 +++++
 src/goocanvas.c           |    2 +-
 src/goocanvasitemsimple.c |   14 +++++++++-----
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 827e2b3..815d1c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-09  Damon Chaplin  <damon gnome org>
+
+	* src/goocanvasitemsimple.c (goo_canvas_item_simple_set_stroke_options):
+	keep a single black pattern rather than recreating one when needed.
+
 2010-07-08  Damon Chaplin  <damon gnome org>
 
 	* src/goocanvas.c (goo_canvas_check_font_size): new function to
diff --git a/src/goocanvas.c b/src/goocanvas.c
index bce521b..2398e7a 100644
--- a/src/goocanvas.c
+++ b/src/goocanvas.c
@@ -2343,7 +2343,7 @@ goo_canvas_expose_event (GtkWidget      *widget,
 	  && canvas->bounds.y2 < bounds.y2))
     {
       /* Clip to the intersection of the canvas bounds and the expose
-	 bounds, to avoid cairo's 16-bit limits. */
+	 bounds, to avoid cairo's coordinate limits. */
       x1 = MAX (canvas->bounds.x1, bounds.x1);
       y1 = MAX (canvas->bounds.y1, bounds.y1);
       x2 = MIN (canvas->bounds.x2, bounds.x2);
diff --git a/src/goocanvasitemsimple.c b/src/goocanvasitemsimple.c
index f09e177..bbe6730 100644
--- a/src/goocanvasitemsimple.c
+++ b/src/goocanvasitemsimple.c
@@ -668,7 +668,7 @@ goo_canvas_item_simple_get_items_at (GooCanvasItem  *item,
 
   cairo_device_to_user (cr, &user_x, &user_y);
 
-  /* Remove any current translation, to avoid the 16-bit cairo limit. */
+  /* Remove any current translation, to avoid cairo's coordinate limits. */
   cairo_get_matrix (cr, &matrix);
   old_x0 = matrix.x0;
   old_y0 = matrix.y0;
@@ -887,7 +887,7 @@ goo_canvas_item_simple_update  (GooCanvasItem   *item,
       if (simple->transform)
 	cairo_transform (cr, simple->transform);
 
-      /* Remove any current translation, to avoid the 16-bit cairo limit. */
+      /* Remove any current translation, to avoid cairo's coordinate limits. */
       cairo_get_matrix (cr, &matrix);
       x_offset = matrix.x0;
       y_offset = matrix.y0;
@@ -984,7 +984,7 @@ goo_canvas_item_simple_get_requested_area (GooCanvasItem    *item,
   if (simple->transform)
     cairo_transform (cr, simple->transform);
 
-  /* Remove any current translation, to avoid the 16-bit cairo limit. */
+  /* Remove any current translation, to avoid cairo's coordinate limits. */
   cairo_get_matrix (cr, &matrix);
   x_offset = matrix.x0;
   y_offset = matrix.y0;
@@ -1593,21 +1593,25 @@ goo_canvas_item_simple_set_stroke_options (GooCanvasItemSimple   *simple,
 					   GooCanvasOperation	  op,
 					   gdouble                scale)
 {
+  static cairo_pattern_t *black_pattern = NULL;
   GooCanvasStyle *style = simple->style;
   gdouble line_width;
 
+  if (!black_pattern)
+    black_pattern = cairo_pattern_create_rgb (0.0, 0.0, 0.0);
+
   /* If no style is set, just reset the source to black and return TRUE so the
      default style will be used. */
   if (!style)
     {
-      cairo_set_source_rgb (cr, 0, 0, 0);
+      cairo_set_source (cr, black_pattern);
       return TRUE;
     }
 
   if (style->stroke_pattern)
     cairo_set_source (cr, style->stroke_pattern);
   else
-    cairo_set_source_rgb (cr, 0, 0, 0);
+    cairo_set_source (cr, black_pattern);
 
   if (style->op != CAIRO_OPERATOR_OVER)
     cairo_set_operator (cr, style->op);



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