diff options
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 0ab929f9a7..d209cb57c5 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -783,7 +783,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, void QQuickWindowPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining) { - QQmlGuard<QQuickItem> item(*items); + QPointer<QQuickItem> item(*items); if (remaining) notifyFocusChangesRecur(items + 1, remaining - 1); @@ -2812,6 +2812,8 @@ QQmlIncubationController *QQuickWindow::incubationController() const \value TextureOwnsGLTexture The texture object owns the texture id and will delete the GL texture when the texture object is deleted. + + \value TextureCanUseAtlas The image can be uploaded into a texture atlas. */ /*! @@ -2904,6 +2906,14 @@ bool QQuickWindow::clearBeforeRendering() const return d->clearBeforeRendering; } +/*! + \overload + */ + +QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const +{ + return createTextureFromImage(image, 0); +} /*! @@ -2913,10 +2923,11 @@ bool QQuickWindow::clearBeforeRendering() const The caller of the function is responsible for deleting the returned texture. The actual GL texture will be deleted when the texture object is deleted. - Depending on the underlying implementation of the scene graph, the returned - texture may be part of an atlas. For code to be portable across implementations - one should always use the texture coordinates returned from - QSGTexture::normalizedTextureSubRect() when building geometry. + When \a options contains TextureCanUseAtlas the engine may put the image + into a texture atlas. Textures in an atlas need to rely on + QSGTexture::normalizedTextureSubRect() for their geometry and will not + support QSGTexture::Repeat. Other values from CreateTextureOption are + ignored. \warning This function will return 0 if the scene graph has not yet been initialized. @@ -2932,11 +2943,15 @@ bool QQuickWindow::clearBeforeRendering() const \sa sceneGraphInitialized() */ -QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const +QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateTextureOptions options) const { Q_D(const QQuickWindow); - if (d->context && d->context->isReady()) - return d->context->createTexture(image); + if (d->context && d->context->isReady()) { + if (options & TextureCanUseAtlas) + return d->context->createTexture(image); + else + return d->context->createTextureNoAtlas(image); + } else return 0; } @@ -2948,7 +2963,8 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const The caller of the function is responsible for deleting the returned texture. - Use \a options to customize the texture attributes. + Use \a options to customize the texture attributes. The TextureUsesAtlas + option is ignored. \warning This function will return 0 if the scenegraph has not yet been initialized. |