From c434e40598fcf780a79a13961ae92933f12eb951 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 27 Sep 2003 15:09:26 +0000 Subject: [PATCH] Fixed SetPixel and initial implementation of SetPixelV. svn path=/trunk/; revision=6164 --- reactos/subsys/win32k/objects/bitmaps.c | 37 ++++++++++--------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/reactos/subsys/win32k/objects/bitmaps.c b/reactos/subsys/win32k/objects/bitmaps.c index e2e7ddc1d36..b747f88e057 100644 --- a/reactos/subsys/win32k/objects/bitmaps.c +++ b/reactos/subsys/win32k/objects/bitmaps.c @@ -16,12 +16,13 @@ * along with this program; if not, write to the Free Software * 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 #include #include #include #include +#include //#include #include "../eng/handle.h" #include @@ -481,10 +482,10 @@ COLORREF STDCALL NtGdiSetPixel(HDC hDC, INT Y, COLORREF Color) { - if(NtGdiSetPixelV(hDC,X,Y,Color)) + COLORREF cr = NtGdiGetPixel(hDC,X,Y); + if(cr != CLR_INVALID && NtGdiSetPixelV(hDC,X,Y,Color)) { - COLORREF cr = NtGdiGetPixel(hDC,X,Y); - if(CLR_INVALID != cr) return(cr); + return(cr); } return ((COLORREF) -1); } @@ -494,26 +495,18 @@ BOOL STDCALL NtGdiSetPixelV(HDC hDC, INT Y, COLORREF Color) { - PDC dc = NULL; - PBITMAPOBJ bmp = NULL; - BITMAP bm; - - dc = DC_LockDc (hDC); - if(NULL == dc) - { + HBRUSH NewBrush = NtGdiCreateSolidBrush(Color); + HGDIOBJ OldBrush; + + if (NewBrush == NULL) return(FALSE); - } - bmp = BITMAPOBJ_LockBitmap (dc->w.hBitmap); - if(NULL == bmp) - { - DC_UnlockDc (hDC); + OldBrush = NtGdiSelectObject(hDC, NewBrush); + if (OldBrush == NULL) return(FALSE); - } - bm = bmp->bitmap; - //FIXME: set the actual pixel value - BITMAPOBJ_UnlockBitmap (dc->w.hBitmap); - DC_UnlockDc (hDC); - return(TRUE); + NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY); + NtGdiSelectObject(hDC, OldBrush); + NtGdiDeleteObject(NewBrush); + return TRUE; } BOOL STDCALL NtGdiStretchBlt(HDC hDCDest,