ReactOS  0.4.15-dev-1384-g878186b
brush.hpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS win32 subsystem
4  * PURPOSE: BRUSH class definition
5  * PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
6  */
7 
8 #pragma once
9 
10 #include <win32k.h>
11 #include "baseobj.hpp"
12 
14 
15 class BRUSH : public BASEOBJECT, protected _BRUSHBODY
16 {
17 
18 public:
19  _Analysis_mode_(_Analysis_operator_new_null_)
20 
21  inline
22  void*
23  __cdecl
24  operator new(
25  _In_ size_t cjSize) throw()
26  {
28  //return BASEOBJECT::pvAllocate(GDIObjType_BRUSH_TYPE, cjSize);
29  }
30 
31  inline
32  void
33  operator delete(
34  void *pvObject)
35  {
37  ExFreePool(pvObject);
38  //ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE);
39  //BASEOBJECT::pvFree(GDIObjType_BRUSH_TYPE, cjSize);
40  }
41 
42  BRUSH(
44  _In_ COLORREF crColor,
47  _In_opt_ PVOID pvClient,
48  _In_ GDILOOBJTYPE objtype);
49 
50  ~BRUSH(
51  VOID);
52 
53  static
54  VOID
56  _In_ PVOID pvObject);
57 
58  BOOL
60  VOID);
61 
64  static
65  inline
66  PBRUSH
67  LockForRead(
68  _In_ HBRUSH hbr)
69  {
70  return static_cast<PBRUSH>(
73  BASEOBJECT::OWNER::PUBLIC));
74  }
75 
78  static
79  inline
80  PBRUSH
81  LockForWrite(
82  _In_ HBRUSH hbr)
83  {
84  return static_cast<PBRUSH>(
87  BASEOBJECT::OWNER::POWNED));
88  }
89 
92  static
93  inline
94  PBRUSH
95  LockAny(
96  _In_ HBRUSH hbr)
97  {
98  return static_cast<PBRUSH>(
102  }
103 
104  UINT
105  cjGetObject(
107  _Out_bytecap_(cjBuffer) PLOGBRUSH plbBuffer) const;
108 
109  HBITMAP
111  _Out_ PUINT puUsage) const;
112 
113  VOID
115  _In_ COLORREF crColor);
116 };
117 
118 /* HACK! */
119 extern "C"
120 PGDI_POOL
BOOL bAllocateBrushAttr(VOID)
Definition: brush.cpp:91
~BRUSH(VOID)
Definition: brush.cpp:55
#define NONE
Definition: ntddpar.h:94
#define _Out_bytecap_(size)
Definition: sal.h:854
#define __cdecl
Definition: accygwin.h:79
_Check_return_ _Ret_opt_bytecap_(sizeof(BRUSH)) static inline PBRUSH LockAny(_In_ HBRUSH hbr)
Definition: brush.hpp:91
static VOID vDeleteObject(_In_ PVOID pvObject)
Definition: brush.cpp:80
PGDI_POOL GetBrushAttrPool(VOID)
HACK!
Definition: gdiobj.c:1612
#define _Check_return_
Definition: no_sal2.h:60
ULONG flAttrs
Definition: brush.h:19
_Analysis_mode_(_Analysis_operator_new_null_) inline void *__cdecl operator new(_In_ size_t cjSize)
Definition: brush.hpp:19
#define _In_opt_
Definition: no_sal2.h:212
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GDITAG_HMGR_BRUSH_TYPE
Definition: tags.h:103
#define _Out_
Definition: no_sal2.h:160
unsigned long FLONG
Definition: ntbasedef.h:367
Definition: types.h:100
DWORD COLORREF
Definition: windef.h:300
Definition: brush.hpp:15
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define __prefast_operator_new_null
Definition: driverspecs.h:321
_Check_return_ _Ret_opt_bytecount_(sizeof(BRUSH)) static inline PBRUSH LockForWrite(_In_ HBRUSH hbr)
Definition: brush.hpp:77
_Inout_ SURFOBJ _In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_opt_ XLATEOBJ _In_ ULONG iHatch
Definition: winddi.h:3959
#define _In_
Definition: no_sal2.h:158
_Check_return_ _Ret_opt_bytecount_(sizeof(BRUSH)) static inline PBRUSH LockForRead(_In_ HBRUSH hbr)
Definition: brush.hpp:63
static BASEOBJECT * LockShared(HGDIOBJ hobj, GDILOOBJTYPE loobjtype, OWNER owner)
Definition: baseobj.hpp:50
unsigned int UINT
Definition: ndis.h:50
BRUSH(_In_ FLONG flAttrs, _In_ COLORREF crColor, _In_ ULONG iHatch, _In_opt_ HBITMAP hbmPattern, _In_opt_ PVOID pvClient, _In_ GDILOOBJTYPE objtype)
Definition: brush.cpp:14
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860
static HBITMAP
Definition: button.c:44
UINT cjGetObject(_In_ UINT cjBuffer, _Out_bytecap_(cjBuffer) PLOGBRUSH plbBuffer) const
Definition: brush.cpp:140
enum GDILoObjType GDILOOBJTYPE
HBITMAP hbmPattern
Definition: brush.h:17
HBITMAP hbmGetBitmapHandle(_Out_ PUINT puUsage) const
Definition: brush.cpp:128
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
unsigned int * PUINT
Definition: ndis.h:50
VOID vSetSolidColor(_In_ COLORREF crColor)
Definition: brush.cpp:116