Changeset 9764 for trunk/src


Ignore:
Timestamp:
Feb 6, 2003, 9:28:09 PM (23 years ago)
Author:
sandervl
Message:

CreateDIBSection: don't get palette from DC if bitmap bits provided

File:
1 edited

Legend:

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

    r9614 r9764  
    1 /* $Id: dibitmap.cpp,v 1.38 2003-01-04 18:18:05 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.39 2003-02-06 20:28:09 sandervl Exp $ */
    22
    33/*
     
    238238        {
    239239            PalSize = dsect->GetBitCount();
    240             if(PalSize <= 8)
     240
     241            if(!ppvBits && PalSize <= 8)
    241242            {
    242243                ULONG Pal[256], nrcolors;
    243244                LOGPALETTE tmpPal = { 0x300,1,{0,0,0,0}};
    244                 HPALETTE hpalCur, hpalTmp;
     245                HPALETTE hpalCur;
    245246
    246247                // Now get the current Palette from the DC
    247                 hpalTmp = CreatePalette(&tmpPal);
    248                 hpalCur = SelectPalette(hdc, hpalTmp, FALSE);
     248                hpalCur = GetCurrentObject(hdc, OBJ_PAL);
    249249
    250250                // and use it to set the DIBColorTable
    251251                nrcolors = GetPaletteEntries( hpalCur, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
    252252                dsect->SetDIBColorTable(0, nrcolors, (LPPALETTEENTRY)&Pal);
    253 
    254                 // Restore the DC Palette
    255                 SelectPalette(hdc,hpalCur,FALSE);
    256                 DeleteObject(hpalTmp);
    257253            }
    258254
Note: See TracChangeset for help on using the changeset viewer.