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 13 __prefast_operator_new_null 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 { 27 return ExAllocatePoolWithTag(PagedPool, cjSize, GDITAG_HMGR_BRUSH_TYPE); 28 //return BASEOBJECT::pvAllocate(GDIObjType_BRUSH_TYPE, cjSize); 29 } 30 31 inline 32 void 33 operator delete( 34 void *pvObject) 35 { 36 /// HACK! better would be to extract the exact object type's tag 37 ExFreePool(pvObject); 38 //ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE); 39 //BASEOBJECT::pvFree(GDIObjType_BRUSH_TYPE, cjSize); 40 } 41 42 BRUSH( 43 _In_ FLONG flAttrs, 44 _In_ COLORREF crColor, 45 _In_ ULONG iHatch, 46 _In_opt_ HBITMAP hbmPattern, 47 _In_opt_ PVOID pvClient, 48 _In_ GDILOOBJTYPE objtype); 49 50 ~BRUSH( 51 VOID); 52 53 static 54 VOID 55 vDeleteObject( 56 _In_ PVOID pvObject); 57 58 BOOL 59 bAllocateBrushAttr( 60 VOID); 61 62 _Check_return_ 63 _Ret_opt_bytecount_(sizeof(BRUSH)) 64 static 65 inline 66 PBRUSH 67 LockForRead( 68 _In_ HBRUSH hbr) 69 { 70 return static_cast<PBRUSH>( 71 BASEOBJECT::LockShared(hbr, 72 GDILoObjType_LO_BRUSH_TYPE, 73 BASEOBJECT::OWNER::PUBLIC)); 74 } 75 76 _Check_return_ 77 _Ret_opt_bytecount_(sizeof(BRUSH)) 78 static 79 inline 80 PBRUSH 81 LockForWrite( 82 _In_ HBRUSH hbr) 83 { 84 return static_cast<PBRUSH>( 85 BASEOBJECT::LockShared(hbr, 86 GDILoObjType_LO_BRUSH_TYPE, 87 BASEOBJECT::OWNER::POWNED)); 88 } 89 90 _Check_return_ 91 _Ret_opt_bytecap_(sizeof(BRUSH)) 92 static 93 inline 94 PBRUSH 95 LockAny( 96 _In_ HBRUSH hbr) 97 { 98 return static_cast<PBRUSH>( 99 BASEOBJECT::LockShared(hbr, 100 GDILoObjType_LO_BRUSH_TYPE, 101 BASEOBJECT::OWNER::NONE)); 102 } 103 104 UINT 105 cjGetObject( 106 _In_ UINT cjBuffer, 107 _Out_bytecap_(cjBuffer) PLOGBRUSH plbBuffer) const; 108 109 HBITMAP 110 hbmGetBitmapHandle( 111 _Out_ PUINT puUsage) const; 112 113 VOID 114 vSetSolidColor( 115 _In_ COLORREF crColor); 116 117 VOID vReleaseAttribute(VOID); 118 }; 119 120 /* HACK! */ 121 extern "C" 122 PGDI_POOL 123 GetBrushAttrPool(VOID); 124