mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:18:05 +02:00
still crashing, feeling closer
This commit is contained in:
parent
b6dd795b00
commit
1912ab1467
1 changed files with 6 additions and 10 deletions
|
@ -5445,22 +5445,19 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR
|
||||||
player->play();
|
player->play();
|
||||||
|
|
||||||
GifWriter _animatedSnapshotGifWriter;
|
GifWriter _animatedSnapshotGifWriter;
|
||||||
uint8_t _currentAnimatedSnapshotFrame;
|
uint8_t _currentAnimatedSnapshotFrame = 0;
|
||||||
QString path;
|
QString path;
|
||||||
|
|
||||||
// If this is a still snapshot...
|
// If this is a still snapshot...
|
||||||
if (!format.compare("still"))
|
if (!format.compare("still"))
|
||||||
{
|
{
|
||||||
// Get a screenshot, save it, and notify the window scripting
|
// Get a screenshot and save it. and - this part of the code has been around for a while
|
||||||
// interface that we've done so - this part of the code has been around for a while
|
|
||||||
path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
|
path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
|
||||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
|
|
||||||
}
|
}
|
||||||
// If this is an animated snapshot (GIF)...
|
// If this is an animated snapshot (GIF)...
|
||||||
else if (!format.compare("animated"))
|
else if (!format.compare("animated"))
|
||||||
{
|
{
|
||||||
char* cstr;
|
char* cstr;
|
||||||
_currentAnimatedSnapshotFrame = 0;
|
|
||||||
// File path stuff
|
// File path stuff
|
||||||
path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
path.append(QDir::separator());
|
path.append(QDir::separator());
|
||||||
|
@ -5469,7 +5466,7 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR
|
||||||
cstr = new char[fname.size() + 1];
|
cstr = new char[fname.size() + 1];
|
||||||
strcpy(cstr, fname.c_str());
|
strcpy(cstr, fname.c_str());
|
||||||
|
|
||||||
connect(&animatedSnapshotTimer, &QTimer::timeout, this, [&] {
|
connect(&animatedSnapshotTimer, &QTimer::timeout, [&] {
|
||||||
if (_currentAnimatedSnapshotFrame == SNAPSNOT_ANIMATED_NUM_FRAMES)
|
if (_currentAnimatedSnapshotFrame == SNAPSNOT_ANIMATED_NUM_FRAMES)
|
||||||
{
|
{
|
||||||
animatedSnapshotTimer.stop();
|
animatedSnapshotTimer.stop();
|
||||||
|
@ -5483,16 +5480,15 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR
|
||||||
{
|
{
|
||||||
GifBegin(&_animatedSnapshotGifWriter, cstr, frame.width(), frame.height(), SNAPSNOT_ANIMATED_FRAME_DELAY);
|
GifBegin(&_animatedSnapshotGifWriter, cstr, frame.width(), frame.height(), SNAPSNOT_ANIMATED_FRAME_DELAY);
|
||||||
}
|
}
|
||||||
uint32_t frameNumBytes = frame.width() * frame.height() * 4;
|
|
||||||
uint8_t* pixelArray = new uint8_t[frameNumBytes];
|
|
||||||
|
|
||||||
GifWriteFrame(&_animatedSnapshotGifWriter, (uint8_t*)frame.bits(), frame.width(), frame.height(), SNAPSNOT_ANIMATED_FRAME_DELAY);
|
GifWriteFrame(&_animatedSnapshotGifWriter, (uint8_t*)frame.bits(), frame.width(), frame.height(), SNAPSNOT_ANIMATED_FRAME_DELAY);
|
||||||
_currentAnimatedSnapshotFrame++;
|
_currentAnimatedSnapshotFrame++;
|
||||||
|
|
||||||
delete[frameNumBytes] pixelArray;
|
|
||||||
});
|
});
|
||||||
animatedSnapshotTimer.start(SNAPSNOT_ANIMATED_FRAME_DELAY * 10);
|
animatedSnapshotTimer.start(SNAPSNOT_ANIMATED_FRAME_DELAY * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify the window scripting interface that we've taken a Snapshot
|
||||||
|
emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
void Application::shareSnapshot(const QString& path) {
|
void Application::shareSnapshot(const QString& path) {
|
||||||
|
|
Loading…
Reference in a new issue