diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-02-02 17:58:30 -0200 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-02-02 17:58:30 -0200 |
commit | 28f8ac15898f029e86ab7cb01f41964ac7997538 (patch) | |
tree | e4cbfae3d7ec2977f877812a1da62287f7253091 | |
parent | dc50effe61c833da9c15b886d5ebba65620b99f0 (diff) |
Changes to make code more portable across different compilers.
-rw-r--r-- | colorscale.cpp | 2 | ||||
-rw-r--r-- | main.h | 4 | ||||
-rw-r--r-- | skelft_core.cpp | 7 | ||||
-rw-r--r-- | voronoisplat.cpp | 9 |
4 files changed, 9 insertions, 13 deletions
diff --git a/colorscale.cpp b/colorscale.cpp index 38898c3..06852d4 100644 --- a/colorscale.cpp +++ b/colorscale.cpp @@ -1,7 +1,7 @@ #include "colorscale.h" ColorScale::ColorScale(const QColor &firstColor, const QColor &lastColor) - : m_colors{firstColor, lastColor} + : m_colors{{firstColor, lastColor}} { setExtents(0, 1); } @@ -128,11 +128,11 @@ public slots: private: Main(QObject *parent = 0) : QObject(parent) - , COLOR_SCALE_CATEGORICAL{ + , COLOR_SCALE_CATEGORICAL{{ QColor("#1f77b4"), QColor("#ff7f0e"), QColor("#2ca02c"), QColor("#d62728"), QColor("#9467bd"), QColor("#8c564b"), QColor("#e377c2"), QColor("#17becf"), QColor("#7f7f7f"), - } + }} , COLOR_SCALE_CONTINUOUS{ContinuousColorScale::builtin(ContinuousColorScale::HEATED_OBJECTS)} , COLOR_SCALE_DIVERGENT{ContinuousColorScale::builtin(ContinuousColorScale::RED_GRAY_BLUE)} , COLOR_SCALE_RAINBOW{ContinuousColorScale::builtin(ContinuousColorScale::RAINBOW)} diff --git a/skelft_core.cpp b/skelft_core.cpp index e4cec20..3b85fb0 100644 --- a/skelft_core.cpp +++ b/skelft_core.cpp @@ -1,3 +1,4 @@ +#include <algorithm> #include <cstdlib> #include <cmath> #include <cstring> @@ -31,8 +32,8 @@ int skelft2DSize(int nx, int ny) { pow(2.0f, int(log(float(nx)) / log(2.0f) + 1))); // Find minimal pow of 2 which fits the input image int dy = (int) floor(pow(2.0f, int(log(float(ny)) / log(2.0f) + 1))); - int fboSize = max(dx, dy); // DT/FT/skeleton image size (pow of 2, should be - // able to contain the input image) + int fboSize = std::max(dx, dy); // DT/FT/skeleton img size (pow of 2, should + // be able to contain the input image) return fboSize; } @@ -184,7 +185,7 @@ void skelft2DSave(short *outputFT, int dx, int dy, const char *f) { int size = dx * dy; int bb = 0; - float range = max(dx, dy) / 255.0f; + float range = std::max(dx, dy) / 255.0f; for (short *v = outputFT, *vend = outputFT + size; v < vend; ++v) { short val = *v; buf[bb++] = (unsigned char) (val / range); diff --git a/voronoisplat.cpp b/voronoisplat.cpp index f5aa69b..7c5641b 100644 --- a/voronoisplat.cpp +++ b/voronoisplat.cpp @@ -161,16 +161,11 @@ QQuickFramebufferObject::Renderer *VoronoiSplat::createRenderer() const } VoronoiSplatRenderer::VoronoiSplatRenderer() - : m_transform{ - { 0.0f, 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 1.0f }, - } - , m_sx(0.0f, 1.0f, 0.0f, 1.0f) + : m_sx(0.0f, 1.0f, 0.0f, 1.0f) , m_sy(0.0f, 1.0f, 0.0f, 1.0f) , gl(QOpenGLContext::currentContext()) { + std::fill(&m_transform[0][0], &m_transform[0][0] + 16, 0.0f); m_transform[3][3] = 1.0f; gl.glGenFramebuffers(1, &m_FBO); |