diff options
Diffstat (limited to 'src/chartsqml2/declarativerendernode.cpp')
-rw-r--r-- | src/chartsqml2/declarativerendernode.cpp | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/chartsqml2/declarativerendernode.cpp b/src/chartsqml2/declarativerendernode.cpp index 583ddb7f..c11f6b00 100644 --- a/src/chartsqml2/declarativerendernode.cpp +++ b/src/chartsqml2/declarativerendernode.cpp @@ -1,23 +1,31 @@ -/****************************************************************************** +/**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Charts module. -** -** $QT_BEGIN_LICENSE:COMM$ +** This file is part of the Qt Charts module of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:GPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** -******************************************************************************/ +****************************************************************************/ #include "declarativerendernode.h" @@ -88,9 +96,10 @@ static const char *vertexSource = "uniform highp vec2 min;\n" "uniform highp vec2 delta;\n" "uniform highp float pointSize;\n" + "uniform highp mat4 matrix;\n" "void main() {\n" " vec2 normalPoint = vec2(-1, -1) + ((points - min) / delta);\n" - " gl_Position = vec4(normalPoint, 0, 1);\n" + " gl_Position = matrix * vec4(normalPoint, 0, 1);\n" " gl_PointSize = pointSize;\n" "}"; static const char *fragmentSource = @@ -115,6 +124,7 @@ void DeclarativeRenderNode::initGL() m_minUniformLoc = m_program->uniformLocation("min"); m_deltaUniformLoc = m_program->uniformLocation("delta"); m_pointSizeUniformLoc = m_program->uniformLocation("pointSize"); + m_matrixUniformLoc = m_program->uniformLocation("matrix"); // Create a vertex array object. In OpenGL ES 2.0 and OpenGL 2.x // implementations this is optional and support may not be present @@ -175,13 +185,7 @@ void DeclarativeRenderNode::setSeriesData(bool mapDirty, const GLXYDataMap &data const GLXYSeriesData *newData = i.value(); if (!data || newData->dirty) { data = new GLXYSeriesData; - data->array = newData->array; - data->color = newData->color; - data->dirty = newData->dirty; - data->width = newData->width; - data->type = newData->type; - data->min = newData->min; - data->delta = newData->delta; + *data = *newData; } m_xyDataMap.insert(i.key(), data); } @@ -200,15 +204,8 @@ void DeclarativeRenderNode::setSeriesData(bool mapDirty, const GLXYDataMap &data const GLXYSeriesData *newData = i.value(); if (i.value()->dirty) { GLXYSeriesData *data = m_xyDataMap.value(i.key()); - if (data) { - data->array = newData->array; - data->color = newData->color; - data->dirty = newData->dirty; - data->width = newData->width; - data->type = newData->type; - data->min = newData->min; - data->delta = newData->delta; - } + if (data) + *data = *newData; } } } @@ -238,6 +235,7 @@ void DeclarativeRenderNode::renderGL() m_program->setUniformValue(m_colorUniformLoc, data->color); m_program->setUniformValue(m_minUniformLoc, data->min); m_program->setUniformValue(m_deltaUniformLoc, data->delta); + m_program->setUniformValue(m_matrixUniformLoc, data->matrix); if (!vbo) { vbo = new QOpenGLBuffer; |