- attempt to help poor kobe and his mad need to press E continuously

- also cleanup a memory leak from code that was thus far unused
This commit is contained in:
Mark Vejvoda 2010-09-17 04:59:32 +00:00
parent 6fece48382
commit f3ea511c40
3 changed files with 29 additions and 4 deletions

View File

@ -155,6 +155,8 @@ Renderer::Renderer() {
lastRenderFps=MIN_FPS_NORMAL_RENDERING;
shadowsOffDueToMinRender=false;
pixmapScreenShot = NULL;;
//resources
for(int i=0; i < rsCount; ++i) {
modelManager[i] = NULL;
@ -208,6 +210,8 @@ Renderer::~Renderer(){
fontManager[i] = NULL;
}
delete pixmapScreenShot;
this->menu = NULL;
this->game = NULL;
}
@ -2858,11 +2862,29 @@ void Renderer::saveScreen(const string &path){
const Metrics &sm= Metrics::getInstance();
Pixmap2D pixmap(sm.getScreenW(), sm.getScreenH(), 3);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//Pixmap2D pixmap(sm.getScreenW(), sm.getScreenH(), 3);
if( pixmapScreenShot == NULL ||
pixmapScreenShot->getW() != sm.getScreenW() ||
pixmapScreenShot->getH() != sm.getScreenH()) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
delete pixmapScreenShot;
pixmapScreenShot = new Pixmap2D(sm.getScreenW(), sm.getScreenH(), 3);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
glFinish();
glReadPixels(0, 0, pixmap.getW(), pixmap.getH(), GL_RGB, GL_UNSIGNED_BYTE, pixmap.getPixels());
pixmap.saveTga(path);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(),
GL_RGB, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
pixmapScreenShot->saveTga(path);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
// ==================== PRIVATE ====================

View File

@ -240,6 +240,9 @@ private:
bool shadowsOffDueToMinRender;
bool useQuadCache;
Pixmap2D *pixmapScreenShot;
private:
Renderer();
~Renderer();

View File

@ -725,7 +725,7 @@ void Pixmap2D::subCopy(int x, int y, const Pixmap2D *sourcePixmap){
}
}
delete pixel;
delete [] pixel;
}
bool Pixmap2D::doDimensionsAgree(const Pixmap2D *pixmap){