Remove infinitive loop if image failed to load

This commit is contained in:
Benau 2018-05-11 19:27:25 +08:00
parent 02ecb9f914
commit 34f416506e
2 changed files with 4 additions and 7 deletions

View File

@ -444,6 +444,8 @@ bool SPTexture::threadedLoad()
std::shared_ptr<video::IImage> image = getTextureImage();
if (!image)
{
m_width.store(2);
m_height.store(2);
return true;
}
std::shared_ptr<video::IImage> mask = getMask(image->getDimension());
@ -642,12 +644,6 @@ void SPTexture::applyMask(video::IImage* texture, video::IImage* mask)
}
} // applyMask
// ----------------------------------------------------------------------------
bool SPTexture::initialized() const
{
return m_width.load() != 0 && m_height.load() != 0;
} // initialized
// ----------------------------------------------------------------------------
void SPTexture::generateQuickMipmap(std::shared_ptr<video::IImage> first_image,
const std::vector<std::pair

View File

@ -183,7 +183,8 @@ public:
// ------------------------------------------------------------------------
GLuint getOpenGLTextureName() const { return m_texture_name; }
// ------------------------------------------------------------------------
bool initialized() const;
bool initialized() const
{ return m_width.load() != 0 && m_height.load() != 0; }
// ------------------------------------------------------------------------
unsigned getWidth() const { return m_width.load(); }
// ------------------------------------------------------------------------