Remove msvc warnings.

This commit is contained in:
castano 2007-12-03 23:26:48 +00:00
parent d0376869be
commit f8377cf7ed
7 changed files with 50 additions and 50 deletions

View File

@ -203,7 +203,7 @@ public:
virtual int tell() const virtual int tell() const
{ {
return m_ptr - m_mem; return int(m_ptr - m_mem);
} }
virtual int size() const virtual int size() const

View File

@ -17,7 +17,7 @@ TextWriter::TextWriter(Stream * s) :
void TextWriter::writeString(const char * str) void TextWriter::writeString(const char * str)
{ {
nvDebugCheck(s != NULL); nvDebugCheck(s != NULL);
s->serialize(const_cast<char *>(str), strlen(str)); s->serialize(const_cast<char *>(str), (int)strlen(str));
} }
void TextWriter::writeString(const char * str, uint len) void TextWriter::writeString(const char * str, uint len)

View File

@ -356,12 +356,12 @@ void AlphaBlockDXT5::evaluatePalette8(uint8 alpha[8]) const
// Bit code 000 = alpha0, 001 = alpha1, others are interpolated. // Bit code 000 = alpha0, 001 = alpha1, others are interpolated.
alpha[0] = alpha0; alpha[0] = alpha0;
alpha[1] = alpha1; alpha[1] = alpha1;
alpha[2] = (6 * alpha0 + 1 * alpha1) / 7; // bit code 010 alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; // bit code 010
alpha[3] = (5 * alpha0 + 2 * alpha1) / 7; // bit code 011 alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; // bit code 011
alpha[4] = (4 * alpha0 + 3 * alpha1) / 7; // bit code 100 alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; // bit code 100
alpha[5] = (3 * alpha0 + 4 * alpha1) / 7; // bit code 101 alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; // bit code 101
alpha[6] = (2 * alpha0 + 5 * alpha1) / 7; // bit code 110 alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; // bit code 110
alpha[7] = (1 * alpha0 + 6 * alpha1) / 7; // bit code 111 alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; // bit code 111
} }
void AlphaBlockDXT5::evaluatePalette6(uint8 alpha[8]) const void AlphaBlockDXT5::evaluatePalette6(uint8 alpha[8]) const
@ -370,10 +370,10 @@ void AlphaBlockDXT5::evaluatePalette6(uint8 alpha[8]) const
// Bit code 000 = alpha0, 001 = alpha1, others are interpolated. // Bit code 000 = alpha0, 001 = alpha1, others are interpolated.
alpha[0] = alpha0; alpha[0] = alpha0;
alpha[1] = alpha1; alpha[1] = alpha1;
alpha[2] = (4 * alpha0 + 1 * alpha1) / 5; // Bit code 010 alpha[2] = (4 * alpha[0] + 1 * alpha[1]) / 5; // Bit code 010
alpha[3] = (3 * alpha0 + 2 * alpha1) / 5; // Bit code 011 alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; // Bit code 011
alpha[4] = (2 * alpha0 + 3 * alpha1) / 5; // Bit code 100 alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; // Bit code 100
alpha[5] = (1 * alpha0 + 4 * alpha1) / 5; // Bit code 101 alpha[5] = (1 * alpha[0] + 4 * alpha[1]) / 5; // Bit code 101
alpha[6] = 0x00; // Bit code 110 alpha[6] = 0x00; // Bit code 110
alpha[7] = 0xFF; // Bit code 111 alpha[7] = 0xFF; // Bit code 111
} }
@ -403,7 +403,7 @@ uint AlphaBlockDXT5::index(uint index) const
nvDebugCheck(index < 16); nvDebugCheck(index < 16);
int offset = (3 * index + 16); int offset = (3 * index + 16);
return (this->u >> offset) & 0x7; return uint((this->u >> offset) & 0x7);
} }
void AlphaBlockDXT5::setIndex(uint index, uint value) void AlphaBlockDXT5::setIndex(uint index, uint value)

View File

