| 1 | #include <os2win.h>
|
|---|
| 2 | #include <stats.h>
|
|---|
| 3 |
|
|---|
| 4 | #ifdef DEBUG
|
|---|
| 5 |
|
|---|
| 6 | static DWORD nrdcscreated = 0;
|
|---|
| 7 | static DWORD nrfontscreated = 0;
|
|---|
| 8 | static DWORD nrpenscreated = 0;
|
|---|
| 9 | static DWORD nrbrushescreated = 0;
|
|---|
| 10 | static DWORD nrregionscreated = 0;
|
|---|
| 11 | static DWORD nrbitmapscreated = 0;
|
|---|
| 12 |
|
|---|
| 13 | //******************************************************************************
|
|---|
| 14 | //******************************************************************************
|
|---|
| 15 | void STATS_CreateFontIndirect(HFONT hFont, LOGFONTA* lplf)
|
|---|
| 16 | {
|
|---|
| 17 | nrfontscreated++;
|
|---|
| 18 | }
|
|---|
| 19 | //******************************************************************************
|
|---|
| 20 | //******************************************************************************
|
|---|
| 21 | void STATS_CreateCompatibleDC(HDC hdc, HDC newHdc)
|
|---|
| 22 | {
|
|---|
| 23 | nrdcscreated++;
|
|---|
| 24 | }
|
|---|
| 25 | //******************************************************************************
|
|---|
| 26 | //******************************************************************************
|
|---|
| 27 | void STATS_DeleteDC(HDC hdc)
|
|---|
| 28 | {
|
|---|
| 29 | nrdcscreated--;
|
|---|
| 30 | }
|
|---|
| 31 | //******************************************************************************
|
|---|
| 32 | //******************************************************************************
|
|---|
| 33 | void STATS_CreatePatternBrush(HBRUSH hBrush, HBITMAP hBitmap)
|
|---|
| 34 | {
|
|---|
| 35 | nrbrushescreated++;
|
|---|
| 36 | }
|
|---|
| 37 | //******************************************************************************
|
|---|
| 38 | //******************************************************************************
|
|---|
| 39 | void STATS_CreateDIBPatternBrushPt(HBRUSH hBrush, LPCVOID buffer, DWORD usage)
|
|---|
| 40 | {
|
|---|
| 41 | nrbrushescreated++;
|
|---|
| 42 | }
|
|---|
| 43 | //******************************************************************************
|
|---|
| 44 | //******************************************************************************
|
|---|
| 45 | void STATS_CreatePenIndirect(HPEN hPen, const LOGPEN *lplgpn)
|
|---|
| 46 | {
|
|---|
| 47 | nrpenscreated++;
|
|---|
| 48 | }
|
|---|
| 49 | //******************************************************************************
|
|---|
| 50 | //******************************************************************************
|
|---|
| 51 | void STATS_CreatePen(HPEN hPen, int fnPenStyle, int nWidth, COLORREF crColor)
|
|---|
| 52 | {
|
|---|
| 53 | nrpenscreated++;
|
|---|
| 54 | }
|
|---|
| 55 | //******************************************************************************
|
|---|
| 56 | //******************************************************************************
|
|---|
| 57 | void STATS_ExtCreatePen(HPEN hPen, DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
|
|---|
| 58 | DWORD dwStyleCount, const DWORD *lpStyle)
|
|---|
| 59 | {
|
|---|
| 60 | nrpenscreated++;
|
|---|
| 61 | }
|
|---|
| 62 | //******************************************************************************
|
|---|
| 63 | //******************************************************************************
|
|---|
| 64 | void STATS_CreateBrushIndirect(HBRUSH hBrush, LPLOGBRUSH pLogBrush)
|
|---|
| 65 | {
|
|---|
| 66 | nrbrushescreated++;
|
|---|
| 67 | }
|
|---|
| 68 | //******************************************************************************
|
|---|
| 69 | //******************************************************************************
|
|---|
| 70 | void STATS_CreateHatchBrush(HBRUSH hBrush, int fnStyle, COLORREF clrref)
|
|---|
| 71 | {
|
|---|
| 72 | nrbrushescreated++;
|
|---|
| 73 | }
|
|---|
| 74 | //******************************************************************************
|
|---|
| 75 | //******************************************************************************
|
|---|
| 76 | void STATS_CreateSolidBrush(HBRUSH hBrush, COLORREF color)
|
|---|
| 77 | {
|
|---|
| 78 | nrbrushescreated++;
|
|---|
| 79 | }
|
|---|
| 80 | //******************************************************************************
|
|---|
| 81 | //******************************************************************************
|
|---|
| 82 | void STATS_CreateICA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
|
|---|
| 83 | const DEVMODEA *lpdvmInit)
|
|---|
| 84 | {
|
|---|
| 85 | nrdcscreated++;
|
|---|
| 86 | }
|
|---|
| 87 | //******************************************************************************
|
|---|
| 88 | //******************************************************************************
|
|---|
| 89 | void STATS_CreateDCA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
|
|---|
| 90 | const DEVMODEA *lpdvmInit)
|
|---|
| 91 | {
|
|---|
| 92 | nrdcscreated++;
|
|---|
| 93 | }
|
|---|
| 94 | //******************************************************************************
|
|---|
| 95 | //******************************************************************************
|
|---|
| 96 | void STATS_CreatePolyPolygonRgn(HRGN hRgn, const POINT *lppt, const int *pPolyCount, int nCount, int fnPolyFillMode)
|
|---|
| 97 | {
|
|---|
| 98 | nrregionscreated++;
|
|---|
| 99 | }
|
|---|
| 100 | //******************************************************************************
|
|---|
| 101 | //******************************************************************************
|
|---|
| 102 | void STATS_CreateRectRgn(HRGN hRgn, int left, int top, int right, int bottom)
|
|---|
| 103 | {
|
|---|
| 104 | nrregionscreated++;
|
|---|
| 105 | }
|
|---|
| 106 | //******************************************************************************
|
|---|
| 107 | //******************************************************************************
|
|---|
| 108 | void STATS_CreateRoundRectRgn(HRGN hRgn, int left, int top, int right, int bottom, int nWidthEllipse, int nHeightEllipse)
|
|---|
| 109 | {
|
|---|
| 110 | nrregionscreated++;
|
|---|
| 111 | }
|
|---|
| 112 | //******************************************************************************
|
|---|
| 113 | //******************************************************************************
|
|---|
| 114 | void STATS_ExtCreateRegion(HRGN hRgn, PVOID pXform, DWORD count, const RGNDATA * pData)
|
|---|
| 115 | {
|
|---|
| 116 | nrregionscreated++;
|
|---|
| 117 | }
|
|---|
| 118 | //******************************************************************************
|
|---|
| 119 | //******************************************************************************
|
|---|
| 120 | void STATS_CreateEllipticRgn(HRGN hRgn, int left, int top, int right, int bottom)
|
|---|
| 121 | {
|
|---|
| 122 | nrregionscreated++;
|
|---|
| 123 | }
|
|---|
| 124 | //******************************************************************************
|
|---|
| 125 | //******************************************************************************
|
|---|
| 126 | void STATS_CreatePolygonRgn(HRGN hRgn, const POINT * lppt, int cPoints, int fnPolyFillMode)
|
|---|
| 127 | {
|
|---|
| 128 | nrregionscreated++;
|
|---|
| 129 | }
|
|---|
| 130 | //******************************************************************************
|
|---|
| 131 | //******************************************************************************
|
|---|
| 132 | void STATS_CreateDIBitmap(HBITMAP hBitmap,HDC hdc, const BITMAPINFOHEADER *lpbmih,
|
|---|
| 133 | DWORD fdwInit, const void *lpbInit,
|
|---|
| 134 | const BITMAPINFO *lpbmi, UINT fuUsage)
|
|---|
| 135 | {
|
|---|
| 136 | nrbitmapscreated++;
|
|---|
| 137 | }
|
|---|
| 138 | //******************************************************************************
|
|---|
| 139 | //******************************************************************************
|
|---|
| 140 | void STATS_CreateCompatibleBitmap(HBITMAP hBitmap,HDC hdc, int nWidth, int nHeight)
|
|---|
| 141 | {
|
|---|
| 142 | nrbitmapscreated++;
|
|---|
| 143 | }
|
|---|
| 144 | //******************************************************************************
|
|---|
| 145 | //******************************************************************************
|
|---|
| 146 | void STATS_CreateBitmap(HBITMAP hBitmap,int nWidth, int nHeight, UINT cPlanes,
|
|---|
| 147 | UINT cBitsPerPel, const void *lpvBits)
|
|---|
| 148 | {
|
|---|
| 149 | nrbitmapscreated++;
|
|---|
| 150 | }
|
|---|
| 151 | //******************************************************************************
|
|---|
| 152 | //******************************************************************************
|
|---|
| 153 | void STATS_CreateDIBSection(HBITMAP hBitmap,HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
|
|---|
| 154 | VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
|
|---|
| 155 | {
|
|---|
| 156 | nrbitmapscreated++;
|
|---|
| 157 | }
|
|---|
| 158 | //******************************************************************************
|
|---|
| 159 | //******************************************************************************
|
|---|
| 160 | void STATS_CreateBitmapIndirect(HBITMAP hBitmap, const BITMAP *pBitmap)
|
|---|
| 161 | {
|
|---|
| 162 | nrbitmapscreated++;
|
|---|
| 163 | }
|
|---|
| 164 | //******************************************************************************
|
|---|
| 165 | //******************************************************************************
|
|---|
| 166 | void STATS_DeleteObject(HANDLE hObj, DWORD objtype)
|
|---|
| 167 | {
|
|---|
| 168 | switch(objtype) {
|
|---|
| 169 | case OBJ_PEN:
|
|---|
| 170 | case OBJ_EXTPEN:
|
|---|
| 171 | nrpenscreated--;
|
|---|
| 172 | break;
|
|---|
| 173 | case OBJ_BRUSH:
|
|---|
| 174 | nrbrushescreated--;
|
|---|
| 175 | break;
|
|---|
| 176 | case OBJ_FONT:
|
|---|
| 177 | nrfontscreated--;
|
|---|
| 178 | break;
|
|---|
| 179 | case OBJ_REGION:
|
|---|
| 180 | nrregionscreated--;
|
|---|
| 181 | break;
|
|---|
| 182 | case OBJ_BITMAP:
|
|---|
| 183 | nrbitmapscreated--;
|
|---|
| 184 | break;
|
|---|
| 185 |
|
|---|
| 186 | case OBJ_PAL:
|
|---|
| 187 | case OBJ_METAFILE:
|
|---|
| 188 | case OBJ_MEMDC:
|
|---|
| 189 | case OBJ_ENHMETADC:
|
|---|
| 190 | case OBJ_ENHMETAFILE:
|
|---|
| 191 | case OBJ_DC:
|
|---|
| 192 | case OBJ_METADC:
|
|---|
| 193 | break;
|
|---|
| 194 | }
|
|---|
| 195 | }
|
|---|
| 196 | //******************************************************************************
|
|---|
| 197 | //******************************************************************************
|
|---|
| 198 | void STATS_DumpStatsGDI32()
|
|---|
| 199 | {
|
|---|
| 200 | dprintf(("************* GDI32 STATISTICS BEGIN *****************"));
|
|---|
| 201 | dprintf(("Leaked dcs %d", nrdcscreated));
|
|---|
| 202 | dprintf(("Leaked font objects %d", nrfontscreated));
|
|---|
| 203 | dprintf(("Leaked pen objects %d", nrpenscreated));
|
|---|
| 204 | dprintf(("Leaked brush objects %d", nrbrushescreated));
|
|---|
| 205 | dprintf(("Leaked region objects %d", nrregionscreated));
|
|---|
| 206 | dprintf(("Leaked bitmap objects %d", nrbitmapscreated));
|
|---|
| 207 | dprintf(("************* GDI32 STATISTICS END *****************"));
|
|---|
| 208 | }
|
|---|
| 209 | //******************************************************************************
|
|---|
| 210 | //******************************************************************************
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 | #endif //DEBUG
|
|---|