Changeset 7717 for trunk/src


Ignore:
Timestamp:
Dec 31, 2001, 1:08:23 PM (24 years ago)
Author:
sandervl
Message:

use critical section in dib section class instead of vmutex

Location:
trunk/src/gdi32
Files:
6 edited

Legend:

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

    r7713 r7717  
    1 /* $Id: blit.cpp,v 1.36 2001-12-30 22:19:04 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.37 2001-12-31 12:08:20 sandervl Exp $ */
    22
    33/*
     
    3838  dprintf(("GDI32: StretchBlt Src : %x (%d, %d) size (%d, %d)\n",
    3939           hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc));
     40
    4041  SetLastError(ERROR_SUCCESS);
    4142  if(DIBSection::getSection() != NULL)
     
    4849                             nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
    4950                             dwRop);
     51        dprintf(("GDI32: StretchBlt returned %d", rc));
    5052        return rc;
    5153    }
     
    5759          destdib->sync(hdcDest, nYOriginDest, nHeightDest);
    5860      }
     61  }
     62  if(rc == FALSE) {
     63      dprintf(("!WARNING!: GDI32: StretchBlt returned FALSE; last error %x", rc, GetLastError()));
    5964  }
    6065  return rc;
     
    7378{
    7479  BOOL rc;
     80
     81  POINT point1, point2;
     82  GetViewportOrgEx(hdcDest, &point1);
     83  GetViewportOrgEx(hdcSrc, &point2);
     84  dprintf(("BitBlt: Viewport origin dest (%d,%d) src (%d,%d)", point1.x, point1.y, point2.x, point2.y));
    7585
    7686  SetLastError(ERROR_SUCCESS);
  • trunk/src/gdi32/dibsect.cpp

    r7662 r7717  
    1 /* $Id: dibsect.cpp,v 1.61 2001-12-20 19:57:01 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.62 2001-12-31 12:08:20 sandervl Exp $ */
    22
    33/*
     
    2020#include <win32type.h>
    2121#include <misc.h>
    22 #define  OS2_ONLY
    23 #include "dibsect.h"
    24 #include <vmutex.h>
    2522#include <win32api.h>
    2623#include <winconst.h>
     
    2825#include <cpuhlp.h>
    2926#include <dcdata.h>
     27#include "dibsect.h"
    3028#include "oslibgpi.h"
    3129#include "rgbcvt.h"
     
    3331#define DBG_LOCALLOG  DBG_dibsect
    3432#include "dbglocal.h"
    35 
    36 static VMutex dibMutex;
    3733
    3834//******************************************************************************
     
    176172   this->iUsage = iUsage;
    177173
    178    dibMutex.enter();
     174   lock();
    179175   if(section == NULL)
    180176   {
     
    195191     dsect->next = this;
    196192   }
    197    dibMutex.leave();
     193   unlock();
    198194}
    199195//******************************************************************************
     
    216212        free(pOS2bmp);
    217213
    218    dibMutex.enter();
     214   lock();
    219215   if(section == this)
    220216   {
     
    231227     dsect->next = this->next;
    232228   }
    233    dibMutex.leave();
     229   unlock();
    234230}
    235231//******************************************************************************
     
    489485        hdcHeight = rect.bottom - rect.top;
    490486        hdcWidth  = rect.right - rect.left;
     487        dprintf(("DIBSection::BitBlt hdc size (%d,%d) (WINDOW)", hdcWidth, hdcHeight));
    491488  }
    492489  else {
    493490        hdcHeight = pHps->bitmapHeight;
    494491        hdcWidth  = pHps->bitmapWidth;
     492        dprintf(("DIBSection::BitBlt hdc size (%d,%d) (BMP)", hdcWidth, hdcHeight));
    495493  }
    496494
     
    498496  //This messes up the two bitmaps in the opening window of Opera 6
    499497  //(choice between MDI & SDI interface)
    500 #if 0
    501   if(nXdest + nDestWidth > hdcWidth) {
    502         nDestWidth  = hdcWidth - nXdest;
    503   }
    504 
    505   if(nYdest + nDestHeight > hdcHeight) {
    506         nDestHeight = hdcHeight - nYdest;
    507   }
    508 #endif
    509498
    510499  //win32 coordinates are relative to left top, OS/2 expects left bottom
     
    513502
    514503  point[0].x = nXdest;
     504  point[1].x = nXdest + nDestWidth - 1;
     505#ifdef INVERT
    515506  point[0].y = hdcHeight - nYdest - nDestHeight;
    516   point[1].x = nXdest + nDestWidth - 1;
    517507  point[1].y = hdcHeight - nYdest - 1;
    518 
    519 #if 0
    520   //Don't check size here either. Let GpiDrawBits do that for us
    521   if(nXsrc + nSrcWidth > pOS2bmp->cx) {
    522         nSrcWidth  = pOS2bmp->cx - nXsrc;
    523   }
    524   if(nYsrc + nSrcHeight > pOS2bmp->cy) {
    525         nSrcHeight = pOS2bmp->cy - nYsrc;
    526   }
     508#else
     509  point[0].y = nYdest;
     510  point[1].y = nYdest + nDestHeight - 1;
    527511#endif
    528512
    529513  //target rectangle is inclusive-inclusive
    530514  point[2].x = nXsrc;
     515  point[3].x = nXsrc + nSrcWidth;
     516#ifdef INVERT
    531517  point[2].y = pOS2bmp->cy - nYsrc - nSrcHeight;
    532   point[3].x = nXsrc + nSrcWidth;
    533518  point[3].y = pOS2bmp->cy - nYsrc;
     519#else
     520  point[2].y = nYsrc;
     521  point[3].y = nYsrc + nSrcHeight - 1;
     522#endif
    534523
    535524  dprintf(("DIBSection::BitBlt (%d,%d)(%d,%d) from (%d,%d)(%d,%d) dim (%d,%d)(%d,%d)", point[0].x, point[0].y,
     
    540529  oldyinversion = GpiQueryYInversion(hps);
    541530  if(oldyinversion != 0) {
     531#ifdef DEBUG
     532        POINT point;
     533        GetViewportOrgEx(hps, &point);
     534        dprintf(("Viewport origin (%d,%d)", point.x, point.y));
     535#endif
    542536        GpiEnableYInversion(hps, 0);
    543537        fRestoryYInversion = TRUE;
     
    631625        if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion);
    632626#endif
    633             SetLastError(ERROR_SUCCESS_W);
     627        SetLastError(ERROR_SUCCESS_W);
    634628
    635629        return(TRUE);
     
    661655      dprintf(("Sync destination dibsection: hdc y inversion = %d", oldyinversion));
    662656      if(oldyinversion != 0) {
     657#ifdef DEBUG
     658          POINT point;
     659          GetViewportOrgEx(hdc, &point);
     660          dprintf(("Viewport origin (%d,%d)", point.x, point.y));
     661#endif
    663662          GpiEnableYInversion(hdc, 0);
    664663      }
     
    774773
    775774  DIBSection *dsect = section;
    776   dibMutex.enter();
     775  lock();
    777776
    778777  do
     
    780779    if(dsect->handle == handle)
    781780    {
    782         dibMutex.leave();
     781        unlock();
    783782        return(dsect);
    784783    }
     
    787786  while(dsect);
    788787
    789   dibMutex.leave();
     788  unlock();
    790789  return(NULL);
    791790}
     
    801800  DIBSection *dsect = section;
    802801 
     802  lock();
    803803  do
    804804  {
    805805        if(dsect->hdc == hdc)
    806806        {
     807            unlock();
    807808            return(dsect);
    808809        }
     
    810811  }
    811812  while(dsect);
    812    
     813
     814  unlock();   
    813815  return(NULL);
    814816}
     
    873875//******************************************************************************
    874876//******************************************************************************
    875 DIBSection *DIBSection::section = NULL;
     877void DIBSection::initDIBSection()
     878{
     879    InitializeCriticalSection(&dibcritsect);
     880}
     881//******************************************************************************
     882//******************************************************************************
     883DIBSection      *DIBSection::section = NULL;
     884CRITICAL_SECTION DIBSection::dibcritsect;
  • trunk/src/gdi32/dibsect.h

    r5825 r7717  
    1 /* $Id: dibsect.h,v 1.25 2001-05-29 09:45:21 sandervl Exp $ */
     1/* $Id: dibsect.h,v 1.26 2001-12-31 12:08:21 sandervl Exp $ */
    22
    33/*
     
    99#define __DIBSECT_H__
    1010
    11 #ifdef OS2_ONLY
     11#ifdef OS2_INCLUDED
    1212typedef struct
    1313{
     
    6161typedef BITMAPINFO *LPBITMAPINFO;
    6262
    63 #ifdef OS2_ONLY
     63#ifdef OS2_INCLUDED
    6464#define DIB_RGB_COLORS   0
    6565#define DIB_PAL_COLORS   1
     
    113113 static DIBSection *findHDC(HDC hdc);
    114114 static       void  deleteSection(HANDLE handle);
     115
     116 static       void  initDIBSection();
     117
     118 static       void  lock()   { EnterCriticalSection(&dibcritsect); };
     119 static       void  unlock() { LeaveCriticalSection(&dibcritsect); };
     120
    115121protected:
    116122
     
    129135              DIBSection*    next;                   // Next DIB section
    130136    static    DIBSection*    section;                // List of DIB sections
     137
     138    static    CRITICAL_SECTION dibcritsect;
    131139};
    132140
  • trunk/src/gdi32/gdi32.cpp

    r7675 r7717  
    1 /* $Id: gdi32.cpp,v 1.78 2001-12-23 16:40:10 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.79 2001-12-31 12:08:22 sandervl Exp $ */
    22
    33/*
     
    227227
    228228    if(newHdc) STATS_CreateCompatibleDC(hdc, newHdc);
    229 
    230229    OSLibGpiSetCp(newHdc, oldcp);
    231230    dprintf(("CreateCompatibleDC %X returned %x", hdc, newHdc));
     
    922921COLORREF WIN32API GetTextColor( HDC hdc)
    923922{
    924     dprintf(("GDI32: GetTextColor %x", hdc));
    925     return O32_GetTextColor(hdc);
    926 }
    927 //******************************************************************************
    928 //******************************************************************************
     923    COLORREF color;
     924
     925    color = O32_GetTextColor(hdc);
     926    dprintf(("GDI32: GetTextColor %x -> %x", hdc, color));
     927    return color;
     928}
    929929//******************************************************************************
    930930//******************************************************************************
  • trunk/src/gdi32/initgdi32.cpp

    r7640 r7717  
    1 /* $Id: initgdi32.cpp,v 1.10 2001-12-16 15:29:55 sandervl Exp $
     1/* $Id: initgdi32.cpp,v 1.11 2001-12-31 12:08:23 sandervl Exp $
    22 *
    33 * DLL entry point
     
    2626#define  INCL_DOSMODULEMGR
    2727#define  INCL_DOSPROCESS
     28#define  INCL_GPI
    2829#include <os2wrap.h>    //Odin32 OS/2 api wrappers
    2930#include <stdlib.h>
     
    3132#include <string.h>
    3233#include <odin.h>
    33 #include <win32type.h>
     34#include <win32api.h>
    3435#include <winconst.h>
    3536#include <odinlx.h>
    3637#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
    37 #define DBG_LOCALLOG    DBG_initterm
    38 #include "dbglocal.h"
    3938#include "region.h"
    4039#include <initdll.h>
    4140#include <stats.h>
     41#include "dibsect.h"
     42
     43#define DBG_LOCALLOG    DBG_initterm
     44#include "dbglocal.h"
    4245
    4346extern "C" {
     
    9497             return 0UL;
    9598         }
     99         DIBSection::initDIBSection();
    96100         dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&gdi32_PEResTab,
    97101                                   GDI32_MAJORIMAGE_VERSION, GDI32_MINORIMAGE_VERSION,
  • trunk/src/gdi32/oslibgdi.cpp

    r5931 r7717  
    1 /* $Id: oslibgdi.cpp,v 1.7 2001-06-08 11:03:33 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.8 2001-12-31 12:08:23 sandervl Exp $ */
    22
    33/*
     
    1414#include <stdlib.h>
    1515#include <string.h>
    16 #include <win32type.h>
     16#include <win32api.h>
    1717#include <misc.h>
    18 #define  OS2_ONLY
    1918#include "dibsect.h"
    2019#include "oslibgdi.h"
Note: See TracChangeset for help on using the changeset viewer.