Ignore:
Timestamp:
Aug 18, 2000, 8:14:59 PM (25 years ago)
Author:
sandervl
Message:

lots of small changes; CreateHalftonePalette + rgb 565 -> rgb 555 conversion

File:
1 edited

Legend:

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

    r3755 r4034  
    1 /* $Id: dibsect.cpp,v 1.36 2000-06-26 10:27:45 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.37 2000-08-18 18:14:57 sandervl Exp $ */
    22
    33/*
    44 * GDI32 DIB sections
    55 *
    6  * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
     6 * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl)
    77 * Copyright 1998 Patrick Haller
    88 *
     
    131131
    132132   dibinfo.dshSection       = handle;
    133    dibinfo.dsOffset         = 0; // TODO: put the correct value here (if createdibsection with file handle)
     133   dibinfo.dsOffset         = dwOffset;
    134134
    135135   if(iUsage == DIB_PAL_COLORS || pbmi->biBitCount <= 8)
     
    555555  dprintf(("Sync destination dibsection %x (%x)", handle, hdc));
    556556
    557   //todo: rgb 565 to 555 conversion if bpp == 16
    558   if(GetBitCount() == 16) {
    559         dprintf(("WARNING: need to convert RGB 565 to RGB 555!!"));
    560   }
    561 
    562557  BITMAPINFO2 *tmphdr = (BITMAPINFO2 *)malloc(os2bmphdrsize);
    563558  memcpy(tmphdr, pOS2bmp, os2bmphdrsize);
     
    582577                          tmphdr);
    583578  }
     579  if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555?
     580        dprintf(("DIBSection::sync: convert RGB 565 to RGB 555"));
     581
     582        destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes;
     583
     584        if(CPUFeatures & CPUID_MMX) {
     585                RGB565to555MMX((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
     586        }
     587        else    RGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
     588  }
    584589  free(tmphdr);
    585590  if(rc != nDestHeight) {
Note: See TracChangeset for help on using the changeset viewer.