Merge changes from the witness.

This commit is contained in:
castano
2011-09-27 17:48:46 +00:00
parent 9c0658edca
commit 3c0ab2d3f3
47 changed files with 1811 additions and 186 deletions

View File

@ -1418,7 +1418,7 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
{
nvDebugCheck((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE));
uint pitch = computeBytePitch(w, header.pf.bitcount, 8); // Asuming 8 bit alignment, which is the same D3DX expects.
uint pitch = computeBytePitch(w, header.pf.bitcount, 1); // Asuming 1 byte alignment, which is the same D3DX expects.
return pitch * h * d;
}

View File

@ -181,7 +181,7 @@ void FloatImage::normalize(uint baseComponent)
for (uint i = 0; i < count; i++) {
Vector3 normal(xChannel[i], yChannel[i], zChannel[i]);
normal = normalizeSafe(normal, Vector3(zero), 0.0f);
normal = normalizeSafe(normal, Vector3(0), 0.0f);
xChannel[i] = normal.x;
yChannel[i] = normal.y;

View File

@ -56,6 +56,7 @@ namespace nv
//@{
NVIMAGE_API void clear(float f = 0.0f);
NVIMAGE_API void clear(uint component, float f = 0.0f);
NVIMAGE_API void copyChannel(uint src, uint dst);
NVIMAGE_API void normalize(uint base_component);
@ -113,8 +114,6 @@ namespace nv
uint pixelCount() const { return m_pixelCount; }
// @@ It would make sense to swap the order of the arguments so that 'c' is always first.
/** @name Pixel access. */
//@{
const float * channel(uint c) const;

View File

@ -70,14 +70,14 @@ namespace nv
inline const Color32 & Image::pixel(uint x, uint y) const
{
nvDebugCheck(x < width() && y < height());
return pixel(y * width() + x);
nvDebugCheck(x < m_width && y < m_height);
return pixel(y * m_width + x);
}
inline Color32 & Image::pixel(uint x, uint y)
{
nvDebugCheck(x < width() && y < height());
return pixel(y * width() + x);
nvDebugCheck(x < m_width && y < m_height);
return pixel(y * m_width + x);
}
} // nv namespace

View File

@ -215,7 +215,7 @@ FloatImage * nv::ImageIO::loadFloat(const char * fileName)
StdInputStream stream(fileName);
if (stream.isError()) {
return false;
return NULL;
}
return loadFloat(fileName, stream);
@ -324,9 +324,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);
@ -711,7 +711,7 @@ Image * nv::ImageIO::loadTGA(Stream & s)
case TGA_TYPE_INDEXED:
if( tga.colormap_type!=1 || tga.colormap_size!=24 || tga.colormap_length>256 ) {
nvDebug( "*** loadTGA: Error, only 24bit paletted images are supported.\n" );
return false;
return NULL;
}
pal = true;
break;
@ -732,7 +732,7 @@ Image * nv::ImageIO::loadTGA(Stream & s)
default:
nvDebug( "*** loadTGA: Error, unsupported image type.\n" );
return false;
return NULL;
}
const uint pixel_size = (tga.pixel_size/8);
@ -1369,7 +1369,7 @@ Image * nv::ImageIO::loadJPG(Stream & s)
// Read the entire file.
Array<uint8> byte_array;
byte_array.resize(s.size());
s.serialize(byte_array.mutableBuffer(), s.size());
s.serialize(byte_array.buffer(), s.size());
jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr;