Code/Editor

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-16 15:56:36 -07:00
parent e6b5342c07
commit 2963739288
51 changed files with 286 additions and 337 deletions
+10 -10
View File
@@ -175,7 +175,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
penSpikes = penColor;
painter.setPen(Qt::black);
painter.setBrush(Qt::white);
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), abs(rc.height() * m_graphHeightPercent)));
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), static_cast<int>(abs(rc.height() * m_graphHeightPercent))));
painter.drawRect(rcGraph);
painter.setPen(penSpikes);
@@ -193,7 +193,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
{
float scale = 0;
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
switch (m_drawMode)
@@ -245,7 +245,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
}
crtX = static_cast<int>(rcGraph.left() + x + 1);
painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight);
painter.drawLine(crtX, graphBottom, crtX, static_cast<int>(graphBottom - scale * graphHeight));
}
}
else
@@ -258,7 +258,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
crtX = static_cast<UINT>(rcGraph.left() + x + 1);
scaleR = scaleG = scaleB = scaleA = 0;
@@ -283,10 +283,10 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
scaleA = (float)m_count[3][i] / m_maxCount[3];
}
heightR = graphBottom - scaleR * graphHeight;
heightG = graphBottom - scaleG * graphHeight;
heightB = graphBottom - scaleB * graphHeight;
heightA = graphBottom - scaleA * graphHeight;
heightR = static_cast<int>(graphBottom - scaleR * graphHeight);
heightG = static_cast<int>(graphBottom - scaleG * graphHeight);
heightB = static_cast<int>(graphBottom - scaleB * graphHeight);
heightA = static_cast<int>(graphBottom - scaleA * graphHeight);
if (lastHeight[0] == INT_MAX)
{
@@ -350,7 +350,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
pos = (float)x / graphWidth;
i = (float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels;
i = static_cast<int>((float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels);
i = CLAMP(i, 0, kNumColorLevels - 1);
scale = 0;
@@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
}
painter.setPen(pPen);
painter.drawLine(rcGraph.left() + static_cast<int>(x) + 1, graphBottom, rcGraph.left() + static_cast<int>(x) + 1, graphBottom - scale * graphHeight);
painter.drawLine(rcGraph.left() + static_cast<int>(x) + 1, graphBottom, rcGraph.left() + static_cast<int>(x) + 1, static_cast<int>(graphBottom - scale * graphHeight));
}
// then draw 3 lines so we separate the channels