History

I think I'm very close to a PR...

Zach Fox committed 10 years ago

Commit 152e0ae1 parent 045dfff1 file · +7 −8Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+7−8
@@ -5430,7 +5430,7 @@ void Application::toggleLogDialog() { · 5429 unmodified lines
5430}5430}
5431 5431
5432#define SNAPSNOT_ANIMATED_WIDTH (900)5432#define SNAPSNOT_ANIMATED_WIDTH (900)
5433#define SNAPSNOT_ANIMATED_FRAMERATE_FPS (20)5433#define SNAPSNOT_ANIMATED_FRAMERATE_FPS (50)
5434#define SNAPSNOT_ANIMATED_FRAME_DELAY (100/SNAPSNOT_ANIMATED_FRAMERATE_FPS)5434#define SNAPSNOT_ANIMATED_FRAME_DELAY (100/SNAPSNOT_ANIMATED_FRAMERATE_FPS)
5435#define SNAPSNOT_ANIMATED_DURATION_SECS (3)5435#define SNAPSNOT_ANIMATED_DURATION_SECS (3)
5436#define SNAPSNOT_ANIMATED_NUM_FRAMES (SNAPSNOT_ANIMATED_DURATION_SECS * SNAPSNOT_ANIMATED_FRAMERATE_FPS)5436#define SNAPSNOT_ANIMATED_NUM_FRAMES (SNAPSNOT_ANIMATED_DURATION_SECS * SNAPSNOT_ANIMATED_FRAMERATE_FPS)
@@ -5480,6 +5480,8 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR · 43 unmodified lines
5480 // If this is the last frame...5480 // If this is the last frame...
5481 if (qApp->_currentAnimatedSnapshotFrame == SNAPSNOT_ANIMATED_NUM_FRAMES)5481 if (qApp->_currentAnimatedSnapshotFrame == SNAPSNOT_ANIMATED_NUM_FRAMES)
5482 {5482 {
5483 // Reset the current frame number
5484 qApp->_currentAnimatedSnapshotFrame = 0;
5483 // Stop the snapshot QTimer5485 // Stop the snapshot QTimer
5484 animatedSnapshotTimer.stop();5486 animatedSnapshotTimer.stop();
5485 // Write out the end of the GIF5487 // Write out the end of the GIF
@@ -5493,23 +5495,20 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR · 7 unmodified lines
5493 // Get a screenshot from the display, then scale the screenshot down,5495 // Get a screenshot from the display, then scale the screenshot down,
5494 // then convert it to the image format the GIF library needs,5496 // then convert it to the image format the GIF library needs,
5495 // then save all that to the QImage named "frame"5497 // then save all that to the QImage named "frame"
5496 QImage* frame = new QImage(qApp->getActiveDisplayPlugin()->getScreenshot(aspectRatio));5498 QImage frame(qApp->getActiveDisplayPlugin()->getScreenshot(aspectRatio));
5497 *frame = frame->scaledToWidth(SNAPSNOT_ANIMATED_WIDTH).convertToFormat(QImage::Format_RGBA8888);5499 frame = frame.scaledToWidth(SNAPSNOT_ANIMATED_WIDTH).convertToFormat(QImage::Format_RGBA8888);
5498 5500
5499 // If this is the first frame...5501 // If this is the first frame...
5500 if (qApp->_currentAnimatedSnapshotFrame == 0)5502 if (qApp->_currentAnimatedSnapshotFrame == 0)
5501 {5503 {
5502 // Write out the header and beginning of the GIF file5504 // Write out the header and beginning of the GIF file
5503 GifBegin(&(qApp->_animatedSnapshotGifWriter), cstr, frame->width(), frame->height(), SNAPSNOT_ANIMATED_FRAME_DELAY*2, 8, false);5505 GifBegin(&(qApp->_animatedSnapshotGifWriter), cstr, frame.width(), frame.height(), SNAPSNOT_ANIMATED_FRAME_DELAY*2, 8, false);
5504 }5506 }
5505 5507
5506 // Write the frame to the gif5508 // Write the frame to the gif
5507 GifWriteFrame(&(qApp->_animatedSnapshotGifWriter), (uint8_t*)frame->bits(), frame->width(), frame->height(), SNAPSNOT_ANIMATED_FRAME_DELAY*2, 8, false);5509 GifWriteFrame(&(qApp->_animatedSnapshotGifWriter), (uint8_t*)frame.bits(), frame.width(), frame.height(), SNAPSNOT_ANIMATED_FRAME_DELAY*2, 8, false);
5508 // Increment the current snapshot frame count5510 // Increment the current snapshot frame count
5509 qApp->_currentAnimatedSnapshotFrame++;5511 qApp->_currentAnimatedSnapshotFrame++;
5510
5511 // Free the dynamic memory
5512 delete frame;
5513 });5512 });
5514 5513
5515 // Start the animatedSnapshotTimer QTimer5514 // Start the animatedSnapshotTimer QTimer