diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2008-05-26 04:25:25 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-05-26 04:25:25 +0000 |
commit | 9ec6a65901aa1e4a494c09341f5a6ffbed8a8415 (patch) | |
tree | e08411d22b1b856a23c0d31a0e3e6877ebc8a04e /gtk/gtkhsv.c | |
parent | 4d734c0e6a8ae9ed2fe623c563047626f9ddec62 (diff) | |
download | gtk+-9ec6a65901aa1e4a494c09341f5a6ffbed8a8415.tar.gz |
Bug 513811 – Use cairo_format_stride_for_width()
* gtk/gtkhsv.c (paint_ring, paint_triangle):
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Use
cairo_format_stride_for_width, proposed by Behdad Esfahbod.
* configure.in: Bump cairo requirement to 1.6.0
* INSTALL.in: Update required versions
svn path=/trunk/; revision=20170
Diffstat (limited to 'gtk/gtkhsv.c')
-rw-r--r-- | gtk/gtkhsv.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index 58c4494809..f6a8133651 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -897,6 +897,7 @@ paint_ring (GtkHSV *hsv, gdouble r, g, b; cairo_surface_t *source; cairo_t *source_cr; + gint stride; gint focus_width; gint focus_pad; @@ -914,7 +915,8 @@ paint_ring (GtkHSV *hsv, /* Create an image initialized with the ring colors */ - buf = g_new (guint32, width * height); + stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); + buf = g_new (guint32, height * stride / 4); for (yy = 0; yy < height; yy++) { @@ -952,7 +954,7 @@ paint_ring (GtkHSV *hsv, source = cairo_image_surface_create_for_data ((char *)buf, CAIRO_FORMAT_RGB24, - width, height, 4 * width); + width, height, stride); /* Now draw the value marker onto the source image, so that it * will get properly clipped at the edges of the ring @@ -1047,6 +1049,7 @@ paint_triangle (GtkHSV *hsv, cairo_surface_t *source; gdouble r, g, b; gchar *detail; + gint stride; priv = hsv->priv; @@ -1094,8 +1097,9 @@ paint_triangle (GtkHSV *hsv, } /* Shade the triangle */ - - buf = g_new (guint32, width * height); + + stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); + buf = g_new (guint32, height * stride / 4); for (yy = 0; yy < height; yy++) { @@ -1162,7 +1166,7 @@ paint_triangle (GtkHSV *hsv, source = cairo_image_surface_create_for_data ((char *)buf, CAIRO_FORMAT_RGB24, - width, height, 4 * width); + width, height, stride); /* Draw a triangle with the image as a source */ |