Author: fireball
Date: Sat Oct 20 17:41:15 2007
New Revision: 29708
URL:
http://svn.reactos.org/svn/reactos?rev=29708&view=rev
Log:
- Merge 21563, 21589, 21652, 21794.
Modified:
branches/win32k-stable/reactos/subsystems/win32/win32k/eng/engmisc.c
branches/win32k-stable/reactos/subsystems/win32/win32k/eng/objects.h
branches/win32k-stable/reactos/subsystems/win32/win32k/eng/surface.c
branches/win32k-stable/reactos/subsystems/win32/win32k/eng/xlate.c
branches/win32k-stable/reactos/subsystems/win32/win32k/ntuser/menu.c
branches/win32k-stable/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: branches/win32k-stable/reactos/subsystems/win32/win32k/eng/engmisc.c
URL:
http://svn.reactos.org/svn/reactos/branches/win32k-stable/reactos/subsystem…
==============================================================================
--- branches/win32k-stable/reactos/subsystems/win32/win32k/eng/engmisc.c (original)
+++ branches/win32k-stable/reactos/subsystems/win32/win32k/eng/engmisc.c Sat Oct 20
17:41:15 2007
@@ -68,6 +68,13 @@
EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width,
DestObj->iBitmapFormat,
BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
+
+ if (!EnterLeave->OutputBitmap)
+ {
+ DPRINT1("EngCreateBitmap() failed\n");
+ return FALSE;
+ }
+
*OutputObj = EngLockSurface((HSURF)EnterLeave->OutputBitmap);
EnterLeave->DestRect.left = 0;
Modified: branches/win32k-stable/reactos/subsystems/win32/win32k/eng/objects.h
URL:
http://svn.reactos.org/svn/reactos/branches/win32k-stable/reactos/subsystem…
==============================================================================
--- branches/win32k-stable/reactos/subsystems/win32/win32k/eng/objects.h (original)
+++ branches/win32k-stable/reactos/subsystems/win32/win32k/eng/objects.h Sat Oct 20
17:41:15 2007
@@ -158,9 +158,6 @@
INT GreenShift;
INT BlueShift;
// };
-// struct { /* For Table Translations */
- ULONG *translationTable;
-// };
// struct { /* For Color -> Mono Translations */
ULONG BackgroundColor;
// };
Modified: branches/win32k-stable/reactos/subsystems/win32/win32k/eng/surface.c
URL:
http://svn.reactos.org/svn/reactos/branches/win32k-stable/reactos/subsystem…
==============================================================================
--- branches/win32k-stable/reactos/subsystems/win32/win32k/eng/surface.c (original)
+++ branches/win32k-stable/reactos/subsystems/win32/win32k/eng/surface.c Sat Oct 20
17:41:15 2007
@@ -122,6 +122,12 @@
SURFOBJ *SurfObj;
NewBitmap = EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format)),
Format, 0, NULL);
+ if(!NewBitmap)
+ {
+ DPRINT1("EngCreateBitmap failed\n");
+ return 0;
+ }
+
SurfObj = EngLockSurface((HSURF)NewBitmap);
SurfObj->dhsurf = dhsurf;
EngUnlockSurface(SurfObj);
Modified: branches/win32k-stable/reactos/subsystems/win32/win32k/eng/xlate.c
URL:
http://svn.reactos.org/svn/reactos/branches/win32k-stable/reactos/subsystem…
==============================================================================
--- branches/win32k-stable/reactos/subsystems/win32/win32k/eng/xlate.c (original)
+++ branches/win32k-stable/reactos/subsystems/win32/win32k/eng/xlate.c Sat Oct 20 17:41:15
2007
@@ -181,6 +181,7 @@
XlateObj->iSrcType = SourcePalType;
XlateObj->iDstType = DestPalType;
XlateObj->flXlate = 0;
+ XlateObj->cEntries = 0;
/* Store handles of palettes in internal Xlate GDI object (or NULLs) */
XlateGDI->SourcePal = PaletteSource;
@@ -237,34 +238,34 @@
/* Indexed -> Indexed */
if (SourcePalType == PAL_INDEXED && DestPalType == PAL_INDEXED)
{
- XlateGDI->translationTable =
- EngAllocMem(0, sizeof(ULONG) * SourcePalGDI->NumColors, 0);
+ XlateObj->cEntries = SourcePalGDI->NumColors;
+ XlateObj->pulXlate =
+ EngAllocMem(0, sizeof(ULONG) * XlateObj->cEntries, 0);
XlateObj->flXlate |= XO_TRIVIAL;
- for (i = 0; i < SourcePalGDI->NumColors; i++)
+ for (i = 0; i < XlateObj->cEntries; i++)
{
- XlateGDI->translationTable[i] = ClosestColorMatch(
+ XlateObj->pulXlate[i] = ClosestColorMatch(
XlateGDI, SourcePalGDI->IndexedColors + i,
- DestPalGDI->IndexedColors, DestPalGDI->NumColors);
- if (XlateGDI->translationTable[i] != i)
+ DestPalGDI->IndexedColors, XlateObj->cEntries);
+ if (XlateObj->pulXlate[i] != i)
XlateObj->flXlate &= ~XO_TRIVIAL;
}
XlateObj->flXlate |= XO_TABLE;
- XlateObj->pulXlate = XlateGDI->translationTable;
goto end;
}
/* Indexed -> Bitfields/RGB/BGR */
if (SourcePalType == PAL_INDEXED)
{
- XlateGDI->translationTable =
- EngAllocMem(0, sizeof(ULONG) * SourcePalGDI->NumColors, 0);
- for (i = 0; i < SourcePalGDI->NumColors; i++)
- XlateGDI->translationTable[i] =
+ XlateObj->cEntries = SourcePalGDI->NumColors;
+ XlateObj->pulXlate =
+ EngAllocMem(0, sizeof(ULONG) * XlateObj->cEntries, 0);
+ for (i = 0; i < XlateObj->cEntries; i++)
+ XlateObj->pulXlate[i] =
ShiftAndMask(XlateGDI, *((ULONG *)&SourcePalGDI->IndexedColors[i]));
XlateObj->flXlate |= XO_TABLE;
- XlateObj->pulXlate = XlateGDI->translationTable;
goto end;
}
@@ -313,6 +314,7 @@
XlateGDI->SourcePal = PaletteSource;
XlateObj->flXlate = XO_TO_MONO;
+ XlateObj->cEntries = 1;
XlateObj->pulXlate = &XlateGDI->BackgroundColor;
switch (SourcePalType)
{
@@ -368,16 +370,15 @@
}
XlateObj = GDIToObj(XlateGDI, XLATE);
- XlateGDI->translationTable = EngAllocMem(0, sizeof(ULONG) * 2, 0);
- if (XlateGDI->translationTable == NULL)
+ XlateObj->cEntries = 2;
+ XlateObj->pulXlate = EngAllocMem(0, sizeof(ULONG) * XlateObj->cEntries, 0);
+ if (XlateObj->pulXlate == NULL)
{
PALETTE_UnlockPalette(DestPalGDI);
EngFreeMem(XlateGDI);
return NULL;
}
- XlateObj->pulXlate = XlateGDI->translationTable;
-
XlateObj->iSrcType = PAL_INDEXED;
XlateObj->iDstType = DestPalGDI->Mode;
@@ -394,19 +395,19 @@
XlateGDI->GreenShift = CalculateShift(RGB(0x00, 0xFF, 0x00)) -
CalculateShift(XlateGDI->GreenMask);
XlateGDI->BlueShift = CalculateShift(RGB(0x00, 0x00, 0xFF)) -
CalculateShift(XlateGDI->BlueMask);
- XlateGDI->translationTable[0] = ShiftAndMask(XlateGDI, BackgroundColor);
- XlateGDI->translationTable[1] = ShiftAndMask(XlateGDI, ForegroundColor);
+ XlateObj->pulXlate[0] = ShiftAndMask(XlateGDI, BackgroundColor);
+ XlateObj->pulXlate[1] = ShiftAndMask(XlateGDI, ForegroundColor);
if (XlateObj->iDstType == PAL_INDEXED)
{
- XlateGDI->translationTable[0] =
+ XlateObj->pulXlate[0] =
ClosestColorMatch(XlateGDI,
- (LPPALETTEENTRY)&XlateGDI->translationTable[0],
+ (LPPALETTEENTRY)&XlateObj->pulXlate[0],
DestPalGDI->IndexedColors,
DestPalGDI->NumColors);
- XlateGDI->translationTable[1] =
+ XlateObj->pulXlate[1] =
ClosestColorMatch(XlateGDI,
- (LPPALETTEENTRY)&XlateGDI->translationTable[1],
+ (LPPALETTEENTRY)&XlateObj->pulXlate[1],
DestPalGDI->IndexedColors,
DestPalGDI->NumColors);
}
@@ -453,9 +454,9 @@
XlateGDI = ObjToGDI(XlateObj, XLATE);
if ((XlateObj->flXlate & XO_TABLE) &&
- XlateGDI->translationTable != NULL)
- {
- EngFreeMem(XlateGDI->translationTable);
+ XlateObj->pulXlate != NULL)
+ {
+ EngFreeMem(XlateObj->pulXlate);
}
EngFreeMem(XlateGDI);
@@ -467,11 +468,9 @@
PULONG STDCALL
XLATEOBJ_piVector(XLATEOBJ *XlateObj)
{
- XLATEGDI *XlateGDI = ObjToGDI(XlateObj, XLATE);
-
if (XlateObj->iSrcType == PAL_INDEXED)
{
- return XlateGDI->translationTable;
+ return XlateObj->pulXlate;
}
return NULL;
@@ -493,9 +492,15 @@
if (XlateObj->flXlate & XO_TRIVIAL)
return Color;
-
+
if (XlateObj->flXlate & XO_TABLE)
+ {
+ if (Color >= XlateObj->cEntries)
+ Color %= XlateObj->cEntries;
+
return XlateObj->pulXlate[Color];
+ }
+
if (XlateObj->flXlate & XO_TO_MONO)
return Color == XlateObj->pulXlate[0];
Modified: branches/win32k-stable/reactos/subsystems/win32/win32k/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/branches/win32k-stable/reactos/subsystem…
==============================================================================
--- branches/win32k-stable/reactos/subsystems/win32/win32k/ntuser/menu.c (original)
+++ branches/win32k-stable/reactos/subsystems/win32/win32k/ntuser/menu.c Sat Oct 20
17:41:15 2007
@@ -744,15 +744,17 @@
IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, PROSMENUITEMINFO lpmii)
{
PMENU_OBJECT SubMenuObject;
+ UINT fTypeMask = (MFT_BITMAP | MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_OWNERDRAW |
MFT_RADIOCHECK | MFT_RIGHTJUSTIFY | MFT_SEPARATOR | MF_POPUP);
if(!MenuItem || !MenuObject || !lpmii)
{
return FALSE;
}
-
- MenuItem->fType &= ~MENU_ITEM_TYPE(MenuItem->fType);
- MenuItem->fType |= MENU_ITEM_TYPE(lpmii->fType);
-
+ if( lpmii->fType & ~fTypeMask)
+ {
+ DPRINT("IntSetMenuItemInfo invalid fType flags %x\n", lpmii->fType
& ~fTypeMask);
+ lpmii->fMask &= ~(MIIM_TYPE | MIIM_FTYPE);
+ }
if(lpmii->fMask & MIIM_BITMAP)
{
MenuItem->hbmpItem = lpmii->hbmpItem;
Modified: branches/win32k-stable/reactos/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/win32k-stable/reactos/subsystem…
==============================================================================
--- branches/win32k-stable/reactos/subsystems/win32/win32k/objects/dibobj.c (original)
+++ branches/win32k-stable/reactos/subsystems/win32/win32k/objects/dibobj.c Sat Oct 20
17:41:15 2007
@@ -454,6 +454,13 @@
BitmapFormat(Info->bmiHeader.biBitCount,
Info->bmiHeader.biCompression),
0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN,
Bits);
+
+ if(DestBitmap == NULL)
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ return 0;
+ }
+
DestSurfObj = EngLockSurface((HSURF)DestBitmap);
SourcePalette = PALETTE_LockPalette(hSourcePalette);