summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/utils
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@digia.com>2013-12-11 10:36:42 +0200
committerMika Salmela <mika.salmela@digia.com>2013-12-11 10:43:32 +0200
commit8eedf6096de1eded74c40c4632ab2ad95b6c6f8d (patch)
treed9f5cc211004dc65bcd801163b12382f5975bc45 /src/datavisualization/utils
parent647ef62c8bdb1cc11cd93657ad32dd855e50ac79 (diff)
Fix for updateCoarseRow reset
- Also topleft updateSmoothItem Task-number: QTRD-2697 Change-Id: I9a5b03021cbeca28f9d63351580584c5567ea607 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/utils')
-rw-r--r--src/datavisualization/utils/surfaceobject.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/datavisualization/utils/surfaceobject.cpp b/src/datavisualization/utils/surfaceobject.cpp
index ca23482a..605376e2 100644
--- a/src/datavisualization/utils/surfaceobject.cpp
+++ b/src/datavisualization/utils/surfaceobject.cpp
@@ -203,12 +203,14 @@ void SurfaceObject::updateSmoothItem(const QSurfaceDataArray &dataArray, int row
int startCol = column;
if (startCol > 0)
startCol--;
+ int rightCol = m_columns - 1;
+ int topRow = m_rows - 1;
for (int i = startRow; i <= row; i++) {
for (int j = startCol; j <= column; j++) {
int p = i * m_columns + j;
- if (i < m_rows) {
- if (j < m_columns) {
+ if (i < topRow) {
+ if (j < rightCol) {
// One right and one up
m_normals[p] = normal(m_vertices.at(p),
m_vertices.at(p + 1),
@@ -221,11 +223,11 @@ void SurfaceObject::updateSmoothItem(const QSurfaceDataArray &dataArray, int row
}
} else {
// Top most line, nothing above, must have different handling.
- if (j < m_columns) {
+ if (j < rightCol) {
// Take from one down and one right. Read till second-to-last
m_normals[p] = normal(m_vertices.at(p),
- m_vertices.at(j - m_columns),
- m_vertices.at(j + 1));
+ m_vertices.at(p - m_columns),
+ m_vertices.at(p + 1));
} else {
// Top left corner. Take from one left and one down
m_normals[p] = normal(m_vertices.at(p),
@@ -446,6 +448,8 @@ void SurfaceObject::updateCoarseRow(const QSurfaceDataArray &dataArray, int rowI
if (p > 0)
p -= doubleColumns;
int rowLimit = (rowIndex + 1) * doubleColumns;
+ if (rowIndex == m_rows - 1)
+ rowLimit = rowIndex * doubleColumns; //Topmost row, no normals
for (int row = p, upperRow = p + doubleColumns;
row < rowLimit;
row += doubleColumns, upperRow += doubleColumns) {