void QSGBasicInternalImageNode::preprocess() { bool doDirty = false; QSGDynamicTexture *t = qobject_cast<QSGDynamicTexture *>(materialTexture()); if (t) { doDirty = t->updateTexture(); if (doDirty) { // The geometry may need updating. This is expensive however, so do // it only when something relevant has changed. if (t != m_dynamicTexture || t->textureSize() != m_dynamicTextureSize || t->normalizedTextureSubRect() != m_dynamicTextureSubRect) { updateGeometry(); m_dynamicTextureSize = t->textureSize(); m_dynamicTextureSubRect = t->normalizedTextureSubRect(); } } } m_dynamicTexture = t; if (updateMaterialBlending()) doDirty = true; if (doDirty) markDirty(DirtyMaterial); }
// THIS METHOD IS EXECUTED IN THE RENDERING THREAD void QmlAsTexture::textureChanged() { if (!this->effectItem) return ; QSGDynamicTexture *txt = dynamic_cast<QSGDynamicTexture*>(this->provider->texture()); if (txt) { qDebug() << "Texture Id " << txt->textureId() << " SIZE " << txt->textureSize(); this->effectItem->setDynamicTexture(txt->textureId(), txt->textureSize()); } }