Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
Yorik van Havre 2015-05-07 18:17:50 -03:00
commit 6c7911a602
2 changed files with 11 additions and 3 deletions

View File

@ -94,6 +94,12 @@ void SoFCOffscreenRenderer::writeToImage (QImage& img) const
void SoFCOffscreenRenderer::writeToImageFile(const char* filename, const char* comment, const SbMatrix& mat, const QImage& image)
{
if (image.isNull()) {
std::stringstream str;
str << "Cannot save null image.";
throw Base::ValueError(str.str());
}
Base::FileInfo file(filename);
if (file.hasExtension("JPG") || file.hasExtension("JPEG")) {
// writing comment in case of jpeg (Qt ignores setText() in case of jpeg)
@ -163,13 +169,15 @@ void SoFCOffscreenRenderer::writeToImageFile(const char* filename, const char* c
f.close();
std::stringstream str;
str << "Cannot save image to file '" << filename << "'.";
throw Base::Exception(str.str());
throw Base::ValueError(str.str());
}
}
else {
std::stringstream str;
str << "Cannot open file '" << filename << "' for writing.";
throw Base::Exception(str.str());
Base::FileException e;
e.setMessage(str.str());
throw e;
}
}
//

View File

@ -899,7 +899,7 @@ void View3DInventorViewer::savePicture(int w, int h, const QColor& bg, QImage& i
#if (COIN_MAJOR_VERSION >= 4)
// The behaviour in Coin4 has changed so that when using the same instance of 'SoFCOffscreenRenderer'
// multiple times internally the biggest viewport size is stored and set to the SoGLRenderAction.
// The trick is to add a callback node and override the viewport size with wath we want.
// The trick is to add a callback node and override the viewport size with what we want.
//SoCallback* cbvp = new SoCallback;
//cbvp->setCallback(setViewportCB);
//root->addChild(cbvp);