Ignore:
Timestamp:
Dec 4, 1999, 2:53:14 PM (26 years ago)
Author:
hugh
Message:

Implemented DEFAULT_GUI_FONT for GetStockObject
DIBSecttion now get the DC Palette on creation and updated if DC pal changes.

File:
1 edited

Legend:

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

    r1937 r1966  
    1 /* $Id: dibsect.cpp,v 1.10 1999-12-02 13:26:04 achimha Exp $ */
     1/* $Id: dibsect.cpp,v 1.11 1999-12-04 13:53:12 hugh Exp $ */
    22
    33/*
     
    101101   dprintf(("pOS2bmp->ulCompression %d\n", pOS2bmp->ulCompression));
    102102   dprintf(("pOS2bmp->cbImage       %d\n", pOS2bmp->cbImage));
     103   dprintf(("Bits at 0x%08X\n",bmpBits));
    103104
    104105   this->handle = handle;
     
    123124     dsect->next = this;
    124125   }
     126
    125127   dprintf(("Class created"));
    126128}
     
    134136        free(pOS2bmp);
    135137
    136    if(section == this) {
    137         section = this->next;
    138    }
    139    else {
    140         DIBSection *dsect = section;
    141 
    142         while(dsect->next != this) {
    143                 dsect = dsect->next;
    144         }
    145         dsect->next = this->next;
     138   if(section == this)
     139   {
     140     section = this->next;
     141   }
     142   else
     143   {
     144     DIBSection *dsect = section;
     145
     146     while(dsect->next != this)
     147     {
     148       dsect = dsect->next;
     149     }
     150     dsect->next = this->next;
    146151   }
    147152}
     
    161166  switch(pbmi->biBitCount)
    162167  {
    163         case 1:
    164                 bmpsize /= 8;
    165                 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
    166                 os2bmpsize += palsize;
    167                 break;
    168         case 4:
    169                 bmpsize /= 2;
    170                 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
    171                 os2bmpsize += palsize;
    172                 break;
    173         case 8:
    174                 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
    175                 os2bmpsize += palsize;
    176                 break;
    177         case 16:
    178                 bmpsize *= 2;
    179                 break;
    180         case 24:
    181                 bmpsize *= 3;
    182                 break;
    183         case 32:
    184                 bmpsize *= 4;
    185                 break;
    186    }
    187    if(bmpsize & 3) {
    188         bmpsize = (bmpsize + 3) & ~3;
     168    case 1:
     169      bmpsize /= 8;
     170      palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
     171      os2bmpsize += palsize;
     172      break;
     173    case 4:
     174      bmpsize /= 2;
     175      palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
     176      os2bmpsize += palsize;
     177      break;
     178    case 8:
     179      palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
     180      os2bmpsize += palsize;
     181      break;
     182    case 16:
     183      bmpsize *= 2;
     184      break;
     185    case 24:
     186      bmpsize *= 3;
     187      break;
     188    case 32:
     189      bmpsize *= 4;
     190      break;
     191   }
     192
     193   if(bmpsize & 3)
     194   {
     195     bmpsize = (bmpsize + 3) & ~3;
    189196   }
    190197
     
    216223 int i;
    217224
    218   if(startIdx + cEntries > (1 << pOS2bmp->cBitCount)) {
    219         dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries));
    220         return(0);
    221   }
     225  if(startIdx + cEntries > (1 << pOS2bmp->cBitCount))
     226  {
     227    dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries));
     228    return(0);
     229  }
     230
    222231  memcpy(&pOS2bmp->argbColor[startIdx], rgb, cEntries*sizeof(RGB2));
    223   for(i=startIdx;i<cEntries;i++) {
    224         pOS2bmp->argbColor[i].fcOptions = 0;
    225   }
     232
     233  for(i=startIdx;i<cEntries;i++)
     234  {
     235    pOS2bmp->argbColor[i].fcOptions = 0;
     236    dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&pOS2bmp->argbColor[i])) ));
     237  }
     238
    226239  return(cEntries);
    227240}
     
    306319  this->hdc  = hdc;
    307320  hwndParent = WinWindowFromDC(hdc);
     321  dprintf(("SelectDIBObject(0x%08X) hwndParent = 0x%08X\n",hdc, hwndParent));
    308322}
    309323//******************************************************************************
     
    313327 DIBSection *dsect = section;
    314328
    315   while(dsect) {
    316         if(dsect->handle == handle) {
    317                 return(dsect);
    318         }
    319         dsect = dsect->next;
     329  while(dsect)
     330  {
     331    if(dsect->handle == handle)
     332    {
     333      return(dsect);
     334    }
     335    dsect = dsect->next;
    320336  }
    321337  return(NULL);
     
    328344 DIBSection *dsect = section;
    329345
    330   while(dsect) {
    331         if(dsect->hdc == hdc) {
    332                 return(dsect);
    333         }
    334         dsect = dsect->next;
     346  while(dsect)
     347  {
     348    if(dsect->hdc == hdc)
     349    {
     350      return(dsect);
     351    }
     352    dsect = dsect->next;
    335353  }
    336354  return(NULL);
     
    343361
    344362  if(dsect)
    345         delete dsect;
    346 
    347 }
    348 //******************************************************************************
    349 //******************************************************************************
    350 int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection){
     363    delete dsect;
     364
     365}
     366//******************************************************************************
     367//******************************************************************************
     368int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection)
     369{
    351370  if( (sizeof(DIBSECTION)==iSize) &&
    352371      (pDIBSection !=NULL))
     
    388407//******************************************************************************
    389408//******************************************************************************
     409char  DIBSection::GetBitCount()
     410{
     411   if(NULL==pOS2bmp)
     412     return 0;
     413   else
     414     return pOS2bmp->cBitCount;
     415}
     416//******************************************************************************
     417//******************************************************************************
    390418DIBSection *DIBSection::section = NULL;
    391 
Note: See TracChangeset for help on using the changeset viewer.