update SDL_render_d3d12.c after DPI scaling/highdpi support patch.

See https://github.com/libsdl-org/SDL/pull/5778#issuecomment-1153006938
This commit is contained in:
Ozkan Sezer 2022-06-14 01:56:40 +03:00 committed by Sam Lantinga
parent 6d1dfc8322
commit 960b86dcb5
1 changed files with 11 additions and 3 deletions

View File

@ -33,6 +33,7 @@
#define COBJMACROS #define COBJMACROS
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#include "../../video/windows/SDL_windowswindow.h"
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
@ -240,7 +241,6 @@ static const GUID SDL_IID_ID3D12InfoQueue = { 0x0742a90b, 0xc387, 0x483f, { 0xb9
#endif #endif
UINT UINT
D3D12_Align(UINT location, UINT alignment) D3D12_Align(UINT location, UINT alignment)
{ {
@ -485,6 +485,13 @@ D3D12_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer); SDL_free(renderer);
} }
static int
D3D12_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
{
WIN_GetDrawableSize(renderer->window, w, h);
return 0;
}
static D3D12_BLEND static D3D12_BLEND
GetBlendFunc(SDL_BlendFactor factor) GetBlendFunc(SDL_BlendFactor factor)
{ {
@ -1211,7 +1218,7 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
/* The width and height of the swap chain must be based on the display's /* The width and height of the swap chain must be based on the display's
* non-rotated size. * non-rotated size.
*/ */
SDL_GetWindowSize(renderer->window, &w, &h); WIN_GetDrawableSize(renderer->window, &w, &h);
data->rotation = D3D12_GetCurrentRotation(); data->rotation = D3D12_GetCurrentRotation();
if (D3D12_IsDisplayRotated90Degrees(data->rotation)) { if (D3D12_IsDisplayRotated90Degrees(data->rotation)) {
int tmp = w; int tmp = w;
@ -2936,6 +2943,7 @@ D3D12_CreateRenderer(SDL_Window * window, Uint32 flags)
data->identity = MatrixIdentity(); data->identity = MatrixIdentity();
renderer->WindowEvent = D3D12_WindowEvent; renderer->WindowEvent = D3D12_WindowEvent;
renderer->GetOutputSize = D3D12_GetOutputSize;
renderer->SupportsBlendMode = D3D12_SupportsBlendMode; renderer->SupportsBlendMode = D3D12_SupportsBlendMode;
renderer->CreateTexture = D3D12_CreateTexture; renderer->CreateTexture = D3D12_CreateTexture;
renderer->UpdateTexture = D3D12_UpdateTexture; renderer->UpdateTexture = D3D12_UpdateTexture;