39QSizeF QQuickItemSpy::requiredTextureSize()
const
41 QSizeF sz = mapRectToScene(QRectF(0, 0, width(), height())).size();
43 const qreal dpr = window() !=
nullptr ? window()->devicePixelRatio() : 1.0;
45 sz.setWidth(std::max(1.0, sz.width() * dpr));
46 sz.setHeight(std::max(1.0, sz.height() * dpr));
48 if (window() !=
nullptr && window()->rhi() !=
nullptr) {
49 QRhi *rhi = window()->rhi();
50 const int textureSizeMax = rhi->resourceLimit(QRhi::TextureSizeMax);
52 if (sz.width() > textureSizeMax || sz.height() > textureSizeMax) {
53 if (sz.width() > sz.height())
54 sz = QSizeF(textureSizeMax, sz.height() * (textureSizeMax / sz.width()));
56 sz = QSizeF(sz.width() * (textureSizeMax / sz.height()), textureSizeMax);
63void QQuickItemSpy::itemChange(ItemChange change,
const ItemChangeData &value)
65 if (change == ItemTransformHasChanged || change == ItemDevicePixelRatioHasChanged)
66 emit requiredTextureSizeChanged();
68 QQuickItem::itemChange(change, value);