fixed the stretch code with some help from filip. small formatting changes.

svn path=/trunk/; revision=19724
This commit is contained in:
Brandon Turner 2005-11-28 19:41:01 +00:00
parent 6cb32a5274
commit 281343a6d5

View file

@ -1205,8 +1205,12 @@ NtUserPaintDesktop(HDC hDC)
IntGdiGetClipBox(hDC, &Rect); IntGdiGetClipBox(hDC, &Rect);
hWndDesktop = IntGetDesktopWindow(); hWndDesktop = IntGetDesktopWindow();
if (!(WndDesktop = UserGetWindowObject(hWndDesktop)))
WndDesktop = UserGetWindowObject(hWndDesktop);
if (!WndDesktop)
{
RETURN(FALSE); RETURN(FALSE);
}
DesktopBrush = (HBRUSH)IntGetClassLong(WndDesktop, GCL_HBRBACKGROUND, FALSE); //fixme: verify retval DesktopBrush = (HBRUSH)IntGetClassLong(WndDesktop, GCL_HBRBACKGROUND, FALSE); //fixme: verify retval
@ -1215,11 +1219,13 @@ NtUserPaintDesktop(HDC hDC)
* Paint desktop background * Paint desktop background
*/ */
if(WinSta->hbmWallpaper != NULL) if (WinSta->hbmWallpaper != NULL)
{ {
PWINDOW_OBJECT DeskWin; PWINDOW_OBJECT DeskWin;
if((DeskWin = UserGetWindowObject(hWndDesktop))) DeskWin = UserGetWindowObject(hWndDesktop);
if (DeskWin)
{ {
SIZE sz; SIZE sz;
int x, y; int x, y;
@ -1228,14 +1234,15 @@ NtUserPaintDesktop(HDC hDC)
sz.cx = DeskWin->WindowRect.right - DeskWin->WindowRect.left; sz.cx = DeskWin->WindowRect.right - DeskWin->WindowRect.left;
sz.cy = DeskWin->WindowRect.bottom - DeskWin->WindowRect.top; sz.cy = DeskWin->WindowRect.bottom - DeskWin->WindowRect.top;
if(WinSta->WallpaperMode == wmStretch || if (WinSta->WallpaperMode == wmStretch ||
WinSta->WallpaperMode == wmTile) WinSta->WallpaperMode == wmTile)
{ {
x = 0; x = 0;
y = 0; y = 0;
} }
else else
{ {
/* Find the upper left corner, can be negtive if the bitmap is bigger then the screen */
x = (sz.cx / 2) - (WinSta->cxWallpaper / 2); x = (sz.cx / 2) - (WinSta->cxWallpaper / 2);
y = (sz.cy / 2) - (WinSta->cyWallpaper / 2); y = (sz.cy / 2) - (WinSta->cyWallpaper / 2);
} }
@ -1245,7 +1252,8 @@ NtUserPaintDesktop(HDC hDC)
{ {
HBITMAP hOldBitmap; HBITMAP hOldBitmap;
if(x > 0 || y > 0) /* fill in the area that the bitmap is not going to cover */
if (x > 0 || y > 0)
{ {
/* FIXME - clip out the bitmap /* FIXME - clip out the bitmap
can be replaced with "NtGdiPatBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, PATCOPY | DSTINVERT);" can be replaced with "NtGdiPatBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, PATCOPY | DSTINVERT);"
@ -1255,82 +1263,55 @@ NtUserPaintDesktop(HDC hDC)
NtGdiSelectObject(hDC, PreviousBrush); NtGdiSelectObject(hDC, PreviousBrush);
} }
//Do not fill the background after it is painted no matter the size of the picture /*Do not fill the background after it is painted no matter the size of the picture */
doPatBlt = FALSE; doPatBlt = FALSE;
hOldBitmap = NtGdiSelectObject(hWallpaperDC, WinSta->hbmWallpaper); hOldBitmap = NtGdiSelectObject(hWallpaperDC, WinSta->hbmWallpaper);
if(WinSta->WallpaperMode == wmStretch) if (WinSta->WallpaperMode == wmStretch)
{ {
#if 0 //Broken Stretch Code NtGdiStretchBlt(hDC,
/* Fix me, stretch the bitmap to fit the screen. I'm not smart enough to do this :( */ x,
BITMAPINFO bmINFO; y,
LPVOID pBits; Rect.right,
bmINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); Rect.bottom,
/* Get bits */ hWallpaperDC,
NtGdiGetDIBits(hDC, 0,
WinSta->hbmWallpaper, 0,
0, WinSta->cxWallpaper,
WinSta->cyWallpaper, WinSta->cyWallpaper,
NULL, // what goes here? SRCCOPY);
&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) else if (WinSta->WallpaperMode == wmTile)
{ {
/* paint the bitmap across the screen then down */
for(y = 0; y < Rect.bottom; y += WinSta->cyWallpaper) for(y = 0; y < Rect.bottom; y += WinSta->cyWallpaper)
{ {
for(x = 0; x < Rect.right; x += WinSta->cxWallpaper) for(x = 0; x < Rect.right; x += WinSta->cxWallpaper)
{ {
NtGdiBitBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, hWallpaperDC, 0, 0, SRCCOPY); NtGdiBitBlt(hDC,
x,
y,
WinSta->cxWallpaper,
WinSta->cyWallpaper,
hWallpaperDC,
0,
0,
SRCCOPY);
} }
} }
} }
else else
{ {
NtGdiBitBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, hWallpaperDC, 0, 0, SRCCOPY); NtGdiBitBlt(hDC,
x,
y,
WinSta->cxWallpaper,
WinSta->cyWallpaper,
hWallpaperDC,
0,
0,
SRCCOPY);
} }
NtGdiSelectObject(hWallpaperDC, hOldBitmap); NtGdiSelectObject(hWallpaperDC, hOldBitmap);
NtGdiDeleteDC(hWallpaperDC); NtGdiDeleteDC(hWallpaperDC);
@ -1356,9 +1337,13 @@ NtUserPaintDesktop(HDC hDC)
RECT rect; RECT rect;
if (*s_wszVersion) if (*s_wszVersion)
{
len = wcslen(s_wszVersion); len = wcslen(s_wszVersion);
}
else else
{
len = GetSystemVersionString(s_wszVersion); len = GetSystemVersionString(s_wszVersion);
}
if (len) if (len)
{ {