StelTexture.cpp   StelTexture.cpp 
skipping to change at line 62 skipping to change at line 62
qWarning() << "WARNING: in StelTexture::~StelTexture () tried to delete invalid texture with ID=" << id << "Current GL ERROR sta tus is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")"; qWarning() << "WARNING: in StelTexture::~StelTexture () tried to delete invalid texture with ID=" << id << "Current GL ERROR sta tus is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")";
} }
else else
{ {
gl->glDeleteTextures(1, &id); gl->glDeleteTextures(1, &id);
textureMgr->glMemoryUsage -= glSize; textureMgr->glMemoryUsage -= glSize;
textureMgr->idMap.remove(id); textureMgr->idMap.remove(id);
glSize = 0; glSize = 0;
} }
#ifndef NDEBUG #ifndef NDEBUG
qDebug()<<"Deleted StelTexture"<<id<<", total memory usage " if (qApp->property("verbose") == true)
<<textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB"; qDebug()<<"Deleted StelTexture"<<id<<", total memory
usage "<<textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB";
#endif #endif
id = 0; id = 0;
} }
else if (id) else if (id)
{ {
qWarning()<<"Cannot delete texture"<<id<<", no GL context"; qWarning()<<"Cannot delete texture"<<id<<", no GL context";
} }
if (networkReply) if (networkReply)
{ {
networkReply->abort(); networkReply->abort();
skipping to change at line 244 skipping to change at line 245
startAsyncLoader(loadFromPath,fullPath); startAsyncLoader(loadFromPath,fullPath);
return false; return false;
} }
// Wait until the loader finish. // Wait until the loader finish.
return loader->isFinished(); return loader->isFinished();
} }
void StelTexture::onNetworkReply() void StelTexture::onNetworkReply()
{ {
Q_ASSERT(loader == Q_NULLPTR); Q_ASSERT(loader == Q_NULLPTR);
if (networkReply->error() != QNetworkReply::NoError) if (networkReply->error() == QNetworkReply::NoError && networkReply-
{ >bytesAvailable()>0)
reportError(networkReply->errorString());
}
else
{ {
QByteArray data = networkReply->readAll(); QByteArray data = networkReply->readAll();
if(data.isEmpty()) //prevent starting the loader when there is nothing to load if(data.isEmpty()) //prevent starting the loader when there is nothing to load
reportError(QString("Empty result received for URL: %1").arg(networkReply->url().toString())); reportError(QString("Empty result received for URL: %1").arg(networkReply->url().toString()));
else else
startAsyncLoader(loadFromData, data); startAsyncLoader(loadFromData, data);
} }
else
reportError(networkReply->errorString());
networkReply->deleteLater(); networkReply->deleteLater();
networkReply = Q_NULLPTR; networkReply = Q_NULLPTR;
} }
/************************************************************************* /*************************************************************************
Return the width and heigth of the texture in pixels Return the width and heigth of the texture in pixels
*************************************************************************/ *************************************************************************/
bool StelTexture::getDimensions(int &awidth, int &aheight) bool StelTexture::getDimensions(int &awidth, int &aheight)
{ {
if (width<0 || height<0) if (width<0 || height<0)
skipping to change at line 412 skipping to change at line 412
} }
//do pixel transfer //do pixel transfer
gl->glTexImage2D(GL_TEXTURE_2D, 0, data.format, width, height, 0, da ta.format, gl->glTexImage2D(GL_TEXTURE_2D, 0, data.format, width, height, 0, da ta.format,
data.type, data.data.constData()); data.type, data.data.constData());
//for now, assume full sized 8 bit GL formats used internally //for now, assume full sized 8 bit GL formats used internally
glSize = data.data.size(); glSize = data.data.size();
#ifndef NDEBUG #ifndef NDEBUG
qDebug()<<"StelTexture"<<id<<"uploaded, total memory usage "<<textur if (qApp->property("verbose") == true)
eMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB"; qDebug()<<"StelTexture"<<id<<"uploaded, total memory usage "
<<textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB";
#endif #endif
//restore old value //restore old value
gl->glPixelStorei(GL_UNPACK_ALIGNMENT, oldalignment); gl->glPixelStorei(GL_UNPACK_ALIGNMENT, oldalignment);
gl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, loadParams.wra pMode); gl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, loadParams.wra pMode);
gl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, loadParams.wra pMode); gl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, loadParams.wra pMode);
if (loadParams.generateMipmaps) if (loadParams.generateMipmaps)
{ {
gl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, lo adParams.filterMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR_MIPMAP_NEAREST ); gl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, lo adParams.filterMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR_MIPMAP_NEAREST );
 End of changes. 4 change blocks. 
9 lines changed or deleted 11 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/