Ignore:
Timestamp:
Apr 13, 2004, 4:17:17 PM (21 years ago)
Author:
sandervl
Message:

updates

File:
1 edited

Legend:

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

    r10558 r10579  
    1 /* $Id: dibitmap.cpp,v 1.43 2004-03-24 16:55:35 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.44 2004-04-13 14:17:17 sandervl Exp $ */
    22
    33/*
     
    4848        ((BITMAPINFOHEADER *)lpbmih)->biHeight = -lpbmih->biHeight;
    4949
    50         if(lpbInit && fdwInit == CBM_INIT) 
     50        if(lpbInit && fdwInit == CBM_INIT)
    5151        {
    5252            // upside down
     
    5454            long lLineByte = DIB_GetDIBWidthBytes(lpbmih->biWidth, lpbmih->biBitCount);
    5555            long lHeight   = lpbmih->biHeight;
    56    
     56
    5757            newbits = (WORD *)malloc( lLineByte * lHeight );
    5858            if(newbits) {
     
    9595        memcpy(infoLoc, lpbmi, sizeof(BITMAPINFO));
    9696
    97         if(GetDIBColorTable(hdc, 0, biClrUsed, pColors) == 0) 
     97        if(GetDIBColorTable(hdc, 0, biClrUsed, pColors) == 0)
    9898        {
    9999            dprintf(("ERROR: StretchDIBits: GetDIBColorTable failed!!"));
     
    107107        rc = CreateDIBitmap(hdc, lpbmih, fdwInit, lpbInit, (PBITMAPINFO)infoLoc,
    108108                            DIB_RGB_COLORS);
    109    
     109
    110110        return rc;
    111111    }
     
    165165    ((BITMAPINFOHEADER *)lpbmih)->biBitCount = biBitCount;
    166166
    167     if(rc) { 
     167    if(rc) {
    168168        STATS_CreateDIBitmap(rc, hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
    169169        if(bitfields[1] == RGB565_GREEN_MASK) {
     
    181181{
    182182    HBITMAP hBitmap;
    183     pDCData pHps; 
     183    pDCData pHps;
    184184
    185185    pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
     
    240240    int     iHeight, iWidth;
    241241    BOOL    fCreateDC = FALSE;
    242    
     242
    243243    dprintf(("GDI32: CreateDIBSection %x %x %x %x %x %d", hdc, pbmi, iUsage, ppvBits, hSection, dwOffset));
    244244
     
    406406{
    407407    int nrlines;
    408     pDCData pHps; 
     408    pDCData pHps;
    409409    HDC hdcMem;
    410410    DWORD biCompression;
     
    436436    //If the app wants bitmap data and upside down, then flip image
    437437    if(lpvBits && lpbi->bmiHeader.biHeight < 0 && (lpbi->bmiHeader.biCompression == BI_RGB ||
    438        lpbi->bmiHeader.biCompression == BI_BITFIELDS)) 
     438       lpbi->bmiHeader.biCompression == BI_BITFIELDS))
    439439    {
    440440        INT rc = -1;
     
    461461        }
    462462        else DebugInt3();
    463  
     463
    464464        //restore height
    465465        lpbi->bmiHeader.biHeight = height;
    466466    }
    467     else {
    468         LONG height = lpbi->bmiHeader.biHeight;
    469 
    470         if(lpbi->bmiHeader.biHeight < 0) {
    471             lpbi->bmiHeader.biHeight = -lpbi->bmiHeader.biHeight;
    472         }
     467    else if (lpbi->bmiHeader.biHeight < 0)
     468    {
     469        LONG cySaved = lpbi->bmiHeader.biHeight;
     470        lpbi->bmiHeader.biHeight = -cySaved;
    473471        nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage);
    474 
    475         //restore height
    476         lpbi->bmiHeader.biHeight = height;
    477     }
     472        lpbi->bmiHeader.biHeight = cySaved;
     473    }
     474    else
     475        nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage);
    478476
    479477    if(lpvBits) {
     
    528526    //WGSS/Open32 returns 1 when querying the bitmap info; must return nr of scanlines
    529527    //(0 signals failure)
    530     if(lpvBits == NULL) {
    531        if(nrlines != 0)
    532             nrlines = cScanLines;
    533        else dprintf(("GetDIBits failed!!"));
    534     }
     528    #if 0//XP returns 1 just like Open32 does for the query bitmap info header mode.
     529    if (lpvBits == NULL)
     530    {
     531       if (nrlines != 0)
     532           nrlines = cScanLines;
     533       else
     534           dprintf(("GetDIBits failed!!"));
     535    }
     536    #else
     537    if (!nrlines)
     538        dprintf(("GetDIBits failed!!"));
     539    #endif
    535540    return nrlines;
    536541}
     
    621626    //If upside down, reverse scanlines and call SetDIBits again
    622627    if(pBitmapInfo->bmiHeader.biHeight < 0 && (pBitmapInfo->bmiHeader.biCompression == BI_RGB ||
    623        pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS)) 
     628       pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS))
    624629    {
    625630        // upside down
Note: See TracChangeset for help on using the changeset viewer.