@ -60,13 +60,13 @@ namespace
// http://en.wikipedia.org/wiki/Bessel_function // http://en.wikipedia.org/wiki/Bessel_function
inline static float bessel0(float x) inline static float bessel0(float x)
{ {
const float EPSILON_RATIO = 1E-6; const float EPSILON_RATIO = 1e-6f;
float xh, sum, pow, ds; float xh, sum, pow, ds;
int k; int k;
xh = 0.5 * x; xh = 0.5f * x;
sum = 1.0; sum = 1.0f;
pow = 1.0; pow = 1.0f;
k = 0; k = 0;
ds = 1.0; ds = 1.0;
while (ds > sum * EPSILON_RATIO) { while (ds > sum * EPSILON_RATIO) {
@ -249,7 +249,7 @@ Kernel1::Kernel1(const Filter & f, int iscale, int samples/*= 32*/)
const float scale = 1.0f / iscale; const float scale = 1.0f / iscale;
m_width = f.width() * iscale; m_width = f.width() * iscale;
m_windowSize = ceilf(2 * m_width); m_windowSize = (int)ceilf(2 * m_width);
m_data = new float[m_windowSize]; m_data = new float[m_windowSize];
const float offset = float(m_windowSize) / 2; const float offset = float(m_windowSize) / 2;
@ -523,7 +523,7 @@ PolyphaseKernel::PolyphaseKernel(const Filter & f, uint srcLength, uint dstLengt
m_length = dstLength; m_length = dstLength;
m_width = f.width() * iscale; m_width = f.width() * iscale;
m_windowSize = ceilf(m_width * 2) + 1; m_windowSize = (int)ceilf(m_width * 2) + 1;
m_data = new float[m_windowSize * m_length]; m_data = new float[m_windowSize * m_length];
memset(m_data, 0, sizeof(float) * m_windowSize * m_length); memset(m_data, 0, sizeof(float) * m_windowSize * m_length);
@ -532,8 +532,8 @@ PolyphaseKernel::PolyphaseKernel(const Filter & f, uint srcLength, uint dstLengt
{ {
const float center = (0.5f + i) * iscale; const float center = (0.5f + i) * iscale;
const int left = floorf(center - m_width); const int left = (int)floorf(center - m_width);
const int right = ceilf(center + m_width); const int right = (int)ceilf(center + m_width);
nvDebugCheck(right - left <= m_windowSize); nvDebugCheck(right - left <= m_windowSize);
float total = 0.0f; float total = 0.0f;

View File

@ -32,7 +32,7 @@ namespace
static int mirror(int x, int w) static int mirror(int x, int w)
{ {
x = fabs(x); x = abs(x);
while (x >= w) { while (x >= w) {
x = 2 * w - x - 2; x = 2 * w - x - 2;
} }
@ -337,10 +337,10 @@ float FloatImage::sampleLinearMirror(float x, float y, int c) const
const float fracX = frac(x); const float fracX = frac(x);
const float fracY = frac(y); const float fracY = frac(y);
int ix0 = mirror(x, w); int ix0 = mirror(iround(x), w);
int iy0 = mirror(y, h); int iy0 = mirror(iround(y), h);
int ix1 = mirror(x + 1, w); int ix1 = mirror(iround(x) + 1, w);
int iy1 = mirror(y + 1, h); int iy1 = mirror(iround(y) + 1, h);
float f1 = pixel(ix0, iy0, c); float f1 = pixel(ix0, iy0, c);
float f2 = pixel(ix1, iy0, c); float f2 = pixel(ix1, iy0, c);
@ -387,9 +387,9 @@ FloatImage * FloatImage::fastDownSample() const
for(uint x = 0; x < w; x++) for(uint x = 0; x < w; x++)
{ {
const float w0 = (w - x); const float w0 = float(w - x);
const float w1 = (w - 0); const float w1 = float(w - 0);
const float w2 = (1 + x); const float w2 = float(1 + x);
*dst++ = scale * (w0 * src[0] + w1 * src[1] + w2 * src[2]); *dst++ = scale * (w0 * src[0] + w1 * src[1] + w2 * src[2]);
src += 2; src += 2;
@ -450,15 +450,15 @@ FloatImage * FloatImage::fastDownSample() const
for(uint y = 0; y < h; y++) for(uint y = 0; y < h; y++)
{ {
const float v0 = (h - y); const float v0 = float(h - y);
const float v1 = (h - 0); const float v1 = float(h - 0);
const float v2 = (1 + y); const float v2 = float(1 + y);
for (uint x = 0; x < w; x++) for (uint x = 0; x < w; x++)
{ {
const float w0 = (w - x); const float w0 = float(w - x);
const float w1 = (w - 0); const float w1 = float(w - 0);
const float w2 = (1 + x); const float w2 = float(1 + x);
float f = 0.0f; float f = 0.0f;
f += v0 * (w0 * src[0 * m_width + 2 * x] + w1 * src[0 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]); f += v0 * (w0 * src[0 * m_width + 2 * x] + w1 * src[0 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]);
@ -487,9 +487,9 @@ FloatImage * FloatImage::fastDownSample() const
{ {
for (uint x = 0; x < w; x++) for (uint x = 0; x < w; x++)
{ {
const float w0 = (w - x); const float w0 = float(w - x);
const float w1 = (w - 0); const float w1 = float(w - 0);
const float w2 = (1 + x); const float w2 = float(1 + x);
float f = 0.0f; float f = 0.0f;
f += w0 * (src[2 * x + 0] + src[m_width + 2 * x + 0]); f += w0 * (src[2 * x + 0] + src[m_width + 2 * x + 0]);
@ -517,9 +517,9 @@ FloatImage * FloatImage::fastDownSample() const
for(uint y = 0; y < h; y++) for(uint y = 0; y < h; y++)
{ {
const float v0 = (h - y); const float v0 = float(h - y);
const float v1 = (h - 0); const float v1 = float(h - 0);
const float v2 = (1 + y); const float v2 = float(1 + y);
for (uint x = 0; x < w; x++) for (uint x = 0; x < w; x++)
{ {
@ -767,8 +767,8 @@ void FloatImage::applyKernelVertical(const PolyphaseKernel & k, int x, int c, Wr
{ {
const float center = (0.5f + i) * iscale; const float center = (0.5f + i) * iscale;
const int left = floor(center - width); const int left = (int)floorf(center - width);
const int right = ceil(center + width); const int right = (int)ceilf(center + width);
nvCheck(right - left <= windowSize); nvCheck(right - left <= windowSize);
float sum = 0; float sum = 0;
@ -799,8 +799,8 @@ void FloatImage::applyKernelHorizontal(const PolyphaseKernel & k, int y, int c,
{ {
const float center = (0.5f + i) * iscale; const float center = (0.5f + i) * iscale;
const int left = floorf(center - width); const int left = (int)floorf(center - width);
const int right = ceilf(center + width); const int right = (int)ceilf(center + width);
nvDebugCheck(right - left <= windowSize); nvDebugCheck(right - left <= windowSize);
float sum = 0; float sum = 0;

View File

@ -18,7 +18,7 @@ public:
Color64(uint16 R, uint16 G, uint16 B, uint16 A) { setRGBA(R, G, B, A); } Color64(uint16 R, uint16 G, uint16 B, uint16 A) { setRGBA(R, G, B, A); }
explicit Color64(uint64 U) : u(U) { } explicit Color64(uint64 U) : u(U) { }
void setRGBA(uint8 R, uint8 G, uint8 B, uint8 A) void setRGBA(uint16 R, uint16 G, uint16 B, uint16 A)
{ {
r = R; r = R;
g = G; g = G;

View File

@ -276,14 +276,14 @@ void semi_definite_symmetric_eigen(
delta = a_ll - a_mm; delta = a_ll - a_mm;
if( delta == 0.0 ) { if( delta == 0.0f ) {
x = - PI/4 ; x = - PI/4 ;
} else { } else {
x = - atan( (a_lm+a_lm) / delta ) / 2.0 ; x = - atanf( (a_lm+a_lm) / delta ) / 2.0f ;
} }
sinx = sin(x) ; sinx = sinf(x);
cosx = cos(x) ; cosx = cosf(x);
sinx_2 = sinx*sinx; sinx_2 = sinx*sinx;
cosx_2 = cosx*cosx; cosx_2 = cosx*cosx;
sincos = sinx*cosx; sincos = sinx*cosx;