https://git.reactos.org/?p=reactos.git;a=commitdiff;h=37c2bb3985c5724e9c3d0…
commit 37c2bb3985c5724e9c3d00472f6f3419d65266d1
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sun May 8 21:56:00 2022 +0200
Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com>
CommitDate: Sat May 14 21:29:12 2022 +0200
[WIN32SS] Handle panning in LDEVOBJ_bProbeAndCaptureDevmode
- search a graphic mode corresponding to real screen resolution (not virtual panning
one)
- when capturing the selected mode, copy from input the virtual panning resolution
- when searching the best mode, also try without panning
---
win32ss/gdi/eng/ldevobj.c | 53 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 46 insertions(+), 7 deletions(-)
diff --git a/win32ss/gdi/eng/ldevobj.c b/win32ss/gdi/eng/ldevobj.c
index cb6a8bbbe32..43c0e0fdf94 100644
--- a/win32ss/gdi/eng/ldevobj.c
+++ b/win32ss/gdi/eng/ldevobj.c
@@ -688,6 +688,14 @@ LDEVOBJ_bGetClosestMode(
if (LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, RequestedMode, pSelectedMode,
FALSE))
return TRUE;
+ /* Remove panning (if specified) */
+ if (RequestedMode->dmFields & (DM_PANNINGWIDTH | DM_PANNINGHEIGHT))
+ {
+ RequestedMode->dmFields &= ~(DM_PANNINGWIDTH | DM_PANNINGHEIGHT);
+ if (LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, RequestedMode,
pSelectedMode, FALSE))
+ return TRUE;
+ }
+
/* Fall back to first mode */
WARN("Fall back to first available mode\n");
*pSelectedMode = pGraphicsDevice->pDevModeList[0].pdm;
@@ -718,21 +726,36 @@ LDEVOBJ_bProbeAndCaptureDevmode(
else
{
/* Search if requested mode exists */
+ DWORD dmPelsWidth = RequestedMode->dmPelsWidth;
+ DWORD dmPelsHeight = RequestedMode->dmPelsHeight;
+ DWORD dmFields = RequestedMode->dmFields;
+
+ if (dmFields & DM_PANNINGWIDTH)
+ {
+ dmFields |= DM_PELSWIDTH;
+ dmPelsWidth = RequestedMode->dmPanningWidth;
+ }
+ if (dmFields & DM_PANNINGHEIGHT)
+ {
+ dmFields |= DM_PELSHEIGHT;
+ dmPelsHeight = RequestedMode->dmPanningHeight;
+ }
+
for (i = 0; i < pGraphicsDevice->cDevModes; i++)
{
pdmCurrent = pGraphicsDevice->pDevModeList[i].pdm;
/* Compare asked DEVMODE fields
* Only compare those that are valid in both DEVMODE structs */
- dwFields = pdmCurrent->dmFields & RequestedMode->dmFields;
+ dwFields = pdmCurrent->dmFields & dmFields;
/* For now, we only need those */
if ((dwFields & DM_BITSPERPEL) &&
(pdmCurrent->dmBitsPerPel != RequestedMode->dmBitsPerPel))
continue;
if ((dwFields & DM_PELSWIDTH) &&
- (pdmCurrent->dmPelsWidth != RequestedMode->dmPelsWidth)) continue;
+ (pdmCurrent->dmPelsWidth != dmPelsWidth)) continue;
if ((dwFields & DM_PELSHEIGHT) &&
- (pdmCurrent->dmPelsHeight != RequestedMode->dmPelsHeight))
continue;
+ (pdmCurrent->dmPelsHeight != dmPelsHeight)) continue;
if ((dwFields & DM_DISPLAYFREQUENCY) &&
(pdmCurrent->dmDisplayFrequency !=
RequestedMode->dmDisplayFrequency)) continue;
@@ -743,10 +766,10 @@ LDEVOBJ_bProbeAndCaptureDevmode(
if (!pdmSelected)
{
WARN("Requested mode not found (%dx%dx%d %d Hz)\n",
- RequestedMode->dmFields & DM_PELSWIDTH ?
RequestedMode->dmPelsWidth : 0,
- RequestedMode->dmFields & DM_PELSHEIGHT ?
RequestedMode->dmPelsHeight : 0,
- RequestedMode->dmFields & DM_BITSPERPEL ?
RequestedMode->dmBitsPerPel : 0,
- RequestedMode->dmFields & DM_DISPLAYFREQUENCY ?
RequestedMode->dmDisplayFrequency : 0);
+ dmFields & DM_PELSWIDTH ? dmPelsWidth : 0,
+ dmFields & DM_PELSHEIGHT ? dmPelsHeight : 0,
+ dmFields & DM_BITSPERPEL ? RequestedMode->dmBitsPerPel : 0,
+ dmFields & DM_DISPLAYFREQUENCY ? RequestedMode->dmDisplayFrequency
: 0);
return FALSE;
}
}
@@ -762,6 +785,22 @@ LDEVOBJ_bProbeAndCaptureDevmode(
(PVOID)((ULONG_PTR)pdmSelected + pdmSelected->dmSize),
pdmSelected->dmDriverExtra);
+ if (!bSearchClosestMode)
+ {
+ if (RequestedMode->dmFields & DM_PANNINGWIDTH)
+ {
+ pdm->dmFields |= DM_PANNINGWIDTH;
+ pdm->dmPanningWidth = pdm->dmPelsWidth;
+ pdm->dmPelsWidth = RequestedMode->dmPelsWidth;
+ }
+ if (RequestedMode->dmFields & DM_PANNINGHEIGHT)
+ {
+ pdm->dmFields |= DM_PANNINGHEIGHT;
+ pdm->dmPanningHeight = pdm->dmPelsHeight;
+ pdm->dmPelsHeight = RequestedMode->dmPelsHeight;
+ }
+ }
+
*pSelectedMode = pdm;
return TRUE;
}