// double the size if needed static QVector<QPoint> points(32); if (np > points.size()) points.resize(2 * np);
Will commit if nobody complains. Stefan
On Sat, May 19, 2007 at 06:51:17PM +0200, Stefan Schimanski wrote:Here is the patch. Comments? Wonder if there is something like that in Boost, but didn't find it. StefanIndex: src/frontends/qt4/QLPainter.cpp =================================================================== --- src/frontends/qt4/QLPainter.cpp (Revision 18423) +++ src/frontends/qt4/QLPainter.cpp (Arbeitskopie) @@ -114,8 +114,15 @@ if (!isDrawingEnabled()) return; - // Must use new as np is not known at compile time. - boost::scoped_array<QPoint> points(new QPoint[np]); + // double the size if needed + static size_t size = 32; + static QPoint * points = new QPoint[size]; + if (size_t(np) > size) { + delete[] points; + while (size_t(np) > size) + size *= 2; + points = new QPoint[size]; + } Simpler: static std::vector<QPoint> points; if (np > points.size()) points.resize(2 * np) Andre'
PGP.sig
Description: Signierter Teil der Nachricht