Changeset 5390 for trunk/src


Ignore:
Timestamp:
Mar 27, 2001, 10:47:53 PM (24 years ago)
Author:
sandervl
Message:

DeleteDC check for DIB section + SelectObject fixes

Location:
trunk/src
Files:
7 edited

Legend:

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

    r4947 r5390  
    1 /* $Id: dibitmap.cpp,v 1.14 2001-01-14 17:17:45 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.15 2001-03-27 20:47:52 sandervl Exp $ */
    22
    33/*
     
    307307        DIBSection *dsect;
    308308
    309         dsect = DIBSection::find((DWORD)hBitmap);
     309        dsect = DIBSection::findObj(hBitmap);
    310310        if(dsect) {
    311311           return dsect->SetDIBits(hdc, hBitmap, startscan, numlines, pBits, (BITMAPINFOHEADER_W *)&pBitmapInfo->bmiHeader, usage);
  • trunk/src/gdi32/dibsect.cpp

    r5346 r5390  
    1 /* $Id: dibsect.cpp,v 1.47 2001-03-21 12:31:36 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.48 2001-03-27 20:47:52 sandervl Exp $ */
    22
    33/*
     
    3939//******************************************************************************
    4040DIBSection::DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip)
    41                 : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsDblBuffer(NULL)
     41                : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsDblBuffer(NULL),
     42                  hdc(0), hwndParent(0)
    4243{
    4344 int  palsize=0;
     
    723724//******************************************************************************
    724725//******************************************************************************
    725 DIBSection *DIBSection::find(DWORD handle)
     726DIBSection *DIBSection::findObj(HANDLE handle)
    726727{
    727728 DIBSection *dsect = section;
     
    759760//******************************************************************************
    760761//******************************************************************************
    761 void DIBSection::deleteSection(DWORD handle)
    762 {
    763  DIBSection *dsect = find(handle);
     762void DIBSection::deleteSection(HANDLE handle)
     763{
     764 DIBSection *dsect = findObj(handle);
    764765
    765766  if(dsect)
  • trunk/src/gdi32/dibsect.h

    r5333 r5390  
    1 /* $Id: dibsect.h,v 1.23 2001-03-19 19:27:53 sandervl Exp $ */
     1/* $Id: dibsect.h,v 1.24 2001-03-27 20:47:52 sandervl Exp $ */
    22
    33/*
     
    109109
    110110 static DIBSection *getSection() { return section; } ;
    111  static DIBSection *find(DWORD handle);
     111 static DIBSection *findObj(HANDLE handle);
    112112 static DIBSection *findHDC(HDC hdc);
    113  static       void  deleteSection(DWORD handle);
     113 static       void  deleteSection(HANDLE handle);
    114114protected:
    115115
  • trunk/src/gdi32/gdi32.DEF

    r4899 r5390  
    1 ; $Id: gdi32.DEF,v 1.15 2001-01-09 18:12:58 sandervl Exp $
     1; $Id: gdi32.DEF,v 1.16 2001-03-27 20:47:52 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    373373    _setWinDeviceRegionFromPMDeviceRegion@16                    @1211 NONAME
    374374
    375 
    376 
     375    _UnselectGDIObjects@4                                       @1212 NONAME
     376
  • trunk/src/gdi32/gdi32.cpp

    r5044 r5390  
    1 /* $Id: gdi32.cpp,v 1.66 2001-02-01 18:01:52 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.67 2001-03-27 20:47:53 sandervl Exp $ */
    22
    33/*
     
    184184  }
    185185  SetLastError(ERROR_SUCCESS);
     186
     187  DIBSection *dsect = DIBSection::findHDC(hdc);
     188  if(dsect)
     189  {
     190      //remove previously selected dibsection
     191      dprintf(("DeleteDC %x, unselect DIB section %x", hdc, dsect->GetBitmapHandle()));
     192      dsect->UnSelectDIBObject();
     193  }
     194
    186195  //Must call ReleaseDC for window dcs
    187196  if(pHps->hdcType == TYPE_1) {
     
    12471256BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
    12481257{
    1249   dprintf(("GDI32: GdiComment, not implemented (TRUE)\n"));
    1250   return(TRUE);
     1258  dprintf(("GDI32: GdiComment %x %d %x NOT IMPLEMENTED", hdc, cbSize, lpData));
     1259//  return O32_GdiComment(hdc, cbSize, lpData);
     1260  return TRUE;
    12511261}
    12521262//******************************************************************************
  • trunk/src/gdi32/objhandle.cpp

    r4963 r5390  
    1 /* $Id: objhandle.cpp,v 1.11 2001-01-18 18:13:18 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.12 2001-03-27 20:47:53 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    177177  if(DIBSection::getSection() != NULL)
    178178  {
    179         DIBSection *dsect = DIBSection::find(hObject);
     179        DIBSection *dsect = DIBSection::findObj(hObject);
    180180        if(dsect)
    181181        {
     
    236236{
    237237 HGDIOBJ rc;
    238 
    239     dprintf2(("GDI32: SelectObject %x %x", hdc, hObj));
    240 
    241     if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
     238 DWORD   handleType = GetObjectType(hObj);
     239
     240    dprintf2(("GDI32: SelectObject %x %x type %x", hdc, hObj, handleType));
     241
     242    if(handleType == GDIOBJ_REGION) {
    242243        //Return complexity here; not previously selected clip region
    243244        return (HGDIOBJ)SelectClipRgn(hdc, hObj);
    244245    }
    245246
    246     if(DIBSection::getSection() != NULL)
     247    if(handleType == OBJ_BITMAP && DIBSection::getSection() != NULL)
    247248    {
    248249        DIBSection *dsect;
    249250
    250         dsect = DIBSection::find(hdc);
     251        dsect = DIBSection::findHDC(hdc);
    251252        if(dsect)
    252253        {
     
    254255            dsect->UnSelectDIBObject();
    255256        }
    256         dsect = DIBSection::find((DWORD)hObj);
     257        dsect = DIBSection::findObj(hObj);
    257258        if(dsect)
    258259        {
     
    261262    }
    262263    rc = O32_SelectObject(hdc, hObj);
    263     if(rc != 0 && DIBSection::getSection != NULL)
    264     {
    265         DIBSection *dsect = DIBSection::find((DWORD)rc);
     264    if(rc != 0 && GetObjectType(rc) == OBJ_BITMAP && DIBSection::getSection != NULL)
     265    {
     266        DIBSection *dsect = DIBSection::findObj(rc);
    266267        if(dsect)
    267268        {
     
    270271    }
    271272#ifdef USING_OPEN32
    272     if(O32_GetObjectType(hObj) == OBJ_BITMAP)
     273    if(handleType == OBJ_BITMAP)
    273274    {
    274275        //SvL: Open32 messes up the height of the hdc (for windows)
     
    286287}
    287288//******************************************************************************
     289//Called from user32 ReleaseDC (for non CS_OWNDC hdcs)
     290//******************************************************************************
     291VOID WIN32API UnselectGDIObjects(HDC hdc)
     292{
     293    DIBSection *dsect;
     294
     295    dsect = DIBSection::findHDC(hdc);
     296    if(dsect)
     297    {
     298        //remove previously selected dibsection
     299        dsect->UnSelectDIBObject();
     300    }
     301}
     302//******************************************************************************
    288303//******************************************************************************
    289304DWORD WIN32API GetObjectType( HGDIOBJ hObj)
  • trunk/src/user32/dc.cpp

    r5314 r5390  
    1 /* $Id: dc.cpp,v 1.95 2001-03-14 15:55:43 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.96 2001-03-27 20:47:22 sandervl Exp $ */
    22
    33/*
     
    3535#include <dcdata.h>
    3636#include <codepage.h>
     37#include <wingdi32.h>
    3738
    3839#define INCLUDED_BY_DC
     
    966967   }
    967968   else {
     969        UnselectGDIObjects(hdc);
    968970        rc = O32_ReleaseDC (0, hdc);
    969971   }
Note: See TracChangeset for help on using the changeset viewer.