aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgatlastexture.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-06-17 14:23:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-02 13:28:19 +0200
commitd1af0a90e6663d49c3e78ac674b0a1ae040c2085 (patch)
treefd8b386b2602887872ecd51b50f40e0f76a5f99d /src/quick/scenegraph/util/qsgatlastexture.cpp
parentbf3594196f7166be6e843679b77210ab5f5da337 (diff)
Use qNextPowerOfTwo instead of reimplementing it
This patch uses the new shared qNextPowerOfTwo implementation introduced in qtbase. Change-Id: I831d056f584897a99df2ceb8c1d840764464e344 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/quick/scenegraph/util/qsgatlastexture.cpp')
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index f7cf97954a..ceeaa977d7 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -43,6 +43,7 @@
#include <QtCore/QVarLengthArray>
#include <QtCore/QElapsedTimer>
+#include <QtCore/QtMath>
#include <QtGui/QOpenGLContext>
#include <QtGui/QGuiApplication>
@@ -67,18 +68,6 @@ static QElapsedTimer qsg_renderer_timer;
namespace QSGAtlasTexture
{
-static inline int qsg_powerOfTwo(int v)
-{
- v--;
- v |= v >> 1;
- v |= v >> 2;
- v |= v >> 4;
- v |= v >> 8;
- v |= v >> 16;
- ++v;
- return v;
-}
-
static int qsg_envInt(const char *name, int defaultValue)
{
QByteArray content = qgetenv(name);
@@ -98,8 +87,8 @@ Manager::Manager()
int max;
gl->functions()->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
- int w = qMin(max, qsg_envInt("QSG_ATLAS_WIDTH", qMax(512, qsg_powerOfTwo(surfaceSize.width()))));
- int h = qMin(max, qsg_envInt("QSG_ATLAS_HEIGHT", qMax(512, qsg_powerOfTwo(surfaceSize.height()))));
+ int w = qMin(max, qsg_envInt("QSG_ATLAS_WIDTH", qMax(512U, qNextPowerOfTwo(surfaceSize.width() - 1))));
+ int h = qMin(max, qsg_envInt("QSG_ATLAS_HEIGHT", qMax(512U, qNextPowerOfTwo(surfaceSize.height() - 1))));
if (surface->surfaceClass() == QSurface::Window) {
QWindow *window = static_cast<QWindow *>(surface);