Skip to content

Commit

Permalink
Removed warnings from histogram.cpp/.h
Browse files Browse the repository at this point in the history
  • Loading branch information
alanspencer committed Apr 14, 2020
1 parent 2cf2a93 commit 842beba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
19 changes: 17 additions & 2 deletions SPIERSedit/src/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
histgv *GVHist;
#include <QResizeEvent>

/**
* @brief histgv::histgv
*/
histgv::histgv()
{
histscene = new QGraphicsScene();
Expand All @@ -39,19 +42,29 @@ histgv::histgv()
Refresh();
}

/**
* @brief histgv::resizeEvent
* @param event
*/
void histgv::resizeEvent ( QResizeEvent *event )
{
Q_UNUSED(event);

fitInView(QRectF(0, 0, 256, 256), Qt::IgnoreAspectRatio);
}

/**
* @brief histgv::Refresh
*/
void histgv::Refresh()
{

if (!Active) return;
int bins[256];

for (int i = 0; i < 256; i++) bins[i] = 0;
for (int i = 0; i < 256; i++)
bins[i] = 0;

uchar *data;
data = GA[CurrentSegment]->bits();
int max = fwidth * fheight;
Expand All @@ -70,7 +83,9 @@ void histgv::Refresh()


int bmax = 0;
for (int i = 0; i < 256; i++) if (bins[i] > bmax) bmax = bins[i];
for (int i = 0; i < 256; i++)
if (bins[i] > bmax)
bmax = bins[i];

bmax /= 240;
if (bmax == 0) bmax = 1;
Expand Down
5 changes: 3 additions & 2 deletions SPIERSedit/src/histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ class histgv : public QGraphicsView
public:
histgv();
void Refresh();

protected:
void resizeEvent ( QResizeEvent *event ) ;
void resizeEvent ( QResizeEvent *event );

private:
QGraphicsScene *histscene;

Expand All @@ -40,7 +42,6 @@ class histgv : public QGraphicsView
QGraphicsLineItem Hist_Green[256];
QGraphicsLineItem Hist_Blue[256];
QGraphicsLineItem ThreshLine;
bool inresize;
};

extern histgv *GVHist;
Expand Down

0 comments on commit 842beba

Please sign in to comment.