mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:26:17 +00:00
[WIN32K]
Fix IntCreateCompatibleBitmap, previously when the given DC was a memory DC with a dibsection selected, the function would only work if the dibsection was <= 8 bpp. svn path=/trunk/; revision=50999
This commit is contained in:
parent
d089825a9f
commit
38e6b4b424
1 changed files with 93 additions and 98 deletions
|
@ -233,10 +233,9 @@ IntCreateCompatibleBitmap(
|
||||||
/* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
|
/* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
|
||||||
if (0 == Width || 0 == Height)
|
if (0 == Width || 0 == Height)
|
||||||
{
|
{
|
||||||
Bmp = NtGdiGetStockObject(DEFAULT_BITMAP);
|
return NtGdiGetStockObject(DEFAULT_BITMAP);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Dc->dctype != DC_TYPE_MEMORY)
|
if (Dc->dctype != DC_TYPE_MEMORY)
|
||||||
{
|
{
|
||||||
PSURFACE psurf;
|
PSURFACE psurf;
|
||||||
|
@ -246,14 +245,14 @@ IntCreateCompatibleBitmap(
|
||||||
1,
|
1,
|
||||||
Dc->ppdev->gdiinfo.cBitsPixel,
|
Dc->ppdev->gdiinfo.cBitsPixel,
|
||||||
NULL);
|
NULL);
|
||||||
psurf = SURFACE_LockSurface(Bmp);
|
psurf = SURFACE_ShareLockSurface(Bmp);
|
||||||
ASSERT(psurf);
|
ASSERT(psurf);
|
||||||
/* Set palette */
|
/* Set palette */
|
||||||
psurf->ppal = PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault);
|
psurf->ppal = PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault);
|
||||||
/* Set flags */
|
/* Set flags */
|
||||||
psurf->flags = API_BITMAP;
|
psurf->flags = API_BITMAP;
|
||||||
psurf->hdc = NULL; // Fixme
|
psurf->hdc = NULL; // Fixme
|
||||||
SURFACE_UnlockSurface(psurf);
|
SURFACE_ShareUnlockSurface(psurf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -262,8 +261,6 @@ IntCreateCompatibleBitmap(
|
||||||
PSURFACE psurf = Dc->dclevel.pSurface;
|
PSURFACE psurf = Dc->dclevel.pSurface;
|
||||||
Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs);
|
Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs);
|
||||||
|
|
||||||
if (Count)
|
|
||||||
{
|
|
||||||
if (Count == sizeof(BITMAP))
|
if (Count == sizeof(BITMAP))
|
||||||
{
|
{
|
||||||
PSURFACE psurfBmp;
|
PSURFACE psurfBmp;
|
||||||
|
@ -283,7 +280,7 @@ IntCreateCompatibleBitmap(
|
||||||
psurfBmp->hdc = NULL; // Fixme
|
psurfBmp->hdc = NULL; // Fixme
|
||||||
SURFACE_UnlockSurface(psurfBmp);
|
SURFACE_UnlockSurface(psurfBmp);
|
||||||
}
|
}
|
||||||
else
|
else if (Count == sizeof(DIBSECTION))
|
||||||
{
|
{
|
||||||
/* A DIB section is selected in the DC */
|
/* A DIB section is selected in the DC */
|
||||||
BYTE buf[sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)] = {0};
|
BYTE buf[sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)] = {0};
|
||||||
|
@ -331,6 +328,7 @@ IntCreateCompatibleBitmap(
|
||||||
bi->bmiColors[Index].rgbReserved = 0;
|
bi->bmiColors[Index].rgbReserved = 0;
|
||||||
}
|
}
|
||||||
PALETTE_UnlockPalette(PalGDI);
|
PALETTE_UnlockPalette(PalGDI);
|
||||||
|
}
|
||||||
|
|
||||||
Bmp = DIB_CreateDIBSection(Dc,
|
Bmp = DIB_CreateDIBSection(Dc,
|
||||||
bi,
|
bi,
|
||||||
|
@ -342,9 +340,6 @@ IntCreateCompatibleBitmap(
|
||||||
return Bmp;
|
return Bmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Bmp;
|
return Bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue