[10374] | 1 | /*
|
---|
| 2 | * GDI object statistics
|
---|
| 3 | *
|
---|
| 4 | *
|
---|
| 5 | * Copyright 2002-2003 Innotek Systemberatung GmbH (sandervl@innotek.de)
|
---|
| 6 | *
|
---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
| 10 |
|
---|
[7639] | 11 | #include <os2win.h>
|
---|
| 12 | #include <stats.h>
|
---|
[10374] | 13 | #include <objhandle.h>
|
---|
[7639] | 14 |
|
---|
[21304] | 15 | #ifdef RAS
|
---|
| 16 |
|
---|
| 17 | RAS_TRACK_HANDLE rthFont;
|
---|
| 18 | RAS_TRACK_HANDLE rthDC;
|
---|
| 19 | RAS_TRACK_HANDLE rthPen;
|
---|
| 20 | RAS_TRACK_HANDLE rthBrush;
|
---|
| 21 | RAS_TRACK_HANDLE rthRgn;
|
---|
| 22 | RAS_TRACK_HANDLE rthBmp;
|
---|
| 23 |
|
---|
| 24 | void STATS_CreateFontIndirect(HFONT hFont, LOGFONTA* lplf)
|
---|
| 25 | {
|
---|
| 26 | if (!rthFont) STATS_InitializeGDI32 ();
|
---|
| 27 | RasAddObject (rthFont, hFont, lplf, sizeof (LOGFONTA));
|
---|
| 28 | }
|
---|
| 29 | void STATS_DeleteFont(HFONT hFont)
|
---|
| 30 | {
|
---|
| 31 | RasRemoveObject (rthFont, hFont);
|
---|
| 32 | }
|
---|
| 33 | void STATS_CreateCompatibleDC(HDC hdc, HDC hdcCreated)
|
---|
| 34 | {
|
---|
| 35 | if (!rthDC) STATS_InitializeGDI32 ();
|
---|
| 36 | RasAddObject (rthDC, hdcCreated, &hdc, sizeof (hdc));
|
---|
| 37 | }
|
---|
| 38 | void STATS_CreateICA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
|
---|
| 39 | const DEVMODEA *lpdvmInit)
|
---|
| 40 | {
|
---|
| 41 | if (!rthDC) STATS_InitializeGDI32 ();
|
---|
| 42 | RasAddObject (rthDC, hdc, NULL, 0);
|
---|
| 43 | }
|
---|
| 44 | void STATS_CreateDCA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
|
---|
| 45 | const DEVMODEA *lpdvmInit)
|
---|
| 46 | {
|
---|
| 47 | if (!rthDC) STATS_InitializeGDI32 ();
|
---|
| 48 | RasAddObject (rthDC, hdc, NULL, 0);
|
---|
| 49 | }
|
---|
| 50 | void STATS_DeleteDC(HDC hdc)
|
---|
| 51 | {
|
---|
| 52 | RasRemoveObject (rthDC, hdc);
|
---|
| 53 | }
|
---|
| 54 | void STATS_CreatePatternBrush(HBRUSH hBrush, HBITMAP hBitmap)
|
---|
| 55 | {
|
---|
| 56 | if (!rthBrush) STATS_InitializeGDI32 ();
|
---|
| 57 | RasAddObject (rthBrush, hBrush, &hBitmap, sizeof (hBitmap));
|
---|
| 58 | }
|
---|
| 59 | void STATS_CreateDIBPatternBrushPt(HBRUSH hBrush, LPCVOID buffer, DWORD usage)
|
---|
| 60 | {
|
---|
| 61 | if (!rthBrush) STATS_InitializeGDI32 ();
|
---|
| 62 | RasAddObject (rthBrush, hBrush, &buffer, sizeof (buffer));
|
---|
| 63 | }
|
---|
| 64 | void STATS_CreateBrushIndirect(HBRUSH hBrush, LPLOGBRUSH pLogBrush)
|
---|
| 65 | {
|
---|
| 66 | if (!rthBrush) STATS_InitializeGDI32 ();
|
---|
| 67 | RasAddObject (rthBrush, hBrush, pLogBrush, sizeof (LOGBRUSH));
|
---|
| 68 | }
|
---|
| 69 | void STATS_CreateHatchBrush(HBRUSH hBrush, int fnStyle, COLORREF clrref)
|
---|
| 70 | {
|
---|
| 71 | struct Parms
|
---|
| 72 | {
|
---|
| 73 | int fnStyle;
|
---|
| 74 | COLORREF clrref;
|
---|
| 75 | } parms = {fnStyle, clrref};
|
---|
| 76 | if (!rthBrush) STATS_InitializeGDI32 ();
|
---|
| 77 | RasAddObject (rthBrush, hBrush, &parms, sizeof (parms));
|
---|
| 78 | }
|
---|
| 79 | void STATS_CreateSolidBrush(HBRUSH hBrush, COLORREF color)
|
---|
| 80 | {
|
---|
| 81 | if (!rthBrush) STATS_InitializeGDI32 ();
|
---|
| 82 | RasAddObject (rthBrush, hBrush, &color, sizeof (COLORREF));
|
---|
| 83 | }
|
---|
| 84 | void STATS_DeleteBrush(HBRUSH hBrush)
|
---|
| 85 | {
|
---|
| 86 | RasRemoveObject (rthBrush, hBrush);
|
---|
| 87 | }
|
---|
| 88 | void STATS_CreatePenIndirect(HPEN hPen, const LOGPEN *lplgpn)
|
---|
| 89 | {
|
---|
| 90 | if (!rthPen) STATS_InitializeGDI32 ();
|
---|
| 91 | RasAddObject (rthPen, hPen, (void *)lplgpn, sizeof (LOGPEN));
|
---|
| 92 | }
|
---|
| 93 | void STATS_CreatePen(HPEN hPen, int fnPenStyle, int nWidth, COLORREF crColor)
|
---|
| 94 | {
|
---|
| 95 | struct Parms
|
---|
| 96 | {
|
---|
| 97 | int fnPenStyle;
|
---|
| 98 | int nWidth;
|
---|
| 99 | COLORREF crColor;
|
---|
| 100 | } parms = {fnPenStyle, nWidth, crColor};
|
---|
| 101 |
|
---|
| 102 | if (!rthPen) STATS_InitializeGDI32 ();
|
---|
| 103 | RasAddObject (rthPen, hPen, &parms, sizeof (parms));
|
---|
| 104 | }
|
---|
| 105 | void STATS_ExtCreatePen(HPEN hPen, DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
|
---|
| 106 | DWORD dwStyleCount, const DWORD *lpStyle)
|
---|
| 107 | {
|
---|
| 108 | struct Parms
|
---|
| 109 | {
|
---|
| 110 | DWORD dwPenStyle;
|
---|
| 111 | DWORD dwWidth;
|
---|
| 112 | const LOGBRUSH *lplb;
|
---|
| 113 | DWORD dwStyleCount;
|
---|
| 114 | const DWORD *lpStyle;
|
---|
| 115 | } parms = {dwPenStyle, dwWidth, lplb,
|
---|
| 116 | dwStyleCount, lpStyle};
|
---|
| 117 |
|
---|
| 118 | if (!rthPen) STATS_InitializeGDI32 ();
|
---|
| 119 | RasAddObject (rthPen, hPen, &parms, sizeof (parms));
|
---|
| 120 | }
|
---|
| 121 | void STATS_DeletePen(HPEN hPen)
|
---|
| 122 | {
|
---|
| 123 | RasRemoveObject (rthPen, hPen);
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | void STATS_CreatePolyPolygonRgn(HRGN hRgn, const POINT *lppt, const int *pPolyCount, int nCount, int fnPolyFillMode)
|
---|
| 127 | {
|
---|
| 128 | if (!rthRgn) STATS_InitializeGDI32 ();
|
---|
| 129 | RasAddObject (rthRgn, hRgn, NULL, 0);
|
---|
| 130 | }
|
---|
| 131 | void STATS_CreateRectRgn(HRGN hRgn, int left, int top, int right, int bottom)
|
---|
| 132 | {
|
---|
| 133 | if (!rthRgn) STATS_InitializeGDI32 ();
|
---|
| 134 | RasAddObject (rthRgn, hRgn, NULL, 0);
|
---|
| 135 | }
|
---|
| 136 | void STATS_CreateRoundRectRgn(HRGN hRgn, int left, int top, int right, int bottom, int nWidthEllipse, int nHeightEllipse)
|
---|
| 137 | {
|
---|
| 138 | if (!rthRgn) STATS_InitializeGDI32 ();
|
---|
| 139 | RasAddObject (rthRgn, hRgn, NULL, 0);
|
---|
| 140 | }
|
---|
| 141 | void STATS_ExtCreateRegion(HRGN hRgn, PVOID pXform, DWORD count, const RGNDATA * pData)
|
---|
| 142 | {
|
---|
| 143 | if (!rthRgn) STATS_InitializeGDI32 ();
|
---|
| 144 | RasAddObject (rthRgn, hRgn, NULL, 0);
|
---|
| 145 | }
|
---|
| 146 | void STATS_CreateEllipticRgn(HRGN hRgn, int left, int top, int right, int bottom)
|
---|
| 147 | {
|
---|
| 148 | if (!rthRgn) STATS_InitializeGDI32 ();
|
---|
| 149 | RasAddObject (rthRgn, hRgn, NULL, 0);
|
---|
| 150 | }
|
---|
| 151 | void STATS_CreatePolygonRgn(HRGN hRgn, const POINT * lppt, int cPoints, int fnPolyFillMode)
|
---|
| 152 | {
|
---|
| 153 | if (!rthRgn) STATS_InitializeGDI32 ();
|
---|
| 154 | RasAddObject (rthRgn, hRgn, NULL, 0);
|
---|
| 155 | }
|
---|
| 156 | void STATS_DeleteRgn(HRGN hRgn)
|
---|
| 157 | {
|
---|
| 158 | RasRemoveObject (rthRgn, hRgn);
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | void STATS_CreateDIBitmap(HBITMAP hBitmap,HDC hdc, const BITMAPINFOHEADER *lpbmih,
|
---|
| 162 | DWORD fdwInit, const void *lpbInit,
|
---|
| 163 | const BITMAPINFO *lpbmi, UINT fuUsage)
|
---|
| 164 | {
|
---|
| 165 | if (!rthBmp) STATS_InitializeGDI32 ();
|
---|
| 166 | RasAddObject (rthBmp, hBitmap, NULL, 0);
|
---|
| 167 | }
|
---|
| 168 | void STATS_CreateCompatibleBitmap(HBITMAP hBitmap,HDC hdc, int nWidth, int nHeight)
|
---|
| 169 | {
|
---|
| 170 | if (!rthBmp) STATS_InitializeGDI32 ();
|
---|
| 171 | RasAddObject (rthBmp, hBitmap, NULL, 0);
|
---|
| 172 | }
|
---|
| 173 | void STATS_CreateBitmap(HBITMAP hBitmap,int nWidth, int nHeight, UINT cPlanes,
|
---|
| 174 | UINT cBitsPerPel, const void *lpvBits)
|
---|
| 175 | {
|
---|
| 176 | if (!rthBmp) STATS_InitializeGDI32 ();
|
---|
| 177 | RasAddObject (rthBmp, hBitmap, NULL, 0);
|
---|
| 178 | }
|
---|
| 179 | void STATS_CreateDIBSection(HBITMAP hBitmap,HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
|
---|
| 180 | VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
|
---|
| 181 | {
|
---|
| 182 | if (!rthBmp) STATS_InitializeGDI32 ();
|
---|
| 183 | RasAddObject (rthBmp, hBitmap, NULL, 0);
|
---|
| 184 | }
|
---|
| 185 | void STATS_CreateBitmapIndirect(HBITMAP hBitmap, const BITMAP *pBitmap)
|
---|
| 186 | {
|
---|
| 187 | if (!rthBmp) STATS_InitializeGDI32 ();
|
---|
| 188 | RasAddObject (rthBmp, hBitmap, NULL, 0);
|
---|
| 189 | }
|
---|
| 190 | void STATS_DeleteBitmap(HBITMAP hBitmap)
|
---|
| 191 | {
|
---|
| 192 | RasRemoveObject (rthBmp, hBitmap);
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | void STATS_DeleteObject(HANDLE hObj, DWORD objtype)
|
---|
| 196 | {
|
---|
| 197 | switch(objtype) {
|
---|
| 198 | case OBJ_PEN:
|
---|
| 199 | case OBJ_EXTPEN:
|
---|
| 200 | STATS_DeletePen(hObj);
|
---|
| 201 | break;
|
---|
| 202 | case OBJ_BRUSH:
|
---|
| 203 | STATS_DeleteBrush(hObj);
|
---|
| 204 | break;
|
---|
| 205 | case OBJ_FONT:
|
---|
| 206 | STATS_DeleteFont(hObj);
|
---|
| 207 | break;
|
---|
| 208 | case OBJ_REGION:
|
---|
| 209 | STATS_DeleteRgn(hObj);
|
---|
| 210 | break;
|
---|
| 211 | case OBJ_BITMAP:
|
---|
| 212 | STATS_DeleteBitmap(hObj);
|
---|
| 213 | break;
|
---|
| 214 |
|
---|
| 215 | case OBJ_MEMDC:
|
---|
| 216 | case OBJ_DC:
|
---|
| 217 | STATS_DeleteDC(hObj);
|
---|
| 218 | break;
|
---|
| 219 |
|
---|
| 220 | case OBJ_PAL:
|
---|
| 221 | case OBJ_METAFILE:
|
---|
| 222 | case OBJ_ENHMETADC:
|
---|
| 223 | case OBJ_ENHMETAFILE:
|
---|
| 224 | case OBJ_METADC:
|
---|
| 225 | break;
|
---|
| 226 | default:
|
---|
| 227 | RasLog ("!ERROR! Unknown object %x of type %d", hObj, objtype);
|
---|
| 228 | break;
|
---|
| 229 | }
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | void STATS_DumpStatsGDI32()
|
---|
| 233 | {
|
---|
| 234 | RasLogObjects(rthDC, RAS_FLAG_LOG_OBJECTS);
|
---|
| 235 | RasLogObjects(rthPen, RAS_FLAG_LOG_OBJECTS);
|
---|
| 236 | RasLogObjects(rthBrush, RAS_FLAG_LOG_OBJECTS);
|
---|
| 237 | RasLogObjects(rthRgn, RAS_FLAG_LOG_OBJECTS);
|
---|
| 238 | RasLogObjects(rthBmp, RAS_FLAG_LOG_OBJECTS);
|
---|
| 239 | }
|
---|
| 240 |
|
---|
| 241 | void STATS_InitializeGDI32(void)
|
---|
| 242 | {
|
---|
| 243 | RasEnterSerialize ();
|
---|
| 244 | if (!rthDC)
|
---|
| 245 | {
|
---|
| 246 | RasRegisterObjectTracking(&rthDC, "DC", 0, 0, NULL, NULL);
|
---|
| 247 | }
|
---|
| 248 | if (!rthPen)
|
---|
| 249 | {
|
---|
| 250 | RasRegisterObjectTracking(&rthPen, "Pen", 0, 0, NULL, NULL);
|
---|
| 251 | }
|
---|
| 252 | if (!rthBrush)
|
---|
| 253 | {
|
---|
| 254 | RasRegisterObjectTracking(&rthBrush, "Brush", 0, 0, NULL, NULL);
|
---|
| 255 | }
|
---|
| 256 | if (!rthRgn)
|
---|
| 257 | {
|
---|
| 258 | RasRegisterObjectTracking(&rthRgn, "Region", 0, 0, NULL, NULL);
|
---|
| 259 | }
|
---|
| 260 | if (!rthBmp)
|
---|
| 261 | {
|
---|
| 262 | RasRegisterObjectTracking(&rthBmp, "Bitmap", 0, 0, NULL, NULL);
|
---|
| 263 | }
|
---|
| 264 | RasExitSerialize ();
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 | void STATS_UninitializeGDI32(void)
|
---|
| 268 | {
|
---|
| 269 | // done in RAS kernel
|
---|
| 270 | // RasDeregisterObjectTracking(rthDC);
|
---|
| 271 | // RasDeregisterObjectTracking(rthPen);
|
---|
| 272 | // RasDeregisterObjectTracking(rthBrush);
|
---|
| 273 | // RasDeregisterObjectTracking(rthRgn);
|
---|
| 274 | // RasDeregisterObjectTracking(rthBmp);
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | #else
|
---|
[7639] | 278 | #ifdef DEBUG
|
---|
| 279 |
|
---|
[9251] | 280 | #define STATS_MAX_OBJECTS 1024
|
---|
[7639] | 281 |
|
---|
[9251] | 282 | static DWORD createddc[STATS_MAX_OBJECTS] = {0};
|
---|
| 283 | static DWORD createdfont[STATS_MAX_OBJECTS] = {0};
|
---|
| 284 | static DWORD createdpen[STATS_MAX_OBJECTS] = {0};
|
---|
| 285 | static DWORD createdbrush[STATS_MAX_OBJECTS] = {0};
|
---|
| 286 | static DWORD createdregion[STATS_MAX_OBJECTS] = {0};
|
---|
| 287 | static DWORD createdbitmap[STATS_MAX_OBJECTS] = {0};
|
---|
| 288 |
|
---|
| 289 | static DWORD nrdcscreated = 0;
|
---|
| 290 | static DWORD nrfontscreated = 0;
|
---|
| 291 | static DWORD nrpenscreated = 0;
|
---|
| 292 | static DWORD nrbrushescreated = 0;
|
---|
| 293 | static DWORD nrregionscreated = 0;
|
---|
| 294 | static DWORD nrbitmapscreated = 0;
|
---|
| 295 |
|
---|
| 296 |
|
---|
[7639] | 297 | //******************************************************************************
|
---|
| 298 | //******************************************************************************
|
---|
[9251] | 299 | static void STAT_InsertObject(HANDLE hObject, DWORD *pdwObjects)
|
---|
| 300 | {
|
---|
| 301 | for(int i=0;i<STATS_MAX_OBJECTS;i++) {
|
---|
| 302 | if(pdwObjects[i] == 0) {
|
---|
| 303 | pdwObjects[i] = hObject;
|
---|
| 304 | break;
|
---|
| 305 | }
|
---|
| 306 | }
|
---|
| 307 | if(i == STATS_MAX_OBJECTS) {
|
---|
| 308 | dprintf(("!WARNING! STAT_InsertObject: no room left!!"));
|
---|
| 309 | }
|
---|
| 310 | }
|
---|
| 311 | //******************************************************************************
|
---|
| 312 | //******************************************************************************
|
---|
| 313 | static void STAT_DeleteObject(HANDLE hObject, DWORD *pdwObjects)
|
---|
| 314 | {
|
---|
| 315 | for(int i=0;i<STATS_MAX_OBJECTS;i++) {
|
---|
[9429] | 316 | if(LOWORD(pdwObjects[i]) == LOWORD(hObject)) {
|
---|
[9251] | 317 | pdwObjects[i] = 0;
|
---|
| 318 | break;
|
---|
| 319 | }
|
---|
| 320 | }
|
---|
| 321 | if(i == STATS_MAX_OBJECTS) {
|
---|
| 322 | dprintf(("!WARNING! STAT_DeleteObject: %x not found!!", hObject));
|
---|
| 323 | }
|
---|
| 324 | }
|
---|
| 325 | //******************************************************************************
|
---|
| 326 | //******************************************************************************
|
---|
| 327 | static void STAT_PrintLeakedObjects(char *szMessage, DWORD *pdwObjects)
|
---|
| 328 | {
|
---|
| 329 | for(int i=0;i<STATS_MAX_OBJECTS;i++) {
|
---|
| 330 | if(pdwObjects[i] != 0) {
|
---|
| 331 | dprintf(("%s %x", szMessage, pdwObjects[i]));
|
---|
| 332 | }
|
---|
| 333 | }
|
---|
| 334 | }
|
---|
| 335 | //******************************************************************************
|
---|
| 336 | //******************************************************************************
|
---|
[7639] | 337 | void STATS_CreateFontIndirect(HFONT hFont, LOGFONTA* lplf)
|
---|
| 338 | {
|
---|
| 339 | nrfontscreated++;
|
---|
[9251] | 340 | STAT_InsertObject(hFont, createdfont);
|
---|
[7639] | 341 | }
|
---|
| 342 | //******************************************************************************
|
---|
| 343 | //******************************************************************************
|
---|
| 344 | void STATS_CreateCompatibleDC(HDC hdc, HDC newHdc)
|
---|
| 345 | {
|
---|
| 346 | nrdcscreated++;
|
---|
[9251] | 347 | STAT_InsertObject(newHdc, createddc);
|
---|
[7639] | 348 | }
|
---|
| 349 | //******************************************************************************
|
---|
| 350 | //******************************************************************************
|
---|
| 351 | void STATS_DeleteDC(HDC hdc)
|
---|
| 352 | {
|
---|
| 353 | nrdcscreated--;
|
---|
[9251] | 354 | STAT_DeleteObject(hdc, createddc);
|
---|
[7639] | 355 | }
|
---|
| 356 | //******************************************************************************
|
---|
| 357 | //******************************************************************************
|
---|
| 358 | void STATS_CreatePatternBrush(HBRUSH hBrush, HBITMAP hBitmap)
|
---|
| 359 | {
|
---|
| 360 | nrbrushescreated++;
|
---|
[9251] | 361 | STAT_InsertObject(hBrush, createdbrush);
|
---|
[7639] | 362 | }
|
---|
| 363 | //******************************************************************************
|
---|
| 364 | //******************************************************************************
|
---|
| 365 | void STATS_CreateDIBPatternBrushPt(HBRUSH hBrush, LPCVOID buffer, DWORD usage)
|
---|
| 366 | {
|
---|
| 367 | nrbrushescreated++;
|
---|
[9251] | 368 | STAT_InsertObject(hBrush, createdbrush);
|
---|
[7639] | 369 | }
|
---|
| 370 | //******************************************************************************
|
---|
| 371 | //******************************************************************************
|
---|
| 372 | void STATS_CreatePenIndirect(HPEN hPen, const LOGPEN *lplgpn)
|
---|
| 373 | {
|
---|
| 374 | nrpenscreated++;
|
---|
[9251] | 375 | STAT_InsertObject(hPen, createdpen);
|
---|
[7639] | 376 | }
|
---|
| 377 | //******************************************************************************
|
---|
| 378 | //******************************************************************************
|
---|
| 379 | void STATS_CreatePen(HPEN hPen, int fnPenStyle, int nWidth, COLORREF crColor)
|
---|
| 380 | {
|
---|
| 381 | nrpenscreated++;
|
---|
[9251] | 382 | STAT_InsertObject(hPen, createdpen);
|
---|
[7639] | 383 | }
|
---|
| 384 | //******************************************************************************
|
---|
| 385 | //******************************************************************************
|
---|
| 386 | void STATS_ExtCreatePen(HPEN hPen, DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
|
---|
| 387 | DWORD dwStyleCount, const DWORD *lpStyle)
|
---|
| 388 | {
|
---|
| 389 | nrpenscreated++;
|
---|
[9251] | 390 | STAT_InsertObject(hPen, createdpen);
|
---|
[7639] | 391 | }
|
---|
| 392 | //******************************************************************************
|
---|
| 393 | //******************************************************************************
|
---|
| 394 | void STATS_CreateBrushIndirect(HBRUSH hBrush, LPLOGBRUSH pLogBrush)
|
---|
| 395 | {
|
---|
| 396 | nrbrushescreated++;
|
---|
[9251] | 397 | STAT_InsertObject(hBrush, createdbrush);
|
---|
[7639] | 398 | }
|
---|
| 399 | //******************************************************************************
|
---|
| 400 | //******************************************************************************
|
---|
| 401 | void STATS_CreateHatchBrush(HBRUSH hBrush, int fnStyle, COLORREF clrref)
|
---|
| 402 | {
|
---|
| 403 | nrbrushescreated++;
|
---|
[9251] | 404 | STAT_InsertObject(hBrush, createdbrush);
|
---|
[7639] | 405 | }
|
---|
| 406 | //******************************************************************************
|
---|
| 407 | //******************************************************************************
|
---|
| 408 | void STATS_CreateSolidBrush(HBRUSH hBrush, COLORREF color)
|
---|
| 409 | {
|
---|
| 410 | nrbrushescreated++;
|
---|
[9251] | 411 | STAT_InsertObject(hBrush, createdbrush);
|
---|
[7639] | 412 | }
|
---|
| 413 | //******************************************************************************
|
---|
| 414 | //******************************************************************************
|
---|
| 415 | void STATS_CreateICA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
|
---|
| 416 | const DEVMODEA *lpdvmInit)
|
---|
| 417 | {
|
---|
| 418 | nrdcscreated++;
|
---|
[9251] | 419 | STAT_InsertObject(hdc, createddc);
|
---|
[7639] | 420 | }
|
---|
| 421 | //******************************************************************************
|
---|
| 422 | //******************************************************************************
|
---|
| 423 | void STATS_CreateDCA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
|
---|
| 424 | const DEVMODEA *lpdvmInit)
|
---|
| 425 | {
|
---|
| 426 | nrdcscreated++;
|
---|
[9251] | 427 | STAT_InsertObject(hdc, createddc);
|
---|
[7639] | 428 | }
|
---|
| 429 | //******************************************************************************
|
---|
| 430 | //******************************************************************************
|
---|
| 431 | void STATS_CreatePolyPolygonRgn(HRGN hRgn, const POINT *lppt, const int *pPolyCount, int nCount, int fnPolyFillMode)
|
---|
| 432 | {
|
---|
| 433 | nrregionscreated++;
|
---|
[9251] | 434 | STAT_InsertObject(hRgn, createdregion);
|
---|
[7639] | 435 | }
|
---|
| 436 | //******************************************************************************
|
---|
| 437 | //******************************************************************************
|
---|
| 438 | void STATS_CreateRectRgn(HRGN hRgn, int left, int top, int right, int bottom)
|
---|
| 439 | {
|
---|
| 440 | nrregionscreated++;
|
---|
[9251] | 441 | STAT_InsertObject(hRgn, createdregion);
|
---|
[7639] | 442 | }
|
---|
| 443 | //******************************************************************************
|
---|
| 444 | //******************************************************************************
|
---|
| 445 | void STATS_CreateRoundRectRgn(HRGN hRgn, int left, int top, int right, int bottom, int nWidthEllipse, int nHeightEllipse)
|
---|
| 446 | {
|
---|
| 447 | nrregionscreated++;
|
---|
[9251] | 448 | STAT_InsertObject(hRgn, createdregion);
|
---|
[7639] | 449 | }
|
---|
| 450 | //******************************************************************************
|
---|
| 451 | //******************************************************************************
|
---|
| 452 | void STATS_ExtCreateRegion(HRGN hRgn, PVOID pXform, DWORD count, const RGNDATA * pData)
|
---|
| 453 | {
|
---|
| 454 | nrregionscreated++;
|
---|
[9251] | 455 | STAT_InsertObject(hRgn, createdregion);
|
---|
[7639] | 456 | }
|
---|
| 457 | //******************************************************************************
|
---|
| 458 | //******************************************************************************
|
---|
| 459 | void STATS_CreateEllipticRgn(HRGN hRgn, int left, int top, int right, int bottom)
|
---|
| 460 | {
|
---|
| 461 | nrregionscreated++;
|
---|
[9251] | 462 | STAT_InsertObject(hRgn, createdregion);
|
---|
[7639] | 463 | }
|
---|
| 464 | //******************************************************************************
|
---|
| 465 | //******************************************************************************
|
---|
| 466 | void STATS_CreatePolygonRgn(HRGN hRgn, const POINT * lppt, int cPoints, int fnPolyFillMode)
|
---|
| 467 | {
|
---|
| 468 | nrregionscreated++;
|
---|
[9251] | 469 | STAT_InsertObject(hRgn, createdregion);
|
---|
[7639] | 470 | }
|
---|
| 471 | //******************************************************************************
|
---|
| 472 | //******************************************************************************
|
---|
| 473 | void STATS_CreateDIBitmap(HBITMAP hBitmap,HDC hdc, const BITMAPINFOHEADER *lpbmih,
|
---|
| 474 | DWORD fdwInit, const void *lpbInit,
|
---|
| 475 | const BITMAPINFO *lpbmi, UINT fuUsage)
|
---|
| 476 | {
|
---|
| 477 | nrbitmapscreated++;
|
---|
[9251] | 478 | STAT_InsertObject(hBitmap, createdbitmap);
|
---|
[7639] | 479 | }
|
---|
| 480 | //******************************************************************************
|
---|
| 481 | //******************************************************************************
|
---|
| 482 | void STATS_CreateCompatibleBitmap(HBITMAP hBitmap,HDC hdc, int nWidth, int nHeight)
|
---|
| 483 | {
|
---|
| 484 | nrbitmapscreated++;
|
---|
[9251] | 485 | STAT_InsertObject(hBitmap, createdbitmap);
|
---|
[7639] | 486 | }
|
---|
| 487 | //******************************************************************************
|
---|
| 488 | //******************************************************************************
|
---|
| 489 | void STATS_CreateBitmap(HBITMAP hBitmap,int nWidth, int nHeight, UINT cPlanes,
|
---|
| 490 | UINT cBitsPerPel, const void *lpvBits)
|
---|
| 491 | {
|
---|
| 492 | nrbitmapscreated++;
|
---|
[9251] | 493 | STAT_InsertObject(hBitmap, createdbitmap);
|
---|
[7639] | 494 | }
|
---|
| 495 | //******************************************************************************
|
---|
| 496 | //******************************************************************************
|
---|
| 497 | void STATS_CreateDIBSection(HBITMAP hBitmap,HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
|
---|
| 498 | VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
|
---|
| 499 | {
|
---|
| 500 | nrbitmapscreated++;
|
---|
[9251] | 501 | STAT_InsertObject(hBitmap, createdbitmap);
|
---|
[7639] | 502 | }
|
---|
| 503 | //******************************************************************************
|
---|
| 504 | //******************************************************************************
|
---|
| 505 | void STATS_CreateBitmapIndirect(HBITMAP hBitmap, const BITMAP *pBitmap)
|
---|
| 506 | {
|
---|
| 507 | nrbitmapscreated++;
|
---|
[9251] | 508 | STAT_InsertObject(hBitmap, createdbitmap);
|
---|
[7639] | 509 | }
|
---|
| 510 | //******************************************************************************
|
---|
| 511 | //******************************************************************************
|
---|
| 512 | void STATS_DeleteObject(HANDLE hObj, DWORD objtype)
|
---|
| 513 | {
|
---|
| 514 | switch(objtype) {
|
---|
| 515 | case OBJ_PEN:
|
---|
| 516 | case OBJ_EXTPEN:
|
---|
| 517 | nrpenscreated--;
|
---|
[9251] | 518 | STAT_DeleteObject(hObj, createdpen);
|
---|
[7639] | 519 | break;
|
---|
| 520 | case OBJ_BRUSH:
|
---|
| 521 | nrbrushescreated--;
|
---|
[9251] | 522 | STAT_DeleteObject(hObj, createdbrush);
|
---|
[7639] | 523 | break;
|
---|
| 524 | case OBJ_FONT:
|
---|
| 525 | nrfontscreated--;
|
---|
[9251] | 526 | STAT_DeleteObject(hObj, createdfont);
|
---|
[7639] | 527 | break;
|
---|
| 528 | case OBJ_REGION:
|
---|
| 529 | nrregionscreated--;
|
---|
[9251] | 530 | STAT_DeleteObject(hObj, createdregion);
|
---|
[7639] | 531 | break;
|
---|
| 532 | case OBJ_BITMAP:
|
---|
| 533 | nrbitmapscreated--;
|
---|
[9251] | 534 | STAT_DeleteObject(hObj, createdbitmap);
|
---|
[7639] | 535 | break;
|
---|
| 536 |
|
---|
[9251] | 537 | case OBJ_MEMDC:
|
---|
| 538 | case OBJ_DC:
|
---|
| 539 | nrdcscreated--;
|
---|
| 540 | STAT_DeleteObject(hObj, createddc);
|
---|
| 541 | break;
|
---|
| 542 |
|
---|
[7639] | 543 | case OBJ_PAL:
|
---|
| 544 | case OBJ_METAFILE:
|
---|
| 545 | case OBJ_ENHMETADC:
|
---|
| 546 | case OBJ_ENHMETAFILE:
|
---|
| 547 | case OBJ_METADC:
|
---|
[9251] | 548 | break;
|
---|
| 549 | default:
|
---|
| 550 | dprintf(("!ERROR! Unknown object %x of type %d", hObj, objtype));
|
---|
| 551 | break;
|
---|
[7639] | 552 | }
|
---|
| 553 | }
|
---|
| 554 | //******************************************************************************
|
---|
| 555 | //******************************************************************************
|
---|
[7640] | 556 | void STATS_DumpStatsGDI32()
|
---|
[7639] | 557 | {
|
---|
| 558 | dprintf(("************* GDI32 STATISTICS BEGIN *****************"));
|
---|
| 559 | dprintf(("Leaked dcs %d", nrdcscreated));
|
---|
[9251] | 560 | STAT_PrintLeakedObjects("Leaked DC", createddc);
|
---|
| 561 | dprintf(("************* ********************** *****************"));
|
---|
[7639] | 562 | dprintf(("Leaked font objects %d", nrfontscreated));
|
---|
[9251] | 563 | STAT_PrintLeakedObjects("Leaked Font", createdfont);
|
---|
| 564 | dprintf(("************* ********************** *****************"));
|
---|
[7639] | 565 | dprintf(("Leaked pen objects %d", nrpenscreated));
|
---|
[9251] | 566 | STAT_PrintLeakedObjects("Leaked Pen", createdpen);
|
---|
| 567 | dprintf(("************* ********************** *****************"));
|
---|
[7639] | 568 | dprintf(("Leaked brush objects %d", nrbrushescreated));
|
---|
[9251] | 569 | STAT_PrintLeakedObjects("Leaked Brush", createdbrush);
|
---|
| 570 | dprintf(("************* ********************** *****************"));
|
---|
[7639] | 571 | dprintf(("Leaked region objects %d", nrregionscreated));
|
---|
[9251] | 572 | STAT_PrintLeakedObjects("Leaked Region", createdregion);
|
---|
| 573 | dprintf(("************* ********************** *****************"));
|
---|
[7639] | 574 | dprintf(("Leaked bitmap objects %d", nrbitmapscreated));
|
---|
[9251] | 575 | STAT_PrintLeakedObjects("Leaked Bitmap", createdbitmap);
|
---|
[10374] | 576 | ObjDumpObjects();
|
---|
[7639] | 577 | dprintf(("************* GDI32 STATISTICS END *****************"));
|
---|
| 578 | }
|
---|
| 579 | //******************************************************************************
|
---|
| 580 | //******************************************************************************
|
---|
[21304] | 581 | void STATS_InitializeGDI32(void)
|
---|
| 582 | {
|
---|
| 583 | return;
|
---|
| 584 | }
|
---|
[7639] | 585 |
|
---|
[21304] | 586 | void STATS_UninitializeGDI32(void)
|
---|
| 587 | {
|
---|
| 588 | return;
|
---|
| 589 | }
|
---|
[7639] | 590 |
|
---|
[21304] | 591 |
|
---|
[7639] | 592 | #endif //DEBUG
|
---|
[21304] | 593 | #endif //RAS
|
---|