diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-02-03 17:36:55 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 21:00:00 +0100 |
commit | a2e92f6dee12320a58a4bcc95c14649b27804427 (patch) | |
tree | 3198365f9f7ca75cc3c4bd23340bb5fe15ee63a5 /src/quick/scenegraph/qsgdefaultimagenode.cpp | |
parent | 337524714cad51934879d817564c5d58e6dbd0c0 (diff) |
Dynamic GL in Quick
The counterpart to I716fdebb. Implements the dynamic path
in scenegraph.
Task-number: QTBUG-36483
Change-Id: I2dc613ba84560b7b8e36d3cd1da61c050ab08db0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultimagenode.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultimagenode.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index 926c0c1f4a..9113d1e447 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -307,13 +307,11 @@ void QSGDefaultImageNode::preprocess() markDirty(DirtyMaterial); } -#ifdef QT_OPENGL_ES_2 inline static bool isPowerOfTwo(int x) { // Assumption: x >= 1 return x == (x & -x); } -#endif namespace { struct X { float x, tx; }; @@ -360,15 +358,18 @@ void QSGDefaultImageNode::updateGeometry() bool hasTiles = hTiles != 1 || vTiles != 1; bool fullTexture = innerSourceRect == QRectF(0, 0, 1, 1); -#ifdef QT_OPENGL_ES_2 - QOpenGLContext *ctx = QOpenGLContext::currentContext(); - bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); - QSize size = t->textureSize(); - bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height()); - bool wrapSupported = npotSupported || !isNpot; -#else bool wrapSupported = true; + + QOpenGLContext *ctx = QOpenGLContext::currentContext(); +#ifndef QT_OPENGL_ES_2 + if (ctx->isES()) #endif + { + bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); + QSize size = t->textureSize(); + const bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height()); + wrapSupported = npotSupported || !isNpot; + } // An image can be rendered as a single quad if: // - There are no margins, and either: |