mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 17:06:29 +00:00
fix wallpaper style center and implement tile.
svn path=/trunk/; revision=19714
This commit is contained in:
parent
305379b387
commit
ce6ccd9bb5
|
@ -1228,9 +1228,17 @@ NtUserPaintDesktop(HDC hDC)
|
|||
sz.cx = DeskWin->WindowRect.right - DeskWin->WindowRect.left;
|
||||
sz.cy = DeskWin->WindowRect.bottom - DeskWin->WindowRect.top;
|
||||
|
||||
|
||||
x = (sz.cx / 2) - (WinSta->cxWallpaper / 2);
|
||||
y = (sz.cy / 2) - (WinSta->cyWallpaper / 2);
|
||||
if(WinSta->WallpaperMode == wmStretch ||
|
||||
WinSta->WallpaperMode == wmTile)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (sz.cx / 2) - (WinSta->cxWallpaper / 2);
|
||||
y = (sz.cy / 2) - (WinSta->cyWallpaper / 2);
|
||||
}
|
||||
|
||||
hWallpaperDC = NtGdiCreateCompatibleDC(hDC);
|
||||
if(hWallpaperDC != NULL)
|
||||
|
@ -1239,23 +1247,98 @@ NtUserPaintDesktop(HDC hDC)
|
|||
|
||||
if(x > 0 || y > 0)
|
||||
{
|
||||
/* FIXME - clip out the bitmap */
|
||||
PreviousBrush = NtGdiSelectObject(hDC, DesktopBrush);
|
||||
NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY);
|
||||
NtGdiSelectObject(hDC, PreviousBrush);
|
||||
/* FIXME - clip out the bitmap
|
||||
can be replaced with "NtGdiPatBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, PATCOPY | DSTINVERT);"
|
||||
once we support DSTINVERT */
|
||||
PreviousBrush = NtGdiSelectObject(hDC, DesktopBrush);
|
||||
NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY);
|
||||
NtGdiSelectObject(hDC, PreviousBrush);
|
||||
}
|
||||
else
|
||||
doPatBlt = FALSE;
|
||||
|
||||
//Do not fill the background after it is painted no matter the size of the picture
|
||||
doPatBlt = FALSE;
|
||||
|
||||
hOldBitmap = NtGdiSelectObject(hWallpaperDC, WinSta->hbmWallpaper);
|
||||
NtGdiBitBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, hWallpaperDC, 0, 0, SRCCOPY);
|
||||
NtGdiSelectObject(hWallpaperDC, hOldBitmap);
|
||||
|
||||
if(WinSta->WallpaperMode == wmStretch)
|
||||
{
|
||||
#if 0 //Broken Stretch Code
|
||||
/* Fix me, stretch the bitmap to fit the screen. I'm not smart enough to do this :( */
|
||||
BITMAPINFO bmINFO;
|
||||
LPVOID pBits;
|
||||
bmINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
/* Get bits */
|
||||
NtGdiGetDIBits(hDC,
|
||||
WinSta->hbmWallpaper,
|
||||
0,
|
||||
WinSta->cyWallpaper,
|
||||
NULL, // what goes here?
|
||||
&bmINFO,
|
||||
DIB_RGB_COLORS);
|
||||
|
||||
bmINFO.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
pBits = ExAllocatePool(PagedPool,bmINFO.bmiHeader.biSizeImage);
|
||||
|
||||
if(pBits == NULL)
|
||||
{
|
||||
doPatBlt = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
NtGdiGetDIBits(hDC,
|
||||
WinSta->hbmWallpaper,
|
||||
0,
|
||||
WinSta->cyWallpaper,
|
||||
(LPVOID)pBits, // what goes here?
|
||||
&bmINFO,
|
||||
DIB_RGB_COLORS);
|
||||
DPRINT1("Before Draw\n");
|
||||
|
||||
/* Stretch it to fit the screen */
|
||||
NtGdiStretchDIBits(hDC,
|
||||
0,
|
||||
0,
|
||||
Rect.right,
|
||||
Rect.bottom,
|
||||
0,
|
||||
0,
|
||||
WinSta->cxWallpaper,
|
||||
WinSta->cyWallpaper,
|
||||
(LPVOID)pBits, // get this from NtGdiGetDiBits?
|
||||
&bmINFO, // get this from NtGdiGetDiBits?
|
||||
DIB_RGB_COLORS,
|
||||
SRCCOPY);
|
||||
ExFreePool(pBits);
|
||||
}
|
||||
#else
|
||||
/* Draw nothing */
|
||||
doPatBlt = TRUE;
|
||||
#endif //Broken Stretch Code
|
||||
}
|
||||
else if(WinSta->WallpaperMode == wmTile)
|
||||
{
|
||||
|
||||
for(y = 0; y < Rect.bottom; y += WinSta->cyWallpaper)
|
||||
{
|
||||
for(x = 0; x < Rect.right; x += WinSta->cxWallpaper)
|
||||
{
|
||||
NtGdiBitBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, hWallpaperDC, 0, 0, SRCCOPY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NtGdiBitBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, hWallpaperDC, 0, 0, SRCCOPY);
|
||||
}
|
||||
NtGdiSelectObject(hWallpaperDC, hOldBitmap);
|
||||
NtGdiDeleteDC(hWallpaperDC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Back ground is set to none, clear the screen */
|
||||
if (doPatBlt)
|
||||
{
|
||||
PreviousBrush = NtGdiSelectObject(hDC, DesktopBrush);
|
||||
|
|
Loading…
Reference in a new issue