hippo-canvas r7285 - in trunk: common/hippo linux/hippo



Author: otaylor
Date: Thu Jun 26 19:49:23 2008
New Revision: 7285
URL: http://svn.gnome.org/viewvc/hippo-canvas?rev=7285&view=rev

Log:
Guard against NULL window when animating a not-yet-realized canvas

Modified:
   trunk/common/hippo/hippo-canvas-image.c
   trunk/linux/hippo/hippo-canvas-helper.c

Modified: trunk/common/hippo/hippo-canvas-image.c
==============================================================================
--- trunk/common/hippo/hippo-canvas-image.c	(original)
+++ trunk/common/hippo/hippo-canvas-image.c	Thu Jun 26 19:49:23 2008
@@ -374,17 +374,15 @@
         return;
 
     if (image->scale_width >= 0) {
-        w = image->scale_width;
         xscale = image->scale_width / (double) image_width;
+        image_width = image->scale_width;
     } else {
-        w = image_width;
         xscale = 1.0;
     }
     if (image->scale_height >= 0) {
-        h = image->scale_height;
         yscale = image->scale_height / (double) image_height;
+        image_height = image->scale_height;
     } else {
-        h = image_height;
         yscale = 1.0;
     }
 
@@ -392,16 +390,20 @@
      * beyond the image's natural size, which will result in
      * a tiled image
      */
-    
-    hippo_canvas_box_align(box, w, h, &x, &y, &w, &h);
 
-    cairo_rectangle(cr, x, y, w, h);
-    cairo_clip(cr);
+    hippo_canvas_box_align(box, image_width, image_height, &x, &y, &w, &h);
+
+    if (w != image_width || h != image_height) {
+        cairo_rectangle(cr, x, y, w, h);
+        cairo_clip(cr);
+    }
 
     cairo_translate (cr, x, y);
     cairo_scale (cr, xscale, yscale);
     cairo_set_source_surface(cr, image->surface, 0, 0);
-    cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
+
+    if (w > image_width || h > image_height)
+        cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
     cairo_paint(cr);
 
     /* g_debug("cairo status %s", cairo_status_to_string(cairo_status(cr))); */

Modified: trunk/linux/hippo/hippo-canvas-helper.c
==============================================================================
--- trunk/linux/hippo/hippo-canvas-helper.c	(original)
+++ trunk/linux/hippo/hippo-canvas-helper.c	Thu Jun 26 19:49:23 2008
@@ -555,7 +555,7 @@
     }
 
     if (helper->frame_pending) {
-        if (!expose_pending_on_window(helper->widget->window)) {
+        if (!helper->widget->window || !expose_pending_on_window(helper->widget->window)) {
             /* We resized, and there was nothing to draw, we can can call frame_complete() */
             
             helper->frame_pending = FALSE;



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