Changeset 2592 for trunk/src


Ignore:
Timestamp:
Feb 1, 2000, 1:53:31 PM (26 years ago)
Author:
sandervl
Message:

cleaned up + dibsection fixes

Location:
trunk/src/gdi32
Files:
4 added
6 edited

Legend:

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

    r2581 r2592  
    1 /* $Id: dibsect.cpp,v 1.13 2000-01-31 22:30:07 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.14 2000-02-01 12:53:29 sandervl Exp $ */
    22
    33/*
     
    4343//******************************************************************************
    4444//******************************************************************************
    45 DIBSection::DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD handle, int fFlip)
     45DIBSection::DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD iUsage, DWORD handle, int fFlip)
    4646                : bmpBits(NULL), pOS2bmp(NULL), next(NULL)
    4747{
     
    9696   pOS2bmp->cBitCount     = pbmi->biBitCount;
    9797   pOS2bmp->ulCompression = pbmi->biCompression;
     98   //SvL: Ignore BI_BITFIELDS type (GpiDrawBits fails otherwise)
     99   if(pOS2bmp->ulCompression == 3) {
     100        pOS2bmp->ulCompression = 0;
     101   }
    98102   pOS2bmp->cbImage       = pbmi->biSizeImage;
    99103   dprintf(("handle                 %x", handle));
     
    104108   dprintf(("pOS2bmp->ulCompression %d\n", pOS2bmp->ulCompression));
    105109   dprintf(("pOS2bmp->cbImage       %d\n", pOS2bmp->cbImage));
    106    dprintf(("Bits at 0x%08X\n",bmpBits));
     110   dprintf(("Bits at %x, size %d",bmpBits, bmpsize*pbmi->biHeight));
    107111
    108112   this->handle = handle;
     113   this->iUsage = iUsage;
    109114
    110115   dibMutex.enter();
     
    312317    WinReleasePS(hps);
    313318  }
    314   if(rc == GPI_OK)
    315     return(TRUE);
    316 
     319  if(rc == GPI_OK) {
     320        return(TRUE);
     321  }
    317322  dprintf(("DIBSection::BitBlt %X (%d,%d) (%d,%d) to (%d,%d) (%d,%d) returned %d\n", hps, point[0].x, point[0].y, point[1].x, point[1].y, point[2].x, point[2].y, point[3].x, point[3].y, rc));
    318323  dprintf(("WinGetLastError returned %X\n", WinGetLastError(WinQueryAnchorBlock(hwndDest)) & 0xFFFF));
     
    325330  this->hdc  = hdc;
    326331  hwndParent = WinWindowFromDC(hdc);
    327   dprintf(("SelectDIBObject(0x%08X) hwndParent = 0x%08X\n",hdc, hwndParent));
     332  dprintf(("SelectDIBObject %x into %x hwndParent = %x", handle, hdc, hwndParent));
    328333}
    329334//******************************************************************************
     
    380385 LPWINBITMAP dsBm        = (LPWINBITMAP)lpBuffer;
    381386
     387  dprintf2(("GetDIBSection %x %d %x", handle, iSize, lpBuffer));
    382388  if(iSize == sizeof(DIBSECTION))
    383389  {
  • trunk/src/gdi32/dibsect.h

    r2267 r2592  
    1 /* $Id: dibsect.h,v 1.9 1999-12-30 11:21:30 sandervl Exp $ */
     1/* $Id: dibsect.h,v 1.10 2000-02-01 12:53:29 sandervl Exp $ */
    22
    33/*
     
    6363{
    6464public:
    65               DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD handle, int fFlip);
     65              DIBSection(WINBITMAPINFOHEADER *pbmi, DWORD iUsage, DWORD handle, int fFlip);
    6666             ~DIBSection();
    6767
     
    7070              char  GetBitCount();
    7171              void  UnSelectDIBObject()      { this->hdc = 0;   };
     72
     73              DWORD GetBitmapHandle()        { return handle; };
     74              DWORD GetRGBUsage()            { return iUsage; };
    7275
    7376              BOOL  BitBlt(HDC hdcDest, int nXdest, int nYDest,
     
    9295
    9396private:
    94           DWORD handle;
     97          DWORD handle, iUsage;
    9598          HWND  hwndParent;
    9699          HDC   hdc;
  • trunk/src/gdi32/gdi32.cpp

    r2581 r2592  
    1 /* $Id: gdi32.cpp,v 1.36 2000-01-31 22:30:08 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.37 2000-02-01 12:53:30 sandervl Exp $ */
    22
    33/*
     
    2121#include "oslibgpi.h"
    2222#include "oslibgdi.h"
    23 
    24 static ULONG QueryPaletteSize(BITMAPINFOHEADER *pBHdr)
    25 {
    26         ULONG cbPalette;
    27 
    28         switch (pBHdr->biBitCount)
    29         {
    30                 case 1:
    31                 case 4:
    32                 case 8:
    33                         cbPalette = (1 << pBHdr->biBitCount) * sizeof(RGBQUAD);
    34                         break;
    35 
    36                 case 16:
    37                 case 24:
    38                 case 32:
    39                         cbPalette = 0;
    40                         break;
    41 
    42                 default:
    43                         dprintf(("QueryPaletteSize: error pBHdr->biBitCount = %d", pBHdr->biBitCount));
    44                         cbPalette = -1;
    45         }
    46 
    47    return cbPalette;
    48 }
    49 
    50 static ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy)
    51 {
    52         ULONG alignment;
    53         ULONG factor;
    54         BOOL flag = TRUE;       //true: '*'     false: '/'
    55 
    56         cy = cy < 0 ? -cy : cy;
    57 
    58         switch(cBits)
    59         {
    60                 case 1:
    61                         factor = 8;
    62                         flag = FALSE;
    63                         break;
    64 
    65                 case 4:
    66                         factor = 2;
    67                         flag = FALSE;
    68                         break;
    69 
    70                 case 8:
    71                         factor = 1;
    72                         break;
    73 
    74                 case 16:
    75                         factor = 2;
    76                         break;
    77 
    78                 case 24:
    79                         factor = 3;
    80                         break;
    81 
    82                 case 32:
    83                         return cx*cy;
    84 
    85                 default:
    86                         return 0;
    87         }
    88 
    89         if (flag)
    90                 alignment = (cx = (cx*factor)) % 4;
    91         else
    92                 alignment = (cx = ((cx+factor-1)/factor)) % 4;
    93 
    94         if (alignment != 0)
    95                 cx += 4 - alignment;
    96 
    97         return cx*cy;
    98 }
    9923
    10024//******************************************************************************
     
    15579//******************************************************************************
    15680//******************************************************************************
    157 UINT WIN32API RealizePalette( HDC arg1)
    158 {
    159     dprintf(("GDI32: RealizePalette(0x%08X)\n",arg1));
    160     return O32_RealizePalette(arg1);
    161 }
    162 //******************************************************************************
    163 //******************************************************************************
    16481int WIN32API GetObjectA( HGDIOBJ hObject, int size, void *lpBuffer)
    16582{
     
    220137//******************************************************************************
    221138//******************************************************************************
    222 HPALETTE WIN32API CreatePalette( const LOGPALETTE * arg1)
    223 {
    224   HPALETTE rc;
    225     dprintf(("GDI32: CreatePalette\n"));
    226    for(int i=0; i<arg1->palNumEntries;i++)
    227    {
    228      dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) ));
    229    }
    230    rc = O32_CreatePalette(arg1);
    231    dprintf(("  returns 0x%08X\n",rc));
    232 
    233    return rc;
    234 }
    235 //******************************************************************************
    236 //******************************************************************************
    237139HBRUSH WIN32API CreatePatternBrush(HBITMAP arg1)
    238140{
     
    259161//******************************************************************************
    260162//******************************************************************************
    261 HRGN WIN32API CreatePolyPolygonRgn( const POINT * arg1, const INT * arg2, int arg3, int  arg4)
    262 {
    263     dprintf(("GDI32: CreatePolyPolygonRgn\n"));
    264     return O32_CreatePolyPolygonRgn(arg1, arg2, arg3, arg4);
    265 }
    266 //******************************************************************************
    267 //******************************************************************************
    268 HRGN WIN32API CreatePolygonRgn(const POINT * arg1, int arg2, int arg3)
    269 {
    270     dprintf(("GDI32: CreatePolygonRgn"));
    271     return O32_CreatePolygonRgn(arg1, arg2, arg3);
    272 }
    273 //******************************************************************************
    274 //******************************************************************************
    275163HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * arg1, UINT  arg2)
    276164{
    277165    dprintf(("GDI32: CreateDIBPatternBrushPt\n"));
    278166    return O32_CreateDIBPatternBrushPt(arg1, arg2);
    279 }
    280 //******************************************************************************
    281 //******************************************************************************
    282 HBITMAP WIN32API CreateDIBitmap(HDC arg1, const BITMAPINFOHEADER * arg2, DWORD arg3, const void * arg4, const BITMAPINFO * arg5, UINT  arg6)
    283 {
    284   int iHeight;
    285   HBITMAP rc;
    286     dprintf(("GDI32: CreateDIBitmap\n"));
    287 
    288     //TEMPORARY HACK TO PREVENT CRASH IN OPEN32 (WSeB GA)
    289 
    290     iHeight = arg2->biHeight;
    291     if(arg2->biHeight < 0)
    292     {
    293       ((BITMAPINFOHEADER *)arg2)->biHeight = -arg2->biHeight;
    294     }
    295 
    296     rc = O32_CreateDIBitmap(arg1, arg2, arg3, arg4, arg5, arg6);
    297 
    298     ((BITMAPINFOHEADER *)arg2)->biHeight = iHeight;
    299 
    300     return rc;
    301 }
    302 //******************************************************************************
    303 //******************************************************************************
    304 HBITMAP WIN32API CreateCompatibleBitmap( HDC arg1, int arg2, int  arg3)
    305 {
    306     dprintf(("GDI32: CreateCompatibleBitmap\n"));
    307     return O32_CreateCompatibleBitmap(arg1, arg2, arg3);
    308167}
    309168//******************************************************************************
     
    369228//******************************************************************************
    370229//******************************************************************************
    371 BOOL WIN32API StretchBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest,
    372                             int nWidthDest, int nHeightDest,
    373                             HDC hdcSrc, int nXOriginSrc, int nYOriginSrc,
    374                             int nWidthSrc, int nHeightSrc, DWORD dwRop)
    375 {
    376   dprintf(("GDI32: StretchBlt Dest: (%d, %d) size (%d, %d)\n",
    377            nXOriginDest, nYOriginDest, nWidthDest, nHeightDest));
    378   dprintf(("GDI32: StretchBlt Src : (%d, %d) size (%d, %d)\n",
    379            nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc));
    380   if(DIBSection::getSection() != NULL)
    381   {
    382     DIBSection *dsect = DIBSection::findHDC(hdcSrc);
    383     if(dsect)
    384     {
    385       dprintf((" Do stretched DIB Blt\n"));
    386       return(dsect->BitBlt( hdcDest,
    387                             nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
    388                             nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
    389                             dwRop));
    390     }
    391   }
    392   return O32_StretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop);
    393 }
    394 //******************************************************************************
    395 //******************************************************************************
    396230BOOL WIN32API StrokeAndFillPath( HDC arg1)
    397231{
     
    408242//******************************************************************************
    409243//******************************************************************************
    410 int WIN32API SetStretchBltMode( HDC arg1, int  arg2)
    411 {
    412   dprintf(("GDI32: SetStretchBltMode 0x%08X, 0x%08X\n",arg1, arg2));
    413 
    414   if(DIBSection::getSection() != NULL)
    415   {
    416     DIBSection *dsect = DIBSection::findHDC(arg1);
    417     if(dsect)
    418     {
    419       dprintf(("       - DC is DIBSection\n"));
    420     }
    421   }
    422   return O32_SetStretchBltMode(arg1, arg2);
    423 }
    424 //******************************************************************************
    425 //******************************************************************************
    426244HGDIOBJ WIN32API SelectObject(HDC hdc, HGDIOBJ hObj)
    427245{
    428246 HGDIOBJ rc;
    429247
    430 ////    dprintf(("GDI32: SelectObject\n"));
     248    dprintf2(("GDI32: SelectObject %x %x", hdc, hObj));
    431249
    432250    if(DIBSection::getSection() != NULL)
     
    459277//******************************************************************************
    460278//******************************************************************************
    461 HPALETTE WIN32API SelectPalette(HDC arg1, HPALETTE arg2, BOOL arg3)
    462 {
    463   dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X)\n", arg1, arg2, arg3));
    464   if(DIBSection::getSection() != NULL)
    465   {
    466     DIBSection *dsect = DIBSection::findHDC(arg1);
    467     if(dsect)
    468     {
    469       PALETTEENTRY Pal[256];
    470       char PalSize = dsect->GetBitCount();
    471       dprintf(("       - Set Palette Values in DIBSection\n"));
    472       if(PalSize<=8)
    473       {
    474         GetPaletteEntries( arg2, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
    475         dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);
    476       }
    477 
    478     }
    479   }
    480   return O32_SelectPalette(arg1, arg2, arg3);
    481 }
    482 //******************************************************************************
    483 //******************************************************************************
    484279int WIN32API SetBkMode( HDC arg1, int  arg2)
    485280{
     
    552347//******************************************************************************
    553348//******************************************************************************
    554 BOOL WIN32API AnimatePalette( HPALETTE arg1, UINT arg2, UINT arg3, const PALETTEENTRY * arg4)
    555 {
    556     dprintf(("GDI32: AnimatePalette"));
    557     return O32_AnimatePalette(arg1, arg2, arg3, arg4);
    558 }
    559 //******************************************************************************
    560 //******************************************************************************
    561349BOOL WIN32API Arc( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int  arg9)
    562350{
     
    580368//******************************************************************************
    581369//******************************************************************************
    582 BOOL WIN32API BitBlt(HDC hdcDest, int arg2, int arg3, int arg4, int arg5, HDC hdcSrc, int arg7, int arg8, DWORD  arg9)
    583 {
    584     if(DIBSection::getSection() != NULL) {
    585         DIBSection *dsect = DIBSection::findHDC(hdcSrc);
    586         if(dsect) {
    587                 return(dsect->BitBlt(hdcDest, arg2, arg3, arg4, arg5, arg7, arg8, arg4, arg5, arg9));
    588         }
    589     }
    590     dprintf(("GDI32: BitBlt to hdc %X from (%d,%d) to (%d,%d), (%d,%d) rop %X\n", hdcDest, arg7, arg8, arg2, arg3, arg4, arg5, arg9));
    591     return O32_BitBlt(hdcDest, arg2, arg3, arg4, arg5, hdcSrc, arg7, arg8, arg9);
    592 }
    593 //******************************************************************************
    594 //******************************************************************************
    595370BOOL WIN32API Chord( HDC arg1, int arg2, int arg3, int arg4, int arg5, int  arg6, int  arg7, int  arg8, int  arg9)
    596371{
     
    600375//******************************************************************************
    601376//******************************************************************************
    602 HENHMETAFILE WIN32API CloseEnhMetaFile( HDC arg1)
    603 {
    604     dprintf(("GDI32: CloseEnhMetaFile"));
    605     return O32_CloseEnhMetaFile(arg1);
    606 }
    607 //******************************************************************************
    608 //******************************************************************************
    609377BOOL WIN32API CloseFigure( HDC arg1)
    610378{
    611379    dprintf(("GDI32: CloseFigure"));
    612380    return O32_CloseFigure(arg1);
    613 }
    614 //******************************************************************************
    615 //******************************************************************************
    616 HMETAFILE WIN32API CloseMetaFile( HDC arg1)
    617 {
    618     dprintf(("GDI32: CloseMetaFile"));
    619     return O32_CloseMetaFile(arg1);
    620 }
    621 //******************************************************************************
    622 //******************************************************************************
    623 int WIN32API CombineRgn( HRGN arg1, HRGN  arg2, HRGN  arg3, int  arg4)
    624 {
    625     dprintf(("GDI32: CombineRgn"));
    626     return O32_CombineRgn(arg1, arg2, arg3, arg4);
    627 }
    628 //******************************************************************************
    629 //******************************************************************************
    630 HENHMETAFILE WIN32API CopyEnhMetaFileA( HENHMETAFILE arg1, LPCSTR  arg2)
    631 {
    632     dprintf(("GDI32: CopyEnhMetaFileA"));
    633     return O32_CopyEnhMetaFile(arg1, arg2);
    634 }
    635 //******************************************************************************
    636 //******************************************************************************
    637 HENHMETAFILE WIN32API CopyEnhMetaFileW( HENHMETAFILE arg1, LPCWSTR  arg2)
    638 {
    639  char        *astring = UnicodeToAsciiString((LPWSTR)arg2);
    640  HENHMETAFILE rc;
    641 
    642     dprintf(("GDI32: CopyEnhMetaFileW"));
    643     rc = O32_CopyEnhMetaFile(arg1, astring);
    644     FreeAsciiString(astring);
    645     return rc;
    646 }
    647 //******************************************************************************
    648 //******************************************************************************
    649 HMETAFILE WIN32API CopyMetaFileA( HMETAFILE arg1, LPCSTR  arg2)
    650 {
    651     dprintf(("GDI32: CopyMetaFileA"));
    652     return O32_CopyMetaFile(arg1, arg2);
    653 }
    654 //******************************************************************************
    655 //******************************************************************************
    656 HMETAFILE WIN32API CopyMetaFileW( HMETAFILE arg1, LPCWSTR  arg2)
    657 {
    658  char        *astring = UnicodeToAsciiString((LPWSTR)arg2);
    659  HMETAFILE rc;
    660 
    661     dprintf(("GDI32: CopyMetaFileW"));
    662     rc = O32_CopyMetaFile(arg1, astring);
    663     FreeAsciiString(astring);
    664     return rc;
    665 }
    666 //******************************************************************************
    667 //******************************************************************************
    668 HBITMAP WIN32API CreateBitmap(int nWidth, int nHeight, UINT cPlanes,
    669                                  UINT cBitsPerPel, const void *lpvBits)
    670 {
    671  HBITMAP rc;
    672 
    673     rc = O32_CreateBitmap(nWidth, nHeight, cPlanes, cBitsPerPel, lpvBits);
    674     dprintf(("GDI32: CreateBitmap (%d,%d) bps %d returned %d\n", nWidth, nHeight, cBitsPerPel, rc));
    675     return(rc);
    676 }
    677 //******************************************************************************
    678 //******************************************************************************
    679 HBITMAP WIN32API CreateBitmapIndirect( const BITMAP * arg1)
    680 {
    681     dprintf(("GDI32: CreateBitmapIndirect"));
    682     return O32_CreateBitmapIndirect(arg1);
    683381}
    684382//******************************************************************************
     
    774472//******************************************************************************
    775473//******************************************************************************
    776 HRGN WIN32API CreateEllipticRgn( int arg1, int arg2, int arg3, int  arg4)
    777 {
    778     dprintf(("GDI32: CreateEllipticRgn"));
    779     return O32_CreateEllipticRgn(arg1, arg2, arg3, arg4);
    780 }
    781 //******************************************************************************
    782 //******************************************************************************
    783 HRGN WIN32API CreateEllipticRgnIndirect( const RECT * arg1)
    784 {
    785     dprintf(("GDI32: CreateEllipticRgnIndirect"));
    786     return O32_CreateEllipticRgnIndirect(arg1);
    787 }
    788 //******************************************************************************
    789 //******************************************************************************
    790 HENHMETAFILE WIN32API CreateEnhMetaFileA( HDC arg1, LPCSTR arg2, const RECT * arg3, LPCSTR  arg4)
    791 {
    792     dprintf(("GDI32: CreateEnhMetaFileA"));
    793     return O32_CreateEnhMetaFile(arg1, arg2, arg3, arg4);
    794 }
    795 //******************************************************************************
    796 //******************************************************************************
    797 HENHMETAFILE WIN32API CreateEnhMetaFileW( HDC arg1, LPCWSTR arg2, const RECT * arg3, LPCWSTR  arg4)
    798 {
    799     char *astring1 = UnicodeToAsciiString((LPWSTR)arg2);
    800     char *astring2 = UnicodeToAsciiString((LPWSTR)arg4);
    801     HENHMETAFILE   rc;
    802 
    803     dprintf(("GDI32: CreateMetaFileW"));
    804     rc = O32_CreateEnhMetaFile(arg1,astring1,arg3,astring2);
    805     FreeAsciiString(astring1);
    806     FreeAsciiString(astring2);
    807     return rc;
    808 }
    809 //******************************************************************************
    810 //******************************************************************************
    811 //******************************************************************************
    812 //******************************************************************************
    813474HBRUSH WIN32API CreateHatchBrush( int arg1, COLORREF  arg2)
    814475{
     
    897558//******************************************************************************
    898559//******************************************************************************
    899 HDC WIN32API CreateMetaFileA( LPCSTR arg1)
    900 {
    901     dprintf(("GDI32: CreateMetaFileA"));
    902     return O32_CreateMetaFile(arg1);
    903 }
    904 //******************************************************************************
    905 //******************************************************************************
    906 HDC WIN32API CreateMetaFileW( LPCWSTR arg1)
    907 {
    908  char *astring = UnicodeToAsciiString((LPWSTR)arg1);
    909  HDC   rc;
    910 
    911     dprintf(("GDI32: CreateMetaFileW"));
    912     rc = O32_CreateMetaFile(astring);
    913     FreeAsciiString(astring);
    914     return rc;
    915 }
    916 //******************************************************************************
    917 //******************************************************************************
    918 HRGN WIN32API CreateRectRgn( int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
    919 {
    920     dprintf(("GDI32: CreateRectRgn (%d,%d)(%d,%d)", nLeftRect, nTopRect, nRightRect, nBottomRect));
    921     return O32_CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect);
    922 }
    923 //******************************************************************************
    924 //******************************************************************************
    925 HRGN WIN32API CreateRectRgnIndirect( const RECT * lpRect)
    926 {
    927     if(lpRect == NULL) {
    928         SetLastError(ERROR_INVALID_PARAMETER);
    929         return 0;
    930     }
    931     dprintf(("GDI32: CreateRectRgnIndirect (%d,%d)(%d,%d)", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
    932     return O32_CreateRectRgnIndirect(lpRect);
    933 }
    934 //******************************************************************************
    935 //******************************************************************************
    936 HRGN WIN32API CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect,
    937                                  int nWidthEllipse, int nHeightEllipse)
    938 {
    939     dprintf(("GDI32: CreateRoundRectRgn (%d,%d)(%d,%d) (%d,%d)", nLeftRect, nTopRect, nRightRect, nBottomRect, nWidthEllipse, nHeightEllipse));
    940     return O32_CreateRoundRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, nWidthEllipse, nHeightEllipse);
    941 }
    942 //******************************************************************************
    943 //******************************************************************************
    944560HBRUSH WIN32API CreateSolidBrush( COLORREF arg1)
    945561{
     
    956572//******************************************************************************
    957573//******************************************************************************
    958 BOOL WIN32API DeleteEnhMetaFile( HENHMETAFILE arg1)
    959 {
    960     dprintf(("GDI32: DeleteEnhMetaFile\n"));
    961     return O32_DeleteEnhMetaFile(arg1);
    962 }
    963 //******************************************************************************
    964 //******************************************************************************
    965 BOOL WIN32API DeleteMetaFile( HMETAFILE arg1)
    966 {
    967     dprintf(("GDI32: DeleteMetaFile"));
    968     return O32_DeleteMetaFile(arg1);
    969 }
    970 //******************************************************************************
    971 //******************************************************************************
    972574BOOL WIN32API Ellipse( HDC arg1, int arg2, int arg3, int arg4, int  arg5)
    973575{
     
    998600//******************************************************************************
    999601//******************************************************************************
    1000 BOOL WIN32API EnumEnhMetaFile( HDC arg1, HENHMETAFILE arg2, ENHMFENUMPROC arg3, PVOID arg4, const RECT *  arg5)
    1001 {
    1002     dprintf(("GDI32: EnumEnhMetaFile DOESN'T WORK!"));
    1003 //    return O32_EnumEnhMetaFile(arg1, arg2, arg3, arg4, arg5);
    1004     return 0;
    1005 }
    1006 //******************************************************************************
    1007 //******************************************************************************
    1008 BOOL WIN32API PatBlt(HDC hdc,int nXLeft,int nYLeft,int nWidth,int nHeight,DWORD dwRop)
    1009 {
    1010   BOOL rc;
    1011 
    1012   //CB: Open32 bug: negative width/height not supported!
    1013   if (nWidth < 0)
    1014   {
    1015     nXLeft += nWidth+1;
    1016     nWidth = -nWidth;
    1017   }
    1018   if (nHeight < 0)
    1019   {
    1020     nYLeft += nHeight+1;
    1021     nHeight = -nHeight;
    1022   }
    1023   rc = O32_PatBlt(hdc,nXLeft,nYLeft,nWidth,nHeight,dwRop);
    1024   dprintf(("GDI32: PatBlt (%d,%d) (%d,%d) returned %d\n",nXLeft,nYLeft,nWidth,nHeight,rc));
    1025   return(rc);
    1026 }
    1027 //******************************************************************************
    1028 //******************************************************************************
    1029602BOOL WIN32API Rectangle( HDC arg1, int arg2, int arg3, int arg4, int  arg5)
    1030603{
     
    1038611    dprintf(("GDI32: SetROP2 %x %x", hdc, rop2));
    1039612    return O32_SetROP2(hdc, rop2);
    1040 }
    1041 //******************************************************************************
    1042 //TODO: Callback
    1043 //******************************************************************************
    1044 BOOL WIN32API EnumMetaFile( HDC arg1, HMETAFILE arg2, MFENUMPROC arg3, LPARAM  arg4)
    1045 {
    1046     dprintf(("GDI32: EnumMetaFile STUB"));
    1047     //calling convention differences
    1048 //    return O32_EnumMetaFile(arg1, arg2, arg3, arg4);
    1049     return 0;
    1050613}
    1051614//******************************************************************************
     
    1060623//******************************************************************************
    1061624//******************************************************************************
    1062 BOOL WIN32API EqualRgn( HRGN arg1, HRGN  arg2)
    1063 {
    1064     dprintf(("GDI32: EqualRgn"));
    1065     return O32_EqualRgn(arg1, arg2);
    1066 }
    1067 //******************************************************************************
    1068 //******************************************************************************
    1069625int WIN32API Escape( HDC arg1, int arg2, int arg3, LPCSTR arg4, PVOID  arg5)
    1070626{
     
    1088644//******************************************************************************
    1089645//******************************************************************************
    1090 HRGN WIN32API ExtCreateRegion( const XFORM * arg1, DWORD arg2, const RGNDATA *  arg3)
    1091 {
    1092     dprintf(("GDI32: ExtCreateRegion"));
    1093     return O32_ExtCreateRegion(arg1, arg2, arg3);
    1094 }
    1095 //******************************************************************************
    1096 //******************************************************************************
    1097646BOOL WIN32API ExtFloodFill( HDC arg1, int arg2, int arg3, COLORREF arg4, UINT  arg5)
    1098647{
     
    1102651//******************************************************************************
    1103652//******************************************************************************
    1104 int WIN32API ExtSelectClipRgn( HDC arg1, HRGN arg2, int  arg3)
    1105 {
    1106     dprintf(("GDI32: ExtSelectClipRgn"));
    1107     return O32_ExtSelectClipRgn(arg1, arg2, arg3);
    1108 }
    1109 //******************************************************************************
    1110 //******************************************************************************
    1111653BOOL WIN32API FillPath( HDC arg1)
    1112654{
     
    1116658//******************************************************************************
    1117659//******************************************************************************
    1118 BOOL WIN32API FillRgn( HDC arg1, HRGN arg2, HBRUSH  arg3)
    1119 {
    1120     dprintf(("GDI32: FillRgn"));
    1121     return O32_FillRgn(arg1, arg2, arg3);
    1122 }
    1123 //******************************************************************************
    1124 //******************************************************************************
    1125660BOOL WIN32API FlattenPath( HDC arg1)
    1126661{
     
    1137672//******************************************************************************
    1138673//******************************************************************************
    1139 BOOL WIN32API FrameRgn( HDC arg1, HRGN arg2, HBRUSH arg3, int arg4, int  arg5)
    1140 {
    1141     dprintf(("GDI32: FrameRgn"));
    1142     return O32_FrameRgn(arg1, arg2, arg3, arg4, arg5);
    1143 }
    1144 //******************************************************************************
    1145 //******************************************************************************
    1146674int WIN32API GetArcDirection( HDC arg1)
    1147675{
     
    1155683    dprintf(("GDI32: GetAspectRatioFilterEx"));
    1156684    return O32_GetAspectRatioFilterEx(arg1, arg2);
    1157 }
    1158 //******************************************************************************
    1159 //******************************************************************************
    1160 LONG WIN32API GetBitmapBits( HBITMAP arg1, LONG arg2, PVOID  arg3)
    1161 {
    1162     dprintf(("GDI32: GetBitmapBits"));
    1163     return O32_GetBitmapBits(arg1, arg2, arg3);
    1164 }
    1165 //******************************************************************************
    1166 //******************************************************************************
    1167 BOOL WIN32API GetBitmapDimensionEx( HBITMAP arg1, PSIZE  arg2)
    1168 {
    1169     dprintf(("GDI32: GetBitmapDimensionEx"));
    1170     return O32_GetBitmapDimensionEx(arg1, arg2);
    1171685}
    1172686//******************************************************************************
     
    1240754//******************************************************************************
    1241755//******************************************************************************
    1242 int WIN32API GetClipRgn( HDC arg1, HRGN  arg2)
    1243 {
    1244     dprintf(("GDI32: GetClipRgn"));
    1245     return O32_GetClipRgn(arg1, arg2);
    1246 }
    1247 //******************************************************************************
    1248 //******************************************************************************
    1249756HANDLE WIN32API GetCurrentObject( HDC hdc, UINT arg2)
    1250757{
     
    1258765    dprintf(("GDI32: GetCurrentPositionEx"));
    1259766    return O32_GetCurrentPositionEx(arg1, arg2);
    1260 }
    1261 //******************************************************************************
    1262 //******************************************************************************
    1263 int WIN32API GetDIBits(HDC hdc, HBITMAP hBitmap, UINT uStartScan, UINT cScanLines,
    1264                        void *lpvBits, PBITMAPINFO lpbi, UINT uUsage)
    1265 {
    1266 #if 1
    1267     dprintf(("GDI32: GetDIBits"));
    1268     return O32_GetDIBits(hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage);
    1269 #else
    1270  int rc;
    1271 
    1272     rc = O32_GetDIBits(hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage);
    1273     dprintf(("GDI32: GetDIBits %x %x %d %d %x %x %d returned %d", hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage, rc));
    1274     //SvL: Wrong Open32 return value
    1275     return (rc == TRUE) ? cScanLines : 0;
    1276 #endif
    1277767}
    1278768//******************************************************************************
     
    1291781//******************************************************************************
    1292782//******************************************************************************
    1293 HENHMETAFILE WIN32API GetEnhMetaFileA( LPCSTR arg1)
    1294 {
    1295     dprintf(("GDI32: GetEnhMetaFileA"));
    1296     return O32_GetEnhMetaFile(arg1);
    1297 }
    1298 //******************************************************************************
    1299 //******************************************************************************
    1300 UINT WIN32API GetEnhMetaFileBits( HENHMETAFILE arg1, UINT arg2, PBYTE  arg3)
    1301 {
    1302     dprintf(("GDI32: GetEnhMetaFileBits"));
    1303     return O32_GetEnhMetaFileBits(arg1, arg2, arg3);
    1304 }
    1305 //******************************************************************************
    1306 //******************************************************************************
    1307 UINT WIN32API GetEnhMetaFileHeader( HENHMETAFILE arg1, UINT arg2, LPENHMETAHEADER  arg3)
    1308 {
    1309     dprintf(("GDI32: GetEnhMetaFileHeader"));
    1310     return O32_GetEnhMetaFileHeader(arg1, arg2, arg3);
    1311 }
    1312 //******************************************************************************
    1313 //******************************************************************************
    1314 UINT WIN32API GetEnhMetaFilePaletteEntries( HENHMETAFILE arg1, UINT arg2, PPALETTEENTRY  arg3)
    1315 {
    1316     dprintf(("GDI32: GetEnhMetaFilePaletteEntries"));
    1317     return O32_GetEnhMetaFilePaletteEntries(arg1, arg2, arg3);
    1318 }
    1319 //******************************************************************************
    1320 //******************************************************************************
    1321 HENHMETAFILE WIN32API GetEnhMetaFileW( LPCWSTR arg1)
    1322 {
    1323  char *astring = UnicodeToAsciiString((LPWSTR)arg1);
    1324  HENHMETAFILE rc;
    1325 
    1326     dprintf(("GDI32: GetEnhMetaFileW"));
    1327     // NOTE: This will not work as is (needs UNICODE support)
    1328     rc = O32_GetEnhMetaFile(astring);
    1329     FreeAsciiString(astring);
    1330     return rc;
    1331 }
    1332 //******************************************************************************
    1333 //******************************************************************************
    1334783int WIN32API GetGraphicsMode(HDC arg1)
    1335784{
     
    1361810//******************************************************************************
    1362811//******************************************************************************
    1363 HMETAFILE WIN32API GetMetaFileA( LPCSTR arg1)
    1364 {
    1365     dprintf(("GDI32: GetMetaFileA"));
    1366     return O32_GetMetaFile(arg1);
    1367 }
    1368 //******************************************************************************
    1369 //******************************************************************************
    1370 UINT WIN32API GetMetaFileBitsEx( HMETAFILE arg1, UINT arg2, LPVOID  arg3)
    1371 {
    1372     dprintf(("GDI32: GetMetaFileBitsEx"));
    1373     return O32_GetMetaFileBitsEx(arg1, arg2, arg3);
    1374 }
    1375 //******************************************************************************
    1376 //******************************************************************************
    1377 HMETAFILE WIN32API GetMetaFileW( LPCWSTR arg1)
    1378 {
    1379  char *astring = UnicodeToAsciiString((LPWSTR)arg1);
    1380  HENHMETAFILE rc;
    1381 
    1382     dprintf(("GDI32: GetMetaFileW"));
    1383     rc = O32_GetMetaFile(astring);
    1384     FreeAsciiString(astring);
    1385     return rc;
    1386 
    1387 }
    1388 //******************************************************************************
    1389 //******************************************************************************
    1390812BOOL WIN32API GetMiterLimit( HDC arg1, float * arg2)
    1391813{
     
    1399821    dprintf(("GDI32: GetNearestColor\n"));
    1400822    return O32_GetNearestColor(arg1, arg2);
    1401 }
    1402 //******************************************************************************
    1403 //******************************************************************************
    1404 UINT WIN32API GetNearestPaletteIndex( HPALETTE arg1, COLORREF  arg2)
    1405 {
    1406     UINT rc;
    1407     dprintf(("GDI32: GetNearestPaletteIndex (0x%08X ,0x%08X) ",arg1,arg2));
    1408     rc = O32_GetNearestPaletteIndex(arg1, arg2);
    1409     dprintf(("Returns %d\n",rc));
    1410     return rc;
    1411823}
    1412824//******************************************************************************
     
    1428840//******************************************************************************
    1429841//******************************************************************************
    1430 UINT WIN32API GetPaletteEntries( HPALETTE arg1, UINT arg2, UINT arg3, PPALETTEENTRY  arg4)
    1431 {
    1432     dprintf(("GDI32: GetPaletteEntries"));
    1433     return O32_GetPaletteEntries(arg1, arg2, arg3, arg4);
    1434 }
    1435 //******************************************************************************
    1436 //******************************************************************************
    1437842INT WIN32API GetPath( HDC arg1, PPOINT arg2, PBYTE arg3, int  arg4)
    1438843{
     
    1460865    dprintf(("GDI32: GetRasterizerCaps"));
    1461866    return O32_GetRasterizerCaps(arg1, arg2);
    1462 }
    1463 //******************************************************************************
    1464 //******************************************************************************
    1465 DWORD WIN32API GetRegionData( HRGN arg1, DWORD arg2, PRGNDATA  arg3)
    1466 {
    1467     dprintf(("GDI32: GetRegionData"));
    1468     return O32_GetRegionData(arg1, arg2, arg3);
    1469 }
    1470 //******************************************************************************
    1471 //******************************************************************************
    1472 int WIN32API GetRgnBox( HRGN arg1, PRECT  arg2)
    1473 {
    1474     dprintf(("GDI32: GetRgnBox"));
    1475     return O32_GetRgnBox(arg1, arg2);
    1476 }
    1477 //******************************************************************************
    1478 //******************************************************************************
    1479 int WIN32API GetStretchBltMode( HDC arg1)
    1480 {
    1481     dprintf(("GDI32: GetStretchBltMode"));
    1482     return O32_GetStretchBltMode(arg1);
    1483 }
    1484 //******************************************************************************
    1485 //******************************************************************************
    1486 UINT WIN32API GetSystemPaletteEntries( HDC arg1, UINT arg2, UINT arg3, PPALETTEENTRY  arg4)
    1487 {
    1488  UINT rc;
    1489 
    1490     dprintf(("GDI32: GetSystemPaletteEntries start %d nr %d pal ptr %X", arg2, arg3, arg4));
    1491     rc = O32_GetSystemPaletteEntries(arg1, arg2, arg3, arg4);
    1492     dprintf((" GetSystemPaletteEntries returned %d", rc));
    1493     return(rc);
    1494867}
    1495868//******************************************************************************
     
    16371010//******************************************************************************
    16381011//******************************************************************************
    1639 UINT WIN32API GetWinMetaFileBits( HENHMETAFILE arg1, UINT arg2, PBYTE arg3, int arg4, HDC arg5)
    1640 {
    1641     dprintf(("GDI32: GetWinMetaFileBits"));
    1642     return O32_GetWinMetaFileBits(arg1, arg2, arg3, arg4, arg5);
    1643 }
    1644 //******************************************************************************
    1645 //******************************************************************************
    16461012BOOL WIN32API GetWindowOrgEx( HDC arg1, PPOINT  arg2)
    16471013{
     
    16681034//******************************************************************************
    16691035//******************************************************************************
    1670 BOOL WIN32API InvertRgn( HDC arg1, HRGN  arg2)
    1671 {
    1672     dprintf(("GDI32: InvertRgn"));
    1673     return O32_InvertRgn(arg1, arg2);
    1674 }
    1675 //******************************************************************************
    1676 //******************************************************************************
    16771036BOOL WIN32API LPtoDP( HDC arg1, PPOINT arg2, int  arg3)
    16781037{
     
    16821041//******************************************************************************
    16831042//******************************************************************************
    1684 BOOL WIN32API MaskBlt( HDC arg1, int arg2, int arg3, int arg4, int arg5, HDC   arg6, int arg7, int arg8, HBITMAP arg9, int arg10, int arg11, DWORD  arg12)
    1685 {
    1686     dprintf(("GDI32: MaskBlt"));
    1687     return O32_MaskBlt(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
    1688 }
    1689 //******************************************************************************
    1690 //******************************************************************************
    16911043BOOL WIN32API ModifyWorldTransform( HDC arg1, const XFORM *arg2, DWORD  arg3)
    16921044{
     
    16961048//******************************************************************************
    16971049//******************************************************************************
    1698 int WIN32API OffsetClipRgn( HDC arg1, int arg2, int  arg3)
    1699 {
    1700     dprintf(("GDI32: OffsetClipRgn"));
    1701     return O32_OffsetClipRgn(arg1, arg2, arg3);
    1702 }
    1703 //******************************************************************************
    1704 //******************************************************************************
    1705 int WIN32API OffsetRgn( HRGN arg1, int arg2, int  arg3)
    1706 {
    1707     dprintf(("GDI32: OffsetRgn"));
    1708     return O32_OffsetRgn(arg1, arg2, arg3);
    1709 }
    1710 //******************************************************************************
    1711 //******************************************************************************
    17121050BOOL WIN32API OffsetViewportOrgEx( HDC arg1, int arg2, int arg3, PPOINT  arg4)
    17131051{
     
    17211059    dprintf(("GDI32: OffsetWindowOrgEx"));
    17221060    return O32_OffsetWindowOrgEx(arg1, arg2, arg3, arg4);
    1723 }
    1724 //******************************************************************************
    1725 //******************************************************************************
    1726 BOOL WIN32API PaintRgn( HDC arg1, HRGN  arg2)
    1727 {
    1728     dprintf(("GDI32: PaintRgn"));
    1729     return O32_PaintRgn(arg1, arg2);
    1730 }
    1731 //******************************************************************************
    1732 //******************************************************************************
    1733 HRGN WIN32API PathToRegion( HDC arg1)
    1734 {
    1735     dprintf(("GDI32: PathToRegion"));
    1736     return O32_PathToRegion(arg1);
    17371061}
    17381062//******************************************************************************
     
    17511075//******************************************************************************
    17521076//******************************************************************************
    1753 BOOL WIN32API PlayEnhMetaFile( HDC arg1, HENHMETAFILE arg2, const RECT *  arg3)
    1754 {
    1755     dprintf(("GDI32: PlayEnhMetaFile"));
    1756     return O32_PlayEnhMetaFile(arg1, arg2, arg3);
    1757 }
    1758 //******************************************************************************
    1759 //******************************************************************************
    1760 BOOL WIN32API PlayMetaFile( HDC arg1, HMETAFILE  arg2)
    1761 {
    1762     dprintf(("GDI32: PlayMetaFile"));
    1763     return O32_PlayMetaFile(arg1, arg2);
    1764 }
    1765 //******************************************************************************
    1766 //******************************************************************************
    1767 BOOL WIN32API PlayMetaFileRecord( HDC arg1, LPHANDLETABLE arg2, LPMETARECORD arg3, UINT  arg4)
    1768 {
    1769     dprintf(("GDI32: PlayMetaFileRecord"));
    1770     return O32_PlayMetaFileRecord(arg1, arg2, arg3, (int)arg4);
    1771 }
    1772 //******************************************************************************
    1773 //******************************************************************************
    17741077BOOL WIN32API PolyBezier( HDC arg1, const POINT * arg2, DWORD  arg3)
    17751078{
     
    18151118//******************************************************************************
    18161119//******************************************************************************
    1817 BOOL WIN32API PtInRegion( HRGN arg1, int arg2, int  arg3)
    1818 {
    1819     dprintf(("GDI32: PtInRegion"));
    1820     return O32_PtInRegion(arg1, arg2, arg3);
    1821 }
    1822 //******************************************************************************
    1823 //******************************************************************************
    18241120BOOL WIN32API PtVisible( HDC arg1, int arg2, int  arg3)
    18251121{
    18261122    dprintf(("GDI32: PtVisible"));
    18271123    return O32_PtVisible(arg1, arg2, arg3);
    1828 }
    1829 //******************************************************************************
    1830 //******************************************************************************
    1831 BOOL WIN32API RectInRegion( HRGN arg1, const RECT *  arg2)
    1832 {
    1833     dprintf(("GDI32: RectInRegion"));
    1834     return O32_RectInRegion(arg1, arg2);
    18351124}
    18361125//******************************************************************************
     
    18581147//******************************************************************************
    18591148//******************************************************************************
    1860 BOOL WIN32API ResizePalette( HPALETTE arg1, UINT  arg2)
    1861 {
    1862     dprintf(("GDI32: ResizePalette\n"));
    1863     return O32_ResizePalette(arg1, arg2);
    1864 }
    1865 //******************************************************************************
    1866 //******************************************************************************
    18671149BOOL WIN32API RestoreDC( HDC arg1, int  arg2)
    18681150{
     
    19001182//******************************************************************************
    19011183//******************************************************************************
    1902 int WIN32API SelectClipRgn( HDC hdc, HRGN hRgn)
    1903 {
    1904     dprintf(("GDI32: SelectClipRgn %x %x", hdc, hRgn));
    1905     return O32_SelectClipRgn(hdc, hRgn);
    1906 }
    1907 //******************************************************************************
    1908 //******************************************************************************
    19091184int WIN32API SetArcDirection( HDC arg1, int  arg2)
    19101185{
    19111186    dprintf(("GDI32: SetArcDirection"));
    19121187    return O32_SetArcDirection(arg1, arg2);
    1913 }
    1914 //******************************************************************************
    1915 //******************************************************************************
    1916 LONG WIN32API SetBitmapBits( HBITMAP arg1, LONG arg2, const VOID *  arg3)
    1917 {
    1918     dprintf(("GDI32: SetBitmapBits"));
    1919     return O32_SetBitmapBits(arg1, (DWORD)arg2, arg3);
    1920 }
    1921 //******************************************************************************
    1922 //******************************************************************************
    1923 BOOL WIN32API SetBitmapDimensionEx( HBITMAP arg1, int arg2, int arg3, PSIZE  arg4)
    1924 {
    1925     dprintf(("GDI32: SetBitmapDimensionEx"));
    1926     return O32_SetBitmapDimensionEx(arg1, arg2, arg3, arg4);
    19271188}
    19281189//******************************************************************************
     
    19451206//******************************************************************************
    19461207//******************************************************************************
    1947 int WIN32API SetDIBits( HDC arg1, HBITMAP arg2, UINT arg3, UINT arg4, const VOID * arg5, const BITMAPINFO * arg6, UINT  arg7)
    1948 {
    1949     dprintf(("GDI32: SetDIBits %x %x %x %x %x %x %x\n", arg1, arg2, arg3, arg4, arg5, arg6, arg7));
    1950 
    1951     if(DIBSection::getSection() != NULL) {
    1952         DIBSection *dsect;
    1953 
    1954         dsect = DIBSection::find((DWORD)arg2);
    1955         if(dsect) {
    1956            return dsect->SetDIBits(arg1, arg2, arg3, arg4, arg5, (WINBITMAPINFOHEADER *)&arg6->bmiHeader, arg7);
    1957         }
    1958     }
    1959     return O32_SetDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
    1960 }
    1961 //******************************************************************************
    1962 //******************************************************************************
    1963 INT WIN32API SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
    1964                                DWORD cy, INT xSrc, INT ySrc,
    1965                                UINT startscan, UINT lines, LPCVOID bits,
    1966                                const BITMAPINFO *info, UINT coloruse)
    1967 {
    1968     INT result, imgsize, palsize, height, width;
    1969     char *ptr;
    1970 
    1971     SetLastError(0);
    1972     if(info == NULL) {
    1973         goto invalid_parameter;
    1974     }
    1975     height = info->bmiHeader.biHeight;
    1976     width  = info->bmiHeader.biWidth;
    1977 
    1978     if (height < 0) height = -height;
    1979     if (!lines || (startscan >= height)) {
    1980         goto invalid_parameter;
    1981     }
    1982     if (startscan + lines > height) lines = height - startscan;
    1983 
    1984     if (ySrc < startscan) ySrc = startscan;
    1985     else if (ySrc >= startscan + lines) goto invalid_parameter;
    1986 
    1987     if (xSrc >= width) goto invalid_parameter;
    1988 
    1989     if (ySrc + cy >= startscan + lines) cy = startscan + lines - ySrc;
    1990 
    1991     if (xSrc + cx >= width) cx = width - xSrc;
    1992 
    1993     if (!cx || !cy) goto invalid_parameter;
    1994 
    1995     // EB: ->>> Crazy. Nobody seen this Open32 bug ?
    1996     // Dont't like dirty pointers, but Open32 needs a bit help.
    1997     // Only tested with winmine.
    1998     palsize = QueryPaletteSize((BITMAPINFOHEADER*)&info->bmiHeader);
    1999     imgsize = CalcBitmapSize(info->bmiHeader.biBitCount,
    2000                              info->bmiHeader.biWidth, info->bmiHeader.biHeight);
    2001     ptr = ((char *)info) + palsize + sizeof(BITMAPINFOHEADER);
    2002     if(bits >= ptr && bits < ptr + imgsize)
    2003     {
    2004         bits = (char *)bits - imgsize +
    2005                    CalcBitmapSize(info->bmiHeader.biBitCount,
    2006                                   info->bmiHeader.biWidth, lines);
    2007     }
    2008     // EB: <<<-
    2009 
    2010 //    if(xDest == 0 && yDest == 0 && xSrc == 0 && ySrc == 0 && cx == width && cy == height) {
    2011 //      result = OSLibSetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (WINBITMAPINFOHEADER*)info, coloruse);
    2012 //      result = lines;
    2013 //    }
    2014 //    else {
    2015         result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse);
    2016         //SvL: Wrong Open32 return value
    2017         result = (result == TRUE) ? lines : 0;
    2018 //    }
    2019 
    2020     dprintf(("GDI32: SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d, bits:%X, info%X, coloruse:%d returned %d",
    2021                  hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (LPVOID) bits, (PBITMAPINFO)info, coloruse, result));
    2022     return result;
    2023 
    2024 invalid_parameter:
    2025     SetLastError(ERROR_INVALID_PARAMETER);
    2026     return 0;
    2027 }
    2028 //******************************************************************************
    2029 //******************************************************************************
    2030 HENHMETAFILE WIN32API SetEnhMetaFileBits( UINT arg1, const BYTE *  arg2)
    2031 {
    2032     dprintf(("GDI32: SetEnhMetaFileBits"));
    2033     return O32_SetEnhMetaFileBits(arg1, arg2);
    2034 }
    2035 //******************************************************************************
    2036 //******************************************************************************
    20371208int WIN32API SetGraphicsMode(HDC arg1, int  arg2)
    20381209{
     
    20561227//******************************************************************************
    20571228//******************************************************************************
    2058 HMETAFILE WIN32API SetMetaFileBitsEx( UINT arg1, const BYTE * arg2)
    2059 {
    2060     dprintf(("GDI32: SetMetaFileBitsEx"));
    2061     return O32_SetMetaFileBitsEx(arg1, (PBYTE)arg2);
    2062 }
    2063 //******************************************************************************
    2064 //******************************************************************************
    20651229BOOL WIN32API SetMiterLimit( HDC arg1, float  arg2, float *  arg3)
    20661230{
     
    20701234//******************************************************************************
    20711235//******************************************************************************
    2072 UINT WIN32API SetPaletteEntries( HPALETTE arg1, UINT arg2, UINT arg3, PALETTEENTRY * arg4)
    2073 {
    2074     dprintf(("GDI32: SetPaletteEntries"));
    2075     return O32_SetPaletteEntries(arg1, arg2, arg3, (const PALETTEENTRY *)arg4);
    2076 }
    2077 //******************************************************************************
    2078 //******************************************************************************
    20791236int WIN32API SetPolyFillMode( HDC arg1, int  arg2)
    20801237{
     
    20841241//******************************************************************************
    20851242//******************************************************************************
    2086 BOOL WIN32API SetRectRgn( HRGN arg1, int arg2, int arg3, int arg4, int  arg5)
    2087 {
    2088     dprintf(("GDI32: SetRectRgn"));
    2089     return O32_SetRectRgn(arg1, arg2, arg3, arg4, arg5);
    2090 }
    2091 //******************************************************************************
    2092 //******************************************************************************
    20931243UINT WIN32API SetTextAlign( HDC arg1, UINT  arg2)
    20941244{
     
    21231273    dprintf(("GDI32: SetViewportOrgEx"));
    21241274    return O32_SetViewportOrgEx(arg1, arg2, arg3, arg4);
    2125 }
    2126 //******************************************************************************
    2127 //******************************************************************************
    2128 HENHMETAFILE WIN32API SetWinMetaFileBits( UINT arg1, const BYTE * arg2, HDC arg3, const METAFILEPICT *  arg4)
    2129 {
    2130     dprintf(("GDI32: SetWinMetaFileBits"));
    2131     return O32_SetWinMetaFileBits(arg1, arg2, arg3, arg4);
    21321275}
    21331276//******************************************************************************
     
    21901333}
    21911334//******************************************************************************
    2192 //CreateDisardableBitmap is obsolete and can be replaced by CreateCompatibleBitmap
    2193 //******************************************************************************
    2194 HBITMAP WIN32API CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight)
    2195 {
    2196     dprintf(("GDI32: CreateDisardableBitmap\n"));
    2197     return O32_CreateCompatibleBitmap(hDC, nWidth, nHeight);
    2198 }
    2199 //******************************************************************************
    22001335//TODO: Not implemented
    22011336//******************************************************************************
     
    22241359  dprintf(("GDI32: SetColorAdjustment, not implemented!(TRUE)\n"));
    22251360  return(TRUE);
    2226 }
    2227 //******************************************************************************
    2228 //WINE: OBJECTS\DIB.C
    2229 //*********************************************************************************
    2230 HBITMAP WIN32API CreateDIBSection( HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
    2231                                    VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
    2232 {
    2233  HBITMAP res = 0;
    2234  BOOL    fFlip = 0;
    2235  int iHeight, iWidth;
    2236 
    2237   dprintf(("GDI32: CreateDIBSection %x %x %x %d", hdc, iUsage, hSection, dwOffset));
    2238   if(hSection)
    2239   {
    2240     dprintf(("GDI32: CreateDIBSection, hSection != NULL, not supported!\n"));
    2241     return NULL;
    2242   }
    2243 
    2244   //SvL: 13-9-98: StarCraft uses bitmap with negative height
    2245   iWidth = pbmi->bmiHeader.biWidth;
    2246   if(pbmi->bmiHeader.biWidth < 0)
    2247   {
    2248         dprintf(("CreateDIBSection: width %d", pbmi->bmiHeader.biWidth));
    2249         pbmi->bmiHeader.biWidth = -pbmi->bmiHeader.biWidth;
    2250         fFlip = FLIP_HOR;
    2251   }
    2252   iHeight = pbmi->bmiHeader.biHeight;
    2253   if(pbmi->bmiHeader.biHeight < 0)
    2254   {
    2255         dprintf(("CreateDIBSection: height %d", pbmi->bmiHeader.biHeight));
    2256         pbmi->bmiHeader.biHeight = -pbmi->bmiHeader.biHeight;
    2257         fFlip |= FLIP_VERT;
    2258   }
    2259 
    2260   res = O32_CreateDIBitmap(hdc, &pbmi->bmiHeader, 0, NULL, pbmi, 0);
    2261   if (res)
    2262   {
    2263     ULONG Pal[256];
    2264     char PalSize;
    2265     LOGPALETTE tmpPal = { 0x300,1,{0,0,0,0}};
    2266     HPALETTE hpalCur, hpalTmp;
    2267     DIBSection *dsect = new DIBSection((WINBITMAPINFOHEADER *)&pbmi->bmiHeader, (DWORD)res, fFlip);
    2268 
    2269     if(NULL!=dsect)
    2270     {
    2271       PalSize = dsect->GetBitCount();
    2272       if(PalSize<=8)
    2273       {
    2274         // Now get the current Palette from the DC
    2275         hpalTmp = CreatePalette(&tmpPal);
    2276         hpalCur = SelectPalette(hdc, hpalTmp, FALSE);
    2277 
    2278         // and use it to set the DIBColorTable
    2279         GetPaletteEntries( hpalCur, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
    2280         dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);
    2281 
    2282         // Restore the DC Palette
    2283         SelectPalette(hdc,hpalCur,FALSE);
    2284         DeleteObject(hpalTmp);
    2285       }
    2286       // Set the hdc in the DIBSection so we can update the palete if a new
    2287       // Paletet etc. gets selected into the DC.
    2288 
    2289       dsect->SelectDIBObject(hdc);
    2290 
    2291       if(ppvBits!=NULL)
    2292         *ppvBits = dsect->GetDIBObject();
    2293 
    2294       pbmi->bmiHeader.biWidth = iWidth;
    2295       pbmi->bmiHeader.biHeight = iHeight;
    2296 
    2297       return(res);
    2298     }
    2299   }
    2300 
    2301   /* Error.  */
    2302   if (res)
    2303     DeleteObject(res);
    2304   *ppvBits = NULL;
    2305 #ifdef DEBUG
    2306   dprintf(("GDI32: CreateDIBSection, error!\n"));
    2307   dprintf(("pbmi->biWidth    %d", pbmi->bmiHeader.biWidth));
    2308   dprintf(("pbmi->biHeight   %d", pbmi->bmiHeader.biHeight));
    2309   dprintf(("pbmi->biBitCount %d", pbmi->bmiHeader.biBitCount));
    2310 #endif
    2311 
    2312   return 0;
    2313 }
    2314 //******************************************************************************
    2315 //******************************************************************************
    2316 UINT WIN32API GetDIBColorTable( HDC hdc, UINT uStartIndex, UINT cEntries,
    2317                                   RGBQUAD *pColors)
    2318 {
    2319  HPALETTE hpal = O32_GetCurrentObject(hdc, OBJ_PAL);
    2320  UINT rc;
    2321  int i;
    2322 
    2323   rc = O32_GetPaletteEntries(hpal,
    2324                          uStartIndex,
    2325                          cEntries,
    2326                          (PALETTEENTRY *)pColors);
    2327   for(i=0;
    2328       i<cEntries;
    2329       i++)
    2330   {
    2331     BYTE tmp;
    2332     tmp = pColors[i].rgbBlue;
    2333     pColors[i].rgbBlue = pColors[i].rgbRed;
    2334     pColors[i].rgbRed = tmp;
    2335     pColors[i].rgbReserved = 0;
    2336   }
    2337   dprintf(("GDI32: GetDIBColorTable returns %d\n", rc));
    2338   return(rc);
    2339 }
    2340 //******************************************************************************
    2341 //******************************************************************************
    2342 UINT WIN32API SetDIBColorTable(HDC hdc, UINT uStartIndex, UINT cEntries,
    2343                                   RGBQUAD *pColors)
    2344 {
    2345  DIBSection *dsect = DIBSection::findHDC(hdc);
    2346 
    2347   dprintf(("GDI32: SetDIBColorTable\n"));
    2348   if(dsect)
    2349   {
    2350     return(dsect->SetDIBColorTable(uStartIndex, cEntries, pColors));
    2351   }
    2352   else
    2353     return(0);
    2354 }
    2355 //******************************************************************************
    2356 //******************************************************************************
    2357 HPALETTE WIN32API CreateHalftonePalette(HDC hdc)
    2358 {
    2359     dprintf(("GDI32: CreateHalftonePalette, not implemented\n"));
    2360     return(NULL);
    23611361}
    23621362//******************************************************************************
     
    24341434{
    24351435  dprintf(("GDI32: GetColorAdjustment, not implemented\n"));
    2436   return(FALSE);
    2437 }
    2438 //******************************************************************************
    2439 //******************************************************************************
    2440 BOOL WIN32API PlgBlt(HDC hdcDest, CONST POINT *lpPoint, HDC hdcSrc, int nXSrc,
    2441                         int nYSrc, int nWidth, int nHeight, HBITMAP hbmMask,
    2442                         int xMast, int yMask)
    2443 {
    2444   dprintf(("GDI32: PlgBlt, not implemented\n"));
    24451436  return(FALSE);
    24461437}
     
    25341525  FreeAsciiString(astring);
    25351526  return rc;
    2536 }
    2537 //******************************************************************************
    2538 //******************************************************************************
    2539 BOOL WIN32API PlayEnhMetaFileRecord(                                 /*KSO Thu 21.05.1998*/
    2540         HDC                                     arg1,
    2541         LPHANDLETABLE           arg2,
    2542         CONST ENHMETARECORD *arg3,
    2543         UINT                            arg4
    2544         )
    2545 {
    2546         dprintf(("GDI32: PlayEnhMetaFileRecord - stub\n"));
    2547         return FALSE;
    2548 }
    2549 //******************************************************************************
    2550 UINT WIN32API GetEnhMetaFileDescriptionA(                    /*KSO Thu 21.05.1998*/
    2551         HENHMETAFILE    arg1,
    2552         UINT                    arg2,
    2553         LPSTR                   arg3
    2554         )
    2555 {
    2556         dprintf(("GDI32: GetEnhMetaFileDescriptionA - stub\n"));
    2557         return FALSE;
    2558 }
    2559 //******************************************************************************
    2560 //******************************************************************************
    2561 UINT WIN32API GetEnhMetaFileDescriptionW(                    /*KSO Thu 21.05.1998*/
    2562         HENHMETAFILE    arg1,
    2563         UINT                    arg2,
    2564         LPWSTR                  arg3
    2565         )
    2566 {
    2567         dprintf(("GDI32: GetEnhMetaFileDescriptionW - stub\n"));
    2568         return FALSE;
    25691527}
    25701528//******************************************************************************
     
    31732131
    31742132/*****************************************************************************
    3175  * Name      : int GetMetaRgn
    3176  * Purpose   : The GetMetaRgn function retrieves the current metaregion for
    3177  *             the specified device context.
    3178  * Parameters: HDC  hdc   handle of device context
    3179  *             HRGN hrgn  handle of region
    3180  * Variables :
    3181  * Result    : 0 / 1
    3182  * Remark    :
    3183  * Status    : UNTESTED STUB
    3184  *
    3185  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    3186  *****************************************************************************/
    3187 
    3188 int WIN32API GetMetaRgn(HDC  hdc,
    3189                            HRGN hrgn)
    3190 {
    3191   dprintf(("GDI32: GetMetaRgn(%08xh, %08xh) not implemented.\n",
    3192            hdc,
    3193            hrgn));
    3194 
    3195   return (0);
    3196 }
    3197 
    3198 /*****************************************************************************
    31992133 * Name      : BOOL SetDeviceGammaRamp
    32002134 * Purpose   : The SetDeviceGammaRamp function sets the gamma ramp on direct
     
    32702204}
    32712205
    3272 
    3273 /*****************************************************************************
    3274  * Name      : int SetMetaRgn
    3275  * Purpose   : The SetMetaRgn function intersects the current clipping region
    3276  *             for the specified device context with the current metaregion
    3277  *             and saves the combined region as the new metaregion for the
    3278  *             specified device context. The clipping region is reset to a null region.
    3279  * Parameters: HDC    hdc   handle of device context
    3280  * Variables :
    3281  * Result    : TRUE / FALSE
    3282  * Remark    :
    3283  * Status    : UNTESTED STUB
    3284  *
    3285  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    3286  *****************************************************************************/
    3287 
    3288 BOOL WIN32API SetMetaRgn(HDC hdc)
    3289 {
    3290   dprintf(("GDI32: SetMetaRgn(%08xh) not implemented.\n",
    3291            hdc));
    3292 
    3293   return (NULLREGION);
    3294 }
    32952206
    32962207
  • trunk/src/gdi32/makefile

    r2254 r2592  
    1 # $Id: makefile,v 1.15 1999-12-29 18:51:45 sandervl Exp $
     1# $Id: makefile,v 1.16 2000-02-01 12:53:30 sandervl Exp $
    22
    33#
     
    2626
    2727OBJS =  gdi32.obj opengl.obj callback.obj dibsect.obj initterm.obj resource.obj \
    28         oslibgdi.obj font.obj text.obj palette.obj line.obj oslibgpi.obj
     28        oslibgdi.obj font.obj text.obj palette.obj line.obj oslibgpi.obj region.obj \
     29        metafile.obj dibitmap.obj blit.obj
    2930
    3031
     
    5758    $(PDWIN32_INCLUDE)\misc.h \
    5859
     60region.obj: region.cpp $(PDWIN32_INCLUDE)\misc.h
     61
     62metafile.obj: metafile.cpp $(PDWIN32_INCLUDE)\misc.h
     63
     64dibitmap.obj: dibitmap.cpp dibsect.h $(PDWIN32_INCLUDE)\misc.h
     65blit.obj: blit.cpp dibsect.h $(PDWIN32_INCLUDE)\misc.h
     66
    5967font.obj: font.cpp \
    6068    $(PDWIN32_INCLUDE)\misc.h \
     
    6472
    6573palette.obj: palette.cpp \
    66     $(PDWIN32_INCLUDE)\misc.h \
     74    $(PDWIN32_INCLUDE)\misc.h dibsect.h \
    6775
    6876dibsect.obj: dibsect.cpp \
  • trunk/src/gdi32/oslibgdi.cpp

    r2551 r2592  
    1 /* $Id: oslibgdi.cpp,v 1.3 2000-01-28 22:24:58 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.4 2000-02-01 12:53:30 sandervl Exp $ */
    22
    33/*
     
    5757  os2bmpinfo.cclrImportant = info->biClrImportant;
    5858
    59 //  rc = GpiDrawBits((HPS)hdc, (VOID *)bits, &os2bmpinfo, 4,
    60 //                   points, ROP_SRCCOPY, BBO_IGNORE);
     59  rc = GpiDrawBits((HPS)hdc, (VOID *)bits, &os2bmpinfo, 4,
     60                   points, ROP_SRCCOPY, BBO_IGNORE);
    6161
    62 //  if(rc != GPI_OK) {
    63 //      dprintf(("GpiDrawBits returned %d", rc));
    64 //  }
     62  if(rc != GPI_OK) {
     63        dprintf(("GpiDrawBits returned %d", rc));
     64  }
    6565  return lines;
    6666}
  • trunk/src/gdi32/palette.cpp

    r1931 r2592  
    1 /* $Id: palette.cpp,v 1.1 1999-12-01 23:30:30 sandervl Exp $ */
     1/* $Id: palette.cpp,v 1.2 2000-02-01 12:53:31 sandervl Exp $ */
    22
    33/*
     
    1616#include <misc.h>
    1717#include <string.h>
     18#include "dibsect.h"
    1819
    1920static UINT SystemPaletteUse = SYSPAL_STATIC;  /* currently not considered */
     
    4647    return SystemPaletteUse;
    4748}
     49//******************************************************************************
     50//******************************************************************************
     51UINT WIN32API RealizePalette( HDC hdc)
     52{
     53    dprintf(("GDI32: RealizePalette %x", hdc));
     54    return O32_RealizePalette(hdc);
     55}
     56//******************************************************************************
     57//******************************************************************************
     58HPALETTE WIN32API CreatePalette( const LOGPALETTE * arg1)
     59{
     60  HPALETTE rc;
     61    dprintf(("GDI32: CreatePalette\n"));
     62   for(int i=0; i<arg1->palNumEntries;i++)
     63   {
     64     dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) ));
     65   }
     66   rc = O32_CreatePalette(arg1);
     67   dprintf(("  returns 0x%08X\n",rc));
     68
     69   return rc;
     70}
     71//******************************************************************************
     72//******************************************************************************
     73HPALETTE WIN32API SelectPalette(HDC arg1, HPALETTE arg2, BOOL arg3)
     74{
     75  dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X)\n", arg1, arg2, arg3));
     76  if(DIBSection::getSection() != NULL)
     77  {
     78    DIBSection *dsect = DIBSection::findHDC(arg1);
     79    if(dsect)
     80    {
     81      PALETTEENTRY Pal[256];
     82      char PalSize = dsect->GetBitCount();
     83      dprintf(("       - Set Palette Values in DIBSection\n"));
     84      if(PalSize<=8)
     85      {
     86        GetPaletteEntries( arg2, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
     87        dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);
     88      }
     89
     90    }
     91  }
     92  return O32_SelectPalette(arg1, arg2, arg3);
     93}
     94//******************************************************************************
     95//******************************************************************************
     96BOOL WIN32API AnimatePalette( HPALETTE arg1, UINT arg2, UINT arg3, const PALETTEENTRY * arg4)
     97{
     98    dprintf(("GDI32: AnimatePalette"));
     99    return O32_AnimatePalette(arg1, arg2, arg3, arg4);
     100}
     101//******************************************************************************
     102//******************************************************************************
     103UINT WIN32API GetNearestPaletteIndex( HPALETTE arg1, COLORREF  arg2)
     104{
     105    UINT rc;
     106    dprintf(("GDI32: GetNearestPaletteIndex (0x%08X ,0x%08X) ",arg1,arg2));
     107    rc = O32_GetNearestPaletteIndex(arg1, arg2);
     108    dprintf(("Returns %d\n",rc));
     109    return rc;
     110}
     111//******************************************************************************
     112//******************************************************************************
     113UINT WIN32API GetPaletteEntries( HPALETTE arg1, UINT arg2, UINT arg3, PPALETTEENTRY  arg4)
     114{
     115    dprintf(("GDI32: GetPaletteEntries"));
     116    return O32_GetPaletteEntries(arg1, arg2, arg3, arg4);
     117}
     118//******************************************************************************
     119//******************************************************************************
     120UINT WIN32API GetSystemPaletteEntries( HDC arg1, UINT arg2, UINT arg3, PPALETTEENTRY  arg4)
     121{
     122 UINT rc;
     123
     124    dprintf(("GDI32: GetSystemPaletteEntries start %d nr %d pal ptr %X", arg2, arg3, arg4));
     125    rc = O32_GetSystemPaletteEntries(arg1, arg2, arg3, arg4);
     126    dprintf((" GetSystemPaletteEntries returned %d", rc));
     127    return(rc);
     128}
     129//******************************************************************************
     130//******************************************************************************
     131BOOL WIN32API ResizePalette( HPALETTE arg1, UINT  arg2)
     132{
     133    dprintf(("GDI32: ResizePalette\n"));
     134    return O32_ResizePalette(arg1, arg2);
     135}
     136//******************************************************************************
     137//******************************************************************************
     138UINT WIN32API SetPaletteEntries( HPALETTE arg1, UINT arg2, UINT arg3, PALETTEENTRY * arg4)
     139{
     140    dprintf(("GDI32: SetPaletteEntries"));
     141    return O32_SetPaletteEntries(arg1, arg2, arg3, (const PALETTEENTRY *)arg4);
     142}
     143//******************************************************************************
     144//******************************************************************************
     145HPALETTE WIN32API CreateHalftonePalette(HDC hdc)
     146{
     147    dprintf(("GDI32: CreateHalftonePalette, not implemented\n"));
     148    return(NULL);
     149}
     150//******************************************************************************
     151//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.