Disable BlitterWidget updates (paintEvents) while not paused.

git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@205 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
This commit is contained in:
sinamas 2008-12-26 02:32:43 +00:00
parent 9932b1f4ac
commit 6056b96c0e
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2007 by Sindre Aamås *
* Copyright (C) 2007 by Sindre Aam<EFBFBD>s *
* aamas@stud.ntnu.no *
* *
* This program is free software; you can redistribute it and/or modify *
@ -57,7 +57,10 @@ QPainterBlitter::~QPainterBlitter() {
}
void QPainterBlitter::blit() {
const bool ue = updatesEnabled();
setUpdatesEnabled(true);
repaint();
setUpdatesEnabled(ue);
}
void QPainterBlitter::paintEvent(QPaintEvent *const event) {

View File

@ -359,9 +359,11 @@ void MainWindow::videoSettingsChange() {
if (blitterContainer->blitter() != blitters[engineIndex]) {
bool visible = false;
bool updatesEnabled = false;
if (blitterContainer->blitter()) {
visible = blitterContainer->blitter()->isVisible();
updatesEnabled = blitterContainer->blitter()->updatesEnabled();
disconnect(fullModeToggler.get(), SIGNAL(rateChange(int)), blitterContainer->blitter(), SLOT(rateChange(int)));
if (running)
@ -375,6 +377,7 @@ void MainWindow::videoSettingsChange() {
connect(fullModeToggler.get(), SIGNAL(rateChange(int)), blitterContainer->blitter(), SLOT(rateChange(int)));
fullModeToggler->emitRate();
blitterContainer->blitter()->setVisible(visible);
blitterContainer->blitter()->setUpdatesEnabled(updatesEnabled);
if (running)
blitterContainer->blitter()->init();
@ -629,6 +632,7 @@ void MainWindow::doPause() {
killTimer(timerId);
timerId = 0;
jsTimer->start();
blitterContainer->blitter()->setUpdatesEnabled(true);
}
void MainWindow::doUnpause() {
@ -637,6 +641,7 @@ void MainWindow::doUnpause() {
jsTimer->stop();
timerId = startTimer(0);
blitterContainer->blitter()->setUpdatesEnabled(false);
}
void MainWindow::pause() {