diff --git a/source/main/gfx/AdvancedScreen.h b/source/main/gfx/AdvancedScreen.h index beb0ba1270..7629a9c308 100644 --- a/source/main/gfx/AdvancedScreen.h +++ b/source/main/gfx/AdvancedScreen.h @@ -26,6 +26,8 @@ along with Rigs of Rods. If not, see . #include "RoRPrerequisites.h" +#include + #define SET_BIT(var, pos) ((var) |= (1<<(pos))) #define CLEAR_BIT(var, pos) ((var) &= ~(1<<(pos))) #define SET_LSB(var) ((var) |= 1) @@ -42,34 +44,6 @@ void save(Ogre::uchar *data, Ogre::uchar *databuf, int mWidth, int mHeight, Ogre OGRE_FREE(databuf, Ogre::MEMCATEGORY_RENDERSYS); } -struct wrap { - Ogre::uchar *data; - Ogre::uchar *databuf; - int mWidth; - int mHeight; - Ogre::PixelFormat pf; - Ogre::String filename; - - wrap(Ogre::uchar *data, Ogre::uchar *databuf, int mWidth, int mHeight, Ogre::PixelFormat pf, Ogre::String filename) : - data(data), - databuf(databuf), - mWidth(mWidth), - mHeight(mHeight), - pf(pf), - filename(filename) - { - } -}; - -void* save_img(void *arg) -{ - std::auto_ptr< wrap > img(static_cast< wrap* >(arg)); - save(img->data, img->databuf, img->mWidth, img->mHeight, img->pf, img->filename); - - pthread_exit(NULL); - return NULL; -} - // this only works with lossless image compression (png) class AdvancedScreen : public ZeroedMemoryAllocator @@ -148,13 +122,7 @@ class AdvancedScreen : public ZeroedMemoryAllocator //float used_per = ((float)(dsize * 8 + 40) / (float)isize) * 100.0f; //LOG("used " + TOSTRING(used_per) + " %"); - //save it - wrap* img = new wrap(data, databuf, mWidth, mHeight, pf, filename); - pthread_t pt; - pthread_create(&pt, NULL, save_img, img); - - // C++11 alternative - //std::thread{save, data, databuf, mWidth, mHeight, pf, filename}.detach(); + std::thread{save, data, databuf, mWidth, mHeight, pf, filename}.detach(); } protected: