aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/textureprovider
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/textureprovider')
-rw-r--r--examples/quick/textureprovider/Label.qml16
-rw-r--r--examples/quick/textureprovider/etcprovider.cpp14
-rw-r--r--examples/quick/textureprovider/main.cpp20
-rw-r--r--examples/quick/textureprovider/textureprovider.qml16
4 files changed, 50 insertions, 16 deletions
diff --git a/examples/quick/textureprovider/Label.qml b/examples/quick/textureprovider/Label.qml
index 46ef201fc7..3df456fa05 100644
--- a/examples/quick/textureprovider/Label.qml
+++ b/examples/quick/textureprovider/Label.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp
index de8eb12366..65960169e2 100644
--- a/examples/quick/textureprovider/etcprovider.cpp
+++ b/examples/quick/textureprovider/etcprovider.cpp
@@ -137,7 +137,7 @@ void EtcTexture::bind()
#endif
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- Q_ASSERT(ctx != 0);
+ Q_ASSERT(ctx != nullptr);
ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES,
m_size.width(), m_size.height(), 0,
(m_paddedSize.width() * m_paddedSize.height()) >> 1,
@@ -166,10 +166,10 @@ public:
QSize m_size;
QSize m_paddedSize;
- QSize textureSize() const { return m_size; }
- int textureByteCount() const { return m_data.size(); }
+ QSize textureSize() const override { return m_size; }
+ int textureByteCount() const override { return m_data.size(); }
- QSGTexture *createTexture(QQuickWindow *) const {
+ QSGTexture *createTexture(QQuickWindow *) const override {
EtcTexture *texture = new EtcTexture;
texture->m_data = m_data;
texture->m_size = m_size;
@@ -181,7 +181,7 @@ public:
QQuickTextureFactory *EtcProvider::requestTexture(const QString &id, QSize *size, const QSize &requestedSize)
{
Q_UNUSED(requestedSize);
- QEtcTextureFactory *ret = 0;
+ QEtcTextureFactory *ret = nullptr;
size->setHeight(0);
size->setWidth(0);
@@ -199,7 +199,7 @@ QQuickTextureFactory *EtcProvider::requestTexture(const QString &id, QSize *size
ret = new QEtcTextureFactory;
ret->m_data = file.readAll();
if (!ret->m_data.isEmpty()) {
- ETCHeader *pETCHeader = NULL;
+ ETCHeader *pETCHeader = nullptr;
pETCHeader = (ETCHeader *)ret->m_data.data();
size->setHeight(getHeight(pETCHeader));
size->setWidth(getWidth(pETCHeader));
@@ -209,7 +209,7 @@ QQuickTextureFactory *EtcProvider::requestTexture(const QString &id, QSize *size
}
else {
delete ret;
- ret = 0;
+ ret = nullptr;
}
}
diff --git a/examples/quick/textureprovider/main.cpp b/examples/quick/textureprovider/main.cpp
index ea4f73127d..658620bc82 100644
--- a/examples/quick/textureprovider/main.cpp
+++ b/examples/quick/textureprovider/main.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
@@ -48,6 +58,10 @@ int main(int argc, char* argv[])
QGuiApplication app(argc,argv);
QQuickView view;
+ /*
+ NOTE: ETC compressed textures in PKM files are supported out-of-the-box since Qt 5.10.
+ However, we retain this example to show how custom texture providers can be integrated.
+ */
EtcProvider *provider = new EtcProvider();
provider->setBaseUrl(QUrl("qrc:///textureprovider/"));
view.engine()->addImageProvider("etc", provider);
diff --git a/examples/quick/textureprovider/textureprovider.qml b/examples/quick/textureprovider/textureprovider.qml
index dc1946d755..b8cfe31397 100644
--- a/examples/quick/textureprovider/textureprovider.qml
+++ b/examples/quick/textureprovider/textureprovider.qml
@@ -1,12 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are