Ignore:
Timestamp:
May 14, 2003, 1:39:59 PM (22 years ago)
Author:
sandervl
Message:

DIB section: do not fetch more colors from a bitmap header than biClrUsed (if ..= 0); GetDIBits: save and restore negative height & log failure

File:
1 edited

Legend:

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

    r9764 r10088  
    1 /* $Id: dibitmap.cpp,v 1.39 2003-02-06 20:28:09 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.40 2003-05-14 11:39:59 sandervl Exp $ */
    22
    33/*
     
    366366    dprintf(("GDI32: GetDIBits %x %x %d %d %x %x (biBitCount %d) %d", hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, lpbi->bmiHeader.biBitCount, uUsage));
    367367
     368#if 0
     369    if(lpvBits && DIBSection::getSection() != NULL)
     370    {
     371        DIBSection *dsect;
     372
     373        dsect = DIBSection::findObj(hBitmap);
     374        if(dsect) {
     375             char *bmpBits = dsect->GetDIBObject();
     376
     377             if(lpbi->bmiHeader.biBitCount == dsect->GetBitCount() &&
     378                lpbi->bmiHeader.biWidth > 0)
     379             {
     380                 LONG lLineByte;
     381
     382                 dprintf(("Quick copy from DIB section memory"));
     383                 lLineByte = DIB_GetDIBWidthBytes(lpbi->bmiHeader.biWidth, lpbi->bmiHeader.biBitCount);
     384                 
     385                 memcpy(lpvBits, bmpBits+(uStartScan*lLineByte), cScanLines*lLineByte);
     386                 return cScanLines;
     387             }
     388        }
     389    }
     390#endif
     391
    368392    //SvL: WGSS screws up the DC if it's a memory DC
    369393    //     TODO: Fix in WGSS (tries to select another bitmap in the DC which fails)
     
    415439    }
    416440    else {
     441        LONG height = lpbi->bmiHeader.biHeight;
     442
     443        if(lpbi->bmiHeader.biHeight < 0) {
     444            lpbi->bmiHeader.biHeight = -lpbi->bmiHeader.biHeight;
     445        }
    417446        nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage);
     447
     448        //restore height
     449        lpbi->bmiHeader.biHeight = height;
    418450    }
    419451
     
    470502    }
    471503
    472     //WGSS/Open32 returns 0 when querying the bitmap info; must return nr of scanlines
    473     //as 0 signals failure
     504    //WGSS/Open32 returns 1 when querying the bitmap info; must return nr of scanlines
     505    //(0 signals failure)
    474506    if(lpvBits == NULL) {
    475        nrlines = cScanLines;
     507       if(nrlines != 0)
     508            nrlines = cScanLines;
     509       else dprintf(("GetDIBits failed!!"));
    476510    }
    477511    return nrlines;
Note: See TracChangeset for help on using the changeset viewer.