diff options
| author | Andrew Higginson <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
|---|---|---|
| committer | Andrew <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
| commit | 80960b623a99aae1402ab651b2974ef544ed3b03 (patch) | |
| tree | ba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/trace/siox.cpp | |
| parent | try to fix bug (diff) | |
| parent | GDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff) | |
| download | inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip | |
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/trace/siox.cpp')
| -rw-r--r-- | src/trace/siox.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index b3404fc00..4c6cf1eac 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -584,7 +584,7 @@ void SioxImage::assign(const SioxImage &other) /** * Write the image to a PPM file */ -bool SioxImage::writePPM(const std::string fileName) +bool SioxImage::writePPM(const std::string &fileName) { FILE *f = fopen(fileName.c_str(), "wb"); @@ -736,19 +736,33 @@ const float Siox::CERTAIN_BACKGROUND_CONFIDENCE=0.0f; /** * Construct a Siox engine */ -Siox::Siox() +Siox::Siox() : + sioxObserver(0), + keepGoing(true), + width(0), + height(0), + pixelCount(0), + image(0), + cm(0), + labelField(0) { - sioxObserver = NULL; init(); } /** * Construct a Siox engine */ -Siox::Siox(SioxObserver *observer) +Siox::Siox(SioxObserver *observer) : + sioxObserver(observer), + keepGoing(true), + width(0), + height(0), + pixelCount(0), + image(0), + cm(0), + labelField(0) { init(); - sioxObserver = observer; } @@ -1011,7 +1025,7 @@ SioxImage Siox::extractForeground(const SioxImage &originalImage, } tupel.minFgDist = minFg; tupel.indexMinFg = minIndex; - if (fgSignature.size() == 0) + if (fgSignature.empty()) { isBackground = (minBg <= clusterSize); // remove next line to force behaviour of old algorithm @@ -1414,7 +1428,7 @@ int Siox::depthFirstSearch(int startPos, } - while (pixelsToVisit.size() > 0) + while (!pixelsToVisit.empty()) { int pos = pixelsToVisit[pixelsToVisit.size() - 1]; pixelsToVisit.erase(pixelsToVisit.end() - 1); @@ -1486,7 +1500,7 @@ void Siox::fillColorRegions() // int componentSize = 1; pixelsToVisit.push_back(i); // depth first search to fill region - while (pixelsToVisit.size() > 0) + while (!pixelsToVisit.empty()) { int pos = pixelsToVisit[pixelsToVisit.size() - 1]; pixelsToVisit.erase(pixelsToVisit.end() - 1); |
