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;