Ignore:
Timestamp:
Jun 14, 2000, 3:17:51 PM (25 years ago)
Author:
sandervl
Message:

region changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/dcrgn.cpp

    r3679 r3705  
    1 /* $Id: dcrgn.cpp,v 1.1 2000-06-08 18:10:10 sandervl Exp $ */
     1/* $Id: dcrgn.cpp,v 1.2 2000-06-14 13:15:24 sandervl Exp $ */
    22
    33/*
     
    3333#include "oslibmsg.h"
    3434#include <dcdata.h>
     35#include <objhandle.h>
     36#include <wingdi32.h>
    3537
    3638#define INCLUDED_BY_DC
     
    4244//******************************************************************************
    4345//******************************************************************************
    44 int WIN32API GetClipBox( HDC hdc, PRECT lpRect)
    45 {
    46  pDCData  pHps = (pDCData)GpiQueryDCData((HPS)hdc);
    47  RECTL    rectl;
    48  LONG     lComplexity;
    49  int      rc;
    50 
    51     if(!hdc || !lpRect || !pHps) {
    52         dprintf(("GDI32: GetClipBox %x %x ERROR_INVALID_PARAMETER", hdc, lpRect));
    53         SetLastError(ERROR_INVALID_PARAMETER_W);
    54         return ERROR_W;
    55     }
    56     if(pHps->isPrinter)
    57     {
    58         lpRect->left   = 0;
    59         lpRect->top    = 0;
    60         lpRect->right  = GetDeviceCaps( hdc, HORZRES_W);
    61         lpRect->bottom = GetDeviceCaps( hdc, VERTRES_W);
    62 
    63         rc = SIMPLEREGION_W;
    64     }
    65     else {
    66         lComplexity = GpiQueryClipBox(pHps->hps, &rectl);
    67         if(lComplexity == RGN_ERROR)
    68         {
    69                 rc = ERROR_W;
    70         }
    71         else
    72         if(lComplexity == RGN_NULL)
    73         {
    74                 memset(lpRect, 0, sizeof(*lpRect));
    75                 rc = NULLREGION_W;
    76         }
    77         else {
    78                 lpRect->left   = rectl.xLeft;
    79                 lpRect->right  = rectl.xRight;
    80 #if 0
    81                 lpRect->top    = pHps->height - rectl.yTop;
    82                 lpRect->bottom = pHps->height - rectl.yBottom;
    83 #else
    84                 //No conversion required as GpiQueryClipBox is affected by
    85                 //the y-inversion of the window
    86                 lpRect->top    = rectl.yBottom;
    87                 lpRect->bottom = rectl.yTop;
    88 #endif
    89                 //Convert including/including to including/excluding
    90                 if(lpRect->left != lpRect->right) {
    91                         lpRect->right++;
    92                 }
    93                 if(lpRect->top != lpRect->bottom) {
    94                         lpRect->bottom++;
    95                 }
    96                 rc = (lComplexity == RGN_RECT) ? SIMPLEREGION_W : COMPLEXREGION_W;
    97         }
    98     }
    99     dprintf(("GDI32: GetClipBox of %X returned %d\n", hdc, rc));
    100     return rc;
    101 }
    102 //******************************************************************************
    103 //******************************************************************************
    104 int WIN32API GetClipRgn( HDC hdc, HRGN hRgn)
    105 {
    106  int rc;
    107 
    108     rc = O32_GetClipRgn(hdc, hRgn);
    109     dprintf(("GDI32: GetClipRgn %x %x returned %x", hdc, hRgn, rc));
    110     return rc;
    111 }
    112 //******************************************************************************
    113 //******************************************************************************
    114 int WIN32API ExcludeClipRect( HDC arg1, int arg2, int arg3, int arg4, int  arg5)
    115 {
    116     dprintf(("GDI32: ExcludeClipRect"));
    117     return O32_ExcludeClipRect(arg1, arg2, arg3, arg4, arg5);
    118 }
    119 //******************************************************************************
    120 //******************************************************************************
    121 int WIN32API IntersectClipRect(HDC arg1, int arg2, int arg3, int arg4, int  arg5)
    122 {
    123  int rc;
    124 
    125   rc = O32_IntersectClipRect(arg1, arg2, arg3, arg4, arg5);
    126   dprintf(("GDI32: IntersectClipRect returned %d\n", rc));
    127   return(rc);
    128 }
    129 //******************************************************************************
    130 //******************************************************************************
    131 int WIN32API ExtSelectClipRgn( HDC arg1, HRGN arg2, int  arg3)
    132 {
    133     dprintf(("GDI32: ExtSelectClipRgn"));
    134     return O32_ExtSelectClipRgn(arg1, arg2, arg3);
    135 }
    136 //******************************************************************************
    137 //******************************************************************************
    138 int WIN32API OffsetClipRgn( HDC arg1, int arg2, int  arg3)
    139 {
    140     dprintf(("GDI32: OffsetClipRgn"));
    141     return O32_OffsetClipRgn(arg1, arg2, arg3);
    142 }
    143 //******************************************************************************
    144 //******************************************************************************
    145 int WIN32API SelectClipRgn( HDC hdc, HRGN hRgn)
    146 {
    147     dprintf(("GDI32: SelectClipRgn %x %x", hdc, hRgn));
    148     return O32_SelectClipRgn(hdc, hRgn);
    149 }
    150 //******************************************************************************
    151 //******************************************************************************
    152 BOOL WIN32API GetUpdateRect (HWND hwnd, LPRECT pRect, BOOL erase)
     46BOOL WIN32API GetUpdateRect(HWND hwnd, LPRECT pRect, BOOL erase)
    15347{
    15448   if (!hwnd)
     
    228122//******************************************************************************
    229123//******************************************************************************
    230 int WIN32API GetUpdateRgn (HWND hwnd, HRGN hrgn, BOOL erase)
    231 {
    232    LONG Complexity;
    233 
     124int WIN32API GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL erase)
     125{
     126   LONG lComplexity;
    234127   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    235128
    236    if (!wnd)
    237    {
    238       SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
    239       return ERROR_W;
    240    }
    241 
    242    Complexity = O32_GetUpdateRgn (wnd->getOS2WindowHandle(), hrgn, FALSE);
    243    if (erase && (Complexity > NULLREGION_W)) sendEraseBkgnd(wnd);
    244 
    245    return Complexity;
    246 }
    247 //******************************************************************************
    248 //******************************************************************************
    249 INT WIN32API ExcludeUpdateRgn( HDC hDC, HWND  hWnd)
    250 {
    251     dprintf(("USER32:  ExcludeUpdateRgn\n"));
    252     hWnd = Win32BaseWindow::Win32ToOS2Handle(hWnd);
    253 
    254     return O32_ExcludeUpdateRgn(hDC,hWnd);
     129   hrgn = ObjWinToOS2Region(hrgn);
     130   if(!wnd || !hrgn)
     131   {
     132        dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase));
     133        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     134        return ERROR_W;
     135   }
     136   lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn);
     137   if(lComplexity == RGN_ERROR) {
     138        dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase));
     139        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     140        return ERROR_W;
     141   }
     142
     143   if(lComplexity != RGN_NULL)
     144   {
     145        if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle()))
     146        {
     147                dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase));
     148                SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     149                return ERROR_W;
     150        }
     151
     152        if(erase) sendEraseBkgnd(wnd);
     153   }
     154
     155   return lComplexity;
     156}
     157//******************************************************************************
     158//TODO: Check
     159//******************************************************************************
     160INT WIN32API ExcludeUpdateRgn(HDC hdc, HWND hwnd)
     161{
     162   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     163   pDCData          pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     164   LONG             lComplexity;
     165
     166   if(!wnd || !pHps)
     167   {
     168        dprintf(("WARNING: ExcludeUpdateRgn %x %x; invalid handle", hdc, hwnd));
     169        SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
     170        return ERROR_W;
     171   }
     172   dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd));
     173
     174   lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle());
     175   if(lComplexity == RGN_ERROR) {
     176        SetLastError(ERROR_INVALID_HANDLE_W); //todo: correct error
     177   }
     178   else SetLastError(ERROR_SUCCESS_W);
     179   return lComplexity;      // windows and PM values are identical
    255180}
    256181/*****************************************************************************
Note: See TracChangeset for help on using the changeset viewer.