Maybe I repeat myself but... This is the original code :
const int cst_nbLines = 5000;
for (int i=0 ; i<cst_nbLines ; i++)
{
QLine myLine
(i
/10, i
/10, i
/10+300, i
/10);
myPainter.drawLine(myLine);
}
const int cst_nbLines = 5000;
for (int i=0 ; i<cst_nbLines ; i++)
{
QLine myLine(i/10, i/10, i/10+300, i/10);
myPainter.drawLine(myLine);
}
To copy to clipboard, switch view to plain text mode
This is the code giving the same final result but 10 times faster :
const int cst_nbLines = 5000;
for (int i=0 ; i<cst_nbLines/10 ; i++)
{
QLine myLine
(i, i, i
+300, i
);
myPainter.drawLine(myLine);
}
const int cst_nbLines = 5000;
for (int i=0 ; i<cst_nbLines/10 ; i++)
{
QLine myLine(i, i, i+300, i);
myPainter.drawLine(myLine);
}
To copy to clipboard, switch view to plain text mode
Bookmarks