Author: jgardou
Date: Tue Mar 1 21:45:45 2011
New Revision: 50948
URL:
http://svn.reactos.org/svn/reactos?rev=50948&view=rev
Log:
[WIN32K]
- only lock DC if asked to in NtGdiSetDIBits.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Tue Mar 1
21:45:45 2011
@@ -336,7 +336,7 @@
CONST BITMAPINFO *bmi,
UINT ColorUse)
{
- PDC Dc;
+ PDC Dc = NULL;
INT Ret;
NTSTATUS Status = STATUS_SUCCESS;
@@ -364,21 +364,25 @@
return 0;
}
- Dc = DC_LockDc(hDC);
- if (NULL == Dc)
- {
- EngSetLastError(ERROR_INVALID_HANDLE);
- return 0;
- }
- if (Dc->dctype == DC_TYPE_INFO)
- {
- DC_UnlockDc(Dc);
- return 0;
+ /* Lock DC if asked to */
+ if(ColorUse == DIB_PAL_COLORS)
+ {
+ Dc = DC_LockDc(hDC);
+ if (NULL == Dc)
+ {
+ EngSetLastError(ERROR_INVALID_HANDLE);
+ return 0;
+ }
+ if (Dc->dctype == DC_TYPE_INFO)
+ {
+ DC_UnlockDc(Dc);
+ return 0;
+ }
}
Ret = IntSetDIBits(Dc, hBitmap, StartScan, ScanLines, Bits, bmi, ColorUse);
- DC_UnlockDc(Dc);
+ if(Dc) DC_UnlockDc(Dc);
return Ret;
}