From: <md...@us...> - 2008-05-06 19:04:08
|
Revision: 5124 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5124&view=rev Author: mdboom Date: 2008-05-06 12:03:54 -0700 (Tue, 06 May 2008) Log Message: ----------- Merged revisions 5122-5123 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint ........ r5123 | mdboom | 2008-05-06 14:56:47 -0400 (Tue, 06 May 2008) | 2 lines Fixing bugs in recent changes to Qt blitting. ........ Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5121 + /branches/v0_91_maint:1-5123 Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-05-06 18:56:47 UTC (rev 5123) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-05-06 19:03:54 UTC (rev 5124) @@ -93,26 +93,28 @@ Py::Object BufferRegion::to_string_argb(const Py::Tuple &args) { // owned=true to prevent memory leak Py_ssize_t length; - char* pix; - char* begin; - char* end; - char tmp; + unsigned char* pix; + unsigned char* begin; + unsigned char* end; + unsigned char tmp; + size_t i, j; PyObject* str = PyString_FromStringAndSize((const char*)data, height*stride); - if (PyString_AsStringAndSize(str, &begin, &length)) { + if (PyString_AsStringAndSize(str, (char**)&begin, &length)) { throw Py::TypeError("Could not create memory for blit"); } pix = begin; end = begin + (height * stride); - while (pix != end) { - // Convert rgba to argb - tmp = pix[3]; - pix[3] = pix[2]; - pix[2] = pix[1]; - pix[1] = pix[0]; - pix[0] = pix[3]; - pix += 4; + for (i = 0; i < (size_t)height; ++i) { + pix = begin + i * stride; + for (j = 0; j < (size_t)width; ++j) { + // Convert rgba to argb + tmp = pix[2]; + pix[2] = pix[0]; + pix[0] = tmp; + pix += 4; + } } return Py::String(str, true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |