void TextLayer::updateResources(VidgfxContext *gfx) { // Completely recreate texture if needed recreateTexture(gfx); //------------------------------------------------------------------------- // Update vertex buffer setVisibleRect(QRect()); // Invisible by default if(m_texture == NULL) return; // Never scale our texture and always align it to the left (The user // needs to set the alignment in the text document itself) LyrAlignment alignment; switch(m_alignment) { default: case LyrTopLeftAlign: case LyrTopCenterAlign: case LyrTopRightAlign: alignment = LyrTopLeftAlign; break; case LyrMiddleLeftAlign: case LyrMiddleCenterAlign: case LyrMiddleRightAlign: alignment = LyrMiddleLeftAlign; break; case LyrBottomLeftAlign: case LyrBottomCenterAlign: case LyrBottomRightAlign: alignment = LyrBottomLeftAlign; break; } QSize exStrokeSize = vidgfx_tex_get_size(m_texture); exStrokeSize.rwidth() -= m_strokeSize * 2; exStrokeSize.rheight() -= m_strokeSize * 2; QRectF rect = createScaledRectInBounds( exStrokeSize, m_rect, LyrActualScale, alignment); rect.adjust(-m_strokeSize, -m_strokeSize, m_strokeSize, m_strokeSize); vidgfx_texdecalbuf_set_rect(m_vertBuf, rect); vidgfx_texdecalbuf_set_tex_uv( m_vertBuf, QRectF(0.0, 0.0, 1.0, 1.0), GfxUnchangedOrient); setVisibleRect(rect.toAlignedRect()); }
void hrAdventureScreen::setViewport(int width, int height) { setVisibleRect(QRect(0, 0, width, height)); window.setRect(0, 0, width, height); }