aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/textureprovider/etcprovider.cpp9
-rw-r--r--examples/quick/textureprovider/etcprovider.h11
2 files changed, 15 insertions, 5 deletions
diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp
index 65960169e2..f542d510b2 100644
--- a/examples/quick/textureprovider/etcprovider.cpp
+++ b/examples/quick/textureprovider/etcprovider.cpp
@@ -116,6 +116,15 @@ int EtcTexture::textureId() const
return m_texture_id;
}
+int EtcTexture::comparisonKey() const
+{
+ if (m_texture_id)
+ return m_texture_id;
+
+ // two textures (and so materials) with not-yet-created texture underneath are never equal
+ return int(qintptr(this));
+}
+
void EtcTexture::bind()
{
if (m_uploaded && m_texture_id) {
diff --git a/examples/quick/textureprovider/etcprovider.h b/examples/quick/textureprovider/etcprovider.h
index 44d5d6f53e..7de03e0955 100644
--- a/examples/quick/textureprovider/etcprovider.h
+++ b/examples/quick/textureprovider/etcprovider.h
@@ -78,13 +78,14 @@ public:
EtcTexture();
~EtcTexture();
- void bind();
+ void bind() override;
- QSize textureSize() const { return m_size; }
- int textureId() const;
+ QSize textureSize() const override { return m_size; }
+ int textureId() const override;
+ int comparisonKey() const override;
- bool hasAlphaChannel() const { return false; }
- bool hasMipmaps() const { return false; }
+ bool hasAlphaChannel() const override { return false; }
+ bool hasMipmaps() const override { return false; }
QByteArray m_data;
QSize m_size;