Fix build errors.
This commit is contained in:
parent
f68d894b8b
commit
504ecc8e10
@ -143,16 +143,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
w = images[i].width();
|
||||
h = images[i].height();
|
||||
w = images[i].width;
|
||||
h = images[i].height;
|
||||
}
|
||||
else if (images[i].width() != w || images[i].height() != h)
|
||||
else if (images[i].width != w || images[i].height != h)
|
||||
{
|
||||
printf("*** error, size of image '%s' does not match\n", files[i].str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (images[i].format() == nv::Image::Format_ARGB)
|
||||
if (images[i].format == nv::Image::Format_ARGB)
|
||||
{
|
||||
hasAlpha = true;
|
||||
}
|
||||
|
@ -506,8 +506,8 @@ int main(int argc, char *argv[])
|
||||
if (nv::strCaseDiff(input.extension(), ".dds") == 0)
|
||||
{
|
||||
// Load surface.
|
||||
nv::DirectDrawSurface dds(input.str());
|
||||
if (!dds.isValid())
|
||||
nv::DirectDrawSurface dds;
|
||||
if (!dds.load(input.str()) || !dds.isValid())
|
||||
{
|
||||
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
|
||||
return EXIT_FAILURE;
|
||||
@ -550,9 +550,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (uint m = 0; m < mipmapCount; m++)
|
||||
{
|
||||
dds.mipmap(&mipmap, f, m); // @@ Load as float.
|
||||
|
||||
inputOptions.setMipmapData(mipmap.pixels(), mipmap.width(), mipmap.height(), mipmap.depth(), f, m);
|
||||
if (imageFromDDS(&mipmap, dds, f, m)) // @@ Load as float.
|
||||
inputOptions.setMipmapData(mipmap.pixels(), mipmap.width, mipmap.height, mipmap.depth, f, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -591,8 +590,8 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
inputOptions.setTextureLayout(nvtt::TextureType_2D, image.width(), image.height());
|
||||
inputOptions.setMipmapData(image.pixels(), image.width(), image.height());
|
||||
inputOptions.setTextureLayout(nvtt::TextureType_2D, image.width, image.height);
|
||||
inputOptions.setMipmapData(image.pixels(), image.width, image.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Load surface.
|
||||
nv::DirectDrawSurface dds(argv[1]);
|
||||
if (!dds.isValid())
|
||||
nv::DirectDrawSurface dds;
|
||||
if (!dds.load(argv[1]) || !dds.isValid())
|
||||
{
|
||||
printf("The file '%s' is not a valid DDS file.\n", argv[1]);
|
||||
return 1;
|
||||
|
@ -166,8 +166,8 @@ int main(int argc, char *argv[])
|
||||
// Load surface.
|
||||
// !!! DirectDrawSurface API doesn't support float images, so BC6 will be converted to 8-bit on load.
|
||||
// Should use nvtt::Surface instead.
|
||||
nv::DirectDrawSurface dds(input.str());
|
||||
if (!dds.isValid())
|
||||
nv::DirectDrawSurface dds;
|
||||
if (!dds.load(input.str()) || !dds.isValid())
|
||||
{
|
||||
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
|
||||
return 1;
|
||||
@ -219,7 +219,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (uint m = 0; m < mipmapCount; m++)
|
||||
{
|
||||
dds.mipmap(&mipmap, f, m);
|
||||
if (!imageFromDDS(&mipmap, dds, f, m))
|
||||
continue;
|
||||
|
||||
// set output filename, if we are doing faces and/or mipmaps
|
||||
name.copy(output);
|
||||
|
@ -42,14 +42,14 @@ static bool loadImage(nv::Image & image, const char * fileName)
|
||||
{
|
||||
if (nv::strCaseDiff(nv::Path::extension(fileName), ".dds") == 0)
|
||||
{
|
||||
nv::DirectDrawSurface dds(fileName);
|
||||
if (!dds.isValid())
|
||||
nv::DirectDrawSurface dds;
|
||||
if (!dds.load(fileName) || !dds.isValid())
|
||||
{
|
||||
printf("The file '%s' is not a valid DDS file.\n", fileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
dds.mipmap(&image, 0, 0); // get first image
|
||||
return imageFromDDS(&image, dds, 0, 0); // get first image
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -59,9 +59,9 @@ static bool loadImage(nv::Image & image, const char * fileName)
|
||||
printf("The file '%s' is not a supported image type.\n", fileName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,10 +174,10 @@ int main(int argc, char *argv[])
|
||||
fimage.toLinear(0, 3, gamma);
|
||||
|
||||
#if 1
|
||||
nv::AutoPtr<nv::FloatImage> fresult(fimage.resize(*filter, uint(image.width() * scale), uint(image.height() * scale), wrapMode));
|
||||
nv::AutoPtr<nv::FloatImage> fresult(fimage.resize(*filter, uint(image.width * scale), uint(image.height * scale), wrapMode));
|
||||
|
||||
nv::AutoPtr<nv::Image> result(fresult->createImageGammaCorrect(gamma));
|
||||
result->setFormat(nv::Image::Format_ARGB);
|
||||
result->format = nv::Image::Format_ARGB;
|
||||
|
||||
nv::StdOutputStream stream(output.str());
|
||||
nv::ImageIO::save(output.str(), stream, result.ptr());
|
||||
|
@ -43,14 +43,14 @@ static bool loadImage(nv::Image & image, const char * fileName)
|
||||
{
|
||||
if (nv::strCaseDiff(nv::Path::extension(fileName), ".dds") == 0)
|
||||
{
|
||||
nv::DirectDrawSurface dds(fileName);
|
||||
if (!dds.isValid())
|
||||
nv::DirectDrawSurface dds;
|
||||
if (!dds.load(fileName) || !dds.isValid())
|
||||
{
|
||||
fprintf(stderr, "The file '%s' is not a valid DDS file.\n", fileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
dds.mipmap(&image, 0, 0); // get first image
|
||||
return imageFromDDS(&image, dds, 0, 0); // get first image
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -60,9 +60,9 @@ static bool loadImage(nv::Image & image, const char * fileName)
|
||||
fprintf(stderr, "The file '%s' is not a supported image type.\n", fileName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -119,9 +119,9 @@ int main(int argc, char *argv[])
|
||||
if (!loadImage(image, input.str())) return 1;
|
||||
|
||||
nv::StringBuilder widthString;
|
||||
widthString.number(image.width());
|
||||
widthString.number(image.width);
|
||||
nv::StringBuilder heightString;
|
||||
heightString.number(image.height());
|
||||
heightString.number(image.height);
|
||||
|
||||
nv::Array<const char *> metaData;
|
||||
metaData.append("Thumb::Image::Width");
|
||||
@ -131,26 +131,26 @@ int main(int argc, char *argv[])
|
||||
metaData.append(NULL);
|
||||
metaData.append(NULL);
|
||||
|
||||
if ((image.width() > size) || (image.height() > size))
|
||||
if ((image.width > size) || (image.height > size))
|
||||
{
|
||||
nv::FloatImage fimage(&image);
|
||||
fimage.toLinear(0, 3, gamma);
|
||||
|
||||
uint thumbW, thumbH;
|
||||
if (image.width() > image.height())
|
||||
if (image.width > image.height)
|
||||
{
|
||||
thumbW = size;
|
||||
thumbH = uint ((float (image.height()) / float (image.width())) * size);
|
||||
thumbH = uint ((float (image.height) / float (image.width)) * size);
|
||||
}
|
||||
else
|
||||
{
|
||||
thumbW = uint ((float (image.width()) / float (image.height())) * size);
|
||||
thumbW = uint ((float (image.width) / float (image.height)) * size);
|
||||
thumbH = size;
|
||||
}
|
||||
nv::AutoPtr<nv::FloatImage> fresult(fimage.resize(nv::BoxFilter(), thumbW, thumbH, nv::FloatImage::WrapMode_Clamp));
|
||||
|
||||
nv::AutoPtr<nv::Image> result(fresult->createImageGammaCorrect(gamma));
|
||||
result->setFormat(nv::Image::Format_ARGB);
|
||||
result->format = nv::Image::Format_ARGB;
|
||||
|
||||
nv::StdOutputStream stream(output.str());
|
||||
nv::ImageIO::save(output.str(), stream, result.ptr(), metaData.buffer());
|
||||
|
Loading…
Reference in New Issue
Block a user