Skip to content

Commit

Permalink
[harbour-barcode] Only compile ImageSource::bwImage() in debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Jan 2, 2022
1 parent 2a840a0 commit 2531808
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/scanner/ImageSource.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
Copyright (c) 2018-2021 Slava Monich
Copyright (c) 2018-2022 Slava Monich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,7 +24,7 @@ THE SOFTWARE.

#include "ImageSource.h"

#include <zxing/common/GlobalHistogramBinarizer.h>
#include "HarbourDebug.h"

class ImageSource::Private {
public:
Expand Down Expand Up @@ -138,6 +138,11 @@ const zxing::byte* ImageSource::getGrayRow(int aY) const
}

// Strictly for debugging

#if HARBOUR_DEBUG

#include <zxing/common/GlobalHistogramBinarizer.h>

QImage ImageSource::bwImage()
{
zxing::GlobalHistogramBinarizer binarizer(zxing::Ref<zxing::LuminanceSource>(this));
Expand Down Expand Up @@ -167,3 +172,5 @@ QImage ImageSource::bwImage()
return QImage();
}
}

#endif // HARBOUR_DEBUG
5 changes: 4 additions & 1 deletion src/scanner/ImageSource.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
Copyright (c) 2018-2021 Slava Monich
Copyright (c) 2018-2022 Slava Monich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,7 +39,10 @@ class ImageSource : public zxing::LuminanceSource
~ImageSource();

const QImage& grayscaleImage() const { return iImage; }

#if HARBOUR_DEBUG
QImage bwImage();
#endif // HARBOUR_DEBUG

zxing::ArrayRef<zxing::byte> getRow(int aY, zxing::ArrayRef<zxing::byte> aRow) const Q_DECL_OVERRIDE;
zxing::ArrayRef<zxing::byte> getMatrix() const Q_DECL_OVERRIDE;
Expand Down

0 comments on commit 2531808

Please sign in to comment.