all repos — mgba @ 11eab66247ed0ac13508921a9fd6b3a3ae14ed0e

mGBA Game Boy Advance Emulator

Qt: Move screenshot to GameController
Jeffrey Pfau jeffrey@endrift.com
Tue, 31 Mar 2015 23:43:47 -0700
commit

11eab66247ed0ac13508921a9fd6b3a3ae14ed0e

parent

0d6cc88f9fc1169dd9549647af8eb6b013813162

M src/platform/qt/Display.hsrc/platform/qt/Display.h

@@ -26,9 +26,6 @@ virtual void unpauseDrawing() = 0;

virtual void forceDraw() = 0; virtual void lockAspectRatio(bool lock) = 0; virtual void filter(bool filter) = 0; -#ifdef USE_PNG - virtual void screenshot() = 0; -#endif }; }
M src/platform/qt/DisplayGL.cppsrc/platform/qt/DisplayGL.cpp

@@ -117,14 +117,6 @@ m_painter->filter(filter);

} } -#ifdef USE_PNG -void DisplayGL::screenshot() { - GBAThreadInterrupt(m_context); - GBAThreadTakeScreenshot(m_context); - GBAThreadContinue(m_context); -} -#endif - void DisplayGL::resizeEvent(QResizeEvent* event) { m_painter->resize(event->size()); }
M src/platform/qt/DisplayGL.hsrc/platform/qt/DisplayGL.h

@@ -31,9 +31,6 @@ void unpauseDrawing();

void forceDraw(); void lockAspectRatio(bool lock); void filter(bool filter); -#ifdef USE_PNG - void screenshot(); -#endif protected: virtual void paintEvent(QPaintEvent*) override {};
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -520,6 +520,14 @@ m_threadContext.stream = nullptr;

threadContinue(); } +#ifdef USE_PNG +void GameController::screenshot() { + GBAThreadInterrupt(&m_threadContext); + GBAThreadTakeScreenshot(&m_threadContext); + GBAThreadContinue(&m_threadContext); +} +#endif + void GameController::reloadAudioDriver() { QMetaObject::invokeMethod(m_audioProcessor, "pause", Qt::BlockingQueuedConnection); int samples = m_audioProcessor->getBufferSamples();
M src/platform/qt/GameController.hsrc/platform/qt/GameController.h

@@ -119,6 +119,10 @@ void setAVStream(GBAAVStream*);

void clearAVStream(); void reloadAudioDriver(); +#ifdef USE_PNG + void screenshot(); +#endif + void setLuminanceValue(uint8_t value); uint8_t luminanceValue() const { return m_luxValue; } void setLuminanceLevel(int level);
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -738,7 +738,7 @@

#ifdef USE_PNG QAction* screenshot = new QAction(tr("Take &screenshot"), avMenu); screenshot->setShortcut(tr("F12")); - connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot())); + connect(screenshot, SIGNAL(triggered()), m_controller, SLOT(screenshot())); m_gameActions.append(screenshot); addControlledAction(avMenu, screenshot, "screenshot"); #endif