Changeset 10374 for trunk/src


Ignore:
Timestamp:
Jan 11, 2004, 12:43:22 PM (22 years ago)
Author:
sandervl
Message:

Update

Location:
trunk/src/gdi32
Files:
2 added
21 edited

Legend:

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

    r10373 r10374  
    9696       else pfnFt2EnableFontEngine(bEnabled);
    9797
    98        pfnGetGlyphIndices = (PFN_FT2GETGLYPHINDICES)QueryProcAddress("Ft2GetGlyphIndices");
    99        if(!pfnGetGlyphIndices) dprintf(("Ft2GetGlyphIndices not found!!"));
    100 
    10198       pfnFt2GetTextExtentW  = (PFN_FT2GETTEXTEXTENTW)QueryProcAddress("Ft2GetTextExtentW");
    10299       if(!pfnFt2GetTextExtentW) dprintf(("Ft2GetTextExtentW not found!!"));
     
    106103       pfnFt2CharStringPosAtW = (PFN_FT2CHARSTRINGPOSATW)QueryProcAddress("Ft2CharStringPosAtW");
    107104       if(!pfnFt2CharStringPosAtW) dprintf(("Ft2CharStringPosAtW not found!!"));
    108 
    109        pfnFt2GetGlyphOutline = (PFN_FT2GETGLYPHOUTLINE)QueryProcAddress("Ft2GetGlyphOutline");
    110        if(!pfnFt2GetGlyphOutline) dprintf(("Ft2GetGlyphOutline not found!!"));
    111 
    112        pfnFt2GetFontData = (PFN_FT2GETFONTDATA)QueryProcAddress("Ft2GetFontData");
    113        if(!pfnFt2GetFontData) dprintf(("Ft2GetFontData not found!!"));
    114105
    115106       pfnFt2QueryFontType = (PFN_FT2QUERYFONTTYPE)QueryProcAddress("Ft2QueryFontType");
  • trunk/src/gdi32/gdi32.DEF

    r10326 r10374  
    1 ; $Id: gdi32.DEF,v 1.24 2003-11-15 12:18:07 sandervl Exp $
     1; $Id: gdi32.DEF,v 1.25 2004-01-11 11:42:14 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    185185    GetKerningPairs            = _GetKerningPairsA@12        @266
    186186    GetKerningPairsA           = _GetKerningPairsA@12        @267
    187     GetKerningPairsW           = _GetKerningPairsW@12        @268
     187    GetKerningPairsW           = _GetKerningPairsA@12        @268
    188188    GetLogColorSpaceA          = _GetLogColorSpaceA@12       @269
    189189    GetLogColorSpaceW          = _GetLogColorSpaceW@12       @270
     
    352352;    pfnRealizePalette          = _pfnRealizePalette@??       @433
    353353;    pfnSelectPalette           = _pfnSelectPalette@??        @434
    354 ;    GetGlyphIndicesA           = _GetGlyphIndicesA@20         @435
    355 ;    GetGlyphIndicesW           = _GetGlyphIndicesW@20         @436
     354    GetGlyphIndicesA           = _GetGlyphIndicesA@20         @435
     355    GetGlyphIndicesW           = _GetGlyphIndicesW@20         @436
    356356
    357357;
  • trunk/src/gdi32/gdi32.cpp

    r10349 r10374  
    1 /* $Id: gdi32.cpp,v 1.90 2003-12-01 13:27:38 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.91 2004-01-11 11:42:15 sandervl Exp $ */
    22
    33/*
     
    2727#include <stats.h>
    2828#include <objhandle.h>
     29#include <winspool.h>
    2930
    3031#define DBG_LOCALLOG    DBG_gdi32
     
    3334ODINDEBUGCHANNEL(GDI32-GDI32)
    3435
     36//******************************************************************************
     37//******************************************************************************
     38BOOL WIN32API GdiFlush()
     39{
     40    //NOP: DIB synchronization is done using exceptions
     41    return TRUE;
     42}
    3543//******************************************************************************
    3644//******************************************************************************
     
    7886    ret = O32_InvertRect(hDC,lprc);
    7987    DIBSECTION_MARK_INVALID(hDC);
     88    return ret;
     89}
     90//******************************************************************************
     91//******************************************************************************
     92BOOL WIN32API StrokeAndFillPath(HDC hdc)
     93{
     94    DIBSECTION_CHECK_IF_DIRTY(hdc);
     95    BOOL ret = O32_StrokeAndFillPath(hdc);
     96    DIBSECTION_MARK_INVALID(hdc);
     97    return ret;
     98}
     99//******************************************************************************
     100//******************************************************************************
     101BOOL WIN32API StrokePath(HDC hdc)
     102{
     103    DIBSECTION_CHECK_IF_DIRTY(hdc);
     104    BOOL ret = O32_StrokePath(hdc);
     105    DIBSECTION_MARK_INVALID(hdc);
    80106    return ret;
    81107}
     
    254280//******************************************************************************
    255281//******************************************************************************
    256 HDC WIN32API CreateCompatibleDC( HDC hdc)
    257 {
    258  HDC newHdc;
    259 
    260     newHdc = O32_CreateCompatibleDC(hdc);
    261     ULONG oldcp = OSLibGpiQueryCp(hdc);
    262     if (!oldcp) /* If new DC is to be created */
    263         oldcp = GetDisplayCodepage();
    264 
    265     if(newHdc) STATS_CreateCompatibleDC(hdc, newHdc);
    266     OSLibGpiSetCp(newHdc, oldcp);
    267     //PF Open32 seems not to move coordinates to 0,0 in newHdc
    268     MoveToEx(newHdc, 0, 0 , NULL);
    269 
    270     return newHdc;
    271 }
    272 //******************************************************************************
    273 //******************************************************************************
    274 BOOL WIN32API DeleteDC(HDC hdc)
    275 {
    276   pDCData  pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
    277   if(!pHps)
    278   {
    279       dprintf(("WARNING: DeleteDC %x; invalid hdc!", hdc));
    280       SetLastError(ERROR_INVALID_HANDLE);
    281       return 0;
    282   }
    283   SetLastError(ERROR_SUCCESS);
    284 
    285   DIBSection *dsect = DIBSection::findHDC(hdc);
    286   if(dsect)
    287   {
    288       //remove previously selected dibsection
    289       dprintf(("DeleteDC %x, unselect DIB section %x", hdc, dsect->GetBitmapHandle()));
    290       dsect->UnSelectDIBObject();
    291   }
    292 
    293   //Must call ReleaseDC for window dcs
    294   if(pHps->hdcType == TYPE_1) {
    295       return ReleaseDC(OS2ToWin32Handle(pHps->hwnd), hdc);
    296   }
    297 
    298   STATS_DeleteDC(hdc);
    299   return O32_DeleteDC(hdc);
    300 }
    301 //******************************************************************************
    302 //******************************************************************************
    303 BOOL WIN32API StrokeAndFillPath(HDC hdc)
    304 {
    305     return O32_StrokeAndFillPath(hdc);
    306 }
    307 //******************************************************************************
    308 //******************************************************************************
    309 BOOL WIN32API StrokePath(HDC hdc)
    310 {
    311     return O32_StrokePath(hdc);
    312 }
    313 //******************************************************************************
    314 //******************************************************************************
    315282int WIN32API SetBkMode( HDC hdc, int mode)
    316283{
     
    396363//******************************************************************************
    397364//******************************************************************************
    398 HDC WIN32API CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, const DEVMODEA *lpInitData)
    399 {
    400     HDC hdc;
    401 
    402     // 2001-05-28 PH
    403     // Ziff Davis Benchmarks come in here with "display".
    404     // Obviously, Windows does accept case-insensitive driver names,
    405     // whereas Open32 doesn't.
    406     if (*lpszDriver == 'd') // quick check
    407     {
    408         // then do a double-check and use the uppercase constant
    409         // instead
    410         if (stricmp(lpszDriver, "DISPLAY") == 0)
    411             lpszDriver = "DISPLAY";
    412     }
    413 
    414     hdc = O32_CreateDC(lpszDriver, lpszDevice, lpszOutput, lpInitData);
    415     if(hdc) {
    416         OSLibGpiSetCp(hdc, GetDisplayCodepage());
    417         STATS_CreateDCA(hdc, lpszDriver, lpszDevice, lpszOutput, lpInitData);
    418     }
    419 
    420     dprintf(("GDI32: CreateDCA %s %s %s %x returned %x", lpszDriver, lpszDevice, lpszOutput, lpInitData, hdc));
    421     return hdc;
    422 }
    423 //******************************************************************************
    424 //******************************************************************************
    425 HDC WIN32API CreateDCW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
    426 {
    427     char *astring4, *astring5;
    428 
    429     char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
    430     char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
    431     char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
    432 
    433     if(arg4)
    434     {
    435       astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
    436       astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
    437     }
    438 
    439     HDC   rc;
    440     DEVMODEA devmode;
    441 
    442     if(arg4)
    443     {
    444       strcpy((char*)devmode.dmDeviceName, astring4);
    445       strcpy((char*)devmode.dmFormName, astring5);
    446 
    447       devmode.dmSpecVersion      = arg4->dmSpecVersion;
    448       devmode.dmDriverVersion    = arg4->dmDriverVersion;
    449       devmode.dmSize             = arg4->dmSize;
    450       devmode.dmDriverExtra      = arg4->dmDriverExtra;
    451       devmode.dmFields           = arg4->dmFields;
    452 #if (__IBMCPP__ == 360)
    453       devmode.dmOrientation   = arg4->dmOrientation;
    454       devmode.dmPaperSize     = arg4->dmPaperSize;
    455       devmode.dmPaperLength   = arg4->dmPaperLength;
    456       devmode.dmPaperWidth    = arg4->dmPaperWidth;
    457 #else
    458       devmode.s1.dmOrientation   = arg4->s1.dmOrientation;
    459       devmode.s1.dmPaperSize     = arg4->s1.dmPaperSize;
    460       devmode.s1.dmPaperLength   = arg4->s1.dmPaperLength;
    461       devmode.s1.dmPaperWidth    = arg4->s1.dmPaperWidth;
    462 #endif
    463       devmode.dmScale            = arg4->dmScale;
    464       devmode.dmCopies           = arg4->dmCopies;
    465       devmode.dmDefaultSource    = arg4->dmDefaultSource;
    466       devmode.dmPrintQuality     = arg4->dmPrintQuality;
    467       devmode.dmColor            = arg4->dmColor;
    468       devmode.dmDuplex           = arg4->dmDuplex;
    469       devmode.dmYResolution      = arg4->dmYResolution;
    470       devmode.dmTTOption         = arg4->dmTTOption;
    471       devmode.dmCollate          = arg4->dmCollate;
    472       devmode.dmLogPixels        = arg4->dmLogPixels;
    473       devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
    474       devmode.dmPelsWidth        = arg4->dmPelsWidth;
    475       devmode.dmPelsHeight       = arg4->dmPelsHeight;
    476       devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
    477       devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
    478       devmode.dmICMMethod        = arg4->dmICMMethod;
    479       devmode.dmICMIntent        = arg4->dmICMIntent;
    480       devmode.dmMediaType        = arg4->dmMediaType;
    481       devmode.dmDitherType       = arg4->dmDitherType;
    482       devmode.dmReserved1        = arg4->dmReserved1;
    483       devmode.dmReserved2        = arg4->dmReserved2;
    484       rc = CreateDCA(astring1,astring2,astring3,&devmode);
    485     }
    486     else
    487       rc = CreateDCA(astring1,astring2,astring3, NULL);
    488 
    489     FreeAsciiString(astring1);
    490     FreeAsciiString(astring2);
    491     FreeAsciiString(astring3);
    492 
    493     if(arg4)
    494     {
    495       FreeAsciiString(astring4);
    496       FreeAsciiString(astring5);
    497     }
    498 
    499     return rc;
    500 }
    501 //******************************************************************************
    502 //******************************************************************************
    503 HDC WIN32API CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
    504                        const DEVMODEA *lpdvmInit)
    505 {
    506  static char *szDisplay = "DISPLAY";
    507  HDC          hdc;
    508 
    509     //SvL: Open32 tests for "DISPLAY"
    510     if(lpszDriver && !strcmp(lpszDriver, "display")) {
    511         lpszDriver = szDisplay;
    512     }
    513     //SvL: Open32 tests lpszDriver for NULL even though it's ignored
    514     if(lpszDriver == NULL) {
    515         lpszDriver = lpszDevice;
    516     }
    517     hdc = O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
    518     if(hdc) STATS_CreateICA(hdc, lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
    519     return hdc;
    520 }
    521 //******************************************************************************
    522 //******************************************************************************
    523 HDC WIN32API CreateICW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
    524 {
    525     char *astring4, *astring5;
    526 
    527     char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
    528     char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
    529     char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
    530     if(arg4)
    531     {
    532       astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
    533       astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
    534     }
    535 
    536     HDC   rc;
    537     DEVMODEA devmode;
    538 
    539     if(arg4)
    540     {
    541       strcpy((char*)devmode.dmDeviceName, astring4);
    542       strcpy((char*)devmode.dmFormName, astring5);
    543 
    544       devmode.dmSpecVersion      = arg4->dmSpecVersion;
    545       devmode.dmDriverVersion    = arg4->dmDriverVersion;
    546       devmode.dmSize             = arg4->dmSize;
    547       devmode.dmDriverExtra      = arg4->dmDriverExtra;
    548       devmode.dmFields           = arg4->dmFields;
    549 #if (__IBMCPP__ == 360)
    550       devmode.dmOrientation      = arg4->dmOrientation;
    551       devmode.dmPaperSize        = arg4->dmPaperSize;
    552       devmode.dmPaperLength      = arg4->dmPaperLength;
    553       devmode.dmPaperWidth       = arg4->dmPaperWidth;
    554 #else
    555       devmode.s1.dmOrientation   = arg4->s1.dmOrientation;
    556       devmode.s1.dmPaperSize     = arg4->s1.dmPaperSize;
    557       devmode.s1.dmPaperLength   = arg4->s1.dmPaperLength;
    558       devmode.s1.dmPaperWidth    = arg4->s1.dmPaperWidth;
    559 #endif
    560       devmode.dmScale            = arg4->dmScale;
    561       devmode.dmCopies           = arg4->dmCopies;
    562       devmode.dmDefaultSource    = arg4->dmDefaultSource;
    563       devmode.dmPrintQuality     = arg4->dmPrintQuality;
    564       devmode.dmColor            = arg4->dmColor;
    565       devmode.dmDuplex           = arg4->dmDuplex;
    566       devmode.dmYResolution      = arg4->dmYResolution;
    567       devmode.dmTTOption         = arg4->dmTTOption;
    568       devmode.dmCollate          = arg4->dmCollate;
    569       devmode.dmLogPixels        = arg4->dmLogPixels;
    570       devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
    571       devmode.dmPelsWidth        = arg4->dmPelsWidth;
    572       devmode.dmPelsHeight       = arg4->dmPelsHeight;
    573       devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
    574       devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
    575       devmode.dmICMMethod        = arg4->dmICMMethod;
    576       devmode.dmICMIntent        = arg4->dmICMIntent;
    577       devmode.dmMediaType        = arg4->dmMediaType;
    578       devmode.dmDitherType       = arg4->dmDitherType;
    579       devmode.dmReserved1        = arg4->dmReserved1;
    580       devmode.dmReserved2        = arg4->dmReserved2;
    581 
    582       rc = CreateICA(astring1,astring2,astring3,&devmode);
    583     }
    584     else
    585       rc = CreateICA(astring1,astring2,astring3, NULL);
    586 
    587     FreeAsciiString(astring1);
    588     FreeAsciiString(astring2);
    589     FreeAsciiString(astring3);
    590     if(arg4)
    591     {
    592       FreeAsciiString(astring4);
    593       FreeAsciiString(astring5);
    594     }
    595 
    596     return rc;
    597 }
    598 //******************************************************************************
    599 //******************************************************************************
    600365BOOL WIN32API Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
    601366                      int nBottomRect)
     
    708473//******************************************************************************
    709474//******************************************************************************
    710 int WIN32API Escape( HDC hdc, int nEscape, int cbInput, LPCSTR lpvInData, PVOID lpvOutData)
    711 {
    712  int rc;
    713 
    714 #ifdef DEBUG
    715   if(cbInput && lpvInData) {
    716         ULONG *tmp = (ULONG *)lpvInData;
    717         for(int i=0;i<cbInput/4;i++) {
    718                 dprintf(("GDI32: Escape par %d: %x", i, *tmp++));
    719         }
    720   }
    721 #endif
    722     rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
    723     if(rc == 0) {
    724          dprintf(("GDI32: Escape %x %d %d %x %x returned %d (WARNING: might not be implemented!!) ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
    725     }
    726     else dprintf(("GDI32: Escape %x %d %d %x %x returned %d ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
    727 
    728     return rc;
    729 }
    730 //******************************************************************************
    731 //******************************************************************************
    732475BOOL WIN32API ExtFloodFill( HDC arg1, int arg2, int arg3, COLORREF arg4, UINT  arg5)
    733476{
     
    787530{
    788531    return O32_GetBrushOrgEx(arg1, arg2);
    789 }
    790 //******************************************************************************
    791 //******************************************************************************
    792 BOOL WIN32API GetCharABCWidthsA( HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
    793 {
    794     return O32_GetCharABCWidths(arg1, arg2, arg3, arg4);
    795 }
    796 //******************************************************************************
    797 //******************************************************************************
    798 BOOL WIN32API GetCharABCWidthsW( HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
    799 {
    800     dprintf(("GDI32: GetCharABCWidthsW not properly implemented."));
    801     // NOTE: This will not work as is (needs UNICODE support)
    802     return O32_GetCharABCWidths(arg1, arg2, arg3, arg4);
    803 }
    804 //******************************************************************************
    805 //******************************************************************************
    806 BOOL WIN32API GetCharWidth32A( HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
    807 {
    808  BOOL ret;
    809 
    810     dprintf(("GDI32: GetCharWidth32A %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
    811     ret = O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
    812     dprintf(("GDI32: GetCharWidth32A returned %d", ret));
    813 #ifdef DEBUG
    814     if(ret) {
    815       for(int i=iFirstChar;i<iLastChar;i++) {
    816           if((i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z')) {
    817                 dprintf2(("Char %c -> width %d", i, pWidthArray[i]));
    818           }
    819           else  dprintf2(("Char %x -> width %d", i, pWidthArray[i]));
    820       }
    821     }
    822 #endif
    823     return ret;
    824 }
    825 //******************************************************************************
    826 //TODO: Cut off Unicode chars?
    827 //******************************************************************************
    828 BOOL WIN32API GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
    829 {
    830     dprintf(("GDI32: GetCharWidth32W might not work properly %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
    831     return O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
    832532}
    833533//******************************************************************************
     
    841541    return rc;
    842542}
     543#ifdef DEBUG
     544//******************************************************************************
     545//******************************************************************************
     546char *GetDeviceCapsString(int nIndex)
     547{
     548    switch(nIndex) {
     549    case DRIVERVERSION:
     550        return "DRIVERVERSION";
     551    case TECHNOLOGY:
     552        return "TECHNOLOGY";
     553    case HORZSIZE:
     554        return "HORZSIZE";
     555    case VERTSIZE:
     556        return "VERTSIZE";
     557    case HORZRES:
     558        return "HORZRES";
     559    case VERTRES:
     560        return "VERTRES";
     561    case BITSPIXEL:
     562        return "BITSPIXEL";
     563    case PLANES:
     564        return "PLANES";
     565    case NUMBRUSHES:
     566        return "NUMBRUSHES";
     567    case NUMPENS:
     568        return "NUMPENS";
     569    case NUMMARKERS:
     570        return "NUMMARKERS";
     571    case NUMFONTS:
     572        return "NUMFONTS";
     573    case NUMCOLORS:
     574        return "NUMCOLORS";
     575    case PDEVICESIZE:
     576        return "PDEVICESIZE";
     577    case CURVECAPS:
     578        return "CURVECAPS";
     579    case LINECAPS:
     580        return "LINECAPS";
     581    case POLYGONALCAPS:
     582        return "POLYGONALCAPS";
     583    case TEXTCAPS:
     584        return "TEXTCAPS";
     585    case CLIPCAPS:
     586        return "CLIPCAPS";
     587    case RASTERCAPS:
     588        return "RASTERCAPS";
     589    case ASPECTX:
     590        return "ASPECTX";
     591    case ASPECTY:
     592        return "ASPECTY";
     593    case ASPECTXY:
     594        return "ASPECTXY";
     595    case LOGPIXELSX:
     596        return "LOGPIXELSX";
     597    case LOGPIXELSY:
     598        return "LOGPIXELSY";
     599    case SIZEPALETTE:
     600        return "SIZEPALETTE";
     601    case NUMRESERVED:
     602        return "NUMRESERVED";
     603    case COLORRES:
     604        return "COLORRES";
     605    case PHYSICALWIDTH:
     606        return "PHYSICALWIDTH";
     607    case PHYSICALHEIGHT:
     608        return "PHYSICALHEIGHT";
     609    case PHYSICALOFFSETX:
     610        return "PHYSICALOFFSETX";
     611    case PHYSICALOFFSETY:
     612        return "PHYSICALOFFSETY";
     613    case SCALINGFACTORX:
     614        return "SCALINGFACTORX";
     615    case SCALINGFACTORY:
     616        return "SCALINGFACTORY";
     617    }
     618    return "unknown";
     619}
     620#endif
    843621//******************************************************************************
    844622//******************************************************************************
     
    848626
    849627    rc = O32_GetDeviceCaps(hdc, nIndex);
    850     dprintf(("GDI32: GetDeviceCaps %X, %d returned %d\n", hdc, nIndex, rc));
     628    dprintf(("GDI32: GetDeviceCaps %x %s returned %d\n", hdc, GetDeviceCapsString(nIndex), rc));
    851629    //SvL: 13-9-'98: NT returns -1 when using 16 bits colors, NOT 65536!
    852630    if(nIndex == NUMCOLORS && rc > 256)
     
    854632
    855633    return(rc);
    856 }
    857 //******************************************************************************
    858 //******************************************************************************
    859 DWORD WIN32API GetKerningPairsA( HDC arg1, DWORD arg2, LPKERNINGPAIR  arg3)
    860 {
    861     return O32_GetKerningPairs(arg1, arg2, arg3);
    862 }
    863 //******************************************************************************
    864 //******************************************************************************
    865 DWORD WIN32API GetKerningPairsW( HDC arg1, DWORD arg2, LPKERNINGPAIR  arg3)
    866 {
    867     dprintf(("GDI32: GetKerningPairsW; might not work"));
    868     // NOTE: This will not work as is (needs UNICODE support)
    869     return O32_GetKerningPairs(arg1, arg2, arg3);
    870634}
    871635//******************************************************************************
     
    952716//******************************************************************************
    953717//******************************************************************************
    954 BOOL WIN32API PolyDraw( HDC arg1, const POINT * arg2, const BYTE * arg3, DWORD  arg4)
    955 {
    956     return O32_PolyDraw(arg1, arg2, arg3, arg4);
    957 }
    958 //******************************************************************************
    959 //******************************************************************************
    960 BOOL WIN32API PolyPolygon( HDC arg1, const POINT * arg2, const INT * arg3, UINT  arg4)
    961 {
    962     return O32_PolyPolygon(arg1, arg2, arg3, arg4);
     718BOOL WIN32API PolyDraw( HDC hdc, const POINT * arg2, const BYTE * arg3, DWORD  arg4)
     719{
     720    return O32_PolyDraw(hdc, arg2, arg3, arg4);
     721}
     722//******************************************************************************
     723//******************************************************************************
     724BOOL WIN32API PolyPolygon( HDC hdc, const POINT * arg2, const INT * arg3, UINT  arg4)
     725{
     726    return O32_PolyPolygon(hdc, arg2, arg3, arg4);
    963727}
    964728//******************************************************************************
     
    972736BOOL WIN32API Polygon( HDC hdc, const POINT *lpPoints, int count)
    973737{
     738    BOOL ret = FALSE;
     739#ifdef DEBUG
     740    if(lpPoints && count) {
     741        for(int i=0;i<count;i++) {
     742            dprintf(("Point (%d,%d)", lpPoints[i].x, lpPoints[i].y));
     743        }
     744    }
     745#endif
    974746    return O32_Polygon(hdc, lpPoints, count);
    975747}
     
    994766//******************************************************************************
    995767//******************************************************************************
    996 HDC WIN32API ResetDCA( HDC arg1, const DEVMODEA *  arg2)
    997 {
    998     return (HDC)O32_ResetDC(arg1, arg2);
    999 }
    1000 //******************************************************************************
    1001 //******************************************************************************
    1002 HDC WIN32API ResetDCW( HDC arg1, const DEVMODEW *  arg2)
    1003 {
    1004     dprintf(("GDI32: ResetDCW: not properly implemented"));
    1005     DebugInt3();
    1006     // NOTE: This will not work as is (needs UNICODE support)
    1007     return (HDC)O32_ResetDC(arg1, (const DEVMODEA *)arg2);
    1008 }
    1009 //******************************************************************************
    1010 //******************************************************************************
    1011 BOOL WIN32API RestoreDC(HDC hdc, int id)
    1012 {
    1013  BOOL ret;
    1014 
    1015     ret = O32_RestoreDC(hdc, id);
    1016     if(ret == FALSE) {
    1017         dprintf(("ERROR: GDI32: RestoreDC %x %d FAILED", hdc, id));
    1018     }
    1019     return ret;
    1020 }
    1021 //******************************************************************************
    1022 //******************************************************************************
    1023768BOOL WIN32API RoundRect( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int  arg7)
    1024769{
    1025770    return O32_RoundRect(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
    1026 }
    1027 //******************************************************************************
    1028 //******************************************************************************
    1029 int WIN32API SaveDC( HDC hdc)
    1030 {
    1031  int id;
    1032 
    1033     id = O32_SaveDC(hdc);
    1034     if(id == 0) {
    1035          dprintf(("ERROR: GDI32: SaveDC %x FAILED", hdc));
    1036     }
    1037     else dprintf(("GDI32: SaveDC %x returned %d", hdc, id));
    1038     return id;
    1039771}
    1040772//******************************************************************************
     
    1128860//******************************************************************************
    1129861//******************************************************************************
    1130 BOOL WIN32API GdiFlush()
    1131 {
    1132   dprintf(("GDI32: GdiFlush, not implemented (TRUE)\n"));
    1133   return(TRUE);
    1134 }
    1135 //******************************************************************************
    1136 //******************************************************************************
    1137862BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
    1138863{
     
    1143868//******************************************************************************
    1144869//******************************************************************************
    1145 BOOL WIN32API GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
    1146 {
    1147   dprintf(("GDI32: GetCharWidthFloatA, not implemented\n"));
    1148   return(FALSE);
    1149 }
    1150 //******************************************************************************
    1151 //******************************************************************************
    1152 BOOL WIN32API GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
    1153 {
    1154   dprintf(("GDI32: GetCharWidthFloatW, not implemented\n"));
    1155   return(FALSE);
    1156 }
    1157 //******************************************************************************
    1158 //******************************************************************************
    1159 BOOL WIN32API GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT pxBUffer)
    1160 {
    1161   dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
    1162   return(FALSE);
    1163 }
    1164 //******************************************************************************
    1165 //******************************************************************************
    1166 BOOL WIN32API GetCharABCWidthsFloatW(HDC hdc,
    1167                                      UINT iFirstChar,
    1168                                      UINT iLastChar,
    1169                                      LPABCFLOAT pxBUffer)
    1170 {
    1171   dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
    1172   return(FALSE);
    1173 }
    1174 //******************************************************************************
    1175 //******************************************************************************
    1176 INT WIN32API ExtEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
    1177                        INT cbOutput, LPSTR lpszOutData)
    1178 {
    1179   dprintf(("GDI32: ExtEscape, %x %x %d %x %d %x not implemented", hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData));
    1180 #ifdef DEBUG
    1181   if(cbInput && lpszInData) {
    1182         ULONG *tmp = (ULONG *)lpszInData;
    1183         for(int i=0;i<cbInput/4;i++) {
    1184                 dprintf(("GDI32: ExtEscape par %d: %x", i, *tmp++));
    1185         }
    1186   }
    1187 #endif
    1188   return(0);
    1189 }
    1190 //******************************************************************************
    1191 //******************************************************************************
    1192870int WIN32API DrawEscape(HDC hdc, int nEscape, int cbInput, LPCSTR lpszInData)
    1193871{
     
    1204882//******************************************************************************
    1205883//******************************************************************************
    1206 DWORD WIN32API GetGlyphOutlineA(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
    1207                                    DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
    1208 {
    1209   dprintf(("GDI32: GetGlyphOutLineA, not implemented (GDI_ERROR)\n"));
    1210   return(GDI_ERROR);
    1211 }
    1212 //******************************************************************************
    1213 
    1214 //******************************************************************************
    1215 /*KSO Thu 21.05.1998*/
    1216 DWORD WIN32API GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
    1217                                    DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
    1218 {
    1219   dprintf(("GDI32: GetGlyphOutLineW, not implemented\n"));
    1220   return(GDI_ERROR);
    1221 }
    1222 //******************************************************************************
    1223 
    1224 //******************************************************************************
     884
    1225885
    1226886/*****************************************************************************
     
    13721032
    13731033
    1374 /*****************************************************************************
    1375  * Name      : DWORD GetCharacterPlacementA
    1376  * Purpose   : The GetCharacterPlacementA function retrieves information about
    1377  *             a character string, such as character widths, caret positioning,
    1378  *             ordering within the string, and glyph rendering. The type of
    1379  *             information returned depends on the dwFlags parameter and is
    1380  *             based on the currently selected font in the given display context.
    1381  *             The function copies the information to the specified GCP_RESULTSA
    1382  *             structure or to one or more arrays specified by the structure.
    1383  * Parameters: HDC     hdc        handle to device context
    1384  *             LPCSTR lpString   pointer to string
    1385  *             int     nCount     number of characters in string
    1386  *             int     nMaxExtent maximum extent for displayed string
    1387  *             LPGCP_RESULTSA *lpResults  pointer to buffer for placement result
    1388  *             DWORD   dwFlags    placement flags
    1389  * Variables :
    1390  * Result    :
    1391  * Remark    :
    1392  * Status    : UNTESTED STUB
    1393  *
    1394  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    1395  *****************************************************************************/
    1396 
    1397 DWORD WIN32API GetCharacterPlacementA(HDC           hdc,
    1398                                          LPCSTR       lpString,
    1399                                          int           nCount,
    1400                                          int           nMaxExtent,
    1401                                          GCP_RESULTSA * lpResults,
    1402                                          DWORD         dwFlags)
    1403 {
    1404   dprintf(("GDI32: GetCharacterPlacementA(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    1405            hdc,
    1406            lpString,
    1407            nCount,
    1408            nMaxExtent,
    1409            lpResults,
    1410            dwFlags));
    1411 
    1412   return (0);
    1413 }
    1414 
    1415 
    1416 /*****************************************************************************
    1417  * Name      : DWORD GetCharacterPlacementW
    1418  * Purpose   : The GetCharacterPlacementW function retrieves information about
    1419  *             a character string, such as character widths, caret positioning,
    1420  *             ordering within the string, and glyph rendering. The type of
    1421  *             information returned depends on the dwFlags parameter and is
    1422  *             based on the currently selected font in the given display context.
    1423  *             The function copies the information to the specified GCP_RESULTSW
    1424  *             structure or to one or more arrays specified by the structure.
    1425  * Parameters: HDC     hdc        handle to device context
    1426  *             LPCSTR lpString   pointer to string
    1427  *             int     nCount     number of characters in string
    1428  *             int     nMaxExtent maximum extent for displayed string
    1429  *             GCP_RESULTSW *lpResults  pointer to buffer for placement result
    1430  *             DWORD   dwFlags    placement flags
    1431  * Variables :
    1432  * Result    :
    1433  * Remark    :
    1434  * Status    : UNTESTED STUB
    1435  *
    1436  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    1437  *****************************************************************************/
    1438 
    1439 DWORD WIN32API GetCharacterPlacementW(HDC           hdc,
    1440                                          LPCWSTR       lpString,
    1441                                          int           nCount,
    1442                                          int           nMaxExtent,
    1443                                          GCP_RESULTSW *lpResults,
    1444                                          DWORD         dwFlags)
    1445 {
    1446   dprintf(("GDI32: GetCharacterPlacementW(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    1447            hdc,
    1448            lpString,
    1449            nCount,
    1450            nMaxExtent,
    1451            lpResults,
    1452            dwFlags));
    1453 
    1454   return (0);
    1455 }
  • trunk/src/gdi32/gdi32dbg.def

    r10326 r10374  
    1 ; $Id: gdi32dbg.def,v 1.3 2003-11-15 12:18:07 sandervl Exp $
     1; $Id: gdi32dbg.def,v 1.4 2004-01-11 11:42:15 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    185185    GetKerningPairs            = _DbgGetKerningPairsA@12        @266
    186186    GetKerningPairsA           = _DbgGetKerningPairsA@12        @267
    187     GetKerningPairsW           = _DbgGetKerningPairsW@12        @268
     187    GetKerningPairsW           = _DbgGetKerningPairsA@12        @268
    188188    GetLogColorSpaceA          = _DbgGetLogColorSpaceA@12       @269
    189189    GetLogColorSpaceW          = _DbgGetLogColorSpaceW@12       @270
     
    352352;    pfnRealizePalette          = _DbgpfnRealizePalette@??       @433
    353353;    pfnSelectPalette           = _DbgpfnSelectPalette@??        @434
    354 ;    GetGlyphIndicesA           = _GetGlyphIndicesA@20            @435
    355 ;    GetGlyphIndicesW           = _GetGlyphIndicesW@20            @436
     354    GetGlyphIndicesA           = _GetGlyphIndicesA@20            @435
     355    GetGlyphIndicesW           = _GetGlyphIndicesW@20            @436
    356356
    357357;
  • trunk/src/gdi32/gdi32rsrc.orc

    r4873 r10374  
    1 /* $Id: gdi32rsrc.orc,v 1.4 2001-01-05 23:25:30 sandervl Exp $ */
     1/* $Id: gdi32rsrc.orc,v 1.5 2004-01-11 11:42:16 sandervl Exp $ */
    22
    33#include "winuser.h"
    44#include "odinrsrc.h"
    55
     6
     7TESTFONT RCDATA "testfont.fot"
    68
    79/////////////////////////////////////////////////////////////////////////////
  • trunk/src/gdi32/gdistats.cpp

    r9429 r10374  
     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
    111#include <os2win.h>
    212#include <stats.h>
     13#include <objhandle.h>
    314
    415#ifdef DEBUG
     
    300311    dprintf(("Leaked bitmap objects %d", nrbitmapscreated));
    301312    STAT_PrintLeakedObjects("Leaked Bitmap", createdbitmap);
     313    ObjDumpObjects();
    302314    dprintf(("*************  GDI32 STATISTICS END   *****************"));
    303315}
  • trunk/src/gdi32/icm.cpp

    r9975 r10374  
    1 /* $Id: icm.cpp,v 1.4 2003-04-02 12:58:58 sandervl Exp $ */
     1/* $Id: icm.cpp,v 1.5 2004-01-11 11:42:17 sandervl Exp $ */
    22
    33/*
  • trunk/src/gdi32/initgdi32.cpp

    r10178 r10374  
    1 /* $Id: initgdi32.cpp,v 1.15 2003-07-17 08:03:33 sandervl Exp $
     1/* $Id: initgdi32.cpp,v 1.16 2004-01-11 11:42:17 sandervl Exp $
    22 *
    33 * DLL entry point
  • trunk/src/gdi32/line.cpp

    r9429 r10374  
    1 /* $Id: line.cpp,v 1.13 2002-11-26 10:53:10 sandervl Exp $ */
     1/* $Id: line.cpp,v 1.14 2004-01-11 11:42:18 sandervl Exp $ */
    22/*
    33 * Line API's
     
    2121#define ROUND_FLOAT(x) ((INT)((x < 0) ? x-0.5:x+0.5))
    2222
     23//******************************************************************************
     24//******************************************************************************
    2325VOID toWin32LineEnd(PPOINTLOS2 startPt,INT nXEnd,INT nYEnd,PPOINTLOS2 pt)
    2426{
     
    4850  }
    4951}
    50 
     52//******************************************************************************
     53//******************************************************************************
    5154BOOL drawSingleLinePoint(HDC hdc,pDCData pHps,PPOINTLOS2 pt)
    5255{
    53   LOGPEN penInfo;
    54 
    55   if (!GetObjectA(GetCurrentObject(hdc,OBJ_PEN),sizeof(penInfo),(LPVOID)&penInfo)) return FALSE;
     56  LOGPEN    penInfo;
     57  EXTLOGPEN extpenInfo;
     58
     59  if (!GetObjectA(GetCurrentObject(hdc,OBJ_PEN),sizeof(penInfo),(LPVOID)&penInfo))
     60  {//try extlogpen
     61      if (!GetObjectA(GetCurrentObject(hdc,OBJ_PEN),sizeof(extpenInfo),(LPVOID)&extpenInfo)) {
     62          return FALSE;
     63      }
     64      penInfo.lopnStyle   = extpenInfo.elpPenStyle;
     65      penInfo.lopnWidth.x = extpenInfo.elpWidth;
     66      penInfo.lopnWidth.y = 0; //??????
     67      penInfo.lopnColor   = extpenInfo.elpColor;
     68  }
    5669
    5770  if ((penInfo.lopnWidth.x > 1) || (penInfo.lopnWidth.y > 1))
     
    7083  }
    7184}
    72 
     85//******************************************************************************
     86//******************************************************************************
    7387BOOL WIN32API MoveToEx( HDC hdc, int X, int Y, LPPOINT lpPoint)
    7488{
     
    146160      } else
    147161      {
    148         if (OSLibGpiLine(pHps,&newPoint) == 0)
     162        if (OSLibGpiLine(pHps,&newPoint) == FALSE)
    149163          rc = FALSE;
    150164      }
  • trunk/src/gdi32/makefile

    r10229 r10374  
    1 # $Id: makefile,v 1.44 2003-08-12 08:22:41 sandervl Exp $
     1# $Id: makefile,v 1.45 2004-01-11 11:42:18 sandervl Exp $
    22
    33#
     
    4444$(OBJDIR)\oslibgdi.obj \
    4545$(OBJDIR)\font.obj \
     46$(OBJDIR)\fontres.obj \
    4647$(OBJDIR)\text.obj \
     48$(OBJDIR)\devcontext.obj \
    4749$(OBJDIR)\palette.obj \
    4850$(OBJDIR)\line.obj \
     
    5860$(OBJDIR)\gdistats.obj \
    5961$(OBJDIR)\dbglocal.obj \
     62$(OBJDIR)\ft2supp.obj \
    6063!ifdef DEBUG
    6164$(OBJDIR)\dbgwrap.obj \
  • trunk/src/gdi32/objhandle.cpp

    r9429 r10374  
    1 /* $Id: objhandle.cpp,v 1.31 2002-11-26 10:53:10 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.32 2004-01-11 11:42:18 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    55 *
    66 * Copyright 2000-2002 Sander van Leeuwen (sandervl@xs4all.nl)
     7 * Copyright 2003 Innotek Systemberatung GmbH (sandervl@innotek.de)
    78 *
    89 * TODO: The table should be dynamically increased when necessary
     
    3738//******************************************************************************
    3839
    39 typedef struct {
    40   DWORD      dwUserData;
    41   DWORD      dwGDI32Data;
    42   DWORD      dwFlags;
    43   DWORD      dwType;
     40typedef struct _GdiObject
     41{
     42  DWORD              dwUserData;
     43  DWORD              dwGDI32Data;
     44  DWORD              dwFlags;
     45  DWORD              dwType;
     46#ifdef DEBUG
     47  DWORD              dwTime;
     48  struct _GdiObject *prev;
     49#endif
     50  struct _GdiObject *next;
    4451} GdiObject;
    4552
    46 static GdiObject *objHandleTable  = NULL;
    47 static ULONG      lowestFreeIndex = 1;
    48 static VMutex     objTableMutex;
     53typedef struct
     54{
     55  GdiObject *headfree;
     56  GdiObject *tailfree;
     57  GdiObject *objects;
     58  int        iAllocated;
     59#ifdef DEBUG
     60  DWORD      dwMaxAllocated;
     61#endif
     62} GdiObjectTable;
     63
     64static GdiObjectTable  objHandleTable = { 0 };
     65static VMutex          objTableMutex;
    4966
    5067//******************************************************************************
     
    5370{
    5471    DWORD oldlowestidx;
    55 
    56     objTableMutex.enter();
    57     if(objHandleTable == NULL) {
    58         objHandleTable = (GdiObject *)malloc(MAX_OBJECT_HANDLES*sizeof(GdiObject));
    59         if(objHandleTable == NULL) {
     72    BOOL  retry = FALSE;
     73
     74    objTableMutex.enter();
     75    if(objHandleTable.objects == NULL)
     76    {
     77        objHandleTable.objects = (GdiObject *)malloc(MAX_OBJECT_HANDLES*sizeof(GdiObject));
     78        if(objHandleTable.objects == NULL) {
    6079            DebugInt3();
    61         }
    62         memset(objHandleTable, 0, MAX_OBJECT_HANDLES*sizeof(GdiObject));
    63     }
    64 
    65     if(lowestFreeIndex == -1) {
     80            return FALSE;
     81        }
     82        memset(objHandleTable.objects, 0, MAX_OBJECT_HANDLES*sizeof(GdiObject));
     83        if(objHandleTable.objects[0].dwType == HNDL_NONE) {
     84            //first handle can never be used
     85            objHandleTable.objects[0].dwType     = HNDL_INVALID;
     86            objHandleTable.objects[0].dwUserData = -1;
     87            objHandleTable.objects[0].dwFlags    = OBJHANDLE_FLAG_NODELETE;
     88        }
     89        objHandleTable.tailfree = &objHandleTable.objects[MAX_OBJECT_HANDLES-1];
     90        for(int i=MAX_OBJECT_HANDLES-1;i>0;i--)
     91        {
     92            GdiObject *obj = &objHandleTable.objects[i];
     93
     94#ifdef DEBUG
     95            if(objHandleTable.headfree) {
     96                objHandleTable.headfree->prev = obj;
     97            }
     98            obj->prev = NULL;
     99#endif
     100            obj->next = objHandleTable.headfree;
     101            objHandleTable.headfree = obj;
     102        }
     103        objHandleTable.iAllocated = 1; //one invalid object
     104    }
     105
     106    GdiObject *newobj = objHandleTable.headfree;
     107    if(newobj == NULL) {
    66108        //oops, out of handles
    67109        objTableMutex.leave();
     
    70112        return FALSE;
    71113    }
    72     if(objHandleTable[0].dwType == HNDL_NONE) {
    73         //first handle can never be used
    74         objHandleTable[0].dwType     = HNDL_INVALID;
    75         objHandleTable[0].dwUserData = -1;
    76     }
    77     *hObject = lowestFreeIndex;
    78     *hObject = MAKE_HANDLE(*hObject);
    79     objHandleTable[lowestFreeIndex].dwUserData  = dwUserData;
    80     objHandleTable[lowestFreeIndex].dwType      = dwType;
    81     objHandleTable[lowestFreeIndex].dwGDI32Data = 0;
    82     objHandleTable[lowestFreeIndex].dwFlags     = 0;
    83 
    84     oldlowestidx = lowestFreeIndex+1;
    85 
    86     lowestFreeIndex = -1;
    87 
    88     //find next free handle
    89 findhandle:
    90     for(int i=oldlowestidx;i<MAX_OBJECT_HANDLES;i++) {
    91         if(objHandleTable[i].dwUserData == 0) {
    92             lowestFreeIndex = i;
    93             break;
    94         }
    95     }
    96     if(lowestFreeIndex == -1) {
    97         oldlowestidx = 0; //search from the start
    98         goto findhandle;
    99     }
    100     objTableMutex.leave();
     114    objHandleTable.headfree = newobj->next;
     115    //if there's nothing left, then there's nothing left
     116    if(objHandleTable.headfree == NULL) {
     117         dprintf(("WARNING: Just allocated our last GDI handle..."));
     118         objHandleTable.tailfree = NULL;
     119    }
     120#ifdef DEBUG
     121    else objHandleTable.headfree->prev = NULL;
     122    newobj->prev = NULL;
     123    newobj->dwTime = GetCurrentTime();
     124#endif
     125
     126    newobj->next = NULL;
     127
     128    *hObject = MAKE_HANDLE(((char *)newobj - (char *)objHandleTable.objects)/sizeof(*newobj));
     129    newobj->dwUserData  = dwUserData;
     130    newobj->dwType      = dwType;
     131    newobj->dwGDI32Data = 0;
     132    newobj->dwFlags     = 0;
     133
     134    objHandleTable.iAllocated++;
     135#ifdef DEBUG
     136    if(objHandleTable.iAllocated > objHandleTable.dwMaxAllocated) {
     137        objHandleTable.dwMaxAllocated = objHandleTable.iAllocated;
     138    }
     139#endif
     140    objTableMutex.leave();
     141    dprintf2(("ObjAllocateHandle %x type %d", *hObject, dwType));
    101142    return TRUE;
    102143}
     
    106147{
    107148    hObject &= OBJHANDLE_MAGIC_MASK;
    108     if(hObject < MAX_OBJECT_HANDLES) {
     149    if(hObject < MAX_OBJECT_HANDLES)
     150    {
    109151        objTableMutex.enter();
    110         if(!(objHandleTable[hObject].dwFlags & OBJHANDLE_FLAG_NODELETE))
    111         {
    112             objHandleTable[hObject].dwUserData = 0;
    113             objHandleTable[hObject].dwType     = HNDL_NONE;
    114 ////            if(lowestFreeIndex == -1 || hObject < lowestFreeIndex)
    115             if(lowestFreeIndex == -1)
    116                 lowestFreeIndex = hObject;
     152        GdiObject *obj = &objHandleTable.objects[hObject];
     153        if(!(obj->dwFlags & OBJHANDLE_FLAG_NODELETE))
     154        {
     155            dprintf2(("ObjDeleteHandle %x type %d", MAKE_HANDLE(hObject), obj->dwType));
     156
     157            obj->dwUserData = 0;
     158            obj->dwType     = HNDL_NONE;
     159            obj->next       = NULL;
     160
     161            //add to the tail of the free object list
     162            if(objHandleTable.tailfree)
     163                objHandleTable.tailfree->next = obj;
     164
     165#ifdef DEBUG
     166            obj->prev       = objHandleTable.tailfree;
     167#endif
     168            objHandleTable.tailfree = obj;
     169            if(objHandleTable.headfree == NULL)
     170                objHandleTable.headfree = obj;
     171
     172            objHandleTable.iAllocated--;
     173            if(objHandleTable.iAllocated < 0) DebugInt3();
    117174        }
    118175        else {
     
    133190    hObject &= OBJHANDLE_MAGIC_MASK;
    134191    if(hObject < MAX_OBJECT_HANDLES &&
    135        ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
    136        dwType == objHandleTable[hObject].dwType))
    137     {
    138         dwUserData = objHandleTable[hObject].dwUserData;
     192       ((dwType == HNDL_ANY && objHandleTable.objects[hObject].dwType != HNDL_NONE) ||
     193       dwType == objHandleTable.objects[hObject].dwType))
     194    {
     195        dwUserData = objHandleTable.objects[hObject].dwUserData;
    139196    }
    140197    objTableMutex.leave();
     
    150207    hObject &= OBJHANDLE_MAGIC_MASK;
    151208    if(hObject < MAX_OBJECT_HANDLES &&
    152        ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
    153        dwType == objHandleTable[hObject].dwType))
    154     {
    155         objHandleTable[hObject].dwUserData = dwUserData;
     209       ((dwType == HNDL_ANY && objHandleTable.objects[hObject].dwType != HNDL_NONE) ||
     210       dwType == objHandleTable.objects[hObject].dwType))
     211    {
     212        objHandleTable.objects[hObject].dwUserData = dwUserData;
    156213        fSuccess = TRUE;
    157214    }
     
    168225    hObject &= OBJHANDLE_MAGIC_MASK;
    169226    if(hObject < MAX_OBJECT_HANDLES &&
    170        ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
    171        dwType == objHandleTable[hObject].dwType))
    172     {
    173         dwGDI32Data = objHandleTable[hObject].dwGDI32Data;
     227       ((dwType == HNDL_ANY && objHandleTable.objects[hObject].dwType != HNDL_NONE) ||
     228       dwType == objHandleTable.objects[hObject].dwType))
     229    {
     230        dwGDI32Data = objHandleTable.objects[hObject].dwGDI32Data;
    174231    }
    175232    objTableMutex.leave();
     
    185242    hObject &= OBJHANDLE_MAGIC_MASK;
    186243    if(hObject < MAX_OBJECT_HANDLES &&
    187        ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
    188        dwType == objHandleTable[hObject].dwType))
    189     {
    190         objHandleTable[hObject].dwGDI32Data = dwGDI32Data;
     244       ((dwType == HNDL_ANY && objHandleTable.objects[hObject].dwType != HNDL_NONE) ||
     245       dwType == objHandleTable.objects[hObject].dwType))
     246    {
     247        objHandleTable.objects[hObject].dwGDI32Data = dwGDI32Data;
    191248        fSuccess = TRUE;
    192249    }
     
    202259    objTableMutex.enter();
    203260    hObject &= OBJHANDLE_MAGIC_MASK;
    204     if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwType != HNDL_NONE)
    205     {
    206         dwFlags = objHandleTable[hObject].dwFlags;
     261    if(hObject < MAX_OBJECT_HANDLES && objHandleTable.objects[hObject].dwType != HNDL_NONE)
     262    {
     263        dwFlags = objHandleTable.objects[hObject].dwFlags;
    207264    }
    208265    objTableMutex.leave();
     
    217274    objTableMutex.enter();
    218275    hObject &= OBJHANDLE_MAGIC_MASK;
    219     if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwType != HNDL_NONE) {
     276    if(hObject < MAX_OBJECT_HANDLES && objHandleTable.objects[hObject].dwType != HNDL_NONE) {
    220277        if(fSet) {
    221              objHandleTable[hObject].dwFlags |= dwFlag;
    222         }
    223         else objHandleTable[hObject].dwFlags &= ~dwFlag;
     278             objHandleTable.objects[hObject].dwFlags |= dwFlag;
     279        }
     280        else objHandleTable.objects[hObject].dwFlags &= ~dwFlag;
    224281
    225282        dprintf(("ObjSetHandleFlag %x -> %x", MAKE_HANDLE(hObject), dwFlag));
     
    238295    objTableMutex.enter();
    239296    hObject &= OBJHANDLE_MAGIC_MASK;
    240     if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwType != HNDL_NONE) {
    241         objtype = objHandleTable[hObject].dwType;
     297    if(hObject < MAX_OBJECT_HANDLES && objHandleTable.objects[hObject].dwType != HNDL_NONE) {
     298        objtype = objHandleTable.objects[hObject].dwType;
    242299    }
    243300    objTableMutex.leave();
    244301    return objtype;
    245302}
     303//******************************************************************************
     304//******************************************************************************
     305#ifdef DEBUG
     306void dumpObjectType(char *szType, DWORD dwType)
     307{
     308    for(int i=0;i<MAX_OBJECT_HANDLES;i++) {
     309        if(objHandleTable.objects[i].dwUserData != 0 && objHandleTable.objects[i].dwType == dwType) {
     310            dprintf(("%s object %x %x %x %x time %x", szType, MAKE_HANDLE(i), objHandleTable.objects[i].dwUserData, objHandleTable.objects[i].dwGDI32Data, objHandleTable.objects[i].dwFlags, objHandleTable.objects[i].dwTime));
     311        }
     312    }
     313}
     314//******************************************************************************
     315//******************************************************************************
     316void WIN32API ObjDumpObjects()
     317{
     318    dprintf(("Open object handles (%d, max %d): (time %x)", objHandleTable.iAllocated, objHandleTable.dwMaxAllocated, GetCurrentTime()));
     319
     320    dumpObjectType("HNDL_PEN", HNDL_PEN);
     321    dumpObjectType("HNDL_BRUSH", HNDL_BRUSH);
     322    dumpObjectType("HNDL_DC", HNDL_DC);
     323    dumpObjectType("HNDL_METADC", HNDL_METADC);
     324    dumpObjectType("HNDL_PALETTE", HNDL_PALETTE);
     325    dumpObjectType("HNDL_FONT", HNDL_FONT);
     326    dumpObjectType("HNDL_BITMAP", HNDL_BITMAP);
     327    dumpObjectType("HNDL_DIBSECTION", HNDL_DIBSECTION);
     328    dumpObjectType("HNDL_REGION", HNDL_REGION);
     329    dumpObjectType("HNDL_METAFILE", HNDL_METAFILE);
     330    dumpObjectType("HNDL_ENHMETAFILE", HNDL_ENHMETAFILE);
     331    dumpObjectType("HNDL_MEMDC", HNDL_MEMDC);
     332    dumpObjectType("HNDL_EXTPEN", HNDL_EXTPEN);
     333    dumpObjectType("HNDL_ENHMETADC", HNDL_ENHMETADC);
     334    dumpObjectType("HNDL_MENU", HNDL_MENU);
     335    dumpObjectType("HNDL_ACCEL", HNDL_ACCEL);
     336    dumpObjectType("HNDL_CURSORICON", HNDL_CURSORICON);
     337    dumpObjectType("HNDL_DDELP", HNDL_DDELP);
     338}
     339#endif
    246340//******************************************************************************
    247341//******************************************************************************
  • trunk/src/gdi32/opengl.cpp

    r9429 r10374  
    1 /* $Id: opengl.cpp,v 1.9 2002-11-26 10:53:11 sandervl Exp $ */
     1/* $Id: opengl.cpp,v 1.10 2004-01-11 11:42:19 sandervl Exp $ */
    22
    33/*
  • trunk/src/gdi32/oslibgpi.cpp

    r10372 r10374  
    1 /* $Id: oslibgpi.cpp,v 1.16 2004-01-08 11:11:55 sandervl Exp $ */
     1/* $Id: oslibgpi.cpp,v 1.17 2004-01-11 11:42:19 sandervl Exp $ */
    22
    33/*
     
    1111
    1212#define  INCL_GPI
     13#define  INCL_GPIERRORS
    1314#define  INCL_WIN
    1415#include <os2wrap.h>    //Odin32 OS/2 api wrappers
     
    256257  ULONG    cx;
    257258  ULONG    cy;
    258 
     259 
    259260  //ignore underhang (just like GetTextExtentPoint does in Windows)
    260261  if (box[TXTBOX_BOTTOMLEFT].x < 0) {
     
    320321}
    321322
    322 LONG OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint)
    323 {
    324   return GpiLine(GetDCData(pHps)->hps,(PPOINTL)pptlEndPoint);
     323BOOL OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint)
     324{
     325  LONG ret = GpiLine(GetDCData(pHps)->hps,(PPOINTL)pptlEndPoint);
     326  if(ret != GPI_OK) {
     327      dprintf(("GpiLine failed with error %x", WinGetLastError(0)));
     328  }
     329  return (ret == GPI_OK);
    325330}
    326331
     
    388393
    389394  lbNew.lColor = color;
    390   BOOL rc = GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,0,&lbNew) && GpiSetPel(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR;
     395  BOOL rc = GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,0,&lbNew);
     396  if(rc == FALSE) {
     397      dprintf(("GpiSetAttrs/GpiSetPel failed with %x", WinGetLastError(0)));
     398  }
     399  else {
     400      rc = GpiSetPel(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR;
     401      if(rc == FALSE && LOWORD(WinGetLastError(0)) == PMERR_INV_IN_PATH) {
     402          dprintf(("WARNING: GpiSetPel invalid in path; retrying with GpiLine"));
     403          rc = GpiLine(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR;
     404      }
     405  }
     406  if(rc == FALSE) {
     407      dprintf(("GpiSetPel/GpiLine failed with %x", WinGetLastError(0)));
     408  }
    391409
    392410  GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,defaults,&lbOld);
     
    448466BOOL OSLibGpiLoadFonts(LPSTR lpszFontFile)
    449467{
    450    return GpiLoadFonts(0, lpszFontFile);
    451 }
    452 //******************************************************************************
    453 //******************************************************************************
     468   BOOL ret;
     469
     470   //We must use GpiLoadPublicFonts here. GpiLoadFonts cannot be used for
     471   //queued printer device contexts
     472   //-> NOTE: this is no longer the case as we spool printer specific data now (not metafiles)
     473   ret = GpiLoadFonts(0, lpszFontFile);
     474   if(ret == FALSE) {
     475       dprintf(("GpiLoadPublicFonts %s failed with %x", lpszFontFile, WinGetLastError(0)));
     476   }
     477   return ret;
     478}
     479//******************************************************************************
     480//******************************************************************************
     481BOOL OSLibGpiUnloadFonts(LPSTR lpszFontFile)
     482{
     483   return GpiUnloadFonts(0, lpszFontFile);
     484}
     485//******************************************************************************
     486//******************************************************************************
     487BOOL OSLibGpiQueryFontName(LPSTR lpszFileName, LPSTR lpszFamily, LPSTR lpszFace, int cbString)
     488{
     489    LONG     cFonts = 0, cRemFonts;
     490    PFFDESCS pffd = NULL;
     491    ULONG    cb;
     492
     493    cRemFonts = GpiQueryFontFileDescriptions(0, lpszFileName, &cFonts, NULL);
     494    if(cRemFonts == GPI_ALTERROR) {
     495        DebugInt3();
     496        return FALSE;
     497    }
     498
     499    cFonts = max(cFonts, cRemFonts);
     500    cb = cFonts * sizeof(FFDESCS) + 100; // must allocate extra
     501    pffd = (PFFDESCS)malloc(cb);
     502    if(pffd == NULL) {
     503        DebugInt3();
     504        return FALSE;
     505    }
     506
     507    memset(pffd, 0, cb);
     508
     509    //assuming one font for now
     510    cFonts = 1;
     511    if(GpiQueryFontFileDescriptions(0, lpszFileName, &cFonts, pffd) == 0)
     512    {
     513        strncpy(lpszFamily, (char *)pffd, cbString);
     514        strncpy(lpszFace, (char *)pffd + FACESIZE, cbString);
     515    }
     516    free(pffd);
     517    return TRUE;
     518}
     519//******************************************************************************
     520//******************************************************************************
     521BOOL ReallySetCharAttrs(PVOID lpHps)
     522{
     523  BOOL bRet = FALSE;
     524  pDCData pHps = (pDCData)lpHps;
     525
     526  if(pHps)
     527  {
     528     if(!pHps->bAttrSet)
     529     {
     530        if (!pHps->bFirstSet) {
     531           pHps->bFirstSet = TRUE;
     532        }
     533        if (pHps->ulCharMask) {
     534           bRet = GpiSetAttrs(pHps->hps, PRIM_CHAR, pHps->ulCharMask, 0, &pHps->CBundle);
     535        } else {
     536           bRet = TRUE;
     537        }
     538        if(bRet == TRUE) {
     539            pHps->CSetBundle = pHps->CBundle;
     540            pHps->ulCharMask = 0;
     541            pHps->bAttrSet = TRUE;
     542        }
     543     }
     544  }
     545  return(bRet);
     546}
     547//******************************************************************************
     548//******************************************************************************
  • trunk/src/gdi32/oslibgpi.h

    r9443 r10374  
    1 /* $Id: oslibgpi.h,v 1.11 2002-11-29 13:46:04 sandervl Exp $ */
     1/* $Id: oslibgpi.h,v 1.12 2004-01-11 11:42:20 sandervl Exp $ */
    22
    33/*
     
    105105BOOL OSLibGpiSetCurrentPosition(PVOID pHps,PPOINTLOS2 ptl);
    106106
     107BOOL ReallySetCharAttrs(PVOID pHps);
     108
    107109BOOL OSLibGpiLoadFonts(LPSTR lpszFontFile);
     110BOOL OSLibGpiUnloadFonts(LPSTR lpszFontFile);
     111
     112BOOL OSLibGpiQueryFontName(LPSTR lpszFileName, LPSTR lpszFamily, LPSTR lpszFace, int cbString);
    108113
    109114#define CHSOS_OPAQUE                 0x0001L
     
    201206
    202207BOOL OSLibGpiMove(PVOID pHps,PPOINTLOS2 pptlPoint);
    203 LONG OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint);
     208BOOL OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint);
    204209
    205210BOOL OSLibGpiEndPath(PVOID pHps);
  • trunk/src/gdi32/palette.cpp

    r9762 r10374  
    1 /* $Id: palette.cpp,v 1.11 2003-02-06 19:20:03 sandervl Exp $ */
     1/* $Id: palette.cpp,v 1.12 2004-01-11 11:42:20 sandervl Exp $ */
    22
    33/*
     
    5858    rc = O32_RealizePalette(hdc);
    5959    dprintf(("GDI32: RealizePalette %x returned %d", hdc, rc));
    60     if(rc && DIBSection::getSection() != NULL)
     60    if(rc)
    6161    {
    62         DIBSection *dsect = DIBSection::findHDC(hdc);
    63         if(dsect)
    64         {
    65             dsect->sync(hdc, 0, dsect->GetHeight());
    66         }
     62        DIBSECTION_MARK_INVALID(hdc);
    6763    }
    6864    return rc;
  • trunk/src/gdi32/printer.cpp

    r6331 r10374  
    1 /* $Id: printer.cpp,v 1.1 2001-07-14 15:31:45 sandervl Exp $ */
     1/* $Id: printer.cpp,v 1.2 2004-01-11 11:42:21 sandervl Exp $ */
    22
    33/*
     
    1919#include <os2win.h>
    2020#include <stdarg.h>
    21 #include <misc.h>
     21#include <string.h>
     22#include <dcdata.h>
     23#include <dbglog.h>
    2224#include <heapstring.h>
     25#include "oslibgpi.h"
    2326
    2427#define DBG_LOCALLOG    DBG_printer
    2528#include "dbglocal.h"
    2629
     30static char *lpszPassThrough = NULL;
     31static int   cbPassThrough   = 0;
     32
     33//NOTE: We need to insert this postscript statement into the stream or else
     34//      the output will be completely inverted (x & y)
     35static char  szSetupString[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n%%EndSetup\n";
     36
     37//******************************************************************************
     38//******************************************************************************
     39int WIN32API Escape( HDC hdc, int nEscape, int cbInput, LPCSTR lpvInData, PVOID lpvOutData)
     40{
     41    int rc;
     42    char *lpszEscape = NULL;
     43
     44    switch(nEscape)
     45    {
     46    case SET_BOUNDS:
     47    {
     48        RECT *r = (RECT *)lpvInData;
     49        if(cbInput != sizeof(RECT)) {
     50            dprintf(("WARNING: cbInput != sizeof(RECT) (=%d) for SET_BOUNDS", cbInput));
     51            return 0;
     52        }
     53        dprintf(("SET_BOUNDS (%d,%d) (%d,%d)", r->left, r->top, r->right, r->bottom));
     54        return 0;
     55    }
     56    case POSTSCRIPT_PASSTHROUGH:
     57        if(!lpszEscape) lpszEscape = "POSTSCRIPT_PASSTHROUGH";
     58        nEscape = PASSTHROUGH;
     59    case POSTSCRIPT_DATA:
     60        if(!lpszEscape) lpszEscape = "POSTSCRIPT_DATA";
     61    case PASSTHROUGH:
     62    {
     63        if(!lpszEscape) lpszEscape = "PASSTHROUGH";
     64        dprintf(("Postscript %s data of size %d", lpszEscape, *(WORD *)lpvInData));
     65
     66        rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
     67        if(rc == 1) rc = *(WORD *)lpvInData;
     68        else        rc = 0;
     69        return rc;
     70    }
     71
     72    case SPCLPASSTHROUGH2:
     73    {
     74        int rawsize = *(WORD *)(lpvInData+4);
     75
     76        dprintf(("SPCLPASSTHROUGH2: pretend success"));
     77        dprintf(("SPCLPASSTHROUGH2: virt mem %x size %x", *(DWORD *)lpvInData, rawsize));
     78        return 1;
     79    }
     80
     81    case DOWNLOADFACE:
     82        dprintf(("DOWNLOADFACE: pretend success"));
     83        return 1;
     84
     85    case POSTSCRIPT_IGNORE:
     86    {
     87        BOOL ret = FALSE;
     88        dprintf(("POSTSCRIPT_IGNORE %d", *(WORD *)lpvInData));
     89        return ret;
     90    }
     91    case EPSPRINTING:
     92    {
     93        UINT epsprint = *(UINT*)lpvInData;
     94        dprintf(("EPSPRINTING support %sable.\n",epsprint?"en":"dis"));
     95        return 1;
     96    }
     97
     98    case QUERYESCSUPPORT:
     99    {
     100        DWORD nEscapeSup = *(DWORD *)lpvInData;
     101        BOOL fdprintf = FALSE;
     102
     103        switch(nEscapeSup) {
     104        case SET_BOUNDS:
     105            if(!fdprintf) dprintf(("QUERYESCSUPPORT: SET_BOUNDS"));
     106            fdprintf = TRUE;
     107/*        case SPCLPASSTHROUGH2:
     108            if(!fdprintf) dprintf(("QUERYESCSUPPORT: SPCLPASSTHROUGH2"));
     109            fdprintf = TRUE;
     110        case DOWNLOADHEADER:
     111            if(!fdprintf) dprintf(("QUERYESCSUPPORT: DOWNLOADHEADER"));
     112            fdprintf = TRUE;
     113        case DOWNLOADFACE:
     114            if(!fdprintf) dprintf(("QUERYESCSUPPORT: DOWNLOADFACE"));
     115            fdprintf = TRUE;
     116*/
     117        case POSTSCRIPT_IGNORE:
     118            if(!fdprintf) dprintf(("QUERYESCSUPPORT: POSTSCRIPT_IGNORE"));
     119            fdprintf = TRUE;
     120        case EPSPRINTING:
     121        {
     122            if(!fdprintf) dprintf(("QUERYESCSUPPORT: EPSPRINTING"));
     123            fdprintf = TRUE;
     124
     125            nEscapeSup = POSTSCRIPT_PASSTHROUGH;
     126            return Escape(hdc, QUERYESCSUPPORT, sizeof(nEscapeSup), (LPCSTR)&nEscapeSup, NULL);
     127        }
     128        default:
     129            break;
     130        }
     131    }
     132    default:
     133        if(cbInput && lpvInData) {
     134            ULONG *tmp = (ULONG *)lpvInData;
     135            for(int i=0;i<min(16,cbInput/4);i++) {
     136                    dprintf(("GDI32: Escape par %d: %x", i, *tmp++));
     137            }
     138        }
     139        break;
     140    }
     141
     142    rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
     143    if(rc == 0) {
     144         dprintf(("GDI32: Escape %x %d %d %x %x returned %d (WARNING: might not be implemented!!) ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
     145    }
     146    else dprintf(("GDI32: Escape %x %d %d %x %x returned %d ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
     147
     148    return rc;
     149}
     150//******************************************************************************
     151//******************************************************************************
     152INT WIN32API ExtEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
     153                       INT cbOutput, LPSTR lpszOutData)
     154{
     155    dprintf(("GDI32: ExtEscape, %x %x %d %x %d %x partly implemented", hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData));
     156
     157    switch(nEscape) {
     158    case DOWNLOADHEADER:
     159    {
     160        dprintf(("DOWNLOADHEADER: hardcoded result"));
     161        if(lpszOutData && cbOutput >= 8) {
     162            strcpy(lpszOutData, "PM_1.2");
     163            return 1;
     164        }
     165        dprintf(("Not enough room for proc name"));
     166        return 0;
     167    }
     168    }
     169    return Escape(hdc, nEscape, cbInput, lpszInData, lpszOutData);
     170}
    27171//******************************************************************************
    28172//******************************************************************************
    29173INT WIN32API StartDocA(HDC hdc, const DOCINFOA *lpDocInfo)
    30174{
    31     dprintf(("GDI32: StartDocA %x %x", hdc, lpDocInfo));
    32     return O32_StartDoc(hdc, (LPDOCINFOA)lpDocInfo);
     175    INT ret;
     176
     177    if(lpDocInfo) {
     178         dprintf(("GDI32: StartDocA %x %x (%s %s %s %x)", hdc, lpDocInfo, lpDocInfo->lpszDocName, lpDocInfo->lpszOutput, lpDocInfo->lpszDatatype, lpDocInfo->fwType));
     179    }
     180    else dprintf(("GDI32: StartDocA %x %x", hdc, lpDocInfo));
     181
     182    ret = O32_StartDoc(hdc, (LPDOCINFOA)lpDocInfo);
     183
     184    if(ret != 0) {
     185        pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
     186        if(pHps)
     187        {
     188            pHps->Reserved |= DC_FLAG_SEND_POSTSCRIPT_SETUP_STRING;
     189        }
     190        else DebugInt3();
     191    }
     192
     193    return ret;
    33194}
    34195//******************************************************************************
     
    91252int WIN32API SetAbortProc(HDC hdc, ABORTPROC lpAbortProc)
    92253{
    93   dprintf(("GDI32: SetAbortProc %x %x - stub (1)", hdc, lpAbortProc));
    94   return(1);
    95 }
    96 //******************************************************************************
    97 //******************************************************************************
     254    dprintf(("GDI32: SetAbortProc %x %x - stub (1)", hdc, lpAbortProc));
     255    return(1);
     256}
     257//******************************************************************************
     258//******************************************************************************
  • trunk/src/gdi32/region.cpp

    r10322 r10374  
    1 /* $Id: region.cpp,v 1.35 2003-11-14 17:31:47 sandervl Exp $ */
     1/* $Id: region.cpp,v 1.36 2004-01-11 11:42:21 sandervl Exp $ */
    22
    33/*
     
    699699}
    700700//******************************************************************************
     701// GdiCopyClipRgn
     702//
     703// Duplicate the GPI region
     704//
     705// Parameters:
     706//
     707// pDCData pHps         - presentation space structure
     708//
     709// Returns:     - NULL     -> failure
     710//              - <> NULL  -> GPI handle of copied region
     711//
     712//******************************************************************************
     713HRGN GdiCopyClipRgn(pDCData pHps)
     714{
     715    HRGN hrgnNewClip;
     716    LONG lComplexity;
     717    RECTL rectl = {0, 0, 1, 1};
     718
     719    hrgnNewClip = GpiCreateRegion(pHps->hps, 1, &rectl);
     720    if(hrgnNewClip == NULLHANDLE) {
     721        dprintf(("ERROR: GdiCopyClipRgn: GpiCreateRegion failed!!"));
     722        DebugInt3();
     723        return 0;
     724    }
     725    lComplexity = GpiCombineRegion(pHps->hps, hrgnNewClip, pHps->hrgnWin32Clip, NULLHANDLE, CRGN_COPY);
     726    if (lComplexity != RGN_ERROR)
     727    {
     728        return TRUE;
     729    }
     730    DebugInt3();
     731    return FALSE;
     732}
     733//******************************************************************************
     734// GdiDestroyRgn
     735//
     736// Destroy the GPI region
     737//
     738// Parameters:
     739//
     740// pDCData pHps         - presentation space structure
     741// HRGN hrgn            - region handle (GPI)
     742//
     743// Returns:     - FALSE -> failure
     744//              - TRUE  -> success
     745//
     746//******************************************************************************
     747BOOL GdiDestroyRgn(pDCData pHps, HRGN hrgn)
     748{
     749    return GpiDestroyRegion(pHps->hps, hrgn);
     750}
     751//******************************************************************************
    701752//******************************************************************************
    702753int WIN32API ExtSelectClipRgn(HDC hdc, HRGN hrgn, int mode)
  • trunk/src/gdi32/region.h

    r7074 r10374  
    1 //$Id: region.h,v 1.3 2001-10-16 11:40:19 sandervl Exp $
     1//$Id: region.h,v 1.4 2004-01-11 11:42:22 sandervl Exp $
    22#ifndef __REGION_H__
    33#define __REGION_H__
     4
     5#include <dcdata.h>
    46
    57BOOL InitRegionSpace();
     
    810BOOL WIN32API OSLibDeleteRegion(HANDLE hRegion);
    911
     12HRGN GdiCopyClipRgn(pDCData pHps);
     13BOOL GdiDestroyRgn(pDCData pHps, HRGN hrgnClip);
     14
    1015#endif //__REGION_H__
  • trunk/src/gdi32/rgbcvt.h

    r10167 r10374  
    1 //$Id: rgbcvt.h,v 1.4 2003-07-16 10:46:18 sandervl Exp $
     1//$Id: rgbcvt.h,v 1.5 2004-01-11 11:42:22 sandervl Exp $
    22#ifndef __RGBCVT_H__
    33#define __RGBCVT_H__
  • trunk/src/gdi32/text.cpp

    r10368 r10374  
    1 /* $Id: text.cpp,v 1.39 2003-12-29 12:04:15 sandervl Exp $ */
     1/* $Id: text.cpp,v 1.40 2004-01-11 11:42:22 sandervl Exp $ */
    22
    33/*
    44 * GDI32 text apis
    55 *
    6  * Based on Wine code (991031) (objects\text.c)
     6 * Based on Wine/ReWind code (objects\text.c, objects\font.c)
    77 *
    88 * Copyright 1993, 1994 Alexandre Julliard
     9 *           1997 Alex Korobka
     10 *
    911 * Copyright 1999-2000 Christoph Bratschi
     12 * Copyright 2002-2003 Innotek Systemberatung GmbH (sandervl@innotek.de)
    1013 *
    1114 * Project Odin Software License can be found in LICENSE.TXT
     
    2124#include <dcdata.h>
    2225#include <unicode.h>
     26#include "dibsect.h"
     27#include "ft2supp.h"
    2328#include "font.h"
    2429
     
    7782//#define INVERT_SETYINVERSION
    7883//******************************************************************************
    79 BOOL InternalTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut)
     84BOOL InternalTextOutAW(HDC hdc,int X,int Y,UINT fuOptions,
     85                       CONST RECT *lprc, LPCSTR lpszStringA, LPCWSTR lpszStringW,
     86                       INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut, BOOL fUnicode)
    8087{
    8188  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
     
    8592  LONG hits;
    8693
    87   if (!pHps || (cbCount < 0) || ((lpszString == NULL) && (cbCount != 0)))
     94  if (!pHps || (cbCount < 0) || (((lpszStringA == NULL && !fUnicode) || (lpszStringW == NULL && fUnicode)) && (cbCount != 0)))
    8895  {
    8996        dprintf(("InternalTextOutA: invalid parameter"));
     
    9299  }
    93100
     101  if(cbCount == -1) {
     102       if(fUnicode)
     103            cbCount = lstrlenW(lpszStringW);
     104       else cbCount = lstrlenA(lpszStringA);
     105  }
     106
    94107  if (cbCount > 512)
    95108  {
     
    98111        return FALSE;
    99112  }
    100   if (fuOptions & ~((UINT)(ETO_CLIPPED | ETO_OPAQUE)))
     113  if (fuOptions & ~((UINT)(ETO_CLIPPED | ETO_OPAQUE | ETO_GLYPH_INDEX)))
    101114  {
    102115        dprintf(("InternalTextOutA: invalid fuOptions"));
     
    150163  else
    151164  {
    152     if (fuOptions)
    153     {
    154         dprintf(("InternalTextOutA: ERROR_INVALID_HANDLE"));
    155         SetLastError(ERROR_INVALID_HANDLE);
     165    if (fuOptions & ~ETO_GLYPH_INDEX)
     166    {
     167        dprintf(("InternalTextOutA: ERROR_INVALID_PARAMETER"));
     168        SetLastError(ERROR_INVALID_PARAMETER);
    156169        return FALSE;
    157170    }
     171  }
     172
     173  if((lpszStringA || lpszStringW) && cbCount) {
     174      DIBSECTION_CHECK_IF_DIRTY(hdc);
    158175  }
    159176
     
    176193        SelectObject(hdc, oldbrush);
    177194        DeleteObject(hbrush);
     195
     196        DIBSECTION_MARK_INVALID(hdc);
     197
    178198        return TRUE;
    179199#endif
     
    244264#endif
    245265
    246   hits = OSLibGpiCharStringPosAt(pHps,&ptl,&pmRect,flOptions,cbCount,lpszString,lpDx);
     266  if(fUnicode)
     267       hits = FT2Module.Ft2CharStringPosAtW(pHps->hps,&ptl,&pmRect,flOptions,cbCount,lpszStringW,lpDx, fuOptions & ETO_GLYPH_INDEX);
     268  else hits = FT2Module.Ft2CharStringPosAtA(pHps->hps,&ptl,&pmRect,flOptions,cbCount,lpszStringA,lpDx, fuOptions & ETO_GLYPH_INDEX);
    247269
    248270  if (lprc && ((align & 0x18) == TA_BASELINE))
    249     OSLibGpiSetTextAlignment(pHps,pmHAlign,pmVAlign);
     271      OSLibGpiSetTextAlignment(pHps,pmHAlign,pmVAlign);
    250272
    251273  if(hits == GPIOS_ERROR) {
    252         dprintf(("InternalTextOutA: OSLibGpiCharStringPosAt returned GPIOS_ERROR"));
     274      dprintf(("InternalTextOutA: OSLibGpiCharStringPosAt returned GPIOS_ERROR"));
    253275#ifdef INVERT_SETYINVERSION
    254         GpiEnableYInversion(pHps->hps, oldyinv);
    255 #endif
    256         return FALSE;
     276      GpiEnableYInversion(pHps->hps, oldyinv);
     277#endif
     278      return FALSE;
    257279  }
    258280
    259281  if (getAlignUpdateCP(pHps))
    260282  {
    261     OSLibGpiQueryCurrentPosition(pHps,&ptl);
    262     ptl.y -= getWorldYDeltaFor1Pixel(pHps);
     283      OSLibGpiQueryCurrentPosition(pHps,&ptl);
     284      ptl.y -= getWorldYDeltaFor1Pixel(pHps);
    263285#ifndef INVERT
    264     ptl.y += vertAdjust;
    265 #endif
    266     OSLibGpiSetCurrentPosition(pHps,&ptl);
     286      ptl.y += vertAdjust;
     287#endif
     288      OSLibGpiSetCurrentPosition(pHps,&ptl);
    267289  }
    268290
     
    270292  GpiEnableYInversion(pHps->hps, oldyinv);
    271293#endif
     294
     295  DIBSECTION_MARK_INVALID(hdc);
     296
    272297  return TRUE;
    273298}
    274299//******************************************************************************
    275300//******************************************************************************
    276 BOOL InternalTextOutW(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCWSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut)
    277 {
    278   char *astring = NULL;
     301BOOL WIN32API ExtTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,UINT cbCount,CONST INT *lpDx)
     302{
    279303  BOOL  rc;
    280 
    281   if(cbCount == -1) {
    282      astring = UnicodeToAsciiString((LPWSTR)lpszString);
    283   }
    284   else
    285   if(cbCount >= 0) {
    286      int n = WideCharToMultiByte( CP_ACP, 0, lpszString, cbCount, 0, 0, NULL, NULL ) + 1;
    287 
    288      astring = (char *)HEAP_malloc( n );
    289      UnicodeToAsciiN((LPWSTR)lpszString, astring, n );
    290   }
    291 
    292   rc = InternalTextOutA(hdc,X,Y,fuOptions,lprc,(LPCSTR)astring, strlen( astring ),lpDx,IsExtTextOut);
    293   if(astring) {
    294       FreeAsciiString(astring);
    295   }
     304  SIZE  size;
     305  int   newy;
     306
     307  if(lprc)
     308  {
     309        dprintf(("GDI32: ExtTextOutA %x %.*s (%d,%d) %x %d %x rect (%d,%d)(%d,%d)", hdc, cbCount, lpszString, X, Y, fuOptions, cbCount, lpDx, lprc->left, lprc->top, lprc->right, lprc->bottom));
     310  }
     311  else  dprintf(("GDI32: ExtTextOutA %x %.*s (%d,%d) %x %d %x", hdc, cbCount, lpszString, X, Y, fuOptions, cbCount, lpDx));
     312
     313  rc = InternalTextOutAW(hdc, X, Y, fuOptions, lprc, lpszString, NULL, cbCount, lpDx, TRUE, FALSE);
    296314
    297315  return(rc);
     
    299317//******************************************************************************
    300318//******************************************************************************
    301 BOOL WIN32API ExtTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,UINT cbCount,CONST INT *lpDx)
    302 {
    303   LPSTR astring = NULL;
    304   LPCSTR aCstring = lpszString;
    305   BOOL  rc;
    306 
    307   /* no guarantee for zeroterminated text in lpszString, found in "PuTTY A Free Win32 Telnet SSH Client" */
    308   if (cbCount >= 0)
    309   {
    310      astring = (char *)malloc(cbCount+1);
    311      memcpy(astring, lpszString, cbCount);
    312      astring[cbCount] = '\0';
    313      aCstring = astring;
    314   }
    315   if(lprc)
    316   {
    317         dprintf(("GDI32: ExtTextOutA %x %s (%d,%d) %x %d %x rect (%d,%d)(%d,%d)", hdc, /*lpszString*/ aCstring, X, Y, fuOptions, cbCount, lpDx, lprc->left, lprc->top, lprc->right, lprc->bottom));
    318   }
    319   else  dprintf(("GDI32: ExtTextOutA %x %s (%d,%d) %x %d %x", hdc, /*lpszString*/ aCstring, X, Y, fuOptions, cbCount, lpDx));
    320 
    321   rc = InternalTextOutA(hdc, X, Y, fuOptions, lprc, aCstring, cbCount, lpDx, TRUE);
    322 
    323   if(astring)
    324       free(astring);
    325 
    326   return(rc);
    327 }
    328 //******************************************************************************
    329 //******************************************************************************
    330319BOOL WIN32API ExtTextOutW(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCWSTR lpszString,UINT cbCount,CONST int *lpDx)
    331320{
    332321  if(lprc) {
    333         dprintf(("GDI32: ExtTextOutW %x %ls (%d,%d) %x %d %x rect (%d,%d)(%d,%d)", hdc, lpszString, X, Y, fuOptions, cbCount, lpDx, lprc->left, lprc->top, lprc->right, lprc->bottom));
    334   }
    335   else  dprintf(("GDI32: ExtTextOutW %x %ls (%d,%d) %x %d %x", hdc, lpszString, X, Y, fuOptions, cbCount, lpDx));
    336   return InternalTextOutW(hdc, X, Y, fuOptions, lprc, lpszString, cbCount, lpDx, TRUE);
     322        dprintf(("GDI32: ExtTextOutW %x %.*ls (%d,%d) %x %d %x rect (%d,%d)(%d,%d)", hdc, cbCount, lpszString, X, Y, fuOptions, cbCount, lpDx, lprc->left, lprc->top, lprc->right, lprc->bottom));
     323  }
     324  else  dprintf(("GDI32: ExtTextOutW %x %.*ls (%d,%d) %x %d %x", hdc, cbCount, lpszString, X, Y, fuOptions, cbCount, lpDx));
     325
     326  return InternalTextOutAW(hdc, X, Y, fuOptions, lprc, NULL, lpszString, cbCount, lpDx, TRUE, TRUE);
    337327}
    338328//******************************************************************************
     
    341331{
    342332   dprintf(("GDI32: TextOutA %x (%d,%d) %d %.*s", hdc, nXStart, nYStart, cbString, cbString, lpszString));
    343    return InternalTextOutA(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE);
     333   return InternalTextOutAW(hdc,nXStart,nYStart,0,NULL,lpszString,NULL,cbString,NULL,FALSE, FALSE);
    344334}
    345335//******************************************************************************
     
    348338{
    349339   dprintf(("GDI32: TextOutW %x (%d,%d) %d %.*ls", hdc, nXStart, nYStart, cbString, cbString, lpszString));
    350    return InternalTextOutW(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE);
     340   return InternalTextOutAW(hdc,nXStart,nYStart,0,NULL, NULL, lpszString,cbString,NULL,FALSE, TRUE);
    351341}
    352342//******************************************************************************
     
    358348  for (INT x = 0;x < cStrings;x++)
    359349  {
    360     BOOL rc;
    361 
    362     rc = InternalTextOutA(hdc,pptxt[x].x,pptxt[x].y,pptxt[x].uiFlags,&pptxt[x].rcl,pptxt[x].lpstr,pptxt[x].n,pptxt[x].pdx,TRUE);
    363     if (!rc) return FALSE;
     350      BOOL rc;
     351
     352      rc = ExtTextOutA(hdc,pptxt[x].x,pptxt[x].y,pptxt[x].uiFlags,&pptxt[x].rcl,pptxt[x].lpstr, pptxt[x].n,pptxt[x].pdx);
     353      if (!rc) return FALSE;
    364354  }
    365355
     
    374364  for (INT x = 0;x < cStrings;x++)
    375365  {
    376     BOOL rc;
    377 
    378     rc = InternalTextOutW(hdc,pptxt[x].x,pptxt[x].y,pptxt[x].uiFlags,&pptxt[x].rcl,pptxt[x].lpstr,pptxt[x].n,pptxt[x].pdx,TRUE);
    379     if (!rc) return FALSE;
     366      BOOL rc;
     367
     368      rc = ExtTextOutW(hdc,pptxt[x].x,pptxt[x].y,pptxt[x].uiFlags,&pptxt[x].rcl, pptxt[x].lpstr,pptxt[x].n,pptxt[x].pdx);
     369      if (!rc) return FALSE;
    380370  }
    381371
     
    383373}
    384374//******************************************************************************
     375// Note: GetTextExtentPoint behaves differently under certain circumstances
     376//       compared to GetTextExtentPoint32 (due to bugs).
     377//       We are treating both as the same thing which is not entirely correct.
     378//
    385379//******************************************************************************
    386380BOOL WIN32API GetTextExtentPointA(HDC hdc, LPCTSTR lpsz, int cbString,
     
    428422   if(cbString == 0)
    429423   {
     424      dprintf(("!WARNING!: GDI32: GetTextExtentPointW invalid parameter!"));
    430425      SetLastError(ERROR_SUCCESS);
    431426      return TRUE;
    432427   }
     428
     429   if(pHps->isPrinter)
     430       ReallySetCharAttrs(pHps);
     431
    433432   if(cbString > 512)
    434433   {
     
    447446         lpSize->cx += newSize.cx;
    448447         lpSize->cy  = max(newSize.cy, lpSize->cy);
    449          lpString     += cbStringNew;
     448         lpString    += cbStringNew;
    450449         cbString -= cbStringNew;
    451450      }
     
    453452   }
    454453
    455    int   len;
    456    LPSTR astring;
    457 
    458    len = WideCharToMultiByte( CP_ACP, 0, lpString, cbString, 0, 0, NULL, NULL );
    459    astring = (char *)malloc( len + 1 );
    460    lstrcpynWtoA(astring, lpString, len + 1 );
    461 
    462    rc = OSLibGpiQueryTextBox(pHps, len, astring, TXTBOXOS_COUNT, pts);
    463    free(astring);
    464 
     454   rc = FT2Module.Ft2GetTextExtentW(pHps->hps, cbString, lpString, TXTBOXOS_COUNT, pts);
    465455   if(rc == FALSE)
    466456   {
     
    476466       LONG alArray[2];
    477467
    478        if (OSLibDevQueryCaps(pHps, OSLIB_CAPS_HORIZONTAL_RESOLUTION, 2, &alArray[0]))
    479          lpSize->cx = lpSize->cx * alArray[0] / alArray[1];
     468       if(OSLibDevQueryCaps(pHps, OSLIB_CAPS_HORIZONTAL_RESOLUTION, 2, &alArray[0]))
     469           lpSize->cx = lpSize->cx * alArray[0] / alArray[1];
    480470   }
    481471
     
    553543    for(index = 0; index < count; index++)
    554544    {
    555     if(!GetTextExtentPoint32W( hdc, str, 1, &tSize )) goto done;
     545        if(!GetTextExtentPoint32W( hdc, str, 1, &tSize )) goto done;
    556546        /* GetTextExtentPoint includes intercharacter spacing. */
    557547        /* FIXME - justification needs doing yet.  Remember that the base
    558548         * data will not be in logical coordinates.
    559549         */
    560     extent += tSize.cx;
    561     if( !lpnFit || extent <= maxExt )
     550        extent += tSize.cx;
     551        if( !lpnFit || extent <= maxExt )
    562552        /* It is allowed to be equal. */
    563553        {
    564         nFit++;
    565         if( alpDx ) alpDx[index] = extent;
     554            nFit++;
     555            if( alpDx ) alpDx[index] = extent;
    566556        }
    567     if( tSize.cy > size->cy ) size->cy = tSize.cy;
    568     str++;
     557        if( tSize.cy > size->cy ) size->cy = tSize.cy;
     558        str++;
    569559    }
    570560    size->cx = extent;
     
    579569//******************************************************************************
    580570//******************************************************************************
     571BOOL WIN32API GetCharWidth32A( HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
     572{
     573    BOOL ret = FALSE;
     574     
     575    for (int i = iFirstChar; i <= iLastChar; i++)
     576    {
     577        SIZE size;
     578        CHAR c = i;
     579       
     580        if (GetTextExtentPointA(hdc, &c, 1, &size))
     581        {
     582            pWidthArray[i-iFirstChar] = size.cx;
     583            // at least one character was processed
     584            ret = TRUE;
     585        }
     586        else
     587        {
     588            // default value for unprocessed characters
     589            pWidthArray[i-iFirstChar] = 0;
     590        }
     591       
     592        dprintf2(("Char 0x%x('%c') -> width %d", i, i<256? i: '.', pWidthArray[i-iFirstChar]));
     593    }
     594   
     595    return ret;
     596}
     597//******************************************************************************
     598//******************************************************************************
     599BOOL WIN32API GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
     600{
     601    BOOL ret = FALSE;
     602     
     603    for (int i = iFirstChar; i <= iLastChar; i++)
     604    {
     605        SIZE size;
     606        WCHAR wc = i;
     607       
     608        if (GetTextExtentPointW(hdc, &wc, 1, &size))
     609        {
     610            pWidthArray[i-iFirstChar] = size.cx;
     611            // at least one character was processed
     612            ret = TRUE;
     613        }
     614        else
     615        {
     616            // default value for unprocessed characters
     617            pWidthArray[i-iFirstChar] = 0;
     618        }
     619       
     620        dprintf2(("Char 0x%x('%c') -> width %d", i, i<256? i: '.', pWidthArray[i-iFirstChar]));
     621    }
     622   
     623    return ret;
     624}
     625//******************************************************************************
     626// GetStringWidthW
     627//
     628// Return the width of each character in the string
     629//
     630// Parameters:
     631//    HDC    hdc            - device context handle
     632//    LPWSTR lpszString     - unicod string pointer
     633//    UINT   cbString       - number of valid characters in string
     634//    PINT   pWidthArray    - array that receives the character width (must be
     635//                            large enough to contain cbString elements
     636//   
     637// Returns:
     638//    FALSE                 - failure
     639//    TRUE                  - success
     640//
     641//******************************************************************************
     642BOOL WIN32API GetStringWidthW(HDC hdc, LPWSTR lpszString, UINT cbString, PINT pWidthArray)
     643{
     644    return FT2Module.Ft2GetStringWidthW(hdc, lpszString, cbString, pWidthArray);
     645}
     646//******************************************************************************
     647//******************************************************************************
     648BOOL WIN32API GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
     649{
     650    dprintf(("ERROR: GDI32: GetCharWidthFloatA, not implemented\n"));
     651    DebugInt3();
     652    return(FALSE);
     653}
     654//******************************************************************************
     655//******************************************************************************
     656BOOL WIN32API GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
     657{
     658    dprintf(("ERROR: GDI32: GetCharWidthFloatW, not implemented\n"));
     659    DebugInt3();
     660    return(FALSE);
     661}
     662//******************************************************************************
     663//******************************************************************************
     664BOOL WIN32API GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar, LPABC abc)
     665{
     666    if(FT2Module.isEnabled() == FALSE)
     667    {//fallback method
     668        return O32_GetCharABCWidths(hdc, firstChar, lastChar, abc);
     669    }
     670
     671    INT i, wlen, count = (INT)(lastChar - firstChar + 1);
     672    LPSTR str;
     673    LPWSTR wstr;
     674    BOOL ret = TRUE;
     675
     676    if(count <= 0) {
     677        dprintf(("ERROR: Invalid parameter!!"));
     678        SetLastError(ERROR_INVALID_PARAMETER);
     679        return FALSE;
     680    }
     681
     682    str = (LPSTR)HeapAlloc(GetProcessHeap(), 0, count);
     683    for(i = 0; i < count; i++)
     684        str[i] = (BYTE)(firstChar + i);
     685
     686    wstr = FONT_mbtowc(hdc, str, count, &wlen, NULL);
     687
     688    for(i = 0; i < wlen; i++)
     689    {
     690        if(!GetCharABCWidthsW(hdc, wstr[i], wstr[i], abc))
     691        {
     692            ret = FALSE;
     693            break;
     694        }
     695        abc++;
     696    }
     697
     698    HeapFree(GetProcessHeap(), 0, str);
     699    HeapFree(GetProcessHeap(), 0, wstr);
     700
     701    return ret;
     702}
     703//******************************************************************************
     704//******************************************************************************
     705BOOL WIN32API GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar, LPABC abc)
     706{
     707    if(FT2Module.isEnabled() == FALSE)
     708    {//no fallback method (yet)
     709        DebugInt3();
     710        return FALSE;
     711    }
     712
     713    int i;
     714    GLYPHMETRICS gm;
     715
     716    for (i=firstChar;i<=lastChar;i++)
     717    {
     718        if(GetGlyphOutlineW(hdc, i, GGO_METRICS, &gm, 0, NULL, NULL) == GDI_ERROR)
     719        {
     720            dprintf(("ERROR: GetGlyphOutlineW failed!!"));
     721            return FALSE;
     722        }
     723        abc[i-firstChar].abcA = gm.gmptGlyphOrigin.x;
     724        abc[i-firstChar].abcB = gm.gmBlackBoxX;
     725        abc[i-firstChar].abcC = gm.gmCellIncX - gm.gmptGlyphOrigin.x - gm.gmBlackBoxX;
     726        dprintf2(("GetCharABCWidthsW %d (%d,%d,%d)", i, abc[i-firstChar].abcA, abc[i-firstChar].abcB, abc[i-firstChar].abcC));
     727    }
     728    return TRUE;
     729}
     730//******************************************************************************
     731//******************************************************************************
     732BOOL WIN32API GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT pxBUffer)
     733{
     734    dprintf(("ERROR: GDI32: GetCharABCWidthsFloatA, not implemented\n"));
     735    DebugInt3();
     736    return(FALSE);
     737}
     738//******************************************************************************
     739//******************************************************************************
     740BOOL WIN32API GetCharABCWidthsFloatW(HDC hdc,
     741                                     UINT iFirstChar,
     742                                     UINT iLastChar,
     743                                     LPABCFLOAT pxBUffer)
     744{
     745    dprintf(("ERROR: GDI32: GetCharABCWidthsFloatA, not implemented\n"));
     746    DebugInt3();
     747    return(FALSE);
     748}
     749//******************************************************************************
     750//******************************************************************************
  • trunk/src/gdi32/transform.cpp

    r9429 r10374  
    1 /* $Id: transform.cpp,v 1.8 2002-11-26 10:53:12 sandervl Exp $ */
     1/* $Id: transform.cpp,v 1.9 2004-01-11 11:42:23 sandervl Exp $ */
    22
    33/*
Note: See TracChangeset for help on using the changeset viewer.