From c00991da29ac2032f7194892538173b093d192ec Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 27 Aug 2024 08:47:08 +0200 Subject: [PATCH] match PreRender_CopyImageRegionImpl (#2093) --- src/code/PreRender.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 527b9c8672..aedc0d07a0 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -138,6 +138,7 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { s32 ult; s32 lrt; s32 uly; + s32 lry; // Make sure that we don't load past the end of the source image if (nRows > rowsRemaining) { @@ -148,6 +149,7 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { ult = this->ulySave + curRow; lrt = ult + nRows - 1; uly = this->uly + curRow; + lry = uly + nRows - 1; // Load a horizontal strip of the source image in RGBA16 format gDPLoadTextureTile(gfx++, this->fbufSave, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->widthSave, this->height - 1, @@ -155,7 +157,7 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); // Draw that horizontal strip to the destination image, dsdx is 4 << 10 for COPY mode - gSPTextureRectangle(gfx++, this->ulx << 2, uly << 2, this->lrx << 2, (uly + nRows - 1) << 2, G_TX_RENDERTILE, + gSPTextureRectangle(gfx++, this->ulx << 2, uly << 2, this->lrx << 2, lry << 2, G_TX_RENDERTILE, this->ulxSave << 5, ult << 5, 4 << 10, 1 << 10); curRow += nRows;