pygtk r3087 - in trunk: . gtk



Author: gianmt
Date: Sun Feb 22 20:42:29 2009
New Revision: 3087
URL: http://svn.gnome.org/viewvc/pygtk?rev=3087&view=rev

Log:
2009-02-22  Gian Mario Tagliaretti  <gianmt gnome org>

	Bug 447388 â pixbuf.get_pixels_array() doesn't correctly flag the array
	as non-contiguous
	
	gtk/gdkpixbuf.override: Fix the rowstride for pixbuf with padded rows.
	Patch from Tim Evans



Modified:
   trunk/ChangeLog
   trunk/gtk/gdkpixbuf.override

Modified: trunk/gtk/gdkpixbuf.override
==============================================================================
--- trunk/gtk/gdkpixbuf.override	(original)
+++ trunk/gtk/gdkpixbuf.override	Sun Feb 22 20:42:29 2009
@@ -98,12 +98,11 @@
 static PyObject *
 _wrap_gdk_pixbuf_get_pixels_array(PyGObject *self)
 {
-
-
 #ifdef HAVE_NUMPY
     GdkPixbuf *pixbuf = GDK_PIXBUF(self->obj);
     PyArrayObject *array;
     int dims[3] = { 0, 0, 3 };
+    int rowstride;
 
     if (!have_numpy())
 	return NULL;
@@ -117,7 +116,12 @@
     if (array == NULL)
         return NULL;
 
-    array->strides[0] = gdk_pixbuf_get_rowstride(pixbuf);
+    rowstride = gdk_pixbuf_get_rowstride(pixbuf);
+    if (rowstride != array->strides[0]) {
+	/* pixbuf data is not contiguous */
+	array->strides[0] = rowstride;
+	array->flags &= ~CONTIGUOUS;
+    }
     /* the array holds a ref to the pixbuf pixels through this wrapper*/
     Py_INCREF(self);
     array->base = (PyObject *)self;



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