mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 08:52:57 +00:00
fixed locking bug, eliminated warnings
svn path=/trunk/; revision=5464
This commit is contained in:
parent
bda3572a3d
commit
ee25eea496
1 changed files with 26 additions and 16 deletions
|
@ -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: bitmaps.c,v 1.30 2003/06/28 08:39:18 gvg Exp $ */
|
/* $Id: bitmaps.c,v 1.31 2003/08/07 16:18:02 royce Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -40,20 +40,33 @@ BOOL STDCALL W32kBitBlt(HDC hDCDest,
|
||||||
INT YSrc,
|
INT YSrc,
|
||||||
DWORD ROP)
|
DWORD ROP)
|
||||||
{
|
{
|
||||||
PDC DCDest = DC_HandleToPtr(hDCDest);
|
GDIMULTILOCK Lock[2] = {{hDCDest, 0, GO_DC_MAGIC}, {hDCSrc, 0, GO_DC_MAGIC}};
|
||||||
PDC DCSrc = DC_HandleToPtr(hDCSrc);
|
PDC DCDest = NULL;
|
||||||
|
PDC DCSrc = NULL;
|
||||||
PSURFOBJ SurfDest, SurfSrc;
|
PSURFOBJ SurfDest, SurfSrc;
|
||||||
PSURFGDI SurfGDIDest, SurfGDISrc;
|
PSURFGDI SurfGDIDest, SurfGDISrc;
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
POINTL SourcePoint;
|
POINTL SourcePoint;
|
||||||
PBITMAPOBJ DestBitmapObj;
|
//PBITMAPOBJ DestBitmapObj;
|
||||||
PBITMAPOBJ SrcBitmapObj;
|
//PBITMAPOBJ SrcBitmapObj;
|
||||||
BOOL Status, SurfDestAlloc, SurfSrcAlloc, XlateAlloc;
|
BOOL Status, SurfDestAlloc, SurfSrcAlloc, XlateAlloc;
|
||||||
PPALOBJ DCLogPal;
|
PPALOBJ DCLogPal;
|
||||||
PPALGDI PalDestGDI, PalSourceGDI;
|
PPALGDI PalDestGDI, PalSourceGDI;
|
||||||
PXLATEOBJ XlateObj = NULL;
|
PXLATEOBJ XlateObj = NULL;
|
||||||
HPALETTE SourcePalette, DestPalette;
|
HPALETTE SourcePalette, DestPalette;
|
||||||
|
|
||||||
|
if ( !GDIOBJ_LockMultipleObj(Lock, sizeof(Lock)/sizeof(Lock[0])) )
|
||||||
|
{
|
||||||
|
DPRINT1("GDIOBJ_LockMultipleObj() failed\n" );
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
DCDest = Lock[0].pObj;
|
||||||
|
DCSrc = Lock[1].pObj;
|
||||||
|
|
||||||
|
if ( !DCDest || !DCSrc )
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
/* Offset the destination and source by the origin of their DCs. */
|
/* Offset the destination and source by the origin of their DCs. */
|
||||||
XDest += DCDest->w.DCOrgX;
|
XDest += DCDest->w.DCOrgX;
|
||||||
YDest += DCDest->w.DCOrgY;
|
YDest += DCDest->w.DCOrgY;
|
||||||
|
@ -73,14 +86,14 @@ BOOL STDCALL W32kBitBlt(HDC hDCDest,
|
||||||
XlateAlloc = FALSE;
|
XlateAlloc = FALSE;
|
||||||
|
|
||||||
// Determine surfaces to be used in the bitblt
|
// Determine surfaces to be used in the bitblt
|
||||||
SurfDest = (PSURFOBJ)AccessUserObject(DCDest->Surface);
|
SurfDest = (PSURFOBJ)AccessUserObject((ULONG)DCDest->Surface);
|
||||||
SurfSrc = (PSURFOBJ)AccessUserObject(DCSrc->Surface);
|
SurfSrc = (PSURFOBJ)AccessUserObject((ULONG)DCSrc->Surface);
|
||||||
|
|
||||||
SurfGDIDest = (PSURFGDI)AccessInternalObjectFromUserObject(SurfDest);
|
SurfGDIDest = (PSURFGDI)AccessInternalObjectFromUserObject(SurfDest);
|
||||||
SurfGDISrc = (PSURFGDI)AccessInternalObjectFromUserObject(SurfSrc);
|
SurfGDISrc = (PSURFGDI)AccessInternalObjectFromUserObject(SurfSrc);
|
||||||
|
|
||||||
// Retrieve the logical palette of the destination DC
|
// Retrieve the logical palette of the destination DC
|
||||||
DCLogPal = (PPALOBJ)AccessUserObject(DCDest->w.hPalette);
|
DCLogPal = (PPALOBJ)AccessUserObject((ULONG)DCDest->w.hPalette);
|
||||||
|
|
||||||
if(DCLogPal)
|
if(DCLogPal)
|
||||||
if(DCLogPal->logicalToSystem)
|
if(DCLogPal->logicalToSystem)
|
||||||
|
@ -90,19 +103,17 @@ BOOL STDCALL W32kBitBlt(HDC hDCDest,
|
||||||
if((BitsPerFormat(SurfDest->iBitmapFormat) != BitsPerFormat(SurfSrc->iBitmapFormat)) && (XlateObj == NULL))
|
if((BitsPerFormat(SurfDest->iBitmapFormat) != BitsPerFormat(SurfSrc->iBitmapFormat)) && (XlateObj == NULL))
|
||||||
{
|
{
|
||||||
if(DCDest->w.hPalette != 0)
|
if(DCDest->w.hPalette != 0)
|
||||||
{
|
|
||||||
DestPalette = DCDest->w.hPalette;
|
DestPalette = DCDest->w.hPalette;
|
||||||
} else
|
else
|
||||||
DestPalette = W32kGetStockObject(DEFAULT_PALETTE);
|
DestPalette = W32kGetStockObject(DEFAULT_PALETTE);
|
||||||
|
|
||||||
if(DCSrc->w.hPalette != 0)
|
if(DCSrc->w.hPalette != 0)
|
||||||
{
|
|
||||||
SourcePalette = DCSrc->w.hPalette;
|
SourcePalette = DCSrc->w.hPalette;
|
||||||
} else
|
else
|
||||||
SourcePalette = W32kGetStockObject(DEFAULT_PALETTE);
|
SourcePalette = W32kGetStockObject(DEFAULT_PALETTE);
|
||||||
|
|
||||||
PalDestGDI = (PPALGDI)AccessInternalObject(DestPalette);
|
PalDestGDI = (PPALGDI)AccessInternalObject((ULONG)DestPalette);
|
||||||
PalSourceGDI = (PPALGDI)AccessInternalObject(SourcePalette);
|
PalSourceGDI = (PPALGDI)AccessInternalObject((ULONG)SourcePalette);
|
||||||
|
|
||||||
XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalDestGDI->Mode, PalSourceGDI->Mode, DestPalette, SourcePalette);
|
XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalDestGDI->Mode, PalSourceGDI->Mode, DestPalette, SourcePalette);
|
||||||
XlateAlloc = TRUE;
|
XlateAlloc = TRUE;
|
||||||
|
@ -116,8 +127,7 @@ BOOL STDCALL W32kBitBlt(HDC hDCDest,
|
||||||
if (SurfDestAlloc) ExFreePool(SurfDest);
|
if (SurfDestAlloc) ExFreePool(SurfDest);
|
||||||
if (SurfSrcAlloc) ExFreePool(SurfSrc);
|
if (SurfSrcAlloc) ExFreePool(SurfSrc);
|
||||||
|
|
||||||
DC_ReleasePtr(hDCDest);
|
GDIOBJ_UnlockMultipleObj(Lock, sizeof(Lock)/sizeof(Lock[0]));
|
||||||
DC_ReleasePtr(hDCSrc);
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue