[video] Change FxU16 to uint16_t

This commit is contained in:
zilmar 2017-08-12 15:08:51 +10:00
parent 0f77559783
commit 72645a8e31
1 changed files with 13 additions and 15 deletions

View File

@ -27,8 +27,6 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <math.h> #include <math.h>
#include "glide.h"
#include "g3ext.h"
#include "glitchmain.h" #include "glitchmain.h"
#include <Project64-video/trace.h> #include <Project64-video/trace.h>
#include <Project64-video/Settings.h> #include <Project64-video/Settings.h>
@ -835,7 +833,7 @@ bool gfxSstWinClose()
glDeleteTextures(1, &(fbs[i].texid)); glDeleteTextures(1, &(fbs[i].texid));
glDeleteFramebuffersEXT(1, &(fbs[i].fbid)); glDeleteFramebuffersEXT(1, &(fbs[i].fbid));
glDeleteRenderbuffersEXT(1, &(fbs[i].zbid)); glDeleteRenderbuffersEXT(1, &(fbs[i].zbid));
} }
} }
#endif #endif
nb_fb = 0; nb_fb = 0;
@ -861,7 +859,7 @@ bool gfxSstWinClose()
//m_pScreen = NULL; //m_pScreen = NULL;
#endif #endif
return true; return true;
} }
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin, gfxLOD_t lodmax, gfxAspectRatio_t aspect, gfxTextureFormat_t fmt, uint32_t evenOdd) void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin, gfxLOD_t lodmax, gfxAspectRatio_t aspect, gfxTextureFormat_t fmt, uint32_t evenOdd)
{ {
@ -1770,7 +1768,7 @@ static void CorrectGamma(LPVOID apGammaRamp)
} }
} }
#else #else
static void CorrectGamma(const FxU16 aGammaRamp[3][256]) static void CorrectGamma(const uint16_t aGammaRamp[3][256])
{ {
int res; int res;
@ -1778,18 +1776,18 @@ static void CorrectGamma(const FxU16 aGammaRamp[3][256])
res = -1; res = -1;
fputs("ERROR: Replacement for SDL_SetGammaRamp unimplemented.\n", stderr); fputs("ERROR: Replacement for SDL_SetGammaRamp unimplemented.\n", stderr);
WriteTrace(TraceGlitch, TraceDebug, "SDL_SetGammaRamp returned %d\r\n", res); WriteTrace(TraceGlitch, TraceDebug, "SDL_SetGammaRamp returned %d\r\n", res);
} }
#endif #endif
void gfxLoadGammaTable(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, uint32_t *blue) void gfxLoadGammaTable(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, uint32_t *blue)
{ {
WriteTrace(TraceGlitch, TraceDebug, "-"); WriteTrace(TraceGlitch, TraceDebug, "-");
FxU16 aGammaRamp[3][256]; uint16_t aGammaRamp[3][256];
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)
{ {
aGammaRamp[0][i] = (FxU16)((red[i] << 8) & 0xFFFF); aGammaRamp[0][i] = (uint16_t)((red[i] << 8) & 0xFFFF);
aGammaRamp[1][i] = (FxU16)((green[i] << 8) & 0xFFFF); aGammaRamp[1][i] = (uint16_t)((green[i] << 8) & 0xFFFF);
aGammaRamp[2][i] = (FxU16)((blue[i] << 8) & 0xFFFF); aGammaRamp[2][i] = (uint16_t)((blue[i] << 8) & 0xFFFF);
} }
CorrectGamma(aGammaRamp); CorrectGamma(aGammaRamp);
} }
@ -1797,7 +1795,7 @@ void gfxLoadGammaTable(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, ui
void gfxGetGammaTableExt(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, uint32_t *blue) void gfxGetGammaTableExt(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, uint32_t *blue)
{ {
WriteTrace(TraceGlitch, TraceDebug, "-"); WriteTrace(TraceGlitch, TraceDebug, "-");
FxU16 aGammaRamp[3][256]; uint16_t aGammaRamp[3][256];
#ifdef _WIN32 #ifdef _WIN32
HDC hdc = GetDC(NULL); HDC hdc = GetDC(NULL);
if (hdc == NULL) if (hdc == NULL)
@ -1823,12 +1821,12 @@ void gfxGammaCorrectionRGB(float gammaR, float gammaG, float gammaB)
{ {
WriteTrace(TraceGlitch, TraceDebug, "-"); WriteTrace(TraceGlitch, TraceDebug, "-");
FxU16 aGammaRamp[3][256]; uint16_t aGammaRamp[3][256];
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)
{ {
aGammaRamp[0][i] = (((FxU16)((pow(i / 255.0F, 1.0F / gammaR)) * 255.0F + 0.5F)) << 8) & 0xFFFF; aGammaRamp[0][i] = (((uint16_t)((pow(i / 255.0F, 1.0F / gammaR)) * 255.0F + 0.5F)) << 8) & 0xFFFF;
aGammaRamp[1][i] = (((FxU16)((pow(i / 255.0F, 1.0F / gammaG)) * 255.0F + 0.5F)) << 8) & 0xFFFF; aGammaRamp[1][i] = (((uint16_t)((pow(i / 255.0F, 1.0F / gammaG)) * 255.0F + 0.5F)) << 8) & 0xFFFF;
aGammaRamp[2][i] = (((FxU16)((pow(i / 255.0F, 1.0F / gammaB)) * 255.0F + 0.5F)) << 8) & 0xFFFF; aGammaRamp[2][i] = (((uint16_t)((pow(i / 255.0F, 1.0F / gammaB)) * 255.0F + 0.5F)) << 8) & 0xFFFF;
} }
CorrectGamma(aGammaRamp); CorrectGamma(aGammaRamp);
} }