| 161 | } |
| 162 | |
| 163 | void CanvasWidget::renderImage(Vec2F const& renderingOffset, String const& texName, Vec2F const& position, float scale, Vec4B const& color, bool centered) { |
| 164 | auto& context = GuiContext::singleton(); |
| 165 | auto texSize = Vec2F(context.textureSize(texName)); |
| 166 | Vec2F pos = centered ? (position - scale * texSize / 2.0f) : position; |
| 167 | |
| 168 | RectF screenCoords; |
| 169 | if (m_ignoreInterfaceScale) |
| 170 | screenCoords = RectF::withSize(renderingOffset + pos, texSize * scale); |
| 171 | else |
| 172 | screenCoords = RectF::withSize(renderingOffset * context.interfaceScale() + pos * context.interfaceScale(), texSize * scale * context.interfaceScale()); |
| 173 | |
| 174 | context.drawQuad(texName, screenCoords, color); |
| 175 | } |
| 176 | |
| 177 | void CanvasWidget::renderImageRect(Vec2F const& renderingOffset, String const& texName, RectF const& texCoords, RectF const& screenCoords, Vec4B const& color) { |
| 178 | auto& context = GuiContext::singleton(); |
nothing calls this directly
no test coverage detected