aboutsummaryrefslogtreecommitdiff
path: root/colormap.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-17 20:49:36 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-17 20:49:36 +0100
commit70fe1f77ec22790ab4bd8ac92a28ceadc41585ae (patch)
tree73f9344bb3fe77049d931ba7ef23420948a74903 /colormap.cpp
parent47bcc9b08a8473298d564cee495cd609909ddcbc (diff)
Colormap & VoronoiSplat: minor change to colormap texture creation.
Diffstat (limited to 'colormap.cpp')
-rw-r--r--colormap.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/colormap.cpp b/colormap.cpp
index 545151f..4d60021 100644
--- a/colormap.cpp
+++ b/colormap.cpp
@@ -28,7 +28,7 @@ private:
ColormapTexture::ColormapTexture(const std::vector<float> *cmap)
: gl(QOpenGLContext::currentContext())
- , m_size(Colormap::SAMPLES, 1)
+ , m_size(cmap->size() / 3, 1)
, m_cmap(cmap)
{
// Setup OpenGL texture
@@ -61,7 +61,6 @@ Colormap::Colormap(QQuickItem *parent)
: QQuickItem(parent)
, m_texture(0)
, m_shouldUpdateTexture(false)
- , m_cmap(3*SAMPLES)
{
setFlag(QQuickItem::ItemHasContents);
}
@@ -76,7 +75,8 @@ Colormap::~Colormap()
void Colormap::setColorScale(const ColorScale &scale)
{
- scale.sample(SAMPLES, m_cmap.begin());
+ m_cmap.resize(scale.numColors() * 3);
+ scale.sample(scale.numColors(), m_cmap.data());
emit colorScaleChanged(scale);
m_shouldUpdateTexture = true;