From 76121a2bcd876ff42f50b48cdb17965a4655168d Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 8 Nov 2016 12:12:40 -0800 Subject: [PATCH] Getting somewheregit add -A! --- interface/src/Application.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 61b0af63c5..097b1092f4 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5457,9 +5457,8 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR strcpy(cstr, fname.c_str()); - frame = (getActiveDisplayPlugin()->getScreenshot(aspectRatio)).scaledToWidth(500); - qDebug() << "image format: " << frame.format(); - uint8_t frameNumBytes = frame.width() * frame.height() * 4; + frame = (getActiveDisplayPlugin()->getScreenshot(aspectRatio)).scaledToWidth(400); + uint32_t frameNumBytes = frame.width() * frame.height() * 4; uint8_t* pixelArray = new uint8_t[frameNumBytes]; uchar *bits; @@ -5468,19 +5467,19 @@ void Application::takeSnapshot(bool notify, const QString& format, float aspectR for (uint8_t itr = 0; itr < 30; itr++) { bits = frame.bits(); - for (uint8_t itr2 = 0; itr2 < frameNumBytes; itr2 += 4) + for (uint32_t itr2 = 0; itr2 < frameNumBytes; itr2 += 4) { - pixelArray[itr2 + 3] = (uint8_t)bits[itr2]; - pixelArray[itr2 + 0] = (uint8_t)bits[itr2 + 1]; - pixelArray[itr2 + 1] = (uint8_t)bits[itr2 + 2]; - pixelArray[itr2 + 2] = (uint8_t)bits[itr2 + 3]; + pixelArray[itr2 + 0] = (uint8_t)bits[itr2 + 0]; // R + pixelArray[itr2 + 1] = (uint8_t)bits[itr2 + 1]; // G + pixelArray[itr2 + 2] = (uint8_t)bits[itr2 + 2]; // B + pixelArray[itr2 + 3] = (uint8_t)bits[itr2 + 3]; // Alpha } GifWriteFrame(&myGifWriter, pixelArray, frame.width(), frame.height(), 0); usleep(USECS_PER_MSEC * 50); // 1/20 sec // updateHeartbeat() while making the GIF so we don't scare the deadlock watchdog updateHeartbeat(); - frame = (getActiveDisplayPlugin()->getScreenshot(aspectRatio)).scaledToWidth(500); + frame = (getActiveDisplayPlugin()->getScreenshot(aspectRatio)).scaledToWidth(400); } delete[frameNumBytes] pixelArray;