shithub: choc

Download patch

ref: eef7a4e066b3bc19c0f6f6f39b67ac0bac5f2d9e
parent: 0b50fbde6a49250d4372a3255b1e1fd451326abe
author: Fabian Greffrath <fabian@greffrath.com>
date: Tue Feb 20 17:55:39 EST 2018

video: rename rgbabuffer variable to argbbuffer

This is just a cosmetic change, the variable is static in i_video.c
and its name has been chosen rather arbitrarily based on the false
assumption that ARGB is the most common pixel format nowadays (it is
the standard pixel format for the PNG image format, though).

In Chocolate Doom, we do not hard-code the pixel format anymore, but
rely on the screen's native format instead. Since nowadays all major
systems apparently use the the 8-8-8-8 ARGB format,
"ARGB is the right thing by monopoly vote."
<http://stereopsis.com/doubleblend.html>

So, if we so have to raise expectations about the pixel format by
our choice of the variable name, it should be the most common one.

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -65,7 +65,7 @@
 // in turn is finally rendered to screen using "linear" scaling.
 
 static SDL_Surface *screenbuffer = NULL;
-static SDL_Surface *rgbabuffer = NULL;
+static SDL_Surface *argbbuffer = NULL;
 static SDL_Texture *texture = NULL;
 static SDL_Texture *texture_upscaled = NULL;
 
@@ -766,11 +766,11 @@
     // Blit from the paletted 8-bit screen buffer to the intermediate
     // 32-bit RGBA buffer that we can load into the texture.
 
-    SDL_LowerBlit(screenbuffer, &blit_rect, rgbabuffer, &blit_rect);
+    SDL_LowerBlit(screenbuffer, &blit_rect, argbbuffer, &blit_rect);
 
     // Update the intermediate texture with the contents of the RGBA buffer.
 
-    SDL_UpdateTexture(texture, NULL, rgbabuffer->pixels, rgbabuffer->pitch);
+    SDL_UpdateTexture(texture, NULL, argbbuffer->pixels, argbbuffer->pitch);
 
     // Make sure the pillarboxes are kept clear each frame.
 
@@ -1267,16 +1267,16 @@
         SDL_FillRect(screenbuffer, NULL, 0);
     }
 
-    // Format of rgbabuffer must match the screen pixel format because we
+    // Format of argbbuffer must match the screen pixel format because we
     // import the surface data into the texture.
-    if (rgbabuffer == NULL)
+    if (argbbuffer == NULL)
     {
         SDL_PixelFormatEnumToMasks(pixel_format, &unused_bpp,
                                    &rmask, &gmask, &bmask, &amask);
-        rgbabuffer = SDL_CreateRGBSurface(0,
+        argbbuffer = SDL_CreateRGBSurface(0,
                                           SCREENWIDTH, SCREENHEIGHT, 32,
                                           rmask, gmask, bmask, amask);
-        SDL_FillRect(rgbabuffer, NULL, 0);
+        SDL_FillRect(argbbuffer, NULL, 0);
     }
 
     if (texture != NULL)