[Bug 3319] GetDeviceCaps: BITSPIXEL returning 15 on 15bit graphics

Wine Bugs wine-bugs at winehq.org
Tue Aug 7 15:43:11 CDT 2007


http://bugs.winehq.org/show_bug.cgi?id=3319





------- Additional Comments From T.Bonner at freesurf.ch  2007-07-08 15:43 -------
The bug seemed fixed, I had no problems with it (trying out a later wine
version). The problem occured on a Permedia II graphics card, just testing out
the high-color mode. For interest I attach a windows function to detect 15 or 16
Bits: 


/* 565 or 555? */
int DisplayBits (void)
{
  HDC hdcDisplay;
  HBITMAP hbm;
  struct MyBitmapInfo
  {
    BITMAPINFOHEADER bi;
    union
    {
      RGBQUAD colors[256];
      DWORD fields[256];
    } un;
  } video;

  ZeroMemory(&video, sizeof(video));
  video.bi.biSize = sizeof(video.bi);
  video.bi.biBitCount = 0;
  
  hdcDisplay = GetDC(NULL);
  hbm = CreateCompatibleBitmap(hdcDisplay,1,1);

  /* twice!!! (on 16-HiColor needed! otherwise erroneously 555 detected!) */
  GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&video,DIB_RGB_COLORS);
  GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&video,DIB_RGB_COLORS);

  DeleteObject(hbm);
  ReleaseDC(NULL,hdcDisplay);

  if (video.bi.biCompression != BI_BITFIELDS) {
    /* Either BI_RGB or BI_RLE_something
     * .... or perhaps (!!) something else.
     * Theoretically biCompression might be
     * mmioFourCC('c','v','i','d') but I doubt it.
     */
    if (video.bi.biBitCount==16 && video.bi.biCompression == BI_RGB) {
      return 15; /* That is, 555*/
    } else {
      return video.bi.biBitCount;
    }
  } else {
    DWORD allmasks = 
      video.un.fields[0] | 
      video.un.fields[1] | 
      video.un.fields[2];
    int k=0;
    while (allmasks) {
      if (allmasks&1) k++;
      allmasks /= 2;
    }
    return k;
  }
} /*DisplayBits*/


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list