Changeset 3589 for trunk/src


Ignore:
Timestamp:
May 22, 2000, 9:11:28 PM (25 years ago)
Author:
sandervl
Message:

StretchDIBits bugfix (dib sections)

Location:
trunk/src/gdi32
Files:
3 edited

Legend:

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

    r3527 r3589  
    1 /* $Id: blit.cpp,v 1.11 2000-05-12 19:14:55 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.12 2000-05-22 19:11:27 sandervl Exp $ */
    22
    33/*
     
    220220//******************************************************************************
    221221//******************************************************************************
     222INT WIN32API StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
     223                           INT heightDst, INT xSrc, INT ySrc, INT widthSrc,
     224                           INT heightSrc, const void *bits,
     225                           const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
     226{
     227#if 1
     228 INT rc;
     229
     230    dprintf(("GDI32: StretchDIBits %x to (%d,%d) (%d,%d) from (%d,%d) (%d,%d), %x %x %x %x", hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc, widthSrc, heightSrc, bits, info, wUsage, dwRop));
     231
     232    if(wUsage == DIB_PAL_COLORS && info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
     233    {
     234        // workaround for open32 bug.
     235        // If syscolors > 256 and wUsage == DIB_PAL_COLORS.
     236
     237        int i;
     238        USHORT *pColorIndex = (USHORT *)info->bmiColors;
     239        RGBQUAD *pColors = (RGBQUAD *) alloca(info->bmiHeader.biClrUsed *
     240                         sizeof(RGBQUAD));
     241        BITMAPINFO *infoLoc = (BITMAPINFO *) alloca(sizeof(BITMAPINFO) +
     242                             info->bmiHeader.biClrUsed * sizeof(RGBQUAD));
     243
     244        memcpy(infoLoc, info, sizeof(BITMAPINFO));
     245
     246        if(GetDIBColorTable(hdc, 0, info->bmiHeader.biClrUsed, pColors) == 0)
     247                return FALSE;
     248
     249        for(i=0;i<info->bmiHeader.biClrUsed;i++, pColorIndex++)
     250        {
     251                infoLoc->bmiColors[i] = pColors[*pColorIndex];
     252        }
     253
     254        rc = O32_StretchDIBits(hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc,
     255                               widthSrc, heightSrc, (void *)bits,
     256                               (PBITMAPINFO)infoLoc, DIB_RGB_COLORS, dwRop);
     257
     258        if(rc != heightDst) {
     259                dprintf(("StretchDIBits failed with rc %x", rc));
     260        }
     261        else {
     262                DIBSection *destdib = DIBSection::findHDC(hdc);
     263                if(destdib) {
     264                        destdib->sync(hdc, yDst, heightDst);
     265                }
     266        }
     267
     268        return rc;
     269    }
     270
     271    rc = O32_StretchDIBits(hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc,
     272                             widthSrc, heightSrc, (void *)bits,
     273                             (PBITMAPINFO)info, wUsage, dwRop);
     274    if(rc != heightDst) {
     275        dprintf(("StretchDIBits failed with rc %x", rc));
     276    }
     277    else {
     278        DIBSection *destdib = DIBSection::findHDC(hdc);
     279        if(destdib) {
     280                destdib->sync(hdc, yDst, heightDst);
     281        }
     282    }
     283
     284    return rc;
     285#else
     286    dprintf(("GDI32: StretchDIBits\n"));
     287    return O32_StretchDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, (void *)arg10, (PBITMAPINFO)arg11, arg12, arg13);
     288#endif
     289}
     290//******************************************************************************
     291//******************************************************************************
    222292int WIN32API SetStretchBltMode( HDC arg1, int  arg2)
    223293{
  • trunk/src/gdi32/gdi32.cpp

    r3255 r3589  
    1 /* $Id: gdi32.cpp,v 1.46 2000-03-28 15:25:47 cbratschi Exp $ */
     1/* $Id: gdi32.cpp,v 1.47 2000-05-22 19:11:28 sandervl Exp $ */
    22
    33/*
     
    188188    dprintf(("CreateCompatibleDC %X returned %x", hdc, newHdc));
    189189    return newHdc;
    190 }
    191 //******************************************************************************
    192 //******************************************************************************
    193 INT WIN32API StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
    194                            INT heightDst, INT xSrc, INT ySrc, INT widthSrc,
    195                            INT heightSrc, const void *bits,
    196                            const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
    197 {
    198 #if 1
    199     dprintf(("GDI32: StretchDIBits %x to (%d,%d) (%d,%d) from (%d,%d) (%d,%d), %x %x %x %x", hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc, widthSrc, heightSrc, bits, info, wUsage, dwRop));
    200 
    201     if(wUsage == DIB_PAL_COLORS && info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
    202     {
    203       // workaround for open32 bug.
    204       // If syscolors > 256 and wUsage == DIB_PAL_COLORS.
    205 
    206       int i;
    207       USHORT *pColorIndex = (USHORT *)info->bmiColors;
    208       RGBQUAD *pColors = (RGBQUAD *) alloca(info->bmiHeader.biClrUsed *
    209                          sizeof(RGBQUAD));
    210       BITMAPINFO *infoLoc = (BITMAPINFO *) alloca(sizeof(BITMAPINFO) +
    211                              info->bmiHeader.biClrUsed * sizeof(RGBQUAD));
    212 
    213       memcpy(infoLoc, info, sizeof(BITMAPINFO));
    214 
    215       if(GetDIBColorTable(hdc, 0, info->bmiHeader.biClrUsed, pColors) == 0)
    216         return FALSE;
    217 
    218       for(i=0;i<info->bmiHeader.biClrUsed;i++, pColorIndex++)
    219       {
    220          infoLoc->bmiColors[i] = pColors[*pColorIndex];
    221       }
    222 
    223       return O32_StretchDIBits(hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc,
    224                                widthSrc, heightSrc, (void *)bits,
    225                                (PBITMAPINFO)infoLoc, DIB_RGB_COLORS, dwRop);
    226     }
    227 
    228     return O32_StretchDIBits(hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc,
    229                              widthSrc, heightSrc, (void *)bits,
    230                              (PBITMAPINFO)info, wUsage, dwRop);
    231 #else
    232     dprintf(("GDI32: StretchDIBits\n"));
    233     return O32_StretchDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, (void *)arg10, (PBITMAPINFO)arg11, arg12, arg13);
    234 #endif
    235190}
    236191//******************************************************************************
  • trunk/src/gdi32/palette.cpp

    r2802 r3589  
    1 /* $Id: palette.cpp,v 1.3 2000-02-16 14:18:12 sandervl Exp $ */
     1/* $Id: palette.cpp,v 1.4 2000-05-22 19:11:28 sandervl Exp $ */
    22
    33/*
     
    6262{
    6363  HPALETTE rc;
    64     dprintf(("GDI32: CreatePalette\n"));
     64
    6565   for(int i=0; i<arg1->palNumEntries;i++)
    6666   {
    67      dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) ));
     67        dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) ));
    6868   }
    6969   rc = O32_CreatePalette(arg1);
    70    dprintf(("  returns 0x%08X\n",rc));
     70   dprintf(("GDI32: CreatePalette returns 0x%08X\n",rc));
    7171
    7272   return rc;
     
    114114//******************************************************************************
    115115//******************************************************************************
    116 UINT WIN32API GetPaletteEntries( HPALETTE arg1, UINT arg2, UINT arg3, PPALETTEENTRY  arg4)
     116UINT WIN32API GetPaletteEntries( HPALETTE hPalette, UINT arg2, UINT arg3, PPALETTEENTRY  arg4)
    117117{
    118     dprintf(("GDI32: GetPaletteEntries"));
    119     return O32_GetPaletteEntries(arg1, arg2, arg3, arg4);
     118    dprintf(("GDI32: GetPaletteEntries %x %d-%d %x", hPalette, arg2, arg3, arg4));
     119    return O32_GetPaletteEntries(hPalette, arg2, arg3, arg4);
    120120}
    121121//******************************************************************************
     
    139139//******************************************************************************
    140140//******************************************************************************
    141 UINT WIN32API SetPaletteEntries( HPALETTE arg1, UINT arg2, UINT arg3, PALETTEENTRY * arg4)
     141UINT WIN32API SetPaletteEntries( HPALETTE hPalette, UINT arg2, UINT arg3, PALETTEENTRY * arg4)
    142142{
    143     dprintf(("GDI32: SetPaletteEntries"));
    144     return O32_SetPaletteEntries(arg1, arg2, arg3, (const PALETTEENTRY *)arg4);
     143    dprintf(("GDI32: SetPaletteEntries %x %d-%d %x", hPalette, arg2, arg3, arg4));
     144    return O32_SetPaletteEntries(hPalette, arg2, arg3, (const PALETTEENTRY *)arg4);
    145145}
    146146//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.