MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / renderImage

Method renderImage

source/windowing/StarCanvasWidget.cpp:163–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void 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
177void CanvasWidget::renderImageRect(Vec2F const& renderingOffset, String const& texName, RectF const& texCoords, RectF const& screenCoords, Vec4B const& color) {
178 auto& context = GuiContext::singleton();

Callers

nothing calls this directly

Calls 4

singletonClass · 0.85
textureSizeMethod · 0.80
drawQuadMethod · 0.80
interfaceScaleMethod · 0.45

Tested by

no test coverage detected