[ros-diffs] [tkreuzer] 40417: [FORMATTING] - fix indentation - move an internal function out of public functions area - Use small file header - No code change

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Apr 8 16:18:24 CEST 2009


Author: tkreuzer
Date: Wed Apr  8 18:18:23 2009
New Revision: 40417

URL: http://svn.reactos.org/svn/reactos?rev=40417&view=rev
Log:
[FORMATTING]
- fix indentation
- move an internal function out of public functions area
- Use small file header
- No code change

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/brush.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/brush.c?rev=40417&r1=40416&r2=40417&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/brush.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/brush.c [iso-8859-1] Wed Apr  8 18:18:23 2009
@@ -1,23 +1,9 @@
-/*
- * ReactOS Win32 Subsystem
- *
- * Copyright (C) 1998 - 2004 ReactOS Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
+/* 
+ * COPYRIGHT:         See COPYING in the top level directory
+ * PROJECT:           ReactOS win32 subsystem
+ * PURPOSE:           Functions for brushes
+ * FILE:              subsystem/win32/win32k/objects/brush.c
+ * PROGRAMER:         
  */
 
 #include <w32k.h>
@@ -27,44 +13,46 @@
 
 static const USHORT HatchBrushes[NB_HATCH_STYLES][8] =
 {
-  {0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00}, /* HS_HORIZONTAL */
-  {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, /* HS_VERTICAL   */
-  {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}, /* HS_FDIAGONAL  */
-  {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}, /* HS_BDIAGONAL  */
-  {0x08, 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08}, /* HS_CROSS      */
-  {0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81}  /* HS_DIAGCROSS  */
+    {0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00}, /* HS_HORIZONTAL */
+    {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, /* HS_VERTICAL   */
+    {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}, /* HS_FDIAGONAL  */
+    {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}, /* HS_BDIAGONAL  */
+    {0x08, 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08}, /* HS_CROSS      */
+    {0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81}  /* HS_DIAGCROSS  */
 };
 
-BOOL INTERNAL_CALL
+BOOL
+INTERNAL_CALL
 BRUSH_Cleanup(PVOID ObjectBody)
 {
-  PBRUSH pbrush = (PBRUSH)ObjectBody;
-  if(pbrush->flAttrs & (GDIBRUSH_IS_HATCH | GDIBRUSH_IS_BITMAP))
-  {
-    ASSERT(pbrush->hbmPattern);
-    GDIOBJ_SetOwnership(pbrush->hbmPattern, PsGetCurrentProcess());
-    GreDeleteObject(pbrush->hbmPattern);
-  }
-
-  /* Free the kmode styles array of EXTPENS */
-  if (pbrush->pStyle)
-  {
-    ExFreePool(pbrush->pStyle);
-  }
-
-  return TRUE;
-}
-
-INT FASTCALL
-BRUSH_GetObject (PBRUSH pbrush, INT Count, LPLOGBRUSH Buffer)
-{
-   if( Buffer == NULL ) return sizeof(LOGBRUSH);
-   if (Count == 0) return 0;
-
-   /* Set colour */
+    PBRUSH pbrush = (PBRUSH)ObjectBody;
+    if (pbrush->flAttrs & (GDIBRUSH_IS_HATCH | GDIBRUSH_IS_BITMAP))
+    {
+        ASSERT(pbrush->hbmPattern);
+        GDIOBJ_SetOwnership(pbrush->hbmPattern, PsGetCurrentProcess());
+        GreDeleteObject(pbrush->hbmPattern);
+    }
+
+    /* Free the kmode styles array of EXTPENS */
+    if (pbrush->pStyle)
+    {
+        ExFreePool(pbrush->pStyle);
+    }
+
+    return TRUE;
+}
+
+INT
+FASTCALL
+BRUSH_GetObject(PBRUSH pbrush, INT Count, LPLOGBRUSH Buffer)
+{
+    if (Buffer == NULL) return sizeof(LOGBRUSH);
+    if (Count == 0) return 0;
+
+    /* Set colour */
     Buffer->lbColor = pbrush->BrushAttr.lbColor;
 
-    /* set Hatch */
+    /* Set Hatch */
     if ((pbrush->flAttrs & GDIBRUSH_IS_HATCH)!=0)
     {
         /* FIXME : this is not the right value */
@@ -135,448 +123,453 @@
  * @return
  *    TRUE if the input values together form a valid image, FALSE otherwise.
  */
-
-BOOL APIENTRY
+BOOL
+APIENTRY
 CalculateColorTableSize(
-   CONST BITMAPINFOHEADER *BitmapInfoHeader,
-   UINT *ColorSpec,
-   UINT *ColorTableSize)
-{
-   WORD BitCount;
-   DWORD ClrUsed;
-   DWORD Compression;
-
-   /*
-    * At first get some basic parameters from the passed BitmapInfoHeader
-    * structure. It can have one of the following formats:
-    * - BITMAPCOREHEADER (the oldest one with totally different layout
-    *                     from the others)
-    * - BITMAPINFOHEADER (the standard and most common header)
-    * - BITMAPV4HEADER (extension of BITMAPINFOHEADER)
-    * - BITMAPV5HEADER (extension of BITMAPV4HEADER)
-    */
-
-   if (BitmapInfoHeader->biSize == sizeof(BITMAPCOREHEADER))
-   {
-      BitCount = ((LPBITMAPCOREHEADER)BitmapInfoHeader)->bcBitCount;
-      ClrUsed = 0;
-      Compression = BI_RGB;
-   }
-   else
-   {
-      BitCount = BitmapInfoHeader->biBitCount;
-      ClrUsed = BitmapInfoHeader->biClrUsed;
-      Compression = BitmapInfoHeader->biCompression;
-   }
-
-   switch (Compression)
-   {
-      case BI_BITFIELDS:
-         if (*ColorSpec == DIB_PAL_COLORS)
-            *ColorSpec = DIB_RGB_COLORS;
-
-         if (BitCount != 16 && BitCount != 32)
+    CONST BITMAPINFOHEADER *BitmapInfoHeader,
+    UINT *ColorSpec,
+    UINT *ColorTableSize)
+{
+    WORD BitCount;
+    DWORD ClrUsed;
+    DWORD Compression;
+
+    /*
+     * At first get some basic parameters from the passed BitmapInfoHeader
+     * structure. It can have one of the following formats:
+     * - BITMAPCOREHEADER (the oldest one with totally different layout
+     *                     from the others)
+     * - BITMAPINFOHEADER (the standard and most common header)
+     * - BITMAPV4HEADER (extension of BITMAPINFOHEADER)
+     * - BITMAPV5HEADER (extension of BITMAPV4HEADER)
+     */
+    if (BitmapInfoHeader->biSize == sizeof(BITMAPCOREHEADER))
+    {
+        BitCount = ((LPBITMAPCOREHEADER)BitmapInfoHeader)->bcBitCount;
+        ClrUsed = 0;
+        Compression = BI_RGB;
+    }
+    else
+    {
+        BitCount = BitmapInfoHeader->biBitCount;
+        ClrUsed = BitmapInfoHeader->biClrUsed;
+        Compression = BitmapInfoHeader->biCompression;
+    }
+
+    switch (Compression)
+    {
+        case BI_BITFIELDS:
+            if (*ColorSpec == DIB_PAL_COLORS)
+                *ColorSpec = DIB_RGB_COLORS;
+
+            if (BitCount != 16 && BitCount != 32)
+                return FALSE;
+
+            /* For BITMAPV4HEADER/BITMAPV5HEADER the masks are included in
+             * the structure itself (bV4RedMask, bV4GreenMask, and bV4BlueMask).
+             * For BITMAPINFOHEADER the color masks are stored in the palette. */
+            if (BitmapInfoHeader->biSize > sizeof(BITMAPINFOHEADER))
+                *ColorTableSize = 0;
+            else
+                *ColorTableSize = 3;
+
+            return TRUE;
+
+        case BI_RGB:
+            switch (BitCount)
+            {
+                case 1:
+                    *ColorTableSize = ClrUsed ? min(ClrUsed, 2) : 2;
+                    return TRUE;
+
+                case 4:
+                    *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16;
+                    return TRUE;
+
+                case 8:
+                    *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256;
+                    return TRUE;
+
+                default:
+                    if (*ColorSpec == DIB_PAL_COLORS)
+                        *ColorSpec = DIB_RGB_COLORS;
+                    if (BitCount != 16 && BitCount != 24 && BitCount != 32)
+                        return FALSE;
+                    *ColorTableSize = ClrUsed;
+                    return TRUE;
+            }
+
+        case BI_RLE4:
+            if (BitCount == 4)
+            {
+                *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16;
+                return TRUE;
+            }
             return FALSE;
 
-         /*
-          * For BITMAPV4HEADER/BITMAPV5HEADER the masks are included in
-          * the structure itself (bV4RedMask, bV4GreenMask, and bV4BlueMask).
-          * For BITMAPINFOHEADER the color masks are stored in the palette.
-          */
-
-         if (BitmapInfoHeader->biSize > sizeof(BITMAPINFOHEADER))
-            *ColorTableSize = 0;
-         else
-            *ColorTableSize = 3;
-
-         return TRUE;
-
-      case BI_RGB:
-         switch (BitCount)
-         {
-            case 1:
-               *ColorTableSize = ClrUsed ? min(ClrUsed, 2) : 2;
-               return TRUE;
-
-            case 4:
-               *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16;
-               return TRUE;
-
-            case 8:
-               *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256;
-               return TRUE;
-
-            default:
-               if (*ColorSpec == DIB_PAL_COLORS)
-                  *ColorSpec = DIB_RGB_COLORS;
-               if (BitCount != 16 && BitCount != 24 && BitCount != 32)
-                  return FALSE;
-               *ColorTableSize = ClrUsed;
-               return TRUE;
-         }
-
-      case BI_RLE4:
-         if (BitCount == 4)
-         {
-            *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16;
+        case BI_RLE8:
+            if (BitCount == 8)
+            {
+                *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256;
+                return TRUE;
+            }
+            return FALSE;
+
+        case BI_JPEG:
+        case BI_PNG:
+            *ColorTableSize = ClrUsed;
             return TRUE;
-         }
-         return FALSE;
-
-      case BI_RLE8:
-         if (BitCount == 8)
-         {
-            *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256;
-            return TRUE;
-         }
-         return FALSE;
-
-      case BI_JPEG:
-      case BI_PNG:
-         *ColorTableSize = ClrUsed;
-         return TRUE;
-
-      default:
-         return FALSE;
-   }
-}
-
-HBRUSH APIENTRY
+
+        default:
+            return FALSE;
+    }
+}
+
+HBRUSH
+APIENTRY
 IntGdiCreateDIBBrush(
-   CONST BITMAPINFO *BitmapInfo,
-   UINT ColorSpec,
-   UINT BitmapInfoSize,
-   CONST VOID *PackedDIB)
-{
-   HBRUSH hBrush;
-   PBRUSH pbrush;
-   HBITMAP hPattern;
-   ULONG_PTR DataPtr;
-   UINT PaletteEntryCount;
-   PSURFACE psurfPattern;
-   INT PaletteType;
-
-   if (BitmapInfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER))
-   {
-      SetLastWin32Error(ERROR_INVALID_PARAMETER);
-      return NULL;
-   }
-
-   if (!CalculateColorTableSize(&BitmapInfo->bmiHeader, &ColorSpec,
-                                &PaletteEntryCount))
-   {
-      SetLastWin32Error(ERROR_INVALID_PARAMETER);
-      return NULL;
-   }
-
-   DataPtr = (ULONG_PTR)BitmapInfo + BitmapInfo->bmiHeader.biSize;
-   if (ColorSpec == DIB_RGB_COLORS)
-      DataPtr += PaletteEntryCount * sizeof(RGBQUAD);
-   else
-      DataPtr += PaletteEntryCount * sizeof(USHORT);
-
-   hPattern = IntGdiCreateBitmap(BitmapInfo->bmiHeader.biWidth,
-                                BitmapInfo->bmiHeader.biHeight,
-                                BitmapInfo->bmiHeader.biPlanes,
-                                BitmapInfo->bmiHeader.biBitCount,
-                                (PVOID)DataPtr);
-   if (hPattern == NULL)
-   {
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-
-   psurfPattern = SURFACE_LockSurface(hPattern);
-   ASSERT(psurfPattern != NULL);
-   psurfPattern->hDIBPalette = BuildDIBPalette(BitmapInfo, &PaletteType);
-   SURFACE_UnlockSurface(psurfPattern);
-
-   pbrush = BRUSH_AllocBrushWithHandle();
-   if (pbrush == NULL)
-   {
-      GreDeleteObject(hPattern);
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-   hBrush = pbrush->BaseObject.hHmgr;
-
-   pbrush->flAttrs |= GDIBRUSH_IS_BITMAP | GDIBRUSH_IS_DIB;
-   pbrush->hbmPattern = hPattern;
-   /* FIXME: Fill in the rest of fields!!! */
-
-   GDIOBJ_SetOwnership(hPattern, NULL);
-
-   BRUSH_UnlockBrush(pbrush);
-
-   return hBrush;
-}
-
-HBRUSH APIENTRY
+    CONST BITMAPINFO *BitmapInfo,
+    UINT ColorSpec,
+    UINT BitmapInfoSize,
+    CONST VOID *PackedDIB)
+{
+    HBRUSH hBrush;
+    PBRUSH pbrush;
+    HBITMAP hPattern;
+    ULONG_PTR DataPtr;
+    UINT PaletteEntryCount;
+    PSURFACE psurfPattern;
+    INT PaletteType;
+
+    if (BitmapInfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER))
+    {
+        SetLastWin32Error(ERROR_INVALID_PARAMETER);
+        return NULL;
+    }
+
+    if (!CalculateColorTableSize(&BitmapInfo->bmiHeader,
+                                 &ColorSpec,
+                                 &PaletteEntryCount))
+    {
+        SetLastWin32Error(ERROR_INVALID_PARAMETER);
+        return NULL;
+    }
+
+    // FIXME: What about BI_BITFIELDS
+    DataPtr = (ULONG_PTR)BitmapInfo + BitmapInfo->bmiHeader.biSize;
+    if (ColorSpec == DIB_RGB_COLORS)
+        DataPtr += PaletteEntryCount * sizeof(RGBQUAD);
+    else
+        DataPtr += PaletteEntryCount * sizeof(USHORT);
+
+    hPattern = IntGdiCreateBitmap(BitmapInfo->bmiHeader.biWidth,
+                                  BitmapInfo->bmiHeader.biHeight,
+                                  BitmapInfo->bmiHeader.biPlanes,
+                                  BitmapInfo->bmiHeader.biBitCount,
+                                  (PVOID)DataPtr);
+    if (hPattern == NULL)
+    {
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+
+    psurfPattern = SURFACE_LockSurface(hPattern);
+    ASSERT(psurfPattern != NULL);
+    psurfPattern->hDIBPalette = BuildDIBPalette(BitmapInfo, &PaletteType);
+    SURFACE_UnlockSurface(psurfPattern);
+
+    pbrush = BRUSH_AllocBrushWithHandle();
+    if (pbrush == NULL)
+    {
+        GreDeleteObject(hPattern);
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+    hBrush = pbrush->BaseObject.hHmgr;
+
+    pbrush->flAttrs |= GDIBRUSH_IS_BITMAP | GDIBRUSH_IS_DIB;
+    pbrush->hbmPattern = hPattern;
+    /* FIXME: Fill in the rest of fields!!! */
+
+    GDIOBJ_SetOwnership(hPattern, NULL);
+
+    BRUSH_UnlockBrush(pbrush);
+
+    return hBrush;
+}
+
+HBRUSH
+APIENTRY
 IntGdiCreateHatchBrush(
-   INT Style,
-   COLORREF Color)
-{
-   HBRUSH hBrush;
-   PBRUSH pbrush;
-   HBITMAP hPattern;
-
-   if (Style < 0 || Style >= NB_HATCH_STYLES)
-   {
-      return 0;
-   }
-
-   hPattern = IntGdiCreateBitmap(8, 8, 1, 1, (LPBYTE)HatchBrushes[Style]);
-   if (hPattern == NULL)
-   {
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-
-   pbrush = BRUSH_AllocBrushWithHandle();
-   if (pbrush == NULL)
-   {
-      GreDeleteObject(hPattern);
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-   hBrush = pbrush->BaseObject.hHmgr;
-
-   pbrush->flAttrs |= GDIBRUSH_IS_HATCH;
-   pbrush->hbmPattern = hPattern;
-   pbrush->BrushAttr.lbColor = Color & 0xFFFFFF;
-
-   GDIOBJ_SetOwnership(hPattern, NULL);
-
-   BRUSH_UnlockBrush(pbrush);
-
-   return hBrush;
-}
-
-HBRUSH APIENTRY
+    INT Style,
+    COLORREF Color)
+{
+    HBRUSH hBrush;
+    PBRUSH pbrush;
+    HBITMAP hPattern;
+
+    if (Style < 0 || Style >= NB_HATCH_STYLES)
+    {
+        return 0;
+    }
+
+    hPattern = IntGdiCreateBitmap(8, 8, 1, 1, (LPBYTE)HatchBrushes[Style]);
+    if (hPattern == NULL)
+    {
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+
+    pbrush = BRUSH_AllocBrushWithHandle();
+    if (pbrush == NULL)
+    {
+        GreDeleteObject(hPattern);
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+    hBrush = pbrush->BaseObject.hHmgr;
+
+    pbrush->flAttrs |= GDIBRUSH_IS_HATCH;
+    pbrush->hbmPattern = hPattern;
+    pbrush->BrushAttr.lbColor = Color & 0xFFFFFF;
+
+    GDIOBJ_SetOwnership(hPattern, NULL);
+
+    BRUSH_UnlockBrush(pbrush);
+
+    return hBrush;
+}
+
+HBRUSH
+APIENTRY
 IntGdiCreatePatternBrush(
-   HBITMAP hBitmap)
-{
-   HBRUSH hBrush;
-   PBRUSH pbrush;
-   HBITMAP hPattern;
-
-   hPattern = BITMAP_CopyBitmap(hBitmap);
-   if (hPattern == NULL)
-   {
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-
-   pbrush = BRUSH_AllocBrushWithHandle();
-   if (pbrush == NULL)
-   {
-      GreDeleteObject(hPattern);
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-   hBrush = pbrush->BaseObject.hHmgr;
-
-   pbrush->flAttrs |= GDIBRUSH_IS_BITMAP;
-   pbrush->hbmPattern = hPattern;
-   /* FIXME: Fill in the rest of fields!!! */
-
-   GDIOBJ_SetOwnership(hPattern, NULL);
-
-   BRUSH_UnlockBrush(pbrush);
-
-   return hBrush;
-}
-
-HBRUSH APIENTRY
+    HBITMAP hBitmap)
+{
+    HBRUSH hBrush;
+    PBRUSH pbrush;
+    HBITMAP hPattern;
+
+    hPattern = BITMAP_CopyBitmap(hBitmap);
+    if (hPattern == NULL)
+    {
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+
+    pbrush = BRUSH_AllocBrushWithHandle();
+    if (pbrush == NULL)
+    {
+        GreDeleteObject(hPattern);
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+    hBrush = pbrush->BaseObject.hHmgr;
+
+    pbrush->flAttrs |= GDIBRUSH_IS_BITMAP;
+    pbrush->hbmPattern = hPattern;
+    /* FIXME: Fill in the rest of fields!!! */
+
+    GDIOBJ_SetOwnership(hPattern, NULL);
+
+    BRUSH_UnlockBrush(pbrush);
+
+    return hBrush;
+}
+
+HBRUSH
+APIENTRY
 IntGdiCreateSolidBrush(
-   COLORREF Color)
-{
-   HBRUSH hBrush;
-   PBRUSH pbrush;
-
-   pbrush = BRUSH_AllocBrushWithHandle();
-   if (pbrush == NULL)
-   {
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-   hBrush = pbrush->BaseObject.hHmgr;
-
-   pbrush->flAttrs |= GDIBRUSH_IS_SOLID;
-
-   pbrush->BrushAttr.lbColor = Color;
-   /* FIXME: Fill in the rest of fields!!! */
-
-   BRUSH_UnlockBrush(pbrush);
-
-   return hBrush;
-}
-
-HBRUSH APIENTRY
+    COLORREF Color)
+{
+    HBRUSH hBrush;
+    PBRUSH pbrush;
+
+    pbrush = BRUSH_AllocBrushWithHandle();
+    if (pbrush == NULL)
+    {
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+    hBrush = pbrush->BaseObject.hHmgr;
+
+    pbrush->flAttrs |= GDIBRUSH_IS_SOLID;
+
+    pbrush->BrushAttr.lbColor = Color;
+    /* FIXME: Fill in the rest of fields!!! */
+
+    BRUSH_UnlockBrush(pbrush);
+
+    return hBrush;
+}
+
+HBRUSH
+APIENTRY
 IntGdiCreateNullBrush(VOID)
 {
-   HBRUSH hBrush;
-   PBRUSH pbrush;
-
-   pbrush = BRUSH_AllocBrushWithHandle();
-   if (pbrush == NULL)
-   {
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-   hBrush = pbrush->BaseObject.hHmgr;
-
-   pbrush->flAttrs |= GDIBRUSH_IS_NULL;
-   BRUSH_UnlockBrush(pbrush);
-
-   return hBrush;
+    HBRUSH hBrush;
+    PBRUSH pbrush;
+
+    pbrush = BRUSH_AllocBrushWithHandle();
+    if (pbrush == NULL)
+    {
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+    hBrush = pbrush->BaseObject.hHmgr;
+
+    pbrush->flAttrs |= GDIBRUSH_IS_NULL;
+    BRUSH_UnlockBrush(pbrush);
+
+    return hBrush;
+}
+
+VOID
+FASTCALL
+IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color)
+{
+    PBRUSH pbrush;
+
+    pbrush = BRUSH_LockBrush(hBrush);
+    if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
+    {
+        pbrush->BrushAttr.lbColor = Color & 0xFFFFFF;
+    }
+    BRUSH_UnlockBrush(pbrush);
 }
 
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
-HBRUSH APIENTRY
+HBRUSH
+APIENTRY
 NtGdiCreateDIBBrush(
-   IN PVOID BitmapInfoAndData,
-   IN FLONG ColorSpec,
-   IN UINT BitmapInfoSize,
-   IN BOOL  b8X8,
-   IN BOOL bPen,
-   IN PVOID PackedDIB)
-{
-   BITMAPINFO *SafeBitmapInfoAndData;
-   NTSTATUS Status = STATUS_SUCCESS;
-   HBRUSH hBrush;
-
-   SafeBitmapInfoAndData = EngAllocMem(FL_ZERO_MEMORY, BitmapInfoSize, TAG_DIB);
-   if (SafeBitmapInfoAndData == NULL)
-   {
-      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-      return NULL;
-   }
-
-   _SEH2_TRY
-   {
-      ProbeForRead(BitmapInfoAndData,
-                   BitmapInfoSize,
-                   1);
-      RtlCopyMemory(SafeBitmapInfoAndData,
-                    BitmapInfoAndData,
-                    BitmapInfoSize);
-   }
-   _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-   {
-      Status = _SEH2_GetExceptionCode();
-   }
-   _SEH2_END;
-
-   if (!NT_SUCCESS(Status))
-   {
-      EngFreeMem(SafeBitmapInfoAndData);
-      SetLastNtError(Status);
-      return 0;
-   }
-
-   hBrush = IntGdiCreateDIBBrush(SafeBitmapInfoAndData, ColorSpec,
-                                 BitmapInfoSize, PackedDIB);
-
-   EngFreeMem(SafeBitmapInfoAndData);
-
-   return hBrush;
-}
-
-HBRUSH APIENTRY
+    IN PVOID BitmapInfoAndData,
+    IN FLONG ColorSpec,
+    IN UINT BitmapInfoSize,
+    IN BOOL  b8X8,
+    IN BOOL bPen,
+    IN PVOID PackedDIB)
+{
+    BITMAPINFO *SafeBitmapInfoAndData;
+    NTSTATUS Status = STATUS_SUCCESS;
+    HBRUSH hBrush;
+
+    SafeBitmapInfoAndData = EngAllocMem(FL_ZERO_MEMORY, BitmapInfoSize, TAG_DIB);
+    if (SafeBitmapInfoAndData == NULL)
+    {
+        SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+        return NULL;
+    }
+
+    _SEH2_TRY
+    {
+        ProbeForRead(BitmapInfoAndData, BitmapInfoSize, 1);
+        RtlCopyMemory(SafeBitmapInfoAndData, BitmapInfoAndData, BitmapInfoSize);
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = _SEH2_GetExceptionCode();
+    }
+    _SEH2_END;
+
+    if (!NT_SUCCESS(Status))
+    {
+        EngFreeMem(SafeBitmapInfoAndData);
+        SetLastNtError(Status);
+        return 0;
+    }
+
+    hBrush = IntGdiCreateDIBBrush(SafeBitmapInfoAndData,
+                                  ColorSpec,
+                                  BitmapInfoSize,
+                                  PackedDIB);
+
+    EngFreeMem(SafeBitmapInfoAndData);
+
+    return hBrush;
+}
+
+HBRUSH
+APIENTRY
 NtGdiCreateHatchBrushInternal(
-   ULONG Style,
-   COLORREF Color,
-   BOOL bPen)
-{
-   return IntGdiCreateHatchBrush(Style, Color);
-}
-
-HBRUSH APIENTRY
+    ULONG Style,
+    COLORREF Color,
+    BOOL bPen)
+{
+    return IntGdiCreateHatchBrush(Style, Color);
+}
+
+HBRUSH
+APIENTRY
 NtGdiCreatePatternBrushInternal(
-   HBITMAP hBitmap,
-   BOOL bPen,
-   BOOL b8x8)
-{
-   return IntGdiCreatePatternBrush(hBitmap);
-}
-
-HBRUSH APIENTRY
+    HBITMAP hBitmap,
+    BOOL bPen,
+    BOOL b8x8)
+{
+    return IntGdiCreatePatternBrush(hBitmap);
+}
+
+HBRUSH
+APIENTRY
 NtGdiCreateSolidBrush(COLORREF Color,
                       IN OPTIONAL HBRUSH hbr)
 {
-   return IntGdiCreateSolidBrush(Color);
-}
-
-/*
- * NtGdiSetBrushOrg
- *
- * The NtGdiSetBrushOrg function sets the brush origin that GDI assigns to
+    return IntGdiCreateSolidBrush(Color);
+}
+
+/**
+ * \name NtGdiSetBrushOrg
+ *
+ * \brief Sets the brush origin that GDI assigns to
  * the next brush an application selects into the specified device context.
  *
- * Status
- *    @implemented
+ * @implemented
  */
-
-BOOL APIENTRY
+BOOL
+APIENTRY
 NtGdiSetBrushOrg(HDC hDC, INT XOrg, INT YOrg, LPPOINT Point)
 {
-   PDC dc;
-   PDC_ATTR pdcattr;
-
-   dc = DC_LockDc(hDC);
-   if (dc == NULL)
-   {
-      SetLastWin32Error(ERROR_INVALID_HANDLE);
-      return FALSE;
-   }
-   pdcattr = dc->pdcattr;
-
-   if (Point != NULL)
-   {
-      NTSTATUS Status = STATUS_SUCCESS;
-      POINT SafePoint;
-      SafePoint.x = pdcattr->ptlBrushOrigin.x;
-      SafePoint.y = pdcattr->ptlBrushOrigin.y;
-      _SEH2_TRY
-      {
-         ProbeForWrite(Point,
-                       sizeof(POINT),
-                       1);
-         *Point = SafePoint;
-      }
-      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-      {
-         Status = _SEH2_GetExceptionCode();
-      }
-      _SEH2_END;
-
-      if(!NT_SUCCESS(Status))
-      {
-        DC_UnlockDc(dc);
-        SetLastNtError(Status);
+    PDC dc;
+    PDC_ATTR pdcattr;
+
+    dc = DC_LockDc(hDC);
+    if (dc == NULL)
+    {
+        SetLastWin32Error(ERROR_INVALID_HANDLE);
         return FALSE;
-      }
-   }
-   pdcattr->ptlBrushOrigin.x = XOrg;
-   pdcattr->ptlBrushOrigin.y = YOrg;
-   DC_UnlockDc(dc);
-   return TRUE;
-}
-
-VOID FASTCALL
-IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color)
-{
-  PBRUSH pbrush;
-
-  pbrush = BRUSH_LockBrush(hBrush);
-  if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
-  {
-      pbrush->BrushAttr.lbColor = Color & 0xFFFFFF;
-  }
-  BRUSH_UnlockBrush(pbrush);
+    }
+    pdcattr = dc->pdcattr;
+
+    if (Point != NULL)
+    {
+        NTSTATUS Status = STATUS_SUCCESS;
+        POINT SafePoint;
+        SafePoint.x = pdcattr->ptlBrushOrigin.x;
+        SafePoint.y = pdcattr->ptlBrushOrigin.y;
+        _SEH2_TRY
+        {
+            ProbeForWrite(Point, sizeof(POINT), 1);
+            *Point = SafePoint;
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            Status = _SEH2_GetExceptionCode();
+        }
+        _SEH2_END;
+
+        if (!NT_SUCCESS(Status))
+        {
+            DC_UnlockDc(dc);
+            SetLastNtError(Status);
+            return FALSE;
+        }
+    }
+
+    pdcattr->ptlBrushOrigin.x = XOrg;
+    pdcattr->ptlBrushOrigin.y = YOrg;
+    DC_UnlockDc(dc);
+
+    return TRUE;
 }
 
 /* EOF */



More information about the Ros-diffs mailing list