Correctly set rotated points values. Closes Issue 1041.

The rotate code was setting the rotated points in a copy of the vector of points, rather than
in the vector owned by the result. Use a reference instead of a copy so changes persist.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1995 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2011-10-28 18:31:35 +00:00
parent 274dd52968
commit 90f7e7b865
3 changed files with 6 additions and 1 deletions

View file

@ -44,6 +44,10 @@ const std::vector<Ref<ResultPoint> >& Result::getResultPoints() const {
return resultPoints_;
}
std::vector<Ref<ResultPoint> >& Result::getResultPoints() {
return resultPoints_;
}
BarcodeFormat Result::getBarcodeFormat() const {
return format_;
}

View file

@ -44,6 +44,7 @@ public:
Ref<String> getText();
ArrayRef<unsigned char> getRawBytes();
const std::vector<Ref<ResultPoint> >& getResultPoints() const;
std::vector<Ref<ResultPoint> >& getResultPoints();
BarcodeFormat getBarcodeFormat() const;
friend std::ostream& operator<<(std::ostream &out, Result& result);

View file

@ -49,7 +49,7 @@ namespace zxing {
result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(orientation));
*/
// Update result points
std::vector<Ref<ResultPoint> > points (result->getResultPoints());
std::vector<Ref<ResultPoint> >& points (result->getResultPoints());
int height = rotatedImage->getHeight();
for (size_t i = 0; i < points.size(); i++) {
points[i].reset(new OneDResultPoint(height - points[i]->getY() - 1, points[i]->getX()));