Changeset 7635 for trunk/src


Ignore:
Timestamp:
Dec 15, 2001, 7:51:16 PM (24 years ago)
Author:
sandervl
Message:

Added statistics for font, bitmap, pen, brush & region objects.

Location:
trunk/src/gdi32
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/dibitmap.cpp

    r7327 r7635  
    1 /* $Id: dibitmap.cpp,v 1.28 2001-11-13 13:18:22 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.29 2001-12-15 18:50:25 sandervl Exp $ */
    22
    33/*
     
    1919#include "dibsect.h"
    2020#include "rgbcvt.h"
     21#include <stats.h>
    2122
    2223#define DBG_LOCALLOG    DBG_dibitmap
     
    131132    ((BITMAPINFOHEADER *)lpbmih)->biBitCount = biBitCount;
    132133
     134    if(rc) STATS_CreateDIBitmap(rc, hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
     135
    133136    return rc;
    134137}
     
    141144    hBitmap = O32_CreateCompatibleBitmap(hdc, nWidth, nHeight);
    142145    dprintf(("GDI32: CreateCompatibleBitmap %x (%d,%d) returned %x", hdc, nWidth, nHeight, hBitmap));
     146    if(hBitmap) STATS_CreateCompatibleBitmap(hBitmap,hdc, nWidth, nHeight);
     147
    143148    return hBitmap;
    144149}
     
    160165    hBitmap = O32_CreateBitmap(nWidth, nHeight, cPlanes, cBitsPerPel, lpvBits);
    161166    dprintf(("GDI32: CreateBitmap (%d,%d) bps %d returned %x", nWidth, nHeight, cBitsPerPel, hBitmap));
     167    if(hBitmap) STATS_CreateBitmap(hBitmap,nWidth, nHeight, cPlanes, cBitsPerPel, lpvBits);
     168
    162169    return(hBitmap);
    163170}
     
    170177    dprintf(("GDI32: CreateBitmapIndirect (%d,%d) bpp %d bits %x", pBitmap->bmWidth, pBitmap->bmHeight, pBitmap->bmBitsPixel, pBitmap->bmBits));
    171178    hBitmap = O32_CreateBitmapIndirect(pBitmap);
     179    if(hBitmap) STATS_CreateBitmapIndirect(hBitmap, pBitmap);
     180
    172181    dprintf(("GDI32: CreateBitmapIndirect returned %x", hBitmap));
    173182    return hBitmap;
     
    243252
    244253            if(fCreateDC) DeleteDC(hdc);
     254
     255            STATS_CreateDIBSection(res, hdc, pbmi, iUsage, ppvBits, hSection, dwOffset);
     256
    245257            return(res);
    246258        }
  • trunk/src/gdi32/font.cpp

    r7330 r7635  
    1 /* $Id: font.cpp,v 1.21 2001-11-13 15:42:05 sandervl Exp $ */
     1/* $Id: font.cpp,v 1.22 2001-12-15 18:50:26 sandervl Exp $ */
    22
    33/*
     
    3838#include <wprocess.h>
    3939#include <odininst.h>
     40#include <stats.h>
    4041
    4142#define DBG_LOCALLOG    DBG_font
     
    287288  hFont = O32_CreateFontIndirect(&afont);
    288289
     290  if(hFont) {
     291      STATS_CreateFontIndirect(hFont, &afont);
     292  }
    289293  return(hFont);
    290294}
  • trunk/src/gdi32/gdi32.cpp

    r7330 r7635  
    1 /* $Id: gdi32.cpp,v 1.76 2001-11-13 15:42:05 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.77 2001-12-15 18:50:26 sandervl Exp $ */
    22
    33/*
     
    2525#include <winuser32.h>
    2626#include "font.h"
     27#include <stats.h>
    2728
    2829#define DBG_LOCALLOG    DBG_gdi32
     
    7778//******************************************************************************
    7879//******************************************************************************
    79 HBRUSH WIN32API CreatePatternBrush(HBITMAP arg1)
    80 {
    81  HBRUSH brush;
    82 
    83     brush = O32_CreatePatternBrush(arg1);
    84     dprintf(("GDI32: CreatePatternBrush from bitmap %X returned %X\n", arg1, brush));
    85     return(brush);
    86 }
    87 //******************************************************************************
    88 //******************************************************************************
    8980ODINFUNCTION3(HPEN, CreatePen, int, fnPenStyle, int, nWidth, COLORREF, crColor)
    9081{
     82 HPEN hPen;
     83
    9184    //CB: todo: PS_DOT is different in Win32 (. . . . and not - - - -)
    9285    //    Open32 looks like LINETYPE_SHORTDASH instead of LINETYPE_DOT!!!
    9386    //    -> difficult to fix without performance decrease!
    9487
    95     return O32_CreatePen(fnPenStyle,nWidth,crColor);
     88    hPen = O32_CreatePen(fnPenStyle,nWidth,crColor);
     89    if(hPen) STATS_CreatePen(hPen, fnPenStyle,nWidth,crColor);
     90    return hPen;
    9691}
    9792//******************************************************************************
     
    9994HPEN WIN32API CreatePenIndirect(const LOGPEN * lplgpn)
    10095{
     96 HPEN hPen;
     97
    10198    dprintf(("GDI32: CreatePenIndirect %x", lplgpn));
    102     return O32_CreatePenIndirect(lplgpn);
     99    hPen = O32_CreatePenIndirect(lplgpn);
     100    if(hPen) STATS_CreatePenIndirect(hPen, lplgpn);
     101    return hPen;
     102}
     103//******************************************************************************
     104//******************************************************************************
     105HPEN WIN32API ExtCreatePen(DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
     106                           DWORD dwStyleCount, const DWORD *lpStyle)
     107{
     108 HPEN hPen;
     109
     110    hPen = O32_ExtCreatePen(dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
     111    dprintf(("GDI32: ExtCreatePen %x %x %x %x %x returned %x", dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle, hPen));
     112    if(hPen) STATS_ExtCreatePen(hPen, dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
     113    return hPen;
     114}
     115//******************************************************************************
     116//******************************************************************************
     117HBRUSH WIN32API CreatePatternBrush(HBITMAP hBitmap)
     118{
     119 HBRUSH hBrush;
     120
     121    hBrush = O32_CreatePatternBrush(hBitmap);
     122    if(hBrush) STATS_CreatePatternBrush(hBrush, hBitmap);
     123
     124    dprintf(("GDI32: CreatePatternBrush from bitmap %X returned %X\n", hBitmap, hBrush));
     125    return(hBrush);
     126}
     127//******************************************************************************
     128//******************************************************************************
     129ODINFUNCTION1(HBRUSH, CreateSolidBrush, COLORREF, color)
     130{
     131    HBRUSH hBrush;
     132
     133    hBrush = O32_CreateSolidBrush(color);
     134    if(hBrush) STATS_CreateSolidBrush(hBrush, color);
     135    return(hBrush);
     136}
     137//******************************************************************************
     138//******************************************************************************
     139HBRUSH WIN32API CreateBrushIndirect( const LOGBRUSH *pLogBrush)
     140{
     141 HBRUSH hBrush;
     142
     143    hBrush = O32_CreateBrushIndirect((LPLOGBRUSH)pLogBrush);
     144    dprintf(("GDI32: CreateBrushIndirect %x %x %x returned %x", pLogBrush->lbStyle, pLogBrush->lbColor, pLogBrush->lbHatch, hBrush));
     145    if(hBrush) STATS_CreateBrushIndirect(hBrush, (LPLOGBRUSH)pLogBrush);
     146    return hBrush;
     147}
     148//******************************************************************************
     149//******************************************************************************
     150HBRUSH WIN32API CreateHatchBrush(int fnStyle, COLORREF clrref)
     151{
     152 HBRUSH hBrush;
     153 
     154    dprintf(("GDI32: CreateHatchBrush %x %x", fnStyle, clrref));
     155    hBrush = O32_CreateHatchBrush(fnStyle, clrref);
     156    if(hBrush) STATS_CreateHatchBrush(hBrush, fnStyle, clrref);
     157    return hBrush;
    103158}
    104159//******************************************************************************
     
    106161HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * buffer, UINT usage)
    107162{
     163 HBRUSH hBrush;
     164
    108165    dprintf(("GDI32: CreateDIBPatternBrushPt %x %x", buffer, usage));
    109     return O32_CreateDIBPatternBrushPt(buffer, usage);
     166    hBrush = O32_CreateDIBPatternBrushPt(buffer, usage);
     167    if(hBrush) STATS_CreateDIBPatternBrushPt(hBrush, buffer, usage);
     168    return hBrush;
    110169}
    111170/*****************************************************************************
     
    151210  }
    152211  else {
    153       dprintf(("ERROR: CreateDIBPatternBrush (%08xh, %08xh) -> INVALID memory handle!!",
     212      dprintf(("!ERROR!: CreateDIBPatternBrush (%08xh, %08xh) -> INVALID memory handle!!",
    154213                hglbDIBPacked, fuColorSpec));
    155214  }
     
    166225    if (!oldcp) /* If new DC is to be created */
    167226        oldcp = GetDisplayCodepage();
     227
     228    if(newHdc) STATS_CreateCompatibleDC(hdc, newHdc);
    168229
    169230    OSLibGpiSetCp(newHdc, oldcp);
     
    197258  }
    198259
     260  STATS_DeleteDC(hdc);
    199261  return O32_DeleteDC(hdc);
    200262}
     
    310372    dprintf(("GDI32: CloseFigure %x", hdc));
    311373    return O32_CloseFigure(hdc);
    312 }
    313 //******************************************************************************
    314 //******************************************************************************
    315 HBRUSH WIN32API CreateBrushIndirect( const LOGBRUSH *pLogBrush)
    316 {
    317  HBRUSH hBrush;
    318 
    319     hBrush = O32_CreateBrushIndirect((LPLOGBRUSH)pLogBrush);
    320     dprintf(("GDI32: CreateBrushIndirect %x %x %x returned %x", pLogBrush->lbStyle, pLogBrush->lbColor, pLogBrush->lbHatch, hBrush));
    321     return hBrush;
    322374}
    323375//******************************************************************************
     
    342394    if(hdc) {
    343395        OSLibGpiSetCp(hdc, GetDisplayCodepage());
     396        STATS_CreateDCA(hdc, lpszDriver, lpszDevice, lpszOutput, lpInitData);
    344397    }
    345398
     
    422475//******************************************************************************
    423476//******************************************************************************
    424 HBRUSH WIN32API CreateHatchBrush( int arg1, COLORREF  arg2)
    425 {
    426     dprintf(("GDI32: CreateHatchBrush"));
    427     return O32_CreateHatchBrush(arg1, arg2);
    428 }
    429 //******************************************************************************
    430 //******************************************************************************
    431477HDC WIN32API CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
    432478                       const DEVMODEA *lpdvmInit)
    433479{
    434480 static char *szDisplay = "DISPLAY";
     481 HDC          hdc;
    435482
    436483    dprintf(("GDI32: CreateICA"));
     
    443490        lpszDriver = lpszDevice;
    444491    }
    445     return O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
     492    hdc = O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
     493    if(hdc) STATS_CreateICA(hdc, lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
     494    return hdc;
    446495}
    447496//******************************************************************************
     
    519568//******************************************************************************
    520569//******************************************************************************
    521 ODINFUNCTION1(HBRUSH, CreateSolidBrush, COLORREF, color)
    522 {
    523     return O32_CreateSolidBrush(color);
    524 }
    525 //******************************************************************************
    526 //******************************************************************************
    527570BOOL WIN32API Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
    528571                      int nBottomRect)
     
    631674//******************************************************************************
    632675//******************************************************************************
    633 int WIN32API EnumObjects( HDC hdc, int objType, GOBJENUMPROC objFunc, LPARAM lParam)
    634 {
    635     //calling convention differences
    636     dprintf(("ERROR: GDI32: EnumObjects STUB"));
    637 //    return O32_EnumObjects(arg1, arg2, arg3, arg4);
    638     return 0;
    639 }
    640 //******************************************************************************
    641 //******************************************************************************
    642676int WIN32API Escape( HDC hdc, int nEscape, int cbInput, LPCSTR lpvInData, PVOID lpvOutData)
    643677{
     
    651685
    652686    return rc;
    653 }
    654 //******************************************************************************
    655 //******************************************************************************
    656 HPEN WIN32API ExtCreatePen( DWORD arg1, DWORD arg2, const LOGBRUSH * arg3, DWORD arg4, const DWORD *  arg5)
    657 {
    658     dprintf(("GDI32: ExtCreatePen"));
    659     return O32_ExtCreatePen(arg1, arg2, arg3, arg4, arg5);
    660687}
    661688//******************************************************************************
     
    778805    dprintf(("GDI32: GetCharWidth32W might not work properly %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
    779806    return O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
    780 }
    781 //******************************************************************************
    782 //******************************************************************************
    783 HANDLE WIN32API GetCurrentObject( HDC hdc, UINT arg2)
    784 {
    785     dprintf(("GDI32: GetCurrentObject %x %x", hdc, arg2));
    786     return (HANDLE)O32_GetCurrentObject(hdc, arg2);
    787807}
    788808//******************************************************************************
     
    11571177//******************************************************************************
    11581178//******************************************************************************
    1159 //******************************************************************************
    1160 //******************************************************************************
    1161 BOOL WIN32API UnrealizeObject( HGDIOBJ hObject)
    1162 {
    1163     dprintf(("GDI32: UnrealizeObject %x", hObject));
    1164     return O32_UnrealizeObject(hObject);
    1165 }
    1166 //******************************************************************************
    1167 //******************************************************************************
    11681179BOOL WIN32API WidenPath( HDC hdc)
    11691180{
  • trunk/src/gdi32/initgdi32.cpp

    r7074 r7635  
    1 /* $Id: initgdi32.cpp,v 1.8 2001-10-16 11:40:17 sandervl Exp $
     1/* $Id: initgdi32.cpp,v 1.9 2001-12-15 18:50:26 sandervl Exp $
    22 *
    33 * DLL entry point
     
    3939#include "region.h"
    4040#include <initdll.h>
     41#include <stats.h>
    4142
    4243extern "C" {
     
    5960
    6061   case DLL_PROCESS_DETACH:
     62    STATS_DumpStats();
    6163    ctordtorTerm();
    6264    return TRUE;
  • trunk/src/gdi32/makefile

    r6918 r7635  
    1 # $Id: makefile,v 1.40 2001-10-01 01:40:08 bird Exp $
     1# $Id: makefile,v 1.41 2001-12-15 18:50:27 sandervl Exp $
    22
    33#
     
    5151$(OBJDIR)\objhandle.obj \
    5252$(OBJDIR)\printer.obj \
     53$(OBJDIR)\gdistats.obj \
    5354$(OBJDIR)\dbglocal.obj \
    5455$(OBJDIR)\gdi32rsrc.obj
  • trunk/src/gdi32/objhandle.cpp

    r7330 r7635  
    1 /* $Id: objhandle.cpp,v 1.19 2001-11-13 15:42:06 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.20 2001-12-15 18:50:27 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    2626#include <unicode.h>
    2727#include "font.h"
     28#include <stats.h>
    2829
    2930#define DBG_LOCALLOG    DBG_objhandle
     
    328329DWORD WIN32API GetObjectType( HGDIOBJ hObj)
    329330{
    330     dprintf2(("GDI32: GetObjectType %x", hObj));
     331    DWORD objtype;
     332
    331333    //TODO: must use 16 bits gdi object handles
    332334    if(HIWORD(hObj) == 0) {
     
    334336    }
    335337    if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
     338        dprintf2(("GDI32: GetObjectType %x REGION", hObj));
    336339        SetLastError(ERROR_SUCCESS);
    337340        return OBJ_REGION;
    338341    }
    339     return O32_GetObjectType(hObj);
     342    objtype = O32_GetObjectType(hObj);
     343    dprintf2(("GDI32: GetObjectType %x objtype %d", hObj, objtype));
     344    return objtype;
    340345}
    341346//******************************************************************************
     
    344349BOOL WIN32API DeleteObject(HANDLE hObj)
    345350{
     351    DWORD objtype;
     352
    346353    dprintf(("GDI32: DeleteObject %x", hObj));
    347354
     
    353360
    354361    //System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
    355     switch (GetObjectType(hObj))
     362    objtype = GetObjectType(hObj);
     363    switch (objtype)
    356364    {
    357365        case OBJ_PEN:
     
    385393    }
    386394
     395    STATS_DeleteObject(hObj, objtype);
     396
    387397    if(ObjGetHandleType(hObj) == GDIOBJ_REGION)
    388398    {
     
    398408//******************************************************************************
    399409//******************************************************************************
     410int WIN32API EnumObjects( HDC hdc, int objType, GOBJENUMPROC objFunc, LPARAM lParam)
     411{
     412    //calling convention differences
     413    dprintf(("!ERROR!: GDI32: EnumObjects STUB"));
     414//    return O32_EnumObjects(arg1, arg2, arg3, arg4);
     415    return 0;
     416}
     417//******************************************************************************
     418//******************************************************************************
     419HANDLE WIN32API GetCurrentObject( HDC hdc, UINT arg2)
     420{
     421    dprintf(("GDI32: GetCurrentObject %x %x", hdc, arg2));
     422    return (HANDLE)O32_GetCurrentObject(hdc, arg2);
     423}
     424//******************************************************************************
     425//******************************************************************************
    400426BOOL WIN32API SetObjectOwner( HGDIOBJ arg1, int arg2 )
    401427{
     
    406432//******************************************************************************
    407433//******************************************************************************
     434BOOL WIN32API UnrealizeObject( HGDIOBJ hObject)
     435{
     436    dprintf(("GDI32: UnrealizeObject %x", hObject));
     437    return O32_UnrealizeObject(hObject);
     438}
     439//******************************************************************************
     440//******************************************************************************
  • trunk/src/gdi32/region.cpp

    r7074 r7635  
    1 /* $Id: region.cpp,v 1.24 2001-10-16 11:40:18 sandervl Exp $ */
     1/* $Id: region.cpp,v 1.25 2001-12-15 18:50:27 sandervl Exp $ */
    22
    33/*
     
    3333#include <winuser32.h>
    3434#include "oslibgpi.h"
     35#include <stats.h>
    3536
    3637#define DBG_LOCALLOG    DBG_region
     
    832833
    833834   if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     835        GpiDestroyRegion(hpsRegion, hrgn);
    834836        SetLastError(ERROR_OUTOFMEMORY_W);
    835837        return 0;
    836838   }
     839   STATS_CreatePolyPolygonRgn(hrgn, lppt, pPolyCount, nCount, fnPolyFillMode);
     840
    837841   SetLastError(ERROR_SUCCESS_W);
    838842   return hrgn;
     
    853857
    854858   if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     859        GpiDestroyRegion(hpsRegion, hrgn);
    855860        SetLastError(ERROR_OUTOFMEMORY_W);
    856861        return 0;
    857862   }
     863   STATS_CreateRectRgn(hrgn, left, top, right, bottom);
     864
    858865   dprintf(("CreateRectRegion (%d,%d)(%d,%d) returned %x", left, top, right, bottom, hrgn));
    859866   SetLastError(ERROR_SUCCESS_W);
     
    885892
    886893   if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     894        GpiDestroyRegion(hpsRegion, hrgn);
    887895        SetLastError(ERROR_OUTOFMEMORY_W);
    888896        return 0;
    889897   }
     898   STATS_CreateRoundRectRgn(hrgn, left, top, right, bottom, nWidthEllipse, nHeightEllipse);
     899
    890900   dprintf(("CreateRoundRectRegion (%d,%d)(%d,%d) (%d,%d) returned %x", left, top, right, bottom, nWidthEllipse, nHeightEllipse, hrgn));
    891901   SetLastError(ERROR_SUCCESS_W);
     
    9951005
    9961006    if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
    997             SetLastError(ERROR_OUTOFMEMORY_W);
    998             return 0;
    999     }
     1007        GpiDestroyRegion(hpsRegion, hrgn);
     1008        SetLastError(ERROR_OUTOFMEMORY_W);
     1009        return 0;
     1010    }
     1011    STATS_ExtCreateRegion(hrgn, (PVOID)pXform, count, pData);
    10001012    SetLastError(ERROR_SUCCESS_W);
    10011013    return hrgn;
     
    10161028
    10171029    if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
    1018             SetLastError(ERROR_OUTOFMEMORY_W);
    1019             return 0;
    1020     }
     1030        GpiDestroyRegion(hpsRegion, hrgn);
     1031        SetLastError(ERROR_OUTOFMEMORY_W);
     1032        return 0;
     1033    }
     1034    STATS_CreateEllipticRgn(hrgn, left, top, right, bottom);
    10211035    SetLastError(ERROR_SUCCESS_W);
    10221036    return hrgn;
     
    10541068        return 0;
    10551069    }
    1056 
    10571070    dprintf(("CreatePolygonRgn %x %d %d", lppt, cPoints, fnPolyFillMode));
    1058 
    10591071
    10601072    POLYGON  polygon;
     
    10661078
    10671079    if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
    1068             SetLastError(ERROR_OUTOFMEMORY_W);
    1069             return 0;
    1070     }
     1080        GpiDestroyRegion(hpsRegion, hrgn);
     1081        SetLastError(ERROR_OUTOFMEMORY_W);
     1082        return 0;
     1083    }
     1084    STATS_CreatePolygonRgn(hrgn, lppt, cPoints, fnPolyFillMode);
    10711085    SetLastError(ERROR_SUCCESS_W);
    10721086    return hrgn;
Note: See TracChangeset for help on using the changeset viewer.