mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
C++ port: fixed warnings for Symbian build
git-svn-id: https://zxing.googlecode.com/svn/trunk@1145 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
5472325ffe
commit
a1083bebd4
|
@ -37,6 +37,10 @@ Detector::Detector(Ref<BitMatrix> image) :
|
||||||
image_(image) {
|
image_(image) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<BitMatrix> Detector::getImage() {
|
||||||
|
return image_;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<DetectorResult> Detector::detect() {
|
Ref<DetectorResult> Detector::detect() {
|
||||||
FinderPatternFinder finder(image_);
|
FinderPatternFinder finder(image_);
|
||||||
Ref<FinderPatternInfo> info(finder.find());
|
Ref<FinderPatternInfo> info(finder.find());
|
||||||
|
|
|
@ -31,9 +31,11 @@ namespace zxing {
|
||||||
namespace qrcode {
|
namespace qrcode {
|
||||||
|
|
||||||
class Detector : public Counted {
|
class Detector : public Counted {
|
||||||
protected:
|
private:
|
||||||
Ref<BitMatrix> image_;
|
Ref<BitMatrix> image_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Ref<BitMatrix> getImage();
|
||||||
|
|
||||||
static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);
|
static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);
|
||||||
static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,
|
static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,
|
||||||
|
|
|
@ -49,7 +49,7 @@ Ref<PerspectiveTransform> QREdgeDetector::createTransform(Ref<ResultPoint> topLe
|
||||||
ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension) {
|
ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension) {
|
||||||
|
|
||||||
if(alignmentPattern == NULL) {
|
if(alignmentPattern == NULL) {
|
||||||
Point corner = findCorner(*image_.object_, rp(topLeft), rp(topRight), rp(bottomLeft), dimension);
|
Point corner = findCorner(*Detector::getImage(), rp(topLeft), rp(topRight), rp(bottomLeft), dimension);
|
||||||
return get1CornerTransform(rp(topLeft), rp(topRight), rp(bottomLeft), corner, dimension);
|
return get1CornerTransform(rp(topLeft), rp(topRight), rp(bottomLeft), corner, dimension);
|
||||||
} else {
|
} else {
|
||||||
return Detector::createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
|
return Detector::createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
|
||||||
|
@ -108,10 +108,10 @@ Ref<PerspectiveTransform> QREdgeDetector::get1CornerTransform(Point topLeft, Poi
|
||||||
|
|
||||||
// Adapted from "sizeOfBlackWhiteBlackRun" in zxing::qrcode::Detector
|
// Adapted from "sizeOfBlackWhiteBlackRun" in zxing::qrcode::Detector
|
||||||
Point QREdgeDetector::endOfReverseBlackWhiteBlackRun(const BitMatrix& image, Point from, Point to) {
|
Point QREdgeDetector::endOfReverseBlackWhiteBlackRun(const BitMatrix& image, Point from, Point to) {
|
||||||
float fromX = from.x;
|
int fromX = (int)from.x;
|
||||||
float fromY = from.y;
|
int fromY = (int)from.y;
|
||||||
float toX = to.x;
|
int toX = (int)to.x;
|
||||||
float toY = to.y;
|
int toY = (int)to.y;
|
||||||
|
|
||||||
bool steep = abs(toY - fromY) > abs(toX - fromX);
|
bool steep = abs(toY - fromY) > abs(toX - fromX);
|
||||||
if (steep) {
|
if (steep) {
|
||||||
|
@ -131,8 +131,8 @@ Point QREdgeDetector::endOfReverseBlackWhiteBlackRun(const BitMatrix& image, Poi
|
||||||
int state = 0; // In black pixels, looking for white, first or second time
|
int state = 0; // In black pixels, looking for white, first or second time
|
||||||
|
|
||||||
// In case there are no points, prepopulate to from
|
// In case there are no points, prepopulate to from
|
||||||
int realX = from.x;
|
int realX = fromX;
|
||||||
int realY = from.y;
|
int realY = fromY;
|
||||||
for (int x = fromX, y = fromY; x != toX; x += xstep) {
|
for (int x = fromX, y = fromY; x != toX; x += xstep) {
|
||||||
realX = steep ? y : x;
|
realX = steep ? y : x;
|
||||||
realY = steep ? x : y;
|
realY = steep ? x : y;
|
||||||
|
|
Loading…
Reference in a new issue