Commit 8b934bde authored by Janis Born's avatar Janis Born

only use QImage for file loading when ACGL_COMPILE_WITH_QT is set

parent 7bc45db3
......@@ -5,8 +5,10 @@
#include <ACGL/OpenGL/Controller/TextureControlFileJPG.hh>
#ifdef ACGL_COMPILE_WITH_QT
#include <QtGui/QImage>
#include <QtOpenGL/QGLWidget>
#endif // ACGL_COMPILE_WITH_QT
using namespace ACGL::Base;
using namespace ACGL::OpenGL;
......@@ -14,6 +16,7 @@ using namespace ACGL::Utils;
bool TextureControlFileJPG::loadJPG(SharedTexture& texture)
{
#ifdef ACGL_COMPILE_WITH_QT
QImage image = QImage(QString(getFullFilePath().c_str()));
if(image.isNull())
......@@ -33,4 +36,8 @@ bool TextureControlFileJPG::loadJPG(SharedTexture& texture)
GL_UNSIGNED_BYTE);
texture->generateMipmaps();
return true;
#else
error() << "Loading image " << getFullFilePath() << " has failed (QImage not supported)!" << std::endl;
return false;
#endif // ACGL_COMPILE_WITH_QT
}
......@@ -6,14 +6,18 @@
#include <ACGL/OpenGL/Controller/TextureDataControlFileJPG.hh>
#include <ACGL/OpenGL/Controller/TextureDataControlFileFactory.hh>
#ifdef ACGL_COMPILE_WITH_QT
#include <QtGui/QImage>
#include <QtOpenGL/QGLWidget>
#endif // ACGL_COMPILE_WITH_QT
using namespace ACGL;
using namespace ACGL::OpenGL;
using namespace ACGL::Utils;
bool TextureDataControlFileJPG::load(SharedTextureData& texture) const
{
#ifdef ACGL_COMPILE_WITH_QT
QImage image = QImage(QString(getFullFilePath().c_str()));
if(image.isNull())
......@@ -29,6 +33,10 @@ bool TextureDataControlFileJPG::load(SharedTextureData& texture) const
texture->setWidth(image.width());
texture->setHeight(image.height());
return true;
#else
error() << "Loading image " << getFullFilePath() << " has failed (QImage not supported)!" << std::endl;
return false;
#endif // ACGL_COMPILE_WITH_QT
}
int_t TextureDataControlFileJPG::sTypeID = TextureDataControlFileFactory::the()->registerType("jpg", &TextureDataControlFileJPG::creator);
......@@ -6,14 +6,18 @@
#include <ACGL/OpenGL/Controller/TextureDataControlFilePNG.hh>
#include <ACGL/OpenGL/Controller/TextureDataControlFileFactory.hh>
#ifdef ACGL_COMPILE_WITH_QT
#include <QtGui/QImage>
#include <QtOpenGL/QGLWidget>
#endif // ACGL_COMPILE_WITH_QT
using namespace ACGL;
using namespace ACGL::OpenGL;
using namespace ACGL::Utils;
bool TextureDataControlFilePNG::load(SharedTextureData& texture) const
{
#ifdef ACGL_COMPILE_WITH_QT
QImage image = QImage(QString(getFullFilePath().c_str()));
if(image.isNull())
......@@ -29,6 +33,10 @@ bool TextureDataControlFilePNG::load(SharedTextureData& texture) const
texture->setWidth(image.width());
texture->setHeight(image.height());
return true;
#else
error() << "Loading image " << getFullFilePath() << " has failed (QImage not supported)!" << std::endl;
return false;
#endif
}
int_t TextureDataControlFilePNG::sTypeID = TextureDataControlFileFactory::the()->registerType("png", &TextureDataControlFilePNG::creator);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment