mirror of
https://github.com/reactos/reactos.git
synced 2025-05-10 20:27:45 +00:00
[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
This commit is contained in:
parent
185f2dac85
commit
37c2bb3985
1 changed files with 46 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue