citra-emu/citra — pull request #165 by neobrain (2014-10-30 20:12:53+00:00)
Title: Stretch emulation output to render window and be display density independent

Superseds #85.

**Viewport Scaling**
The view is scaled to be as large as possible, without changing the aspect, within the bounds of the window.

**Display Density Independence**
On "retina" displays, or other displays where window units != pixels, the view should no longer draw incorrectly.

**Minimal Render Window Size**
The render window cannot be made smaller than the native display resolution anymore. This is to provide an easy way to achieve an "unstretched" experience of a 1:1 mapping of emulated framebuffer pixels to host screen pixels.

**Internal API changes**
Citra's EmuWindow was fundamentally broken in some aspects (what have people done to gekko's EmuWindow?!) and has been fixed up:
* GetConfig doesn't return a non-const `WindowConfig` object anymore but instead a non-const reference.
* Most setters other than `SetConfig` have been removed from the base class. In other words, the emulation core doesn't have any say about the emulation window anymore. Instead, it's the GUI's job to decide on things like the window title or size. This is implemented by having protected "notifiers" in the base class, which are used by the EmuWindow implementation to update internal base state.
* `SetConfig` does not directly change the active config anymore but instead backups the requested configuration and leaves it up to the GUI to decide when to enable it (by calling the protected `ProcessConfigurationChanges` method from EmuWindow implementation code). This is because apparently people like to think it's fine to just randomly change the window title whenever they feel like it, even though it's not (it can only be done in the GUI thread). I should note though that the code probably isn't really thread-safe, yet, but at least the API allows it to be now.
* EmuWindow's `Config` structure now has additional members which specify the desired minimal client area size. Again, it's up to the GUI to decide whether to respect this field or not. Currently, both glfw and qt respect it.

RendererOpenGL:
* A method called `UpdateViewportExtent` was added to update the OpenGL viewport according to the current EmuWindow size. It also deals with display density independence (I don't really have any means to test that, however).

**Notes**
**Please only review the full diff**. While fixing up the original patch I realized how broken some aspects of the EmuWindow interface had become, so I fixed that as well, which is why the individual patches might be a bit confusing to review (I still think it makes sense to have them separated, however).