fix up a few long-standing display quirks:

- don't clear the display when toggling fullscreen
- clear the overscan area when disabling overscan (for PAL window sizes)
- always actively draw to the display even when no cart is loaded,
rather than relying on the blank canvas widget to always get drawn
correctly
- properly clear some video drivers' buffer (e.g. OpenGL) on startup
This commit is contained in:
Devin Acker 2021-08-14 22:21:50 -04:00
parent f924b82771
commit a632b50acc
7 changed files with 9 additions and 7 deletions

View file

@ -43,6 +43,7 @@ public:
iheight = max(height, iheight);
if(buffer) delete[] buffer;
buffer = new uint32_t[iwidth * iheight];
clear();
glBindTexture(GL_TEXTURE_2D, gltexture);
glPixelStorei(GL_UNPACK_ROW_LENGTH, iwidth);

View file

@ -50,6 +50,7 @@ public:
SDL_SWSURFACE, iwidth, iheight, 32,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
);
clear();
}
bool lock(uint32_t *&data, unsigned &pitch, unsigned width, unsigned height) {

View file

@ -102,10 +102,12 @@ void PPU::scanline() {
}
void PPU::render_scanline() {
if(framecounter) return;
if(line >= 1 && line < (!overscan() ? 225 : 240)) {
if(framecounter) return;
render_line_oam_rto();
render_line();
} else if(line >= 1 && line < 240) {
render_line_clear();
}
}

View file

@ -144,6 +144,8 @@ void PPU::frame() {
oam.frame();
display.interlace = regs.interlace;
if (display.overscan && !regs.overscan)
memset(output + 225 * 1024, 0, 15 * 1024 * sizeof(uint16));
display.overscan = regs.overscan;
}

View file

@ -724,9 +724,7 @@ void CanvasObject::mouseMoveEvent(QMouseEvent *event) {
//custom video render and mouse capture functionality
QPaintEngine* CanvasWidget::paintEngine() const {
if(SNES::cartridge.loaded()) {
video.refresh();
}
video.refresh();
return 0;
}

View file

@ -104,7 +104,7 @@ void Utility::modifySystemState(system_state_t systemState) {
if(!application.power) unacquireMouse();
// don't let widget updates temporarily draw a parent widget over an external rendering contex
// don't let widget updates temporarily draw a parent widget over an external rendering context
// (only applies when the system is powered on)
mainWindow->canvas->setUpdatesEnabled(!application.power || video.cap("QWidget"));

View file

@ -1,6 +1,4 @@
void Utility::updateFullscreenState() {
video.clear();
if(config().video.isFullscreen == false) {
config().video.context = &config().video.windowed;
mainWindow->showNormal();