summaryrefslogtreecommitdiffstats
path: root/src/datavisualization
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2014-10-14 13:29:18 +0300
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2014-10-14 13:33:04 +0300
commitd0244a84f150fe59327afa9bd59d0f9cdde72406 (patch)
tree5d217e336ae9e3f68a15c97903182fba0e8d7e8c /src/datavisualization
parent7d954d485255acd7f40d6facb1b90e75e375641f (diff)
Gradient adjustment logic was broken.
Bug in adjustment logic caused adjustment to happen pretty much always. Task-number: QTRD-3374 Change-Id: Id6151d2d3eb8369bbf9252e4eb4b76ed57fb1f3c Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavisualization')
-rw-r--r--src/datavisualization/utils/scatterobjectbufferhelper.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/datavisualization/utils/scatterobjectbufferhelper.cpp b/src/datavisualization/utils/scatterobjectbufferhelper.cpp
index 6135c225..8925a7a4 100644
--- a/src/datavisualization/utils/scatterobjectbufferhelper.cpp
+++ b/src/datavisualization/utils/scatterobjectbufferhelper.cpp
@@ -233,8 +233,8 @@ uint ScatterObjectBufferHelper::createRangeGradientUVs(ScatterSeriesRenderCache
const ScatterRenderItemArray &renderArray = cache->renderArray();
const bool updateAll = (cache->updateIndices().size() == 0);
const int updateSize = updateAll ? renderArray.size() : cache->updateIndices().size();
- const float yAdjustment = 0.1f / gradientTextureHeight;
- const float flippedYAdjustment = 0.9f / gradientTextureHeight;
+ const float yAdjustment = 0.1f;
+ const float flippedYAdjustment = 0.9f;
QVector2D uv;
uv.setX(0.0f);
@@ -250,11 +250,11 @@ uint ScatterObjectBufferHelper::createRangeGradientUVs(ScatterSeriesRenderCache
// Avoid values near gradient texel boundary, as this causes artifacts
// with some graphics cards.
const float floorY = float(qFloor(y * gradientTextureHeight));
- const float diff = y - floorY;
+ const float diff = (y * gradientTextureHeight) - floorY;
if (diff < yAdjustment)
- y += yAdjustment;
+ y += yAdjustment / gradientTextureHeight;
else if (diff > flippedYAdjustment)
- y -= yAdjustment;
+ y -= yAdjustment / gradientTextureHeight;
uv.setY(y);
int offset = pos * uvsCount;