From 604299443dea3be150e36ed7f2d2f1149736c074 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Fri, 14 Jun 2024 16:58:42 +0200 Subject: [PATCH] Do less calculations in PSP_LockTexture --- src/render/psp/SDL_render_psp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 7246bfffcc6e6..43fd377a10604 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -439,9 +439,9 @@ static int PSP_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, prepareTextureForDownload(texture); *pixels = - (void *)((Uint8 *)psp_tex->data + rect->y * psp_tex->width * SDL_BYTESPERPIXEL(texture->format) + + (void *)((Uint8 *)psp_tex->data + rect->y * psp_tex->pitch + rect->x * SDL_BYTESPERPIXEL(texture->format)); - *pitch = psp_tex->width * SDL_BYTESPERPIXEL(texture->format); + *pitch = psp_tex->pitch; return 0; }