[gnome-photos/wip/rishi/edit-mode: 24/25] preview-view: Use the correct height and width when drawing background



commit c181f75b3d373e52e157baafa3c2bda6506d5873
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 18 09:59:44 2015 +0200

    preview-view: Use the correct height and width when drawing background
    
    We should use the widget's allocated height and width when rendering
    the background. The (0, 0) of the Cairo context coincides with upper
    left corner of the widget, not the clip rectangle.
    
    Not entirely sure why we didn't see any bugs because of this, but
    let's do the right thing.

 src/photos-preview-view.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 869ba7f..f828c00 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -121,12 +121,16 @@ photos_preview_view_draw_background (PhotosPreviewView *self, cairo_t *cr, GdkRe
   GtkStyleContext *context;
   GtkStateFlags flags;
   GtkWidget *view = GTK_WIDGET (user_data);
+  gint height;
+  gint width;
 
   context = gtk_widget_get_style_context (view);
   flags = gtk_widget_get_state_flags (view);
   gtk_style_context_save (context);
   gtk_style_context_set_state (context, flags);
-  gtk_render_background (context, cr, 0, 0, rect->width, rect->height);
+  height = gtk_widget_get_allocated_height (view);
+  width = gtk_widget_get_allocated_width (view);
+  gtk_render_background (context, cr, 0, 0, width, height);
   gtk_style_context_restore (context);
 }
 


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