From: <md...@us...> - 2008-10-08 16:37:20
|
Revision: 6171 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6171&view=rev Author: mdboom Date: 2008-10-08 16:37:15 +0000 (Wed, 08 Oct 2008) Log Message: ----------- Throw exception when there are too many data points. Modified Paths: -------------- trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h =================================================================== --- trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 14:38:26 UTC (rev 6170) +++ trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 16:37:15 UTC (rev 6171) @@ -29,6 +29,7 @@ #ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED #define AGG_RASTERIZER_CELLS_AA_INCLUDED +#include <exception> #include <string.h> #include <math.h> #include "agg_math.h" @@ -183,7 +184,9 @@ { if((m_num_cells & cell_block_mask) == 0) { - if(m_num_blocks >= cell_block_limit) return; + if(m_num_blocks >= cell_block_limit) { + throw "Agg rendering complexity exceeded."; + } allocate_block(); } *m_curr_cell_ptr++ = m_curr_cell; Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-10-08 14:38:26 UTC (rev 6170) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-10-08 16:37:15 UTC (rev 6171) @@ -941,7 +941,11 @@ if (snap) gc.isaa = false; - _draw_path(curve, has_clippath, face, gc); + try { + _draw_path(curve, has_clippath, face, gc); + } catch (const char* e) { + throw Py::RuntimeError(e); + } return Py::Object(); } @@ -1175,20 +1179,24 @@ PathListGenerator path_generator(paths); - _draw_path_collection_generic<PathListGenerator, 1, 1> - (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<PathListGenerator, 1, 1> + (master_transform, + cliprect, + clippath, + clippath_trans, + path_generator, + transforms_obj, + offsets_obj, + offset_trans, + facecolors_obj, + edgecolors_obj, + linewidths, + linestyles_obj, + antialiaseds); + } catch (const char *e) { + throw Py::RuntimeError(e); + } return Py::Object(); } @@ -1310,20 +1318,24 @@ } 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); + 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 (const char* e) { + throw Py::RuntimeError(e); + } } catch (...) { if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr()); throw; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |