Changeset View
Standalone View
src/declarativeimports/core/framesvgitem.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | 132 | { | |||
---|---|---|---|---|---|
140 | //for atlas' this will only be a small part of the texture | 140 | //for atlas' this will only be a small part of the texture | ||
141 | QRectF textureRect; | 141 | QRectF textureRect; | ||
142 | 142 | | |||
143 | if (m_fitMode == Tile) { | 143 | if (m_fitMode == Tile) { | ||
144 | textureRect = QRectF(0,0,1,1); //we can never be in an atlas for tiled images. | 144 | textureRect = QRectF(0,0,1,1); //we can never be in an atlas for tiled images. | ||
145 | 145 | | |||
146 | //if tiling horizontally | 146 | //if tiling horizontally | ||
147 | if (m_border == FrameSvg::TopBorder || m_border == FrameSvg::BottomBorder || m_border == FrameSvg::NoBorder) { | 147 | if (m_border == FrameSvg::TopBorder || m_border == FrameSvg::BottomBorder || m_border == FrameSvg::NoBorder) { | ||
148 | textureRect.setWidth(nodeRect.width() / m_elementNativeSize.width()); | 148 | textureRect.setWidth(qMax(1, nodeRect.width() / m_elementNativeSize.width())); | ||
apol: Makes sense to me. Should we also use qRound? | |||||
qRound would mean that samples are also stretched beyond their original size if rounding up is done, right? In that case the pixel quality might be an issue perhaps. For the stretching needs I smell this could get input from the fractional resolution experts, to know if oversampling better also gets support for higher-resolution samples. Seems this really depends on the nature of the look, and for the case of stretching with full sample copies one might provide a higher resolution sample, to keep quality. Makes me wonder how complex this should get and if theme authors actually really need all such options :) Possibly the best for now is to just keep the existing behaviour, but limit to the minimum 1. kossebau: qRound would mean that samples are also stretched beyond their original size if rounding up is… | |||||
149 | } | 149 | } | ||
150 | //if tiling vertically | 150 | //if tiling vertically | ||
151 | if (m_border == FrameSvg::LeftBorder || m_border == FrameSvg::RightBorder || m_border == FrameSvg::NoBorder) { | 151 | if (m_border == FrameSvg::LeftBorder || m_border == FrameSvg::RightBorder || m_border == FrameSvg::NoBorder) { | ||
152 | textureRect.setHeight(nodeRect.height() / m_elementNativeSize.height()); | 152 | textureRect.setHeight(qMax(1, nodeRect.height() / m_elementNativeSize.height())); | ||
153 | } | 153 | } | ||
154 | } else if (m_fitMode == Stretch) { | 154 | } else if (m_fitMode == Stretch) { | ||
155 | QString prefix = m_frameSvg->frameSvg()->actualPrefix(); | 155 | QString prefix = m_frameSvg->frameSvg()->actualPrefix(); | ||
156 | 156 | | |||
157 | QString elementId = prefix + FrameSvgHelpers::borderToElementId(m_border); | 157 | QString elementId = prefix + FrameSvgHelpers::borderToElementId(m_border); | ||
158 | 158 | | |||
159 | //re-render the SVG at new size | 159 | //re-render the SVG at new size | ||
160 | updateTexture(nodeRect.size(), elementId); | 160 | updateTexture(nodeRect.size(), elementId); | ||
▲ Show 20 Lines • Show All 509 Lines • Show Last 20 Lines |
Makes sense to me. Should we also use qRound?