summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-12 07:31:50 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-12 08:33:08 +0200
commit990969655c5fb4d03682e96df9b12101f5ee9815 (patch)
treeb8fb5c50285105c8bc5a938fb50f93ff9f24889d /src/opengl
parenta213011a53f12f101d08a04afc8fdacd2d54a232 (diff)
parente64b2234e829cc47872225debcf80d6c06db18f0 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: config_help.txt configure src/corelib/io/qprocess_wince.cpp src/plugins/platforms/windows/qwindowstheme.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qtimezone/BLACKLIST tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache.cpp19
-rw-r--r--src/opengl/qgl.cpp2
3 files changed, 10 insertions, 13 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index fff64506ab..ec673e8726 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -333,7 +333,7 @@ QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name)
QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog)
{
for (int i = 0; i < cachedPrograms.size(); ++i) {
- QGLEngineShaderProg *cachedProg = cachedPrograms[i];
+ QGLEngineShaderProg *cachedProg = cachedPrograms.at(i);
if (*cachedProg == prog) {
// Move the program to the top of the list as a poor-man's cache algo
cachedPrograms.move(i, 0);
diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp
index 943560da4a..b4ca49514f 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache.cpp
+++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp
@@ -102,7 +102,7 @@ GLuint QGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity)
QMutexLocker lock(&m_mutex);
quint64 hash_val = 0;
- QGradientStops stops = gradient.stops();
+ const QGradientStops stops = gradient.stops();
for (int i = 0; i < stops.size() && i <= 2; i++)
hash_val += stops[i].second.rgba();
@@ -172,16 +172,12 @@ static inline uint qtToGlColor(uint c)
void QGL2GradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const
{
int pos = 0;
- QGradientStops s = gradient.stops();
- QVector<uint> colors(s.size());
-
- for (int i = 0; i < s.size(); ++i)
- colors[i] = s[i].second.rgba(); // Qt LIES! It returns ARGB (on little-endian AND on big-endian)
-
+ const QGradientStops s = gradient.stops();
bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation);
uint alpha = qRound(opacity * 256);
- uint current_color = ARGB_COMBINE_ALPHA(colors[0], alpha);
+ // Qt LIES! It returns ARGB (on little-endian AND on big-endian)
+ uint current_color = ARGB_COMBINE_ALPHA(s[0].second.rgba(), alpha);
qreal incr = 1.0 / qreal(size);
qreal fpos = 1.5 * incr;
colorTable[pos++] = qtToGlColor(qPremultiply(current_color));
@@ -195,9 +191,10 @@ void QGL2GradientCache::generateGradientColorTable(const QGradient& gradient, ui
if (colorInterpolation)
current_color = qPremultiply(current_color);
- for (int i = 0; i < s.size() - 1; ++i) {
+ const int sLast = s.size() - 1;
+ for (int i = 0; i < sLast; ++i) {
qreal delta = 1/(s[i+1].first - s[i].first);
- uint next_color = ARGB_COMBINE_ALPHA(colors[i+1], alpha);
+ uint next_color = ARGB_COMBINE_ALPHA(s[i + 1].second.rgba(), alpha);
if (colorInterpolation)
next_color = qPremultiply(next_color);
@@ -216,7 +213,7 @@ void QGL2GradientCache::generateGradientColorTable(const QGradient& gradient, ui
Q_ASSERT(s.size() > 0);
- uint last_color = qtToGlColor(qPremultiply(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha)));
+ uint last_color = qtToGlColor(qPremultiply(ARGB_COMBINE_ALPHA(s[sLast].second.rgba(), alpha)));
for (;pos < size; ++pos)
colorTable[pos] = last_color;
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index a17beb898d..f249984893 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -5235,7 +5235,7 @@ void QGLContextGroup::removeShare(const QGLContext *context) {
// Update context group representative.
Q_ASSERT(group->m_shares.size() != 0);
if (group->m_context == context)
- group->m_context = group->m_shares[0];
+ group->m_context = group->m_shares.at(0);
// If there is only one context left, then make the list empty.
if (group->m_shares.size() == 1)