MCPcopy Create free account
hub / github.com/dborth/vbagx / copyTextureToFramebuffer

Method copyTextureToFramebuffer

source/utils/FreeTypeGX.cpp:619–646  ·  view source on GitHub ↗

* Copies the supplied texture quad to the EFB. * * This routine uses the in-built GX quad builder functions to define the texture bounds and location on the EFB target. * * @param texObj A pointer to the glyph's initialized texture object. * @param texWidth The pixel width of the texture object. * @param texHeight The pixel height of the texture object. * @param screenX The screen X coordin

Source from the content-addressed store, hash-verified

617 * @param color Color to apply to the texture.
618 */
619void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color)
620{
621 GX_LoadTexObj(texObj, GX_TEXMAP0);
622 GX_InvalidateTexAll();
623
624 GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
625 GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
626
627 GX_Begin(GX_QUADS, this->vertexIndex, 4);
628 GX_Position2s16(screenX, screenY);
629 GX_Color4u8(color.r, color.g, color.b, color.a);
630 GX_TexCoord2f32(0.0f, 0.0f);
631
632 GX_Position2s16(texWidth + screenX, screenY);
633 GX_Color4u8(color.r, color.g, color.b, color.a);
634 GX_TexCoord2f32(1.0f, 0.0f);
635
636 GX_Position2s16(texWidth + screenX, texHeight + screenY);
637 GX_Color4u8(color.r, color.g, color.b, color.a);
638 GX_TexCoord2f32(1.0f, 1.0f);
639
640 GX_Position2s16(screenX, texHeight + screenY);
641 GX_Color4u8(color.r, color.g, color.b, color.a);
642 GX_TexCoord2f32(0.0f, 1.0f);
643 GX_End();
644
645 this->setDefaultMode();
646}
647
648/**
649 * Creates a feature quad to the EFB.

Callers 1

drawTextMethod · 0.95

Calls 1

setDefaultModeMethod · 0.95

Tested by

no test coverage detected