mirror of
https://github.com/reactos/reactos.git
synced 2024-10-22 22:09:47 +00:00
[WIN32K]
- NtGdiGetBitmapBits : Bits we're given are 16 bits aligned. - NtGdiGetDIBitsInternal : we must not stretch, for this there is NtGdiStretchDIBitsInternal. Use lower level functions to do the work, there is no need to create HDCs etc... Now icons are back. svn path=/branches/reactos-yarotows/; revision=48416
This commit is contained in:
parent
501947714e
commit
4519685bb8
|
@ -581,6 +581,36 @@ IntGetBitmapBits(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
UnsafeGetBitmapBits(
|
||||||
|
PSURFACE psurf,
|
||||||
|
DWORD Bytes,
|
||||||
|
OUT PBYTE pvBits)
|
||||||
|
{
|
||||||
|
PUCHAR pjDst, pjSrc;
|
||||||
|
LONG lDeltaDst, lDeltaSrc;
|
||||||
|
ULONG nWidth, nHeight, cBitsPixel;
|
||||||
|
|
||||||
|
nWidth = psurf->SurfObj.sizlBitmap.cx;
|
||||||
|
nHeight = psurf->SurfObj.sizlBitmap.cy;
|
||||||
|
cBitsPixel = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
|
||||||
|
|
||||||
|
/* Get pointers */
|
||||||
|
pjSrc = psurf->SurfObj.pvScan0;
|
||||||
|
pjDst = pvBits;
|
||||||
|
lDeltaSrc = psurf->SurfObj.lDelta;
|
||||||
|
lDeltaDst = BITMAP_GetWidthBytes(nWidth, cBitsPixel);
|
||||||
|
|
||||||
|
while (nHeight--)
|
||||||
|
{
|
||||||
|
/* Copy one line */
|
||||||
|
RtlCopyMemory(pjDst, pjSrc, lDeltaDst);
|
||||||
|
pjSrc += lDeltaSrc;
|
||||||
|
pjDst += lDeltaDst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LONG APIENTRY
|
LONG APIENTRY
|
||||||
NtGdiGetBitmapBits(
|
NtGdiGetBitmapBits(
|
||||||
HBITMAP hBitmap,
|
HBITMAP hBitmap,
|
||||||
|
@ -620,7 +650,8 @@ NtGdiGetBitmapBits(
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForWrite(pUnsafeBits, Bytes, 1);
|
ProbeForWrite(pUnsafeBits, Bytes, 1);
|
||||||
ret = IntGetBitmapBits(psurf, Bytes, pUnsafeBits);
|
UnsafeGetBitmapBits(psurf, Bytes, pUnsafeBits);
|
||||||
|
ret = Bytes;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -695,7 +695,7 @@ NtGdiGetDIBitsInternal(
|
||||||
Info->bmiHeader.biYPelsPerMeter = 0;
|
Info->bmiHeader.biYPelsPerMeter = 0;
|
||||||
Info->bmiHeader.biClrUsed = 0;
|
Info->bmiHeader.biClrUsed = 0;
|
||||||
Info->bmiHeader.biClrImportant = 0;
|
Info->bmiHeader.biClrImportant = 0;
|
||||||
ScanLines = psurf->SurfObj.sizlBitmap.cy;
|
ScanLines = 1;
|
||||||
/* Get Complete info now */
|
/* Get Complete info now */
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -897,8 +897,11 @@ NtGdiGetDIBitsInternal(
|
||||||
{
|
{
|
||||||
/* Create a DIBSECTION, blt it, profit */
|
/* Create a DIBSECTION, blt it, profit */
|
||||||
PVOID pDIBits ;
|
PVOID pDIBits ;
|
||||||
HBITMAP hBmpDest, hOldDest = NULL, hOldSrc = NULL;
|
HBITMAP hBmpDest;
|
||||||
HDC hdcDest = NULL, hdcSrc;
|
PSURFACE psurfDest;
|
||||||
|
EXLATEOBJ exlo;
|
||||||
|
RECT rcDest;
|
||||||
|
POINTL srcPoint;
|
||||||
BOOL ret ;
|
BOOL ret ;
|
||||||
|
|
||||||
if (StartScan > psurf->SurfObj.sizlBitmap.cy)
|
if (StartScan > psurf->SurfObj.sizlBitmap.cy)
|
||||||
|
@ -911,7 +914,15 @@ NtGdiGetDIBitsInternal(
|
||||||
ScanLines = min(ScanLines, psurf->SurfObj.sizlBitmap.cy - StartScan);
|
ScanLines = min(ScanLines, psurf->SurfObj.sizlBitmap.cy - StartScan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fixup values */
|
||||||
|
Info->bmiHeader.biWidth = psurf->SurfObj.sizlBitmap.cx;
|
||||||
|
Info->bmiHeader.biHeight = height < 0 ?
|
||||||
|
-ScanLines : ScanLines;
|
||||||
|
/* Create the DIB */
|
||||||
hBmpDest = DIB_CreateDIBSection(pDC, Info, Usage, &pDIBits, NULL, 0, 0);
|
hBmpDest = DIB_CreateDIBSection(pDC, Info, Usage, &pDIBits, NULL, 0, 0);
|
||||||
|
/* Restore them */
|
||||||
|
Info->bmiHeader.biWidth = width;
|
||||||
|
Info->bmiHeader.biHeight = height;
|
||||||
|
|
||||||
if(!hBmpDest)
|
if(!hBmpDest)
|
||||||
{
|
{
|
||||||
|
@ -921,56 +932,25 @@ NtGdiGetDIBitsInternal(
|
||||||
goto done ;
|
goto done ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(psurf->hdc)
|
psurfDest = SURFACE_LockSurface(hBmpDest);
|
||||||
hdcSrc = psurf->hdc;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hdcSrc = NtGdiCreateCompatibleDC(0);
|
|
||||||
if(!hdcSrc)
|
|
||||||
{
|
|
||||||
DPRINT1("Error: could not create HDC!\n");
|
|
||||||
ScanLines = 0;
|
|
||||||
goto cleanup_blt;
|
|
||||||
}
|
|
||||||
hOldSrc = NtGdiSelectBitmap(hdcSrc, hBitmap);
|
|
||||||
if(!hOldSrc)
|
|
||||||
{
|
|
||||||
DPRINT1("Error : Could not Select bitmap\n");
|
|
||||||
ScanLines = 0;
|
|
||||||
goto cleanup_blt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hdcDest = NtGdiCreateCompatibleDC(0);
|
rcDest.left = 0;
|
||||||
if(!hdcDest)
|
rcDest.top = 0;
|
||||||
{
|
rcDest.bottom = ScanLines;
|
||||||
DPRINT1("Error: could not create HDC!\n");
|
rcDest.right = psurf->SurfObj.sizlBitmap.cx;
|
||||||
ScanLines = 0;
|
|
||||||
goto cleanup_blt;
|
|
||||||
}
|
|
||||||
hOldDest = NtGdiSelectBitmap(hdcDest, hBmpDest);
|
|
||||||
if(!hOldDest)
|
|
||||||
{
|
|
||||||
DPRINT1("Error : Could not Select bitmap\n");
|
|
||||||
ScanLines = 0;
|
|
||||||
goto cleanup_blt;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = GreStretchBltMask(hdcDest,
|
srcPoint.x = 0;
|
||||||
0,
|
srcPoint.y = height < 0 ?
|
||||||
0,
|
psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines) : StartScan;
|
||||||
width,
|
|
||||||
height,
|
EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0, 0, 0);
|
||||||
hdcSrc,
|
|
||||||
0,
|
ret = IntEngCopyBits(&psurfDest->SurfObj,
|
||||||
StartScan,
|
&psurf->SurfObj,
|
||||||
psurf->SurfObj.sizlBitmap.cx,
|
NULL,
|
||||||
ScanLines,
|
&exlo.xlo,
|
||||||
SRCCOPY,
|
&rcDest,
|
||||||
0,
|
&srcPoint);
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if(!ret)
|
if(!ret)
|
||||||
ScanLines = 0;
|
ScanLines = 0;
|
||||||
|
@ -994,18 +974,8 @@ NtGdiGetDIBitsInternal(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_blt:
|
|
||||||
if(hdcSrc && (hdcSrc != psurf->hdc))
|
|
||||||
{
|
|
||||||
if(hOldSrc) NtGdiSelectBitmap(hdcSrc, hOldSrc);
|
|
||||||
NtGdiDeleteObjectApp(hdcSrc);
|
|
||||||
}
|
|
||||||
if(hdcSrc)
|
|
||||||
{
|
|
||||||
if(hOldDest) NtGdiSelectBitmap(hdcDest, hOldDest);
|
|
||||||
NtGdiDeleteObjectApp(hdcDest);
|
|
||||||
}
|
|
||||||
GreDeleteObject(hBmpDest);
|
GreDeleteObject(hBmpDest);
|
||||||
|
EXLATEOBJ_vCleanup(&exlo);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Reference in a new issue