Skip to content

Commit c168d39

Browse files
author
rblazek
committed
enable floating points in drawPolygon
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5466 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8297b7f commit c168d39

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/gui/qgsvectorlayer.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,20 @@ std::cerr << i << ": " << ring->first[i]
647647
ringDetails.push_back(std::make_pair(ii, ringSize));
648648

649649
// Transfer points to the array of QPointF
650-
for (register unsigned int j = 0; j != ringSize; ++j, ++ii)
650+
//for (register unsigned int j = 0; j != ringSize; ++j, ++ii)
651+
for (register unsigned int j = 0; j != ringSize; ++j, ii++)
651652
{
652653
// there is maybe a bug in Qt4.1: when using doubles without rounding,
653654
// I've experienced crashes (broken pipe) when drawing polygon
654655
// with more than 3000 vertices [MD]
655-
pa[ii].setX(static_cast<int>(r->first[j] + 0.5));
656-
pa[ii].setY(static_cast<int>(r->second[j] + 0.5));
657-
// pa[ii].setX(r->first[j]);
658-
// pa[ii].setY(r->second[j]);
656+
//pa[ii].setX(static_cast<int>(r->first[j] + 0.5));
657+
//pa[ii].setY(static_cast<int>(r->second[j] + 0.5));
658+
659+
// The crash was probably caused by writing outside
660+
// pa(total_points + numRings - 1) size, because
661+
// cycle was using ++ii insted of ii++ => reenabled floating point
662+
pa[ii].setX(r->first[j]);
663+
pa[ii].setY(r->second[j]);
659664
}
660665

661666
// Store the last point of the first ring, and insert it at

0 commit comments

Comments
 (0)