commit f0b5b0bcb0e51b3f642725e55b16b2b6e0a56829
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Thu Aug 6 18:22:08 2015 +0200
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Thu Aug 6 18:22:08 2015 +0200
Revert "Video: Use intended function sequence to update "streaming" texture"
This reverts commit a61f85c35583c5e000698a8a6591d81e7b2787b5.
The explicit SDL_LockTexture()/memcpy()/SDL_UnlockTexture() sequence is
tedious and not a tad faster than the SDL_UpdateTexture() function.
Thanks @bradharding
---
src/i_video.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/i_video.c b/src/i_video.c
index f211ac05..4f64b94d 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -160,8 +160,6 @@ static SDL_Surface *screenbuffer = NULL;
static SDL_Surface *rgbabuffer = NULL;
static SDL_Surface *rgbabuffer_upscaled = NULL;
static SDL_Texture *texture = NULL;
-static int pitch;
-static void *pixels;
// palette
@@ -1111,12 +1109,10 @@ void I_FinishUpdate (void)
SDL_BlitScaled(rgbabuffer, NULL, rgbabuffer_upscaled, NULL);
// Update the texture with the content of the 32-bit RGBA buffer
+ // (the last argument is the pitch, i.e. 320 pixels of 4 RGBA-bytes)
- if (!SDL_LockTexture(texture, NULL, &pixels, &pitch))
- {
- memcpy(pixels, rgbabuffer_upscaled->pixels, UPSCALE*SCREENHEIGHT*pitch);
- SDL_UnlockTexture(texture);
- }
+ SDL_UpdateTexture(texture, NULL, rgbabuffer_upscaled->pixels,
+ UPSCALE * SCREENWIDTH * sizeof(Uint32));
// Render the texture into the window