Commit 9ec6a659 authored by Matthias Clasen's avatar Matthias Clasen

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
parent 4d734c0e
2008-05-26 Matthias Clasen <mclasen@redhat.com>
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
2008-05-26 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkshow.[hc]: Formatting fixes
......
......@@ -4,8 +4,8 @@ Prerequisites
GTK+ requires the following packages:
- The GLib, Pango, ATK and cairo libraries, available at the same
location as GTK+. GTK+ @GTK_VERSION@ requires at least GLib 2.12,
Pango 1.13, ATK 1.9 and cairo 1.2.
location as GTK+. GTK+ @GTK_VERSION@ requires at least GLib 2.15.0,
Pango 1.19.3, ATK 1.13.0 and cairo 1.6.0.
- The TIFF, PNG, and JPEG image loading libraries. You most
likely have these installed on your system already. If not
......
......@@ -34,7 +34,7 @@ m4_define([gtk_binary_version], [2.10.0])
m4_define([glib_required_version], [2.15.0])
m4_define([pango_required_version], [1.19.3])
m4_define([atk_required_version], [1.13.0])
m4_define([cairo_required_version], [1.5.2])
m4_define([cairo_required_version], [1.6])
AC_INIT([gtk+], [gtk_version],
......
......@@ -146,6 +146,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
guchar *gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
int gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
int cairo_stride;
guchar *cairo_pixels;
cairo_format_t format;
cairo_surface_t *surface;
......@@ -157,10 +158,12 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
else
format = CAIRO_FORMAT_ARGB32;
cairo_pixels = g_malloc (4 * width * height);
cairo_stride = cairo_format_stride_for_width (format, width);
cairo_pixels = g_malloc (height * cairo_stride);
surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels,
format,
width, height, 4 * width);
format,
width, height, cairo_stride);
cairo_surface_set_user_data (surface, &key,
cairo_pixels, (cairo_destroy_func_t)g_free);
......@@ -217,7 +220,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
}
gdk_pixels += gdk_rowstride;
cairo_pixels += 4 * width;
cairo_pixels += cairo_stride;
}
cairo_set_source_surface (cr, surface, pixbuf_x, pixbuf_y);
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment