diff --git a/src/nvimage/ColorBlock.cpp b/src/nvimage/ColorBlock.cpp index 20b9a33..511a6b9 100644 --- a/src/nvimage/ColorBlock.cpp +++ b/src/nvimage/ColorBlock.cpp @@ -468,8 +468,6 @@ void FloatColorBlock::init(const Image * img, uint x, uint y) // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( // @@ Ideally we should zero the weights of the pixels out of range. - uint srcPlane = w * h; - for (uint i = 0; i < 4; i++) { const uint by = i % h; diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index c4861f1..83e9be3 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -524,7 +524,7 @@ namespace static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) { - for (int i = 0; i < s_d3dFormatCount; i++) + for (uint i = 0; i < s_d3dFormatCount; i++) { if (s_d3dFormats[i].bitcount == bitcount && s_d3dFormats[i].rmask == rmask && @@ -1160,7 +1160,7 @@ void * DirectDrawSurface::readData(uint * sizePtr) void * data = new unsigned char [size]; size = stream->serialize(data, size); - nvDebugCheck(size == *sizePtr); + nvDebugCheck(uint(size) == *sizePtr); return data; } diff --git a/src/nvimage/ImageIO.cpp b/src/nvimage/ImageIO.cpp index d6ead0f..a36c600 100644 --- a/src/nvimage/ImageIO.cpp +++ b/src/nvimage/ImageIO.cpp @@ -118,17 +118,18 @@ Image * nv::ImageIO::load(const char * fileName, Stream & s) nvDebugCheck(fileName != NULL); nvDebugCheck(s.isLoading()); - const char * extension = Path::extension(fileName); - #if defined(HAVE_FREEIMAGE) FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName); if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) { return loadFreeImage(fif, s); } #else // defined(HAVE_FREEIMAGE) + const char * extension = Path::extension(fileName); + if (strCaseCmp(extension, ".tga") == 0) { return loadTGA(s); } + #if defined(HAVE_JPEG) if (strCaseCmp(extension, ".jpg") == 0 || strCaseCmp(extension, ".jpeg") == 0) { return loadJPG(s); @@ -139,7 +140,8 @@ Image * nv::ImageIO::load(const char * fileName, Stream & s) return loadPNG(s); } #endif - if (strCaseCmp(extension, ".psd") == 0) { + + if (strCaseCmp(extension, ".psd") == 0) { return loadPSD(s); } #endif // defined(HAVE_FREEIMAGE) @@ -297,9 +299,9 @@ bool nv::ImageIO::saveFloat(const char * fileName, Stream & s, const FloatImage bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, uint baseComponent, uint componentCount) { +#if !defined(HAVE_FREEIMAGE) const char * extension = Path::extension(fileName); -#if !defined(HAVE_FREEIMAGE) #if defined(HAVE_OPENEXR) if (strCaseCmp(extension, ".exr") == 0) { return saveFloatEXR(fileName, fimage, baseComponent, componentCount); @@ -310,7 +312,8 @@ bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, ui return saveFloatTIFF(fileName, fimage, baseComponent, componentCount); } #endif -#endif // defined(HAVE_FREEIMAGE) + +#endif // !defined(HAVE_FREEIMAGE) StdInputStream stream(fileName); @@ -600,6 +603,10 @@ bool nv::ImageIO::saveFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s, const Fl { type = FIT_RGBAF; } + else { + return false; + } + FIBITMAP * bitmap = FreeImage_AllocateT(type, w, h);