Changeset 1830 for trunk/src


Ignore:
Timestamp:
Nov 24, 1999, 8:30:18 PM (26 years ago)
Author:
sandervl
Message:

EB's dibsection updates

Location:
trunk/src/gdi32
Files:
3 edited

Legend:

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

    r1710 r1830  
    1 /* $Id: dibsect.cpp,v 1.8 1999-11-12 11:38:38 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.9 1999-11-24 19:30:18 sandervl Exp $ */
    22
    33/*
     
    145145        dsect->next = this->next;
    146146   }
     147}
     148//******************************************************************************
     149//******************************************************************************
     150int DIBSection::SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
     151                          lines, const VOID *bits, WINBITMAPINFOHEADER *pbmi,
     152                          UINT coloruse)
     153{
     154  lines = (int)lines >= 0 ? (int)lines : (int)-lines;
     155  int  os2bmpsize;
     156  int  palsize=0;
     157
     158  bmpsize = pbmi->biWidth;
     159  os2bmpsize = sizeof(BITMAPINFO2);
     160
     161  switch(pbmi->biBitCount)
     162  {
     163        case 1:
     164                bmpsize /= 8;
     165                palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
     166                os2bmpsize += palsize;
     167                break;
     168        case 4:
     169                bmpsize /= 2;
     170                palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
     171                os2bmpsize += palsize;
     172                break;
     173        case 8:
     174                palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
     175                os2bmpsize += palsize;
     176                break;
     177        case 16:
     178                bmpsize *= 2;
     179                break;
     180        case 24:
     181                bmpsize *= 3;
     182                break;
     183        case 32:
     184                bmpsize *= 4;
     185                break;
     186   }
     187   if(bmpsize & 3) {
     188        bmpsize = (bmpsize + 3) & ~3;
     189   }
     190
     191   bmpBits    = (char *)realloc(bmpBits, bmpsize*pbmi->biHeight);
     192   pOS2bmp    = (BITMAPINFO2 *)realloc(pOS2bmp, os2bmpsize);
     193
     194   pOS2bmp->cbFix         = sizeof(BITMAPINFO2) - sizeof(RGB2);
     195   pOS2bmp->cx            = pbmi->biWidth;
     196   pOS2bmp->cy            = pbmi->biHeight;
     197   pOS2bmp->cPlanes       = pbmi->biPlanes;
     198   pOS2bmp->cBitCount     = pbmi->biBitCount;
     199   pOS2bmp->ulCompression = pbmi->biCompression;
     200   pOS2bmp->cbImage       = pbmi->biSizeImage;
     201
     202   if(palsize)
     203     memcpy(pOS2bmp->argbColor, (char *)pbmi + 1 , palsize);
     204
     205   if(bits)
     206   {
     207     int size = bmpsize*lines;
     208     memcpy(bmpBits+bmpsize*startscan, bits, size);
     209   }
     210   return(lines);
    147211}
    148212//******************************************************************************
  • trunk/src/gdi32/dibsect.h

    r1686 r1830  
    1 /* $Id: dibsect.h,v 1.5 1999-11-10 14:15:23 sandervl Exp $ */
     1/* $Id: dibsect.h,v 1.6 1999-11-24 19:30:18 sandervl Exp $ */
    22
    33/*
     
    7575               int  SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
    7676
     77               int  SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
     78                              lines, const VOID *bits, WINBITMAPINFOHEADER *pbmi,
     79                              UINT coloruse);
     80
    7781               int  GetDIBSection(int iSize , DIBSECTION *pDIBSection);
    7882
  • trunk/src/gdi32/gdi32.cpp

    r1703 r1830  
    1 /* $Id: gdi32.cpp,v 1.16 1999-11-11 13:16:40 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.17 1999-11-24 19:30:18 sandervl Exp $ */
    22
    33/*
     
    19031903int WIN32API SetDIBits( HDC arg1, HBITMAP arg2, UINT arg3, UINT arg4, const VOID * arg5, const BITMAPINFO * arg6, UINT  arg7)
    19041904{
    1905     dprintf(("GDI32: SetDIBits\n"));
     1905    dprintf(("GDI32: SetDIBits %x %x %x %x %x %x %x\n", arg1, arg2, arg3, arg4, arg5, arg6, arg7));
     1906
     1907    if(DIBSection::getSection() != NULL) {
     1908        DIBSection *dsect;
     1909
     1910        dsect = DIBSection::find((DWORD)arg2);
     1911        if(dsect) {
     1912           return dsect->SetDIBits(arg1, arg2, arg3, arg4, arg5, (WINBITMAPINFOHEADER *)&arg6->bmiHeader, arg7);
     1913        }
     1914    }
    19061915    return O32_SetDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
    19071916}
Note: See TracChangeset for help on using the changeset viewer.