diff --git a/reactos/subsys/win32k/eng/bitblt.c b/reactos/subsys/win32k/eng/bitblt.c index 8db2d236b29..a02b2d44d30 100644 --- a/reactos/subsys/win32k/eng/bitblt.c +++ b/reactos/subsys/win32k/eng/bitblt.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: bitblt.c,v 1.66 2004/12/18 17:52:30 royce Exp $ +/* $Id: bitblt.c,v 1.67 2004/12/30 02:32:18 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -831,7 +831,7 @@ AlphaBltMask(SURFOBJ* Dest, g = (int)GetGValue(BrushColor); b = (int)GetBValue(BrushColor); - tMask = Mask->pvBits + (SourcePoint->y * Mask->lDelta) + SourcePoint->x; + tMask = Mask->pvScan0 + (SourcePoint->y * Mask->lDelta) + SourcePoint->x; for (j = 0; j < dy; j++) { lMask = tMask; diff --git a/reactos/subsys/win32k/ntuser/cursoricon.c b/reactos/subsys/win32k/ntuser/cursoricon.c index 2d3131c23cc..3d83602772e 100644 --- a/reactos/subsys/win32k/ntuser/cursoricon.c +++ b/reactos/subsys/win32k/ntuser/cursoricon.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: cursoricon.c,v 1.4 2004/12/20 21:34:23 gvg Exp $ */ +/* $Id: cursoricon.c,v 1.5 2004/12/30 02:32:18 navaraf Exp $ */ #include PCURICON_OBJECT FASTCALL @@ -446,8 +446,11 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect) if(CurIconObject->IconInfo.hbmMask && (bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmMask))) { - CurIconObject->Size.cx = bmp->SurfObj.sizlBitmap.cx; - CurIconObject->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2; + if (CurIconObject->IconInfo.hbmColor == NULL) + { + CurIconObject->Size.cx = bmp->SurfObj.sizlBitmap.cx; + CurIconObject->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2; + } BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask); GDIOBJ_SetOwnership(CurIconObject->IconInfo.hbmMask, NULL); } diff --git a/reactos/subsys/win32k/objects/bitmaps.c b/reactos/subsys/win32k/objects/bitmaps.c index 5aca49e2a4c..f61da6c88b4 100644 --- a/reactos/subsys/win32k/objects/bitmaps.c +++ b/reactos/subsys/win32k/objects/bitmaps.c @@ -16,7 +16,7 @@ * 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.84 2004/12/12 23:08:12 navaraf Exp $ */ +/* $Id: bitmaps.c,v 1.85 2004/12/30 02:32:19 navaraf Exp $ */ #include #define IN_RECT(r,x,y) \ @@ -388,7 +388,7 @@ NtGdiCreateBitmap( /* Create the bitmap object. */ hBitmap = IntCreateBitmap(Size, BITMAPOBJ_GetWidthBytes(Width, BitsPerPel), BitmapFormat(BitsPerPel, BI_RGB), - (Height > 0 ? 0 : BMF_TOPDOWN) | + (Height < 0 ? BMF_TOPDOWN : 0) | (Bits == NULL ? 0 : BMF_NOZEROINIT), NULL); if (!hBitmap) { @@ -893,9 +893,9 @@ NtGdiSetBitmapBits( /* Only get entire lines */ height = Bytes / abs(bmp->SurfObj.lDelta); - if (height > bmp->SurfObj.sizlBitmap.cx) + if (height > bmp->SurfObj.sizlBitmap.cy) { - height = bmp->SurfObj.sizlBitmap.cx; + height = bmp->SurfObj.sizlBitmap.cy; } Bytes = height * abs(bmp->SurfObj.lDelta); DPRINT ("(%08x, bytes:%ld, bits:%p) %dx%d %d colors fetched height: %ld\n", @@ -1257,23 +1257,33 @@ BITMAPOBJ_CopyBitmap(HBITMAP hBitmap) { HBITMAP res; BITMAP bm; + BITMAPOBJ *Bitmap; - if (IntGdiGetObject(hBitmap, sizeof(BITMAP), &bm) == 0) - { + if (hBitmap == NULL) return 0; - } + + Bitmap = GDIOBJ_LockObj(hBitmap, GDI_OBJECT_TYPE_BITMAP); + if (Bitmap == NULL) + return 0; + + BITMAP_GetObject(Bitmap, sizeof(BITMAP), &bm); bm.bmBits = NULL; + if (Bitmap->SurfObj.lDelta >= 0) + bm.bmHeight = -bm.bmHeight; + res = NtGdiCreateBitmapIndirect(&bm); if(res) { char *buf; - buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * bm.bmHeight, TAG_BITMAP); - NtGdiGetBitmapBits (hBitmap, bm.bmWidthBytes * bm.bmHeight, buf); - NtGdiSetBitmapBits (res, bm.bmWidthBytes * bm.bmHeight, buf); + buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * abs(bm.bmHeight), TAG_BITMAP); + NtGdiGetBitmapBits (hBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf); + NtGdiSetBitmapBits (res, bm.bmWidthBytes * abs(bm.bmHeight), buf); ExFreePool (buf); } + GDIOBJ_UnlockObj(hBitmap); + return res; } diff --git a/reactos/subsys/win32k/objects/dib.c b/reactos/subsys/win32k/objects/dib.c index 2e74e812840..6128240f083 100644 --- a/reactos/subsys/win32k/objects/dib.c +++ b/reactos/subsys/win32k/objects/dib.c @@ -1,5 +1,5 @@ /* - * $Id: dib.c,v 1.59 2004/12/27 16:47:02 navaraf Exp $ + * $Id: dib.c,v 1.60 2004/12/30 02:32:19 navaraf Exp $ * * ReactOS W32 Subsystem * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team @@ -149,7 +149,7 @@ IntSetDIBits( // Create source surface SourceSize.cx = bmi->bmiHeader.biWidth; - SourceSize.cy = abs(bmi->bmiHeader.biHeight); + SourceSize.cy = ScanLines; // Determine width of DIB DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount); @@ -157,7 +157,7 @@ IntSetDIBits( SourceBitmap = EngCreateBitmap(SourceSize, DIBWidth, BitmapFormat(bmi->bmiHeader.biBitCount, bmi->bmiHeader.biCompression), - 0 < bmi->bmiHeader.biHeight ? 0 : BMF_TOPDOWN, + bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0, (PVOID) Bits); if (0 == SourceBitmap) { @@ -217,10 +217,10 @@ IntSetDIBits( ZeroPoint.y = 0; // Determine destination rectangle - DestRect.top = 0; DestRect.left = 0; + DestRect.top = abs(bmi->bmiHeader.biHeight) - StartScan - ScanLines; DestRect.right = SourceSize.cx; - DestRect.bottom = SourceSize.cy; + DestRect.bottom = DestRect.top + ScanLines; copyBitsResult = EngCopyBits(DestSurf, SourceSurf, NULL, XlateObj, &DestRect, &ZeroPoint); @@ -778,7 +778,7 @@ DIB_CreateDIBSection( /* bm.bmBits = MapViewOfFile(section, FILE_MAP_ALL_ACCESS, 0L, offset, totalSize); */ DbgPrint("DIB_CreateDIBSection: Cannot yet handle section DIBs\n"); - SetLastWin32Error(ERROR_INVALID_FUNCTION); + SetLastWin32Error(ERROR_CALL_NOT_IMPLEMENTED); return 0; } else if (ovr_pitch && offset) @@ -836,11 +836,11 @@ DIB_CreateDIBSection( if (dib) { Size.cx = bm.bmWidth; - Size.cy = bm.bmHeight; + Size.cy = abs(bm.bmHeight); res = IntCreateBitmap(Size, bm.bmWidthBytes, BitmapFormat(bi->biBitCount * bi->biPlanes, bi->biCompression), BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | - (bi->biHeight > 0 ? 0 : BMF_TOPDOWN), + (bi->biHeight < 0 ? BMF_TOPDOWN : 0), bm.bmBits); if (! res) { diff --git a/reactos/subsys/win32k/objects/pen.c b/reactos/subsys/win32k/objects/pen.c index 61f732a8c47..f2f3fa6b7cd 100644 --- a/reactos/subsys/win32k/objects/pen.c +++ b/reactos/subsys/win32k/objects/pen.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: pen.c,v 1.17 2004/12/12 01:40:38 weiden Exp $ + * $Id: pen.c,v 1.18 2004/12/30 02:32:19 navaraf Exp $ */ #include @@ -109,12 +109,21 @@ HPEN STDCALL NtGdiExtCreatePen( DWORD PenStyle, DWORD Width, - CONST PLOGBRUSH LogBrush, + CONST LOGBRUSH *LogBrush, DWORD StyleCount, - CONST PDWORD Style) + CONST DWORD *Style) { - UNIMPLEMENTED; - return 0; + /* NOTE: This is HACK! */ + LOGPEN LogPen; + + if (PenStyle & PS_USERSTYLE) + PenStyle = (PenStyle & ~PS_STYLE_MASK) | PS_SOLID; + + LogPen.lopnStyle = PenStyle & PS_STYLE_MASK; + LogPen.lopnWidth.x = Width; + LogPen.lopnColor = (LogBrush != NULL) ? LogBrush->lbColor : 0; + + return IntGdiCreatePenIndirect(&LogPen); } /* EOF */