Fixed SetPixel and initial implementation of SetPixelV.

svn path=/trunk/; revision=6164
This commit is contained in:
Filip Navara 2003-09-27 15:09:26 +00:00
parent f7deec4b5c
commit c434e40598

View file

@ -16,12 +16,13 @@
* 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.38 2003/08/31 07:56:24 gvg Exp $ */ /* $Id: bitmaps.c,v 1.39 2003/09/27 15:09:26 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <stdlib.h> #include <stdlib.h>
#include <win32k/gdiobj.h> #include <win32k/gdiobj.h>
#include <win32k/bitmaps.h> #include <win32k/bitmaps.h>
#include <win32k/brush.h>
//#include <win32k/debug.h> //#include <win32k/debug.h>
#include "../eng/handle.h" #include "../eng/handle.h"
#include <include/inteng.h> #include <include/inteng.h>
@ -480,11 +481,11 @@ COLORREF STDCALL NtGdiSetPixel(HDC hDC,
INT X, INT X,
INT Y, INT Y,
COLORREF Color) COLORREF Color)
{
if(NtGdiSetPixelV(hDC,X,Y,Color))
{ {
COLORREF cr = NtGdiGetPixel(hDC,X,Y); COLORREF cr = NtGdiGetPixel(hDC,X,Y);
if(CLR_INVALID != cr) return(cr); if(cr != CLR_INVALID && NtGdiSetPixelV(hDC,X,Y,Color))
{
return(cr);
} }
return ((COLORREF) -1); return ((COLORREF) -1);
} }
@ -494,26 +495,18 @@ BOOL STDCALL NtGdiSetPixelV(HDC hDC,
INT Y, INT Y,
COLORREF Color) COLORREF Color)
{ {
PDC dc = NULL; HBRUSH NewBrush = NtGdiCreateSolidBrush(Color);
PBITMAPOBJ bmp = NULL; HGDIOBJ OldBrush;
BITMAP bm;
dc = DC_LockDc (hDC); if (NewBrush == NULL)
if(NULL == dc)
{
return(FALSE); return(FALSE);
} OldBrush = NtGdiSelectObject(hDC, NewBrush);
bmp = BITMAPOBJ_LockBitmap (dc->w.hBitmap); if (OldBrush == NULL)
if(NULL == bmp)
{
DC_UnlockDc (hDC);
return(FALSE); return(FALSE);
} NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY);
bm = bmp->bitmap; NtGdiSelectObject(hDC, OldBrush);
//FIXME: set the actual pixel value NtGdiDeleteObject(NewBrush);
BITMAPOBJ_UnlockBitmap (dc->w.hBitmap); return TRUE;
DC_UnlockDc (hDC);
return(TRUE);
} }
BOOL STDCALL NtGdiStretchBlt(HDC hDCDest, BOOL STDCALL NtGdiStretchBlt(HDC hDCDest,