Revision: 5963
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5963&view=rev
Author: mdboom
Date: 2008-08-04 13:11:45 +0000 (Mon, 04 Aug 2008)
Log Message:
-----------
Speed improvements in quadmesh. Proper ref-counting in error case.
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-08-04 13:09:02 UTC (rev
5962)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-08-04 13:11:45 UTC (rev
5963)
@@ -1214,8 +1214,8 @@
private:
inline unsigned vertex(unsigned idx, double* x, double* y) {
- size_t m = (idx & 0x2) ? (m_m + 1) : m_m;
- size_t n = (idx+1 & 0x2) ? (m_n + 1) : m_n;
+ size_t m = m_m + ((idx & 0x2) >> 1);
+ size_t n = m_n + ((idx+1 & 0x2) >> 1);
double* pair = (double*)PyArray_GETPTR2(m_coordinates, n, m);
*x = *pair++;
*y = *pair;
@@ -1243,7 +1243,7 @@
inline QuadMeshGenerator(size_t meshWidth, size_t meshHeight, PyObject*
coordinates) :
m_meshWidth(meshWidth), m_meshHeight(meshHeight), m_coordinates(NULL) {
- PyArrayObject* coordinates_array =
(PyArrayObject*)PyArray_FromObject(coordinates, PyArray_DOUBLE, 3, 3);
+ PyArrayObject* coordinates_array =
(PyArrayObject*)PyArray_ContiguousFromObject(coordinates, PyArray_DOUBLE, 3, 3);
if (!coordinates_array) {
throw Py::ValueError("Invalid coordinates array.");
}
@@ -1310,23 +1310,27 @@
}
}
- _draw_path_collection_generic<QuadMeshGenerator, 0, 0>
- (master_transform,
- cliprect,
- clippath,
- clippath_trans,
- path_generator,
- transforms_obj,
- offsets_obj,
- offset_trans,
- facecolors_obj,
- edgecolors_obj,
- linewidths,
- linestyles_obj,
- antialiaseds);
+ try {
+ _draw_path_collection_generic<QuadMeshGenerator, 0, 0>
+ (master_transform,
+ cliprect,
+ clippath,
+ clippath_trans,
+ path_generator,
+ transforms_obj,
+ offsets_obj,
+ offset_trans,
+ facecolors_obj,
+ edgecolors_obj,
+ linewidths,
+ linestyles_obj,
+ antialiaseds);
+ } catch (...) {
+ if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr());
+ throw;
+ }
- if (free_edgecolors)
- Py_XDECREF(edgecolors_obj.ptr());
+ if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr());
return Py::Object();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins