Changeset 5901 for trunk/src


Ignore:
Timestamp:
Jun 3, 2001, 4:52:47 PM (24 years ago)
Author:
sandervl
Message:

rgb conversions added + palette fix

Location:
trunk/src/gdi32
Files:
4 edited

Legend:

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

    r5870 r5901  
    1 /* $Id: blit.cpp,v 1.30 2001-06-02 07:24:38 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.31 2001-06-03 14:52:46 sandervl Exp $ */
    22
    33/*
     
    2323
    2424static ULONG QueryPaletteSize(BITMAPINFOHEADER *pBHdr);
    25 static ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy);
     25ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy);
    2626
    2727//******************************************************************************
     
    452452        break;
    453453    }
    454 
    455454    if(bitfields[1] == 0x3E0)
    456455    {//RGB 555?
     
    582581//******************************************************************************
    583582//******************************************************************************
    584 static ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy)
     583ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy)
    585584{
    586585        ULONG alignment;
  • trunk/src/gdi32/dibitmap.cpp

    r5866 r5901  
    1 /* $Id: dibitmap.cpp,v 1.19 2001-06-01 12:29:25 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.20 2001-06-03 14:52:47 sandervl Exp $ */
    22
    33/*
     
    1515#include <string.h>
    1616#include <misc.h>
     17#include <cpuhlp.h>
    1718#include <winuser32.h>
    1819#include "dibsect.h"
     20#include "rgbcvt.h"
    1921
    2022#define DBG_LOCALLOG    DBG_dibitmap
    2123#include "dbglocal.h"
     24
     25ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy);
    2226
    2327//******************************************************************************
     
    296300#endif
    297301
    298     // set proper color masks!
     302    // set proper color masks
    299303    switch(lpbi->bmiHeader.biBitCount) {
    300304    case 16: //RGB 565
    301305       ((DWORD*)(lpbi->bmiColors))[0] = 0xF800;
    302        ((DWORD*)(lpbi->bmiColors))[1] = 0x07E0;
     306       ((DWORD*)(lpbi->bmiColors))[1] = 0x03E0;
    303307       ((DWORD*)(lpbi->bmiColors))[2] = 0x001F;
    304308       break;
     
    310314       break;
    311315    }
     316    if(lpvBits && lpbi->bmiHeader.biBitCount == 16 && ((DWORD*)(lpbi->bmiColors))[1] == 0x3E0)
     317    {//RGB 555?
     318        dprintf(("RGB 565->555 conversion required"));
     319
     320        int imgsize = CalcBitmapSize(lpbi->bmiHeader.biBitCount,
     321                                     lpbi->bmiHeader.biWidth, lpbi->bmiHeader.biHeight);
     322
     323        if(CPUFeatures & CPUID_MMX) {
     324             RGB565to555MMX((WORD *)lpvBits, (WORD *)lpvBits, imgsize/sizeof(WORD));
     325        }
     326        else RGB565to555((WORD *)lpvBits, (WORD *)lpvBits, imgsize/sizeof(WORD));
     327    }
     328
    312329    //WGSS/Open32 returns 0 when querying the bitmap info; must return nr of scanlines
    313330    //as 0 signals failure
  • trunk/src/gdi32/dibsect.cpp

    r5825 r5901  
    1 /* $Id: dibsect.cpp,v 1.52 2001-05-29 09:45:21 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.53 2001-06-03 14:52:47 sandervl Exp $ */
    22
    33/*
     
    746746  memcpy(pOS2bmp, tmphdr, os2bmphdrsize);
    747747
    748 #if 0
    749748  if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555?
    750749    dprintf(("DIBSection::sync: convert RGB 565 to RGB 555"));
     
    757756    else    RGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
    758757  }
    759 #endif
     758
    760759  free(tmphdr);
    761760  if(rc != nDestHeight) {
  • trunk/src/gdi32/palette.cpp

    r5825 r5901  
    1 /* $Id: palette.cpp,v 1.9 2001-05-29 09:45:21 sandervl Exp $ */
     1/* $Id: palette.cpp,v 1.10 2001-06-03 14:52:47 sandervl Exp $ */
    22
    33/*
     
    5858    rc = O32_RealizePalette(hdc);
    5959    dprintf(("GDI32: RealizePalette %x returned %d", hdc, rc));
     60    if(rc && DIBSection::getSection() != NULL)
     61    {
     62        DIBSection *dsect = DIBSection::findHDC(hdc);
     63        if(dsect)
     64        {
     65            dsect->sync(hdc, 0, dsect->GetHeight());
     66        }
     67    }
    6068    return rc;
    6169}
     
    8593  dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X)", hdc, hPalette, bForceBackground));
    8694  hPal = O32_SelectPalette(hdc, hPalette, bForceBackground);
    87 
    88   //hack for beyond compare buttons (+ other apps)
    89   //seems to select old palette into dc before unselecting dib section
    90   if(bForceBackground != -1 && DIBSection::getSection() != NULL)
    91   {
    92     DIBSection *dsect = DIBSection::findHDC(hdc);
    93     if(dsect)
    94     {
    95         dsect->sync(hdc, 0, dsect->GetHeight());
    96     }
    97   }
    9895  return hPal;
    9996}
Note: See TracChangeset for help on using the changeset viewer.