mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Fix icon handling
svn path=/trunk/; revision=6251
This commit is contained in:
parent
307c3b1526
commit
0c98050bdc
12 changed files with 461 additions and 371 deletions
|
@ -40,7 +40,6 @@ NtGdiCreateFontIndirect 1
|
||||||
NtGdiCreateHalftonePalette 1
|
NtGdiCreateHalftonePalette 1
|
||||||
NtGdiCreateHatchBrush 2
|
NtGdiCreateHatchBrush 2
|
||||||
NtGdiCreateIC 4
|
NtGdiCreateIC 4
|
||||||
NtGdiCreateIcon 9
|
|
||||||
NtGdiCreateMetaFile 1
|
NtGdiCreateMetaFile 1
|
||||||
NtGdiCreatePalette 1
|
NtGdiCreatePalette 1
|
||||||
NtGdiCreatePatternBrush 1
|
NtGdiCreatePatternBrush 1
|
||||||
|
|
|
@ -1098,7 +1098,7 @@ extern "C" {
|
||||||
#define RT_CURSORA (MAKEINTRESOURCEA(1))
|
#define RT_CURSORA (MAKEINTRESOURCEA(1))
|
||||||
#define RT_GROUP_CURSORA (MAKEINTRESOURCEA(12))
|
#define RT_GROUP_CURSORA (MAKEINTRESOURCEA(12))
|
||||||
#define RT_ICONA (MAKEINTRESOURCEA(3))
|
#define RT_ICONA (MAKEINTRESOURCEA(3))
|
||||||
#define RT_GROUP_ICONA (MAKEINTRESOURCEA(13))
|
#define RT_GROUP_ICONA (MAKEINTRESOURCEA(14))
|
||||||
#define RT_VERSIONA (MAKEINTRESOURCEA(16))
|
#define RT_VERSIONA (MAKEINTRESOURCEA(16))
|
||||||
|
|
||||||
#define RT_ACCELERATORW (MAKEINTRESOURCEW(9))
|
#define RT_ACCELERATORW (MAKEINTRESOURCEW(9))
|
||||||
|
@ -1113,7 +1113,7 @@ extern "C" {
|
||||||
#define RT_CURSORW (MAKEINTRESOURCEW(1))
|
#define RT_CURSORW (MAKEINTRESOURCEW(1))
|
||||||
#define RT_GROUP_CURSORW (MAKEINTRESOURCEW(12))
|
#define RT_GROUP_CURSORW (MAKEINTRESOURCEW(12))
|
||||||
#define RT_ICONW (MAKEINTRESOURCEW(3))
|
#define RT_ICONW (MAKEINTRESOURCEW(3))
|
||||||
#define RT_GROUP_ICONW (MAKEINTRESOURCEW(13))
|
#define RT_GROUP_ICONW (MAKEINTRESOURCEW(14))
|
||||||
#define RT_VERSIONW (MAKEINTRESOURCEW(16))
|
#define RT_VERSIONW (MAKEINTRESOURCEW(16))
|
||||||
|
|
||||||
#ifndef _DISABLE_TIDENT
|
#ifndef _DISABLE_TIDENT
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define GDI_OBJECT_TYPE_ENHMETAFILE 0x00730000
|
#define GDI_OBJECT_TYPE_ENHMETAFILE 0x00730000
|
||||||
#define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
|
#define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
|
||||||
#define GDI_OBJECT_TYPE_MEMDC 0x00750000
|
#define GDI_OBJECT_TYPE_MEMDC 0x00750000
|
||||||
#define GDI_OBJECT_TYPE_ICONCURSOR 0x00760000
|
|
||||||
#define GDI_OBJECT_TYPE_DCE 0x00770000
|
#define GDI_OBJECT_TYPE_DCE 0x00770000
|
||||||
#define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
|
#define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: icon.c,v 1.11 2003/08/29 00:24:42 weiden Exp $
|
/* $Id: icon.c,v 1.12 2003/10/06 16:25:53 gvg Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/icon.c
|
* FILE: lib/user32/windows/icon.c
|
||||||
|
@ -36,25 +36,194 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
STATIC WINBOOL FASTCALL
|
||||||
|
ICON_CopyBitmaps(HBITMAP *MaskTo, HBITMAP MaskFrom,
|
||||||
|
HBITMAP *ColorTo, HBITMAP *ColorFrom,
|
||||||
|
DWORD Width, DWORD Height)
|
||||||
|
{
|
||||||
|
HDC DCFrom, DCTo;
|
||||||
|
HBITMAP InitialFrom, InitialTo;
|
||||||
|
|
||||||
|
DCFrom = CreateCompatibleDC(NULL);
|
||||||
|
if (NULL == DCFrom)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
DCTo = CreateCompatibleDC(DCFrom);
|
||||||
|
if (NULL == DCTo)
|
||||||
|
{
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*MaskTo = CreateCompatibleBitmap(DCTo, Width, Height);
|
||||||
|
if (NULL == *MaskTo)
|
||||||
|
{
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
InitialFrom = SelectObject(DCFrom, MaskFrom);
|
||||||
|
if (NULL == InitialFrom)
|
||||||
|
{
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
InitialTo = SelectObject(DCTo, *MaskTo);
|
||||||
|
if (NULL == InitialTo)
|
||||||
|
{
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! BitBlt(DCTo, 0, 0, Width, Height, DCFrom, 0, 0, SRCCOPY))
|
||||||
|
{
|
||||||
|
SelectObject(DCTo, InitialTo);
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ColorTo = CreateCompatibleBitmap(DCTo, Width, Height);
|
||||||
|
if (NULL == *ColorTo)
|
||||||
|
{
|
||||||
|
SelectObject(DCTo, InitialTo);
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == SelectObject(DCFrom, ColorFrom))
|
||||||
|
{
|
||||||
|
DeleteObject(*ColorTo);
|
||||||
|
*ColorTo = NULL;
|
||||||
|
SelectObject(DCTo, InitialTo);
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == SelectObject(DCTo, *ColorTo))
|
||||||
|
{
|
||||||
|
DeleteObject(*ColorTo);
|
||||||
|
*ColorTo = NULL;
|
||||||
|
SelectObject(DCTo, InitialTo);
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (! BitBlt(DCTo, 0, 0, Width, Height, DCFrom, 0, 0, SRCCOPY))
|
||||||
|
{
|
||||||
|
SelectObject(DCTo, InitialTo);
|
||||||
|
DeleteObject(*ColorTo);
|
||||||
|
*ColorTo = NULL;
|
||||||
|
DeleteObject(*MaskTo);
|
||||||
|
*MaskTo = NULL;
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectObject(DCTo, InitialTo);
|
||||||
|
DeleteDC(DCTo);
|
||||||
|
SelectObject(DCFrom, InitialFrom);
|
||||||
|
DeleteDC(DCFrom);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
HICON
|
||||||
|
FASTCALL
|
||||||
|
ICON_CreateIconIndirect(PICONINFO IconInfo, WINBOOL CopyBitmaps,
|
||||||
|
DWORD Width, DWORD Height)
|
||||||
|
{
|
||||||
|
PICONINFO NewIcon;
|
||||||
|
|
||||||
|
if (NULL == IconInfo)
|
||||||
|
{
|
||||||
|
DPRINT("Invalid parameter passed\n");
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
NewIcon = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICONINFO));
|
||||||
|
if (NULL == NewIcon)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up the basic icon stuff */
|
||||||
|
NewIcon->fIcon = IconInfo->fIcon;
|
||||||
|
NewIcon->xHotspot = IconInfo->xHotspot;
|
||||||
|
NewIcon->yHotspot = IconInfo->yHotspot;
|
||||||
|
|
||||||
|
if (CopyBitmaps)
|
||||||
|
{
|
||||||
|
/* Store a copy the bitmaps */
|
||||||
|
if (! ICON_CopyBitmaps(&(NewIcon->hbmMask), IconInfo->hbmMask,
|
||||||
|
&(NewIcon->hbmColor), IconInfo->hbmColor,
|
||||||
|
Width, Height))
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, NewIcon);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We take ownership of the bitmaps */
|
||||||
|
NewIcon->hbmMask = IconInfo->hbmMask;
|
||||||
|
NewIcon->hbmColor = IconInfo->hbmColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (HICON) NewIcon;
|
||||||
|
}
|
||||||
|
|
||||||
HICON
|
HICON
|
||||||
ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
|
ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
|
||||||
{
|
{
|
||||||
HANDLE hXORBitmap;
|
|
||||||
HANDLE hANDBitmap;
|
|
||||||
BITMAPINFO* bwBIH;
|
BITMAPINFO* bwBIH;
|
||||||
ICONINFO IconInfo;
|
ICONINFO IconInfo;
|
||||||
HICON hIcon;
|
|
||||||
|
|
||||||
//load the XOR bitmap
|
IconInfo.fIcon = TRUE;
|
||||||
hXORBitmap = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT,
|
IconInfo.xHotspot = xHotspot;
|
||||||
ImageData, (BITMAPINFO*)IconImage, DIB_RGB_COLORS);
|
IconInfo.yHotspot = yHotspot;
|
||||||
|
|
||||||
//make ImageData point to the start of the AND image data
|
/* Load the XOR bitmap */
|
||||||
|
IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT,
|
||||||
|
ImageData, (BITMAPINFO*)IconImage, DIB_RGB_COLORS);
|
||||||
|
|
||||||
|
/* make ImageData point to the start of the AND image data */
|
||||||
ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
|
ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
|
||||||
IconImage->icHeader.biBitCount + 31) & ~31) >> 3) *
|
IconImage->icHeader.biBitCount + 31) & ~31) >> 3) *
|
||||||
(IconImage->icHeader.biHeight );
|
(IconImage->icHeader.biHeight );
|
||||||
|
|
||||||
//create a BITMAPINFO header for the monocrome part of the icon
|
/* create a BITMAPINFO header for the monocrome part of the icon */
|
||||||
bwBIH = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
|
bwBIH = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
|
||||||
|
|
||||||
bwBIH->bmiHeader.biBitCount = 1;
|
bwBIH->bmiHeader.biBitCount = 1;
|
||||||
|
@ -80,26 +249,15 @@ ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDe
|
||||||
bwBIH->bmiColors[1].rgbRed = 0xff;
|
bwBIH->bmiColors[1].rgbRed = 0xff;
|
||||||
bwBIH->bmiColors[1].rgbReserved = 0;
|
bwBIH->bmiColors[1].rgbReserved = 0;
|
||||||
|
|
||||||
//load the AND bitmap
|
/* load the AND bitmap */
|
||||||
hANDBitmap = CreateDIBitmap(hDC, &bwBIH->bmiHeader, CBM_INIT,
|
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, CBM_INIT,
|
||||||
ImageData, bwBIH, DIB_RGB_COLORS);
|
ImageData, bwBIH, DIB_RGB_COLORS);
|
||||||
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, bwBIH);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, bwBIH);
|
||||||
|
|
||||||
IconInfo.fIcon = TRUE;
|
/* Create the icon based on everything we have so far */
|
||||||
IconInfo.xHotspot = xHotspot;
|
return ICON_CreateIconIndirect(&IconInfo, FALSE, IconImage->icHeader.biWidth,
|
||||||
IconInfo.yHotspot = yHotspot;
|
IconImage->icHeader.biHeight);
|
||||||
IconInfo.hbmColor = hXORBitmap;
|
|
||||||
IconInfo.hbmMask = hANDBitmap;
|
|
||||||
|
|
||||||
//Create the icon based on everything we have so far
|
|
||||||
hIcon = CreateIconIndirect(&IconInfo);
|
|
||||||
|
|
||||||
//clean up
|
|
||||||
DeleteObject(hXORBitmap);
|
|
||||||
DeleteObject(hANDBitmap);
|
|
||||||
|
|
||||||
return hIcon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,13 +269,21 @@ STDCALL
|
||||||
CopyIcon(
|
CopyIcon(
|
||||||
HICON hIcon)
|
HICON hIcon)
|
||||||
{
|
{
|
||||||
ICONINFO IconInfo;
|
PICONINFO IconInfo = (PICONINFO) hIcon;
|
||||||
NtUserGetIconInfo(hIcon, &IconInfo.fIcon,
|
BITMAP BitmapInfo;
|
||||||
&IconInfo.xHotspot,
|
|
||||||
&IconInfo.yHotspot,
|
if (NULL == IconInfo)
|
||||||
&IconInfo.hbmMask,
|
{
|
||||||
&IconInfo.hbmColor);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
return CreateIconIndirect(&IconInfo);
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &BitmapInfo))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ICON_CreateIconIndirect(IconInfo, TRUE, BitmapInfo.bmWidth, BitmapInfo.bmHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,19 +298,27 @@ CreateIcon(
|
||||||
int nHeight,
|
int nHeight,
|
||||||
BYTE cPlanes,
|
BYTE cPlanes,
|
||||||
BYTE cBitsPixel,
|
BYTE cBitsPixel,
|
||||||
CONST BYTE *lpbANDbits,
|
CONST BYTE *ANDbits,
|
||||||
CONST BYTE *lpbXORbits)
|
CONST BYTE *XORbits)
|
||||||
{
|
{
|
||||||
DPRINT("hInstance not used in this implementation\n");
|
ICONINFO IconInfo;
|
||||||
return NtGdiCreateIcon(TRUE,
|
|
||||||
nWidth,
|
IconInfo.fIcon = TRUE;
|
||||||
nHeight,
|
IconInfo.xHotspot = nWidth / 2;
|
||||||
cPlanes,
|
IconInfo.yHotspot = nHeight / 2;
|
||||||
cBitsPixel,
|
IconInfo.hbmMask = CreateBitmap(nWidth, nHeight, cPlanes, cBitsPixel, ANDbits);
|
||||||
nWidth/2,
|
if (NULL == IconInfo.hbmMask)
|
||||||
nHeight/2,
|
{
|
||||||
lpbANDbits,
|
return NULL;
|
||||||
lpbXORbits);
|
}
|
||||||
|
IconInfo.hbmColor = CreateBitmap(nWidth, nHeight, cPlanes, cBitsPixel, XORbits);
|
||||||
|
if (NULL == IconInfo.hbmColor)
|
||||||
|
{
|
||||||
|
DeleteObject(IconInfo.hbmMask);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ICON_CreateIconIndirect(&IconInfo, FALSE, nWidth, nHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,53 +362,54 @@ CreateIconFromResourceEx(
|
||||||
|
|
||||||
DPRINT("dwVersion, cxDesired, cyDesired are all ignored in this implementation!\n");
|
DPRINT("dwVersion, cxDesired, cyDesired are all ignored in this implementation!\n");
|
||||||
|
|
||||||
if (!fIcon)
|
if (! fIcon)
|
||||||
{
|
{
|
||||||
wXHotspot = (WORD)*pbIconBits;
|
wXHotspot = (WORD)*pbIconBits;
|
||||||
pbIconBits+=2;
|
pbIconBits+=2;
|
||||||
wYHotspot = (WORD)*pbIconBits;
|
wYHotspot = (WORD)*pbIconBits;
|
||||||
pbIconBits+=2;
|
pbIconBits+=2;
|
||||||
cbIconBits-=4;
|
cbIconBits-=4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wXHotspot = cxDesired / 2;
|
wXHotspot = cxDesired / 2;
|
||||||
wYHotspot = cyDesired / 2;
|
wYHotspot = cyDesired / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get an safe copy of the icon data
|
/* get an safe copy of the icon data */
|
||||||
SafeIconImage = RtlAllocateHeap(RtlGetProcessHeap(), 0, cbIconBits);
|
SafeIconImage = RtlAllocateHeap(RtlGetProcessHeap(), 0, cbIconBits);
|
||||||
memcpy(SafeIconImage, pbIconBits, cbIconBits);
|
memcpy(SafeIconImage, pbIconBits, cbIconBits);
|
||||||
|
|
||||||
//take into acount the origonal hight was for both the AND and XOR images
|
/* take into acount the origonal hight was for both the AND and XOR images */
|
||||||
SafeIconImage->icHeader.biHeight /= 2;
|
SafeIconImage->icHeader.biHeight /= 2;
|
||||||
|
|
||||||
if (SafeIconImage->icHeader.biSize == sizeof(BITMAPCOREHEADER))
|
if (SafeIconImage->icHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||||
{
|
{
|
||||||
BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)SafeIconImage;
|
BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)SafeIconImage;
|
||||||
ColourCount = (Core->bcBitCount <= 8) ? (1 << Core->bcBitCount) : 0;
|
ColourCount = (Core->bcBitCount <= 8) ? (1 << Core->bcBitCount) : 0;
|
||||||
HeaderSize = sizeof(BITMAPCOREHEADER) + ColourCount * sizeof(RGBTRIPLE);
|
HeaderSize = sizeof(BITMAPCOREHEADER) + ColourCount * sizeof(RGBTRIPLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ColourCount = (SafeIconImage->icHeader.biBitCount <= 8) ?
|
ColourCount = (SafeIconImage->icHeader.biBitCount <= 8) ?
|
||||||
(1 << SafeIconImage->icHeader.biBitCount) : 0;
|
(1 << SafeIconImage->icHeader.biBitCount) : 0;
|
||||||
HeaderSize = sizeof(BITMAPINFOHEADER) + ColourCount * sizeof(RGBQUAD);
|
HeaderSize = sizeof(BITMAPINFOHEADER) + ColourCount * sizeof(RGBQUAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
//make data point to the start of the XOR image data
|
/* make data point to the start of the XOR image data */
|
||||||
Data = (PBYTE)SafeIconImage + HeaderSize;
|
Data = (PBYTE)SafeIconImage + HeaderSize;
|
||||||
|
|
||||||
//get a handle to the screen dc, the icon we create is going to be compatable with this
|
/* get a handle to the screen dc, the icon we create is going to be compatable with this */
|
||||||
hScreenDc = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
hScreenDc = CreateCompatibleDC(NULL);
|
||||||
if (hScreenDc == NULL)
|
if (hScreenDc == NULL)
|
||||||
{
|
{
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, SafeIconImage);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, SafeIconImage);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
hIcon = ICON_CreateIconFromData(hScreenDc, Data, SafeIconImage, cxDesired, cyDesired, wXHotspot, wYHotspot);
|
hIcon = ICON_CreateIconFromData(hScreenDc, Data, SafeIconImage, cxDesired, cyDesired, wXHotspot, wYHotspot);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, SafeIconImage);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, SafeIconImage);
|
||||||
|
|
||||||
return hIcon;
|
return hIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,24 +419,33 @@ CreateIconFromResourceEx(
|
||||||
*/
|
*/
|
||||||
HICON
|
HICON
|
||||||
STDCALL
|
STDCALL
|
||||||
CreateIconIndirect(
|
CreateIconIndirect(PICONINFO IconInfo)
|
||||||
PICONINFO piconinfo)
|
|
||||||
{
|
{
|
||||||
BITMAP bmMask;
|
BITMAP ColorBitmap;
|
||||||
BITMAP bmColor;
|
BITMAP MaskBitmap;
|
||||||
|
|
||||||
NtGdiGetObject( piconinfo->hbmMask, sizeof(BITMAP), &bmMask );
|
if (NULL == IconInfo)
|
||||||
NtGdiGetObject( piconinfo->hbmColor, sizeof(BITMAP), &bmColor );
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return NtGdiCreateIcon(piconinfo->fIcon,
|
if (0 == GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
|
||||||
bmColor.bmWidth,
|
{
|
||||||
bmColor.bmHeight,
|
return NULL;
|
||||||
bmColor.bmPlanes,
|
}
|
||||||
bmColor.bmBitsPixel,
|
if (0 == GetObjectW(IconInfo->hbmMask, sizeof(BITMAP), &MaskBitmap))
|
||||||
piconinfo->xHotspot,
|
{
|
||||||
piconinfo->yHotspot,
|
return NULL;
|
||||||
bmMask.bmBits,
|
}
|
||||||
bmColor.bmBits);
|
if (ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
|
||||||
|
ColorBitmap.bmHeight != MaskBitmap.bmWidth)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ICON_CreateIconIndirect(IconInfo, TRUE, ColorBitmap.bmWidth, ColorBitmap.bmHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -273,7 +457,26 @@ STDCALL
|
||||||
DestroyIcon(
|
DestroyIcon(
|
||||||
HICON hIcon)
|
HICON hIcon)
|
||||||
{
|
{
|
||||||
return NtGdiDeleteObject(hIcon);
|
PICONINFO IconInfo = (PICONINFO) hIcon;
|
||||||
|
|
||||||
|
if (NULL == IconInfo)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != IconInfo->hbmMask)
|
||||||
|
{
|
||||||
|
DeleteObject(IconInfo->hbmMask);
|
||||||
|
}
|
||||||
|
if (NULL != IconInfo->hbmColor)
|
||||||
|
{
|
||||||
|
DeleteObject(IconInfo->hbmColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, IconInfo);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,7 +491,7 @@ DrawIcon(
|
||||||
int Y,
|
int Y,
|
||||||
HICON hIcon)
|
HICON hIcon)
|
||||||
{
|
{
|
||||||
return DrawIconEx (hDC, X, Y, hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
|
return DrawIconEx(hDC, X, Y, hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ported from WINE20030408 */
|
/* Ported from WINE20030408 */
|
||||||
|
@ -308,52 +511,50 @@ DrawIconEx(
|
||||||
HBRUSH hbrFlickerFreeDraw,
|
HBRUSH hbrFlickerFreeDraw,
|
||||||
UINT diFlags)
|
UINT diFlags)
|
||||||
{
|
{
|
||||||
ICONINFO IconInfo;
|
PICONINFO IconInfo = (PICONINFO) hIcon;
|
||||||
BITMAP XORBitmap;
|
BITMAP Bitmap;
|
||||||
HDC hDC_off = 0, hMemDC;
|
HDC hDC_off = 0, hMemDC;
|
||||||
BOOL result = FALSE, DoOffscreen;
|
BOOL result = FALSE, DoOffscreen;
|
||||||
HBITMAP hB_off = 0, hOld = 0;
|
HBITMAP hB_off = 0, hOld = 0;
|
||||||
|
|
||||||
if (!NtUserGetIconInfo(hIcon, &IconInfo.fIcon,
|
if (NULL == IconInfo)
|
||||||
&IconInfo.xHotspot,
|
{
|
||||||
&IconInfo.yHotspot,
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
&IconInfo.hbmMask,
|
|
||||||
&IconInfo.hbmColor))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
NtGdiGetObject(IconInfo.hbmColor, sizeof(BITMAP), &XORBitmap);
|
|
||||||
|
|
||||||
DPRINT("(hdc=%p,pos=%d.%d,hicon=%p,extend=%d.%d,istep=%d,br=%p,flags=0x%08x)\n",
|
|
||||||
hdc,xLeft,yTop,hIcon,cxWidth,cyWidth,istepIfAniCur,hbrFlickerFreeDraw,diFlags );
|
|
||||||
|
|
||||||
hMemDC = CreateCompatibleDC (hdc);
|
|
||||||
if (diFlags & DI_COMPAT)
|
|
||||||
DPRINT("Ignoring flag DI_COMPAT\n");
|
|
||||||
|
|
||||||
if (!diFlags)
|
|
||||||
{
|
|
||||||
diFlags = DI_NORMAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the size of the destination image.
|
GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &Bitmap);
|
||||||
if (cxWidth == 0)
|
|
||||||
|
DPRINT("(hdc=%p,pos=%d.%d,hicon=%p,extend=%d.%d,istep=%d,br=%p,flags=0x%08x)\n",
|
||||||
|
hdc,xLeft,yTop,hIcon,cxWidth,cyWidth,istepIfAniCur,hbrFlickerFreeDraw,diFlags );
|
||||||
|
|
||||||
|
hMemDC = CreateCompatibleDC(hdc);
|
||||||
|
if (diFlags & DI_COMPAT)
|
||||||
{
|
{
|
||||||
if (diFlags & DI_DEFAULTSIZE)
|
DPRINT("Ignoring flag DI_COMPAT\n");
|
||||||
cxWidth = GetSystemMetrics (SM_CXICON);
|
|
||||||
else
|
|
||||||
cxWidth = XORBitmap.bmWidth;
|
|
||||||
}
|
|
||||||
if (cyWidth == 0)
|
|
||||||
{
|
|
||||||
if (diFlags & DI_DEFAULTSIZE)
|
|
||||||
cyWidth = GetSystemMetrics (SM_CYICON);
|
|
||||||
else
|
|
||||||
cyWidth = XORBitmap.bmHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DoOffscreen = (GetObjectType( hbrFlickerFreeDraw ) == OBJ_BRUSH);
|
if (!diFlags)
|
||||||
|
{
|
||||||
|
diFlags = DI_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (DoOffscreen)
|
/* Calculate the size of the destination image. */
|
||||||
|
if (cxWidth == 0)
|
||||||
|
{
|
||||||
|
cxWidth = (diFlags & DI_DEFAULTSIZE ? GetSystemMetrics (SM_CXICON)
|
||||||
|
: Bitmap.bmWidth);
|
||||||
|
}
|
||||||
|
if (cyWidth == 0)
|
||||||
|
{
|
||||||
|
cyWidth = (diFlags & DI_DEFAULTSIZE ? GetSystemMetrics (SM_CYICON)
|
||||||
|
: Bitmap.bmHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
DoOffscreen = (NULL != hbrFlickerFreeDraw
|
||||||
|
&& OBJ_BRUSH == GetObjectType(hbrFlickerFreeDraw));
|
||||||
|
|
||||||
|
if (DoOffscreen)
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
|
@ -362,82 +563,93 @@ DrawIconEx(
|
||||||
r.right = cxWidth;
|
r.right = cxWidth;
|
||||||
r.bottom = cxWidth;
|
r.bottom = cxWidth;
|
||||||
|
|
||||||
DbgPrint("in DrawIconEx calling: CreateCompatibleDC\n");
|
DPRINT("in DrawIconEx calling: CreateCompatibleDC\n");
|
||||||
hDC_off = CreateCompatibleDC(hdc);
|
hDC_off = CreateCompatibleDC(hdc);
|
||||||
|
|
||||||
DbgPrint("in DrawIconEx calling: CreateCompatibleBitmap\n");
|
DPRINT("in DrawIconEx calling: CreateCompatibleBitmap\n");
|
||||||
hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth);
|
hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth);
|
||||||
if (hDC_off && hB_off)
|
if (hDC_off && hB_off)
|
||||||
{
|
{
|
||||||
DbgPrint("in DrawIconEx calling: SelectObject\n");
|
DPRINT("in DrawIconEx calling: SelectObject\n");
|
||||||
hOld = SelectObject(hDC_off, hB_off);
|
hOld = SelectObject(hDC_off, hB_off);
|
||||||
|
|
||||||
DbgPrint("in DrawIconEx calling: FillRect\n");
|
DPRINT("in DrawIconEx calling: FillRect\n");
|
||||||
FillRect(hDC_off, &r, hbrFlickerFreeDraw);
|
FillRect(hDC_off, &r, hbrFlickerFreeDraw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hMemDC && (!DoOffscreen || (hDC_off && hB_off)))
|
if (hMemDC && (! DoOffscreen || (hDC_off && hB_off)))
|
||||||
{
|
{
|
||||||
COLORREF oldFg, oldBg;
|
COLORREF oldFg, oldBg;
|
||||||
INT nStretchMode;
|
INT nStretchMode;
|
||||||
|
|
||||||
nStretchMode = SetStretchBltMode (hdc, STRETCH_DELETESCANS);
|
nStretchMode = SetStretchBltMode(hdc, STRETCH_DELETESCANS);
|
||||||
|
oldFg = SetTextColor(hdc, RGB(0, 0, 0));
|
||||||
|
oldBg = SetBkColor(hdc, RGB(255, 255, 255));
|
||||||
|
|
||||||
oldFg = SetTextColor( hdc, RGB(0,0,0) );
|
if (IconInfo->hbmColor && IconInfo->hbmMask)
|
||||||
|
|
||||||
oldBg = SetBkColor( hdc, RGB(255,255,255) );
|
|
||||||
|
|
||||||
if (IconInfo.hbmColor && IconInfo.hbmMask)
|
|
||||||
{
|
|
||||||
HBITMAP hBitTemp = SelectObject( hMemDC, IconInfo.hbmMask );
|
|
||||||
if (diFlags & DI_MASK)
|
|
||||||
{
|
{
|
||||||
if (DoOffscreen)
|
HBITMAP hBitTemp = SelectObject(hMemDC, IconInfo->hbmMask);
|
||||||
StretchBlt (hDC_off, 0, 0, cxWidth, cyWidth,
|
if (diFlags & DI_MASK)
|
||||||
hMemDC, 0, 0, XORBitmap.bmWidth, XORBitmap.bmHeight, SRCAND);
|
{
|
||||||
else
|
if (DoOffscreen)
|
||||||
StretchBlt (hdc, xLeft, yTop, cxWidth, cyWidth,
|
{
|
||||||
hMemDC, 0, 0, XORBitmap.bmWidth, XORBitmap.bmHeight, SRCAND);
|
StretchBlt (hDC_off, 0, 0, cxWidth, cyWidth,
|
||||||
|
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
|
||||||
|
SRCAND);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StretchBlt (hdc, xLeft, yTop, cxWidth, cyWidth,
|
||||||
|
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
|
||||||
|
SRCAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SelectObject(hMemDC, IconInfo->hbmColor);
|
||||||
|
if (diFlags & DI_IMAGE)
|
||||||
|
{
|
||||||
|
if (DoOffscreen)
|
||||||
|
{
|
||||||
|
StretchBlt (hDC_off, 0, 0, cxWidth, cyWidth,
|
||||||
|
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
|
||||||
|
SRCINVERT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StretchBlt (hdc, xLeft, yTop, cxWidth, cyWidth,
|
||||||
|
hMemDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight,
|
||||||
|
SRCINVERT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SelectObject(hMemDC, hBitTemp);
|
||||||
|
result = TRUE;
|
||||||
}
|
}
|
||||||
SelectObject( hMemDC, IconInfo.hbmColor );
|
|
||||||
if (diFlags & DI_IMAGE)
|
|
||||||
{
|
|
||||||
if (DoOffscreen)
|
|
||||||
StretchBlt (hDC_off, 0, 0, cxWidth, cyWidth,
|
|
||||||
hMemDC, 0, 0, XORBitmap.bmWidth, XORBitmap.bmHeight, SRCPAINT);
|
|
||||||
else
|
|
||||||
StretchBlt (hdc, xLeft, yTop, cxWidth, cyWidth,
|
|
||||||
hMemDC, 0, 0, XORBitmap.bmWidth, XORBitmap.bmHeight, SRCPAINT);
|
|
||||||
}
|
|
||||||
SelectObject( hMemDC, hBitTemp );
|
|
||||||
result = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetTextColor( hdc, oldFg );
|
SetTextColor( hdc, oldFg );
|
||||||
SetBkColor( hdc, oldBg );
|
SetBkColor( hdc, oldBg );
|
||||||
if (IconInfo.hbmColor)
|
|
||||||
DeleteObject( IconInfo.hbmColor );
|
|
||||||
|
|
||||||
if (IconInfo.hbmMask)
|
|
||||||
DeleteObject( IconInfo.hbmMask );
|
|
||||||
|
|
||||||
SetStretchBltMode (hdc, nStretchMode);
|
SetStretchBltMode (hdc, nStretchMode);
|
||||||
|
|
||||||
if (DoOffscreen)
|
if (DoOffscreen)
|
||||||
{
|
{
|
||||||
BitBlt(hdc, xLeft, yTop, cxWidth, cyWidth, hDC_off, 0, 0, SRCCOPY);
|
BitBlt(hdc, xLeft, yTop, cxWidth, cyWidth, hDC_off, 0, 0, SRCCOPY);
|
||||||
SelectObject(hDC_off, hOld);
|
SelectObject(hDC_off, hOld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hMemDC)
|
if (hMemDC)
|
||||||
|
{
|
||||||
DeleteDC( hMemDC );
|
DeleteDC( hMemDC );
|
||||||
if (hDC_off)
|
}
|
||||||
|
if (hDC_off)
|
||||||
|
{
|
||||||
DeleteDC(hDC_off);
|
DeleteDC(hDC_off);
|
||||||
if (hB_off)
|
}
|
||||||
|
if (hB_off)
|
||||||
|
{
|
||||||
DeleteObject(hB_off);
|
DeleteObject(hB_off);
|
||||||
return result;
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,26 +660,40 @@ WINBOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
GetIconInfo(
|
GetIconInfo(
|
||||||
HICON hIcon,
|
HICON hIcon,
|
||||||
PICONINFO piconinfo)
|
PICONINFO IconInfo)
|
||||||
{
|
{
|
||||||
ICONINFO IconInfo;
|
PICONINFO IconData = (PICONINFO) hIcon;
|
||||||
WINBOOL res;
|
BITMAP BitmapInfo;
|
||||||
|
|
||||||
if(!piconinfo)
|
if (NULL == IconData)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOACCESS);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (NULL == IconInfo)
|
||||||
res = NtUserGetIconInfo(hIcon,
|
{
|
||||||
&piconinfo->fIcon,
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
&piconinfo->xHotspot,
|
return FALSE;
|
||||||
&piconinfo->yHotspot,
|
}
|
||||||
&piconinfo->hbmMask,
|
|
||||||
&piconinfo->hbmColor);
|
/* Copy basic info */
|
||||||
if(res)
|
IconInfo->fIcon = IconData->fIcon;
|
||||||
RtlCopyMemory(piconinfo, &IconInfo, sizeof(ICONINFO));
|
IconInfo->xHotspot = IconData->xHotspot;
|
||||||
return res;
|
IconInfo->yHotspot = IconData->yHotspot;
|
||||||
|
|
||||||
|
/* Copy the bitmaps */
|
||||||
|
if (0 == GetObjectW(IconData->hbmColor, sizeof(BITMAP), &BitmapInfo))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (! ICON_CopyBitmaps(&(IconInfo->hbmMask), IconData->hbmMask,
|
||||||
|
&(IconInfo->hbmColor), IconData->hbmColor,
|
||||||
|
BitmapInfo.bmWidth, BitmapInfo.bmHeight))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib16bpp.c,v 1.8 2003/08/31 07:56:24 gvg Exp $ */
|
/* $Id: dib16bpp.c,v 1.9 2003/10/06 16:25:53 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -305,7 +305,7 @@ DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Source = 0;
|
Source = 0;
|
||||||
for (k = 0; k < 2; k++)
|
for (k = 0; k < 2; k++)
|
||||||
{
|
{
|
||||||
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation) << (k * 16));
|
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (k * 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
|
@ -323,7 +323,7 @@ DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
{
|
{
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + i, sy, ColorTranslation);
|
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation);
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
|
@ -335,6 +335,7 @@ DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Dest >>= 16;
|
Dest >>= 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib1bpp.c,v 1.10 2003/08/22 08:03:51 gvg Exp $ */
|
/* $Id: dib1bpp.c,v 1.11 2003/10/06 16:25:53 gvg Exp $ */
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -295,7 +295,7 @@ DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Source = 0;
|
Source = 0;
|
||||||
for (k = 0; k < 32; k++)
|
for (k = 0; k < 32; k++)
|
||||||
{
|
{
|
||||||
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation) << k);
|
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
|
@ -312,7 +312,7 @@ DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
{
|
{
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + i, sy, ColorTranslation);
|
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation);
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
|
@ -323,6 +323,7 @@ DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Dest >>= 1;
|
Dest >>= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib24bpp.c,v 1.13 2003/08/12 21:55:47 gvg Exp $ */
|
/* $Id: dib24bpp.c,v 1.14 2003/10/06 16:25:53 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -253,7 +253,7 @@ DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
LONG i, j, k, sx, sy;
|
LONG i, j, sx, sy;
|
||||||
ULONG Dest, Source, Pattern;
|
ULONG Dest, Source, Pattern;
|
||||||
PULONG DestBits;
|
PULONG DestBits;
|
||||||
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
||||||
|
@ -276,7 +276,7 @@ DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Dest = *DestBits & 0x00ffffff;
|
Dest = *DestBits & 0x00ffffff;
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation) & 0x00ffffff;
|
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation) & 0x00ffffff;
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
|
@ -287,6 +287,7 @@ DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
*(PBYTE)DestBits = Dest & 0xff;
|
*(PBYTE)DestBits = Dest & 0xff;
|
||||||
*(PWORD)(DestBits + 1) = Dest >> 8;
|
*(PWORD)(DestBits + 1) = Dest >> 8;
|
||||||
}
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib32bpp.c,v 1.5 2003/08/13 20:24:04 chorns Exp $ */
|
/* $Id: dib32bpp.c,v 1.6 2003/10/06 16:25:53 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -247,7 +247,7 @@ DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
LONG i, j, k, sx, sy;
|
LONG i, j, sx, sy;
|
||||||
ULONG Dest, Source, Pattern;
|
ULONG Dest, Source, Pattern;
|
||||||
PULONG DestBits;
|
PULONG DestBits;
|
||||||
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
||||||
|
@ -270,7 +270,7 @@ DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Dest = *DestBits;
|
Dest = *DestBits;
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation);
|
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation);
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
|
@ -279,6 +279,7 @@ DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||||
}
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib4bpp.c,v 1.18 2003/08/13 20:24:04 chorns Exp $ */
|
/* $Id: dib4bpp.c,v 1.19 2003/10/06 16:25:53 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -285,7 +285,7 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Source = 0;
|
Source = 0;
|
||||||
for (k = 0; k < 8; k++)
|
for (k = 0; k < 8; k++)
|
||||||
{
|
{
|
||||||
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation) << (k * 4));
|
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (k * 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
|
@ -302,7 +302,7 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
{
|
{
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + i, sy, ColorTranslation);
|
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation);
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
|
@ -313,6 +313,7 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Dest >>= 4;
|
Dest >>= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib8bpp.c,v 1.6 2003/08/31 07:56:24 gvg Exp $ */
|
/* $Id: dib8bpp.c,v 1.7 2003/10/06 16:25:53 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -301,7 +301,7 @@ DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Source = 0;
|
Source = 0;
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
{
|
{
|
||||||
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation) << (k * 8));
|
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (k * 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
|
@ -321,7 +321,7 @@ DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
{
|
{
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + i, sy, ColorTranslation);
|
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation);
|
||||||
}
|
}
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
|
@ -335,6 +335,7 @@ DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
Dest >>= 8;
|
Dest >>= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -15,105 +15,8 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
|
||||||
BOOL FASTCALL IconCursor_InternalDelete( PICONCURSOROBJ pIconCursor )
|
|
||||||
{
|
|
||||||
ASSERT( pIconCursor );
|
|
||||||
if( pIconCursor->ANDBitmap.bmBits )
|
|
||||||
ExFreePool(pIconCursor->ANDBitmap.bmBits);
|
|
||||||
if( pIconCursor->XORBitmap.bmBits )
|
|
||||||
ExFreePool(pIconCursor->XORBitmap.bmBits);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @unimplemented
|
||||||
*/
|
|
||||||
HICON
|
|
||||||
STDCALL
|
|
||||||
NtGdiCreateIcon(BOOL fIcon,
|
|
||||||
INT Width,
|
|
||||||
INT Height,
|
|
||||||
UINT Planes,
|
|
||||||
UINT BitsPerPel,
|
|
||||||
DWORD xHotspot,
|
|
||||||
DWORD yHotspot,
|
|
||||||
CONST VOID *ANDBits,
|
|
||||||
CONST VOID *XORBits)
|
|
||||||
{
|
|
||||||
PICONCURSOROBJ icon;
|
|
||||||
HICON hIcon;
|
|
||||||
|
|
||||||
Planes = (BYTE) Planes;
|
|
||||||
BitsPerPel = (BYTE) BitsPerPel;
|
|
||||||
|
|
||||||
/* Check parameters */
|
|
||||||
if (!Height || !Width)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (Planes != 1)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create the ICONCURSOROBJ object*/
|
|
||||||
hIcon = ICONCURSOROBJ_AllocIconCursor ();
|
|
||||||
if (!hIcon)
|
|
||||||
{
|
|
||||||
DPRINT("NtGdiCreateIcon: ICONCURSOROBJ_AllocIconCursor(hIcon == 0x%x) returned 0\n", hIcon);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
icon = ICONCURSOROBJ_LockIconCursor(hIcon);
|
|
||||||
|
|
||||||
/* Set up the basic icon stuff */
|
|
||||||
icon->fIcon = TRUE;
|
|
||||||
icon->xHotspot = xHotspot;
|
|
||||||
icon->yHotspot = yHotspot;
|
|
||||||
|
|
||||||
/* Setup the icon mask and icon color bitmaps */
|
|
||||||
icon->ANDBitmap.bmType = 0;
|
|
||||||
icon->ANDBitmap.bmWidth = Width;
|
|
||||||
icon->ANDBitmap.bmHeight = Height;
|
|
||||||
icon->ANDBitmap.bmPlanes = 1;
|
|
||||||
icon->ANDBitmap.bmBitsPixel = 1;
|
|
||||||
icon->ANDBitmap.bmWidthBytes = BITMAPOBJ_GetWidthBytes (Width, 1);
|
|
||||||
icon->ANDBitmap.bmBits = NULL;
|
|
||||||
|
|
||||||
icon->XORBitmap.bmType = 0;
|
|
||||||
icon->XORBitmap.bmWidth = Width;
|
|
||||||
icon->XORBitmap.bmHeight = Height;
|
|
||||||
icon->XORBitmap.bmPlanes = Planes;
|
|
||||||
icon->XORBitmap.bmBitsPixel = BitsPerPel;
|
|
||||||
icon->XORBitmap.bmWidthBytes = BITMAPOBJ_GetWidthBytes (Width, BitsPerPel);
|
|
||||||
icon->XORBitmap.bmBits = NULL;
|
|
||||||
|
|
||||||
/* allocate memory for the icon mask and icon color bitmaps,
|
|
||||||
this will be freed in IconCursor_InternalDelete */
|
|
||||||
icon->ANDBitmap.bmBits = ExAllocatePool(PagedPool, Height * icon->ANDBitmap.bmWidthBytes);
|
|
||||||
icon->XORBitmap.bmBits = ExAllocatePool(PagedPool, Height * icon->XORBitmap.bmWidthBytes);
|
|
||||||
|
|
||||||
/* set the bits of the mask and color bitmaps */
|
|
||||||
if (ANDBits)
|
|
||||||
{
|
|
||||||
memcpy(icon->ANDBitmap.bmBits, (PVOID)ANDBits, Height * icon->ANDBitmap.bmWidthBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XORBits)
|
|
||||||
{
|
|
||||||
memcpy(icon->XORBitmap.bmBits, (PVOID)XORBits, Height * icon->XORBitmap.bmWidthBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
ICONCURSOROBJ_UnlockIconCursor( hIcon );
|
|
||||||
|
|
||||||
return hIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -125,43 +28,14 @@ NtUserGetIconInfo(
|
||||||
HBITMAP *hbmMask,
|
HBITMAP *hbmMask,
|
||||||
HBITMAP *hbmColor)
|
HBITMAP *hbmColor)
|
||||||
{
|
{
|
||||||
PICONCURSOROBJ icon;
|
UNIMPLEMENTED
|
||||||
|
|
||||||
icon = ICONCURSOROBJ_LockIconCursor(hIcon);
|
return FALSE;
|
||||||
|
|
||||||
if (!icon)
|
|
||||||
{
|
|
||||||
DPRINT1("NtUserGetIconInfo: ICONCURSOROBJ_LockIconCursor(hIcon == 0x%x) returned 0\n", hIcon);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*fIcon = icon->fIcon ;
|
|
||||||
*xHotspot = icon->xHotspot;
|
|
||||||
*yHotspot = icon->yHotspot;
|
|
||||||
|
|
||||||
*hbmMask = NtGdiCreateBitmap(icon->ANDBitmap.bmWidth,
|
|
||||||
icon->ANDBitmap.bmHeight,
|
|
||||||
icon->ANDBitmap.bmPlanes,
|
|
||||||
icon->ANDBitmap.bmBitsPixel,
|
|
||||||
icon->ANDBitmap.bmBits);
|
|
||||||
|
|
||||||
*hbmColor = NtGdiCreateBitmap(icon->XORBitmap.bmWidth,
|
|
||||||
icon->XORBitmap.bmHeight,
|
|
||||||
icon->XORBitmap.bmPlanes,
|
|
||||||
icon->XORBitmap.bmBitsPixel,
|
|
||||||
icon->XORBitmap.bmBits);
|
|
||||||
|
|
||||||
ICONCURSOROBJ_UnlockIconCursor(hIcon);
|
|
||||||
|
|
||||||
if (!*hbmMask || !*hbmColor)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -171,26 +45,9 @@ NtUserGetIconSize(
|
||||||
LONG *Width,
|
LONG *Width,
|
||||||
LONG *Height)
|
LONG *Height)
|
||||||
{
|
{
|
||||||
PICONCURSOROBJ icon;
|
UNIMPLEMENTED
|
||||||
|
|
||||||
if (!hIcon || !Width || !Width)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
icon = ICONCURSOROBJ_LockIconCursor(hIcon);
|
return FALSE;
|
||||||
|
|
||||||
if (!icon)
|
|
||||||
{
|
|
||||||
DPRINT1("NtUserGetIconInfo: ICONCURSOROBJ_LockIconCursor() returned 0\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fIcon) *fIcon = icon->fIcon;
|
|
||||||
*Width = icon->ANDBitmap.bmWidth;
|
|
||||||
*Width = icon->ANDBitmap.bmHeight;
|
|
||||||
|
|
||||||
ICONCURSOROBJ_UnlockIconCursor(hIcon);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dc.c,v 1.86 2003/10/04 20:26:43 gvg Exp $
|
/* $Id: dc.c,v 1.87 2003/10/06 16:25:53 gvg Exp $
|
||||||
*
|
*
|
||||||
* DC.C - Device context functions
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -132,6 +132,7 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
HDC hNewDC;
|
HDC hNewDC;
|
||||||
HRGN hVisRgn;
|
HRGN hVisRgn;
|
||||||
BITMAPOBJ *pb;
|
BITMAPOBJ *pb;
|
||||||
|
PSURFGDI SurfGDI;
|
||||||
|
|
||||||
if (hDC == NULL)
|
if (hDC == NULL)
|
||||||
{
|
{
|
||||||
|
@ -166,6 +167,8 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
sizeof(NewDC->FillPatternSurfaces));
|
sizeof(NewDC->FillPatternSurfaces));
|
||||||
NewDC->GDIInfo = &PrimarySurface.GDIInfo;
|
NewDC->GDIInfo = &PrimarySurface.GDIInfo;
|
||||||
NewDC->DevInfo = &PrimarySurface.DevInfo;
|
NewDC->DevInfo = &PrimarySurface.DevInfo;
|
||||||
|
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) PrimarySurface.Handle);
|
||||||
|
NewDC->w.bitsPerPixel = SurfGDI->BitsPerPixel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -176,6 +179,7 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
sizeof OrigDC->FillPatternSurfaces);
|
sizeof OrigDC->FillPatternSurfaces);
|
||||||
NewDC->GDIInfo = OrigDC->GDIInfo;
|
NewDC->GDIInfo = OrigDC->GDIInfo;
|
||||||
NewDC->DevInfo = OrigDC->DevInfo;
|
NewDC->DevInfo = OrigDC->DevInfo;
|
||||||
|
NewDC->w.bitsPerPixel = OrigDC->w.bitsPerPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DriverName is copied in the AllocDC routine */
|
/* DriverName is copied in the AllocDC routine */
|
||||||
|
@ -197,7 +201,7 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create default bitmap */
|
/* Create default bitmap */
|
||||||
if (!(hBitmap = NtGdiCreateBitmap( 1, 1, 1, 1, NULL )))
|
if (!(hBitmap = NtGdiCreateBitmap( 1, 1, 1, NewDC->w.bitsPerPixel, NULL )))
|
||||||
{
|
{
|
||||||
DC_UnlockDc( hDC );
|
DC_UnlockDc( hDC );
|
||||||
DC_UnlockDc( hNewDC );
|
DC_UnlockDc( hNewDC );
|
||||||
|
@ -205,7 +209,6 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
NewDC->w.flags = DC_MEMORY;
|
NewDC->w.flags = DC_MEMORY;
|
||||||
NewDC->w.bitsPerPixel = 1;
|
|
||||||
NewDC->w.hBitmap = hBitmap;
|
NewDC->w.hBitmap = hBitmap;
|
||||||
NewDC->w.hFirstBitmap = hBitmap;
|
NewDC->w.hFirstBitmap = hBitmap;
|
||||||
pb = BITMAPOBJ_LockBitmap(hBitmap);
|
pb = BITMAPOBJ_LockBitmap(hBitmap);
|
||||||
|
|
Loading…
Reference in a new issue