mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +00:00
Fix 32bit Windows crash while taking the save screenshot.
This commit is contained in:
parent
8fa88f4480
commit
56ae85df0c
1 changed files with 5 additions and 7 deletions
|
@ -980,13 +980,11 @@ void RenderingManager::screenshot(Image &image, int w, int h)
|
||||||
|
|
||||||
Ogre::PixelFormat pf = rt->suggestPixelFormat();
|
Ogre::PixelFormat pf = rt->suggestPixelFormat();
|
||||||
|
|
||||||
std::vector<Ogre::uchar> data;
|
image.loadDynamicImage(
|
||||||
data.resize(w * h * Ogre::PixelUtil::getNumElemBytes(pf));
|
OGRE_ALLOC_T(Ogre::uchar, w * h * Ogre::PixelUtil::getNumElemBytes(pf), Ogre::MEMCATEGORY_GENERAL),
|
||||||
|
w, h, 1, pf, true // autoDelete=true, frees memory we allocate
|
||||||
Ogre::PixelBox pb(w, h, 1, pf, &data[0]);
|
);
|
||||||
rt->copyContentsToMemory(pb);
|
rt->copyContentsToMemory(image.getPixelBox()); // getPixelBox returns a box sharing the same memory as the image
|
||||||
|
|
||||||
image.loadDynamicImage(&data[0], w, h, pf);
|
|
||||||
|
|
||||||
Ogre::TextureManager::getSingleton().remove(tempName);
|
Ogre::TextureManager::getSingleton().remove(tempName);
|
||||||
mRendering.getCamera()->setAspectRatio(oldAspect);
|
mRendering.getCamera()->setAspectRatio(oldAspect);
|
||||||
|
|
Loading…
Reference in a new issue