From Sylvain Marie, "changed raw pointers to smart pointers in the dxfBlock, dxfTables and

dxfSection classes, so their members data are correctly deleted.
- changed some methods signatures to pass arguments by reference instead of
by value. The performance and memory usage are enhanced (the reader was
clogging the heap when reading some large DXF files)

The updated files have been compiled and tested with a variety of DXF files
on XP with VS2003, but the changes should not disturb any other compiler."
This commit is contained in:
Robert Osfield
2006-12-05 15:31:07 +00:00
parent 8e0bb5f6ef
commit d70cf68ae6
7 changed files with 95 additions and 94 deletions

View File

@@ -418,8 +418,8 @@ dxfPolyline::drawScene(scene* sc)
Vec3d nr;
bool nset = false;
//dxfVertex* v = NULL;
unsigned short ncount;
unsigned short mcount;
unsigned int ncount;
unsigned int mcount;
if (_surfacetype == 6) {
// I dont have examples of type 5 and 8, but they may be the same as 6
mcount = _mdensity;
@@ -428,8 +428,8 @@ dxfPolyline::drawScene(scene* sc)
mcount = _mcount;
ncount = _ncount;
}
for (unsigned short n = 0; n < ncount-1; n++) {
for (unsigned short m = 1; m < mcount; m++) {
for (unsigned int n = 0; n < ncount-1; n++) {
for (unsigned int m = 1; m < mcount; m++) {
// 0
a = _vertices[(m-1)*ncount+n].get()->getVertex();
// 1
@@ -463,7 +463,7 @@ dxfPolyline::drawScene(scene* sc)
}
}
if (_flag & 1) {
for (unsigned short n = 0; n < ncount-1; n++) {
for (unsigned int n = 0; n < ncount-1; n++) {
// 0
a = _vertices[(mcount-1)*ncount+n].get()->getVertex();
// 1
@@ -492,7 +492,7 @@ dxfPolyline::drawScene(scene* sc)
}
}
if (_flag & 32) {
for (unsigned short m = 1; m < mcount; m++) {
for (unsigned int m = 1; m < mcount; m++) {
// 0
a = _vertices[(m-1)*ncount+(ncount-1)].get()->getVertex();
// 1
@@ -553,7 +553,7 @@ dxfPolyline::drawScene(scene* sc)
} else if (_flag & 64) {
unsigned short _facetype = 3;
for (unsigned short i = 0; i < _indices.size(); i++) {
for (unsigned int i = 0; i < _indices.size(); i++) {
dxfVertex* vindice = _indices[i].get();
if (!vindice) continue;
if (vindice->getIndice4()) {
@@ -751,8 +751,8 @@ dxfInsert::drawScene(scene* sc)
sc->pushMatrix(m);
sc->pushMatrix(back);
std::vector<dxfEntity*> l = _block->getEntityList();
for (std::vector<dxfEntity*>::iterator itr = l.begin(); itr != l.end(); ++itr) {
std::vector<osg::ref_ptr<dxfEntity> > l = _block->getEntityList();
for (std::vector<osg::ref_ptr<dxfEntity> >::iterator itr = l.begin(); itr != l.end(); ++itr) {
dxfBasicEntity* e = (*itr)->getEntity();
if (e) {
e->drawScene(sc);