Ignore:
Timestamp:
Oct 31, 1999, 10:38:20 PM (26 years ago)
Author:
achimha
Message:

Added DIB changes from Markus Montkowski to return initalized DIB structure + various bug fixes in DIB handling

File:
1 edited

Legend:

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

    r1396 r1533  
    1 /* $Id: dibsect.cpp,v 1.5 1999-10-21 19:25:06 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.6 1999-10-31 21:38:15 achimha Exp $ */
    22
    33/*
     
    1212#define  INCL_GPI
    1313#define  INCL_WIN
    14 #include <os2wrap.h>    //Odin32 OS/2 api wrappers
     14#include <os2wrap.h>  //Odin32 OS/2 api wrappers
    1515#include <stdlib.h>
    1616#include <string.h>
     
    2727                : bmpBits(NULL), pOS2bmp(NULL), next(NULL)
    2828{
    29  int bmpsize = pbmi->biWidth, os2bmpsize;
    30 
     29  int  os2bmpsize;
     30
     31  bmpsize = pbmi->biWidth;
    3132  /* @@@PH 98/06/07 -- high-color bitmaps don't have palette */
    3233
     
    6162        bmpsize = (bmpsize + 3) & ~3;
    6263   }
     64
    6365   bmpBits    = (char *)malloc(bmpsize*pbmi->biHeight);
    6466
     
    8587   this->handle = handle;
    8688
    87    if(section == NULL) {
    88         section = this;
     89   if(section == NULL)
     90   {
     91     dprintf(("section was NULL\n"));
     92     section = this;
    8993   }
    9094   else
    9195   {
    9296     DIBSection *dsect = section;
     97     dprintf(("Increment section starting at %08X\n",dsect));
    9398
    9499     /* @@@PH 98/07/11 fix for dsect->next == NULL */
     
    96101             (dsect->next != NULL) )
    97102     {
    98                 dsect = dsect->next;
     103       dprintf(("Increment section to %08X\n",dsect->next));
     104       dsect = dsect->next;
    99105     }
    100106     dsect->next = this;
    101107   }
     108   dprintf(("Class created"));
    102109}
    103110//******************************************************************************
     
    285292//******************************************************************************
    286293//******************************************************************************
     294int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection){
     295  if( (sizeof(DIBSECTION)==iSize) &&
     296      (pDIBSection !=NULL))
     297  {
     298    // BITMAP struct
     299    pDIBSection->dsBm.bmType       = 0;  // TODO: put the correct value here
     300    pDIBSection->dsBm.bmWidth      = pOS2bmp->cx;
     301    pDIBSection->dsBm.bmHeight     = pOS2bmp->cy;
     302    pDIBSection->dsBm.bmWidthBytes = bmpsize;
     303    pDIBSection->dsBm.bmPlanes     = pOS2bmp->cPlanes;
     304    pDIBSection->dsBm.bmBitsPixel  = pOS2bmp->cBitCount;
     305    pDIBSection->dsBm.bmBits       = bmpBits;
     306        // BITMAPINFOHEADER     data
     307        pDIBSection->dsBmih.biSize = sizeof(BITMAPINFOHEADER);
     308    pDIBSection->dsBmih.biWidth       = pOS2bmp->cx;
     309    pDIBSection->dsBmih.biHeight      = pOS2bmp->cy;
     310    pDIBSection->dsBmih.biPlanes      = pOS2bmp->cPlanes;
     311    pDIBSection->dsBmih.biBitCount    = pOS2bmp->cBitCount;
     312    pDIBSection->dsBmih.biCompression = pOS2bmp->ulCompression;
     313    pDIBSection->dsBmih.biSizeImage   = pOS2bmp->cbImage;
     314    pDIBSection->dsBmih.biXPelsPerMeter = 0; // TODO: put the correct value here
     315    pDIBSection->dsBmih.biYPelsPerMeter = 0;
     316    pDIBSection->dsBmih.biClrUsed       = (1<< pOS2bmp->cBitCount);
     317    pDIBSection->dsBmih.biClrImportant  = 0;
     318
     319    pDIBSection->dsBitfields[0] = 0; // TODO: put the correct value here
     320    pDIBSection->dsBitfields[1] = 0;
     321    pDIBSection->dsBitfields[2] = 0;
     322
     323        pDIBSection->dshSection = this->handle;
     324       
     325        pDIBSection->dsOffset = 0; // TODO: put the correct value here
     326       
     327        return 0; //ERROR_SUCCESS
     328  }
     329  return 87;    //ERROR_INVALID_PARAMETER
     330
     331}
     332//******************************************************************************
     333//******************************************************************************
    287334DIBSection *DIBSection::section = NULL;
     335
Note: See TracChangeset for help on using the changeset viewer.