[gtk+] docs: get the pixbuf options from the existing instead of hardcoding.



commit 9bb3b2ae3ce5e9e9a8776806211b2414f3ae8425
Author: William Jon McCann <william jon mccann gmail com>
Date:   Thu Feb 13 12:08:03 2014 -0500

    docs: get the pixbuf options from the existing instead of hardcoding.

 docs/tools/shooter.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/docs/tools/shooter.c b/docs/tools/shooter.c
index 15e1daa..8543318 100644
--- a/docs/tools/shooter.c
+++ b/docs/tools/shooter.c
@@ -54,8 +54,12 @@ static GdkPixbuf *
 add_border_to_shot (GdkPixbuf *pixbuf)
 {
   GdkPixbuf *retval;
+  GdkColorspace colorspace;
+  int bits;
 
-  retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+  colorspace = gdk_pixbuf_get_colorspace (pixbuf);
+  bits = gdk_pixbuf_get_bits_per_sample (pixbuf);
+  retval = gdk_pixbuf_new (colorspace, TRUE, bits,
                           gdk_pixbuf_get_width (pixbuf) + 2,
                           gdk_pixbuf_get_height (pixbuf) + 2);
 
@@ -78,8 +82,12 @@ remove_shaped_area (GdkPixbuf *pixbuf,
   XRectangle *rectangles;
   int rectangle_count, rectangle_order;
   int i;
+  GdkColorspace colorspace;
+  int bits;
 
-  retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+  colorspace = gdk_pixbuf_get_colorspace (pixbuf);
+  bits = gdk_pixbuf_get_bits_per_sample (pixbuf);
+  retval = gdk_pixbuf_new (colorspace, TRUE, bits,
                           gdk_pixbuf_get_width (pixbuf),
                           gdk_pixbuf_get_height (pixbuf));
   


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