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

rgb conversions added + palette fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.