[gtk+/rendering-cleanup-next] gtk-demo: Get rid of gdk_drawable_get_size() usage



commit 8a656a98cdcd461bed7d246a88f4b6893fbdc5da
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 20 12:54:07 2010 +0200

    gtk-demo: Get rid of gdk_drawable_get_size() usage

 demos/gtk-demo/offscreen_window.c  |    7 ++++---
 demos/gtk-demo/offscreen_window2.c |   10 +++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c
index 62259ec..223cad2 100644
--- a/demos/gtk-demo/offscreen_window.c
+++ b/demos/gtk-demo/offscreen_window.c
@@ -474,7 +474,6 @@ gtk_rotated_bin_draw (GtkWidget *widget,
 {
   GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
   GdkWindow *window;
-  gint width, height;
   gdouble s, c;
   gdouble w, h;
 
@@ -501,8 +500,10 @@ gtk_rotated_bin_draw (GtkWidget *widget,
           cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
 
           /* clip */
-          gdk_drawable_get_size (bin->offscreen_window, &width, &height);
-          cairo_rectangle (cr, 0, 0, width, height);
+          cairo_rectangle (cr,
+                           0, 0,
+                           gdk_window_get_width (bin->offscreen_window),
+                           gdk_window_get_height (bin->offscreen_window));
           cairo_clip (cr);
           /* paint */
           cairo_set_source_surface (cr, surface, 0, 0);
diff --git a/demos/gtk-demo/offscreen_window2.c b/demos/gtk-demo/offscreen_window2.c
index 81279e2..a61fbc4 100644
--- a/demos/gtk-demo/offscreen_window2.c
+++ b/demos/gtk-demo/offscreen_window2.c
@@ -380,7 +380,6 @@ gtk_mirror_bin_draw (GtkWidget *widget,
 {
   GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
   GdkWindow *window;
-  gint width, height;
 
   window = gtk_widget_get_window (widget);
   if (gtk_cairo_should_draw_window (cr, window))
@@ -388,11 +387,12 @@ gtk_mirror_bin_draw (GtkWidget *widget,
       cairo_surface_t *surface;
       cairo_matrix_t matrix;
       cairo_pattern_t *mask;
+      int height;
 
       if (bin->child && gtk_widget_get_visible (bin->child))
         {
           surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
-          gdk_drawable_get_size (bin->offscreen_window, &width, &height);
+          height = gdk_window_get_height (bin->offscreen_window);
 
           /* paint the offscreen child */
           cairo_set_source_surface (cr, surface, 0, 0);
@@ -421,12 +421,12 @@ gtk_mirror_bin_draw (GtkWidget *widget,
     }
   else if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
     {
-      gdk_drawable_get_size (bin->offscreen_window, &width, &height);
-
       gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
                           GTK_STATE_NORMAL, GTK_SHADOW_NONE,
                           widget, "blah",
-                          0, 0, width, height);
+                          0, 0,
+                          gdk_window_get_width (bin->offscreen_window),
+                          gdk_window_get_height (bin->offscreen_window));
 
       if (bin->child)
         gtk_container_propagate_draw (GTK_CONTAINER (widget),



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