Fix OpenGL colors on big-endian CPUs, from Bryce McKinley
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@430 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -28,6 +28,15 @@ static unsigned int TransitionTexture;
|
|||||||
static BOOLEAN scanlines;
|
static BOOLEAN scanlines;
|
||||||
static BOOLEAN upload_transitiontexture = FALSE;
|
static BOOLEAN upload_transitiontexture = FALSE;
|
||||||
|
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
#define R_MASK 0x00ff0000
|
||||||
|
#define G_MASK 0x0000ff00
|
||||||
|
#define B_MASK 0x000000ff
|
||||||
|
#else
|
||||||
|
#define R_MASK 0x000000ff
|
||||||
|
#define G_MASK 0x0000ff00
|
||||||
|
#define B_MASK 0x00ff0000
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||||
@@ -114,7 +123,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Screen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 24,
|
SDL_Screen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 24,
|
||||||
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
R_MASK, G_MASK, B_MASK, 0x00000000);
|
||||||
|
|
||||||
if (SDL_Screen == NULL)
|
if (SDL_Screen == NULL)
|
||||||
{
|
{
|
||||||
@@ -123,7 +132,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtraScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 24,
|
ExtraScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 24,
|
||||||
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
R_MASK, G_MASK, B_MASK, 0x00000000);
|
||||||
|
|
||||||
if (ExtraScreen == NULL)
|
if (ExtraScreen == NULL)
|
||||||
{
|
{
|
||||||
@@ -132,7 +141,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TransitionScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 24,
|
TransitionScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 24,
|
||||||
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
R_MASK, G_MASK, B_MASK, 0x00000000);
|
||||||
|
|
||||||
if (TransitionScreen == NULL)
|
if (TransitionScreen == NULL)
|
||||||
{
|
{
|
||||||
@@ -141,7 +150,7 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
format_conv_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, 32,
|
format_conv_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, 32,
|
||||||
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
|
R_MASK, G_MASK, B_MASK, 0x00000000);
|
||||||
|
|
||||||
if (format_conv_surf == NULL)
|
if (format_conv_surf == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_image.h"
|
#include "SDL_image.h"
|
||||||
|
#include "SDL_byteorder.h"
|
||||||
|
|
||||||
#include "libs/graphics/gfxintrn.h"
|
#include "libs/graphics/gfxintrn.h"
|
||||||
#include "libs/input/inpintrn.h"
|
#include "libs/input/inpintrn.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user