[GPU/D3D12] Letterboxing cropping to action-safe area

This commit is contained in:
Triang3l
2020-09-05 17:47:32 +03:00
parent 52efbcf741
commit 0be0eb2b38
5 changed files with 154 additions and 34 deletions

View File

@@ -300,9 +300,9 @@ void D3D12Context::BeginSwap() {
clear_color[1] = 1.0f;
clear_color[2] = 0.0f;
} else {
clear_color[0] = 238.0f / 255.0f;
clear_color[1] = 238.0f / 255.0f;
clear_color[2] = 238.0f / 255.0f;
clear_color[0] = 0.0f;
clear_color[1] = 0.0f;
clear_color[2] = 0.0f;
}
clear_color[3] = 1.0f;
swap_command_list_->ClearRenderTargetView(back_buffer_rtv, clear_color, 0,

View File

@@ -253,20 +253,6 @@ bool Win32Window::ReleaseMouse() {
bool Win32Window::is_fullscreen() const { return fullscreen_; }
// https://blogs.msdn.microsoft.com/oldnewthing/20131017-00/?p=2903
BOOL UnadjustWindowRect(LPRECT prc, DWORD dwStyle, BOOL fMenu) {
RECT rc;
SetRectEmpty(&rc);
BOOL fRc = AdjustWindowRect(&rc, dwStyle, fMenu);
if (fRc) {
prc->left -= rc.left;
prc->top -= rc.top;
prc->right -= rc.right;
prc->bottom -= rc.bottom;
}
return fRc;
}
void Win32Window::ToggleFullscreen(bool fullscreen) {
if (fullscreen == is_fullscreen()) {
return;
@@ -288,9 +274,6 @@ void Win32Window::ToggleFullscreen(bool fullscreen) {
AdjustWindowRect(&rc, GetWindowLong(hwnd_, GWL_STYLE), false);
MoveWindow(hwnd_, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
TRUE);
width_ = rc.right - rc.left;
height_ = rc.bottom - rc.top;
}
} else {
// Reinstate borders, resize to 1280x720
@@ -301,15 +284,13 @@ void Win32Window::ToggleFullscreen(bool fullscreen) {
if (main_menu) {
::SetMenu(hwnd_, main_menu->handle());
}
auto& rc = windowed_pos_.rcNormalPosition;
bool has_menu = main_menu_ ? true : false;
UnadjustWindowRect(&rc, GetWindowLong(hwnd_, GWL_STYLE), has_menu);
width_ = rc.right - rc.left;
height_ = rc.bottom - rc.top;
}
fullscreen_ = fullscreen;
// width_ and height_ will be updated by the WM_SIZE handler -
// windowed_pos_.rcNormalPosition is also not the correct source for them when
// switching from fullscreen to maximized.
}
bool Win32Window::is_bordered() const {