From 54f31a64d01a138e72f79b9585cb90004bbe1e4a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 29 Aug 2019 12:27:59 +0200 Subject: Avoid introducing rhiTexture() in the public API of QSGTexture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need for this. The few internal users can get it via QSGTexturePrivate. The original thinking was based on QRhi* being a public API, but that is not the case in the near future. So avoid introducing a public API relying on QRhiTexture. This of course makes it impossible to retrieve the native object under a QSGTexture (as textureId() is not used anymore when rendering with the RHI). For that, an alternative approach will be introduced later on. Change-Id: I0099b23424cafa4958f78c03300b0c934b60d92c Reviewed-by: Christian Strømme --- src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp') diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index db889c3102..8fc8c711c6 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -451,7 +451,9 @@ bool QSGTextMaskRhiShader::updateUniformData(const RenderState &state, changed = true; } - if (updated || !oldMat || oldMat->texture()->rhiTexture() != mat->texture()->rhiTexture()) { + QRhiTexture *oldRtex = oldMat ? QSGTexturePrivate::get(oldMat->texture())->rhiTexture() : nullptr; + QRhiTexture *newRtex = QSGTexturePrivate::get(mat->texture())->rhiTexture(); + if (updated || !oldMat || oldRtex != newRtex) { const QVector2D textureScale = QVector2D(1.0f / mat->rhiGlyphCache()->width(), 1.0f / mat->rhiGlyphCache()->height()); memcpy(buf->data() + 64 + 16, &textureScale, 8); -- cgit v1.2.3