Ignore:
Timestamp:
Sep 4, 1999, 2:42:10 PM (26 years ago)
Author:
sandervl
Message:

icongroup & cursorgroup fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/cvticon.cpp

    r589 r816  
    1 /* $Id: cvticon.cpp,v 1.2 1999-08-19 19:50:40 sandervl Exp $ */
     1/* $Id: cvticon.cpp,v 1.3 1999-09-04 12:41:46 sandervl Exp $ */
    22
    33/*
     
    2727
    2828//******************************************************************************
     29//******************************************************************************
     30ULONG QueryConvertedIconSize(WINBITMAPINFOHEADER *bmpHdr, int size)
     31{
     32 int bwsize, colorsize, rgbsize, iconsize;
     33
     34  bwsize   = (bmpHdr->biWidth*(bmpHdr->biHeight/2))/8;
     35  colorsize = bmpHdr->biWidth*(bmpHdr->biHeight/2);
     36  //SvL: 28-09-'98: only for <= 8
     37  if(bmpHdr->biBitCount <= 8)
     38        rgbsize = (1<<bmpHdr->biBitCount)*sizeof(RGB2);
     39  else  rgbsize = 0;
     40
     41  switch(bmpHdr->biBitCount) {
     42        case 1:
     43                colorsize /= 8;
     44                break;
     45        case 4:
     46                colorsize /= 2;
     47                break;
     48        case 8:
     49                break;
     50        case 16:
     51                colorsize *= 2;
     52                break;
     53        case 24:
     54                colorsize *= 3;
     55                break;
     56        case 32:
     57                colorsize *= 4;
     58                break;
     59  }
     60  if(bmpHdr->biSizeImage == 0 && bmpHdr->biCompression == 0) {
     61        bmpHdr->biSizeImage = bwsize + colorsize;
     62  }
     63
     64  //SvL: 28-09-'98: cllngenu.dll has an incorrect size in the header
     65  if(bmpHdr->biSizeImage < colorsize) {
     66        bmpHdr->biSizeImage = colorsize;
     67  }
     68  //bitmapfileheader for AndXor mask + 2 RGB structs + bitmapfileheader
     69  //for color bitmap + RGB structs for all the colors
     70  //SvL, 3-3-98: 2*bwsize
     71  iconsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) +
     72             rgbsize + 2*bwsize + bmpHdr->biSizeImage;
     73
     74  return iconsize;
     75}
     76//******************************************************************************
    2977//NOTE: offsetBits is the value added to the offBits bitmap structure members
    3078//      (handy for converting icon groups)
    3179//******************************************************************************
    32 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int offsetBits)
     80void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int *os2size, int offsetBits)
    3381{
    3482 RGBQUAD *rgb;
     
    83131  iconsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) +
    84132             rgbsize + 2*bwsize + bmpHdr->biSizeImage;
     133#if 0
     134  //SvL: Not necessary anymore
    85135  //There are icons without an XOR mask, so check for it
    86136  if(bmpHdr->biSizeImage == colorsize) {
    87137        iconsize += bwsize;
    88138  }
     139#endif
    89140  iconhdr  = (BITMAPFILEHEADER2 *)malloc(iconsize);
    90141  memset(iconhdr, 0, iconsize);
     
    104155  os2rgb                 = (RGB2 *)(iconhdr+1);
    105156  memset(os2rgb, 0, sizeof(RGB2));
    106   memset(os2rgb+1, 0xff, sizeof(RGB2)); //not reserved byte
     157  memset(os2rgb+1, 0xff, sizeof(RGB)); //not reserved byte!
    107158  iconhdr2               = (BITMAPFILEHEADER2 *)(os2rgb+2);
    108159  iconhdr2->usType       = BFT_COLORICON;
     
    143194        memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize);
    144195  }
     196  *os2size = iconsize;
    145197  return (void *)iconhdr;
    146198}
Note: See TracChangeset for help on using the changeset viewer.