Changeset 923 for trunk/src


Ignore:
Timestamp:
Sep 13, 1999, 6:13:46 PM (26 years ago)
Author:
dengert
Message:

some more DC related functions

Location:
trunk/src/user32/new
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/dc.cpp

    r911 r923  
    1 /* $Id: dc.cpp,v 1.3 1999-09-12 15:44:20 dengert Exp $ */
     1/* $Id: dc.cpp,v 1.4 1999-09-13 16:13:46 dengert Exp $ */
    22
    33/*
     
    268268ULONG   OPEN32API _O32_GetRegionData (HRGN hrgn, ULONG count, PRGNDATA_W pData);
    269269BOOL    OPEN32API _O32_DeleteObject (LHANDLE hgdiobj);
     270int     OPEN32API _O32_ReleaseDC (HWND hwnd, HDC hdc);
     271
     272#ifndef DEVESC_SETPS
     273  #define DEVESC_SETPS  49149L
     274#endif
    270275
    271276#define FLOAT_TO_FIXED(x) ((FIXED) ((x) * 65536.0))
     
    649654}
    650655
     656void releaseOwnDC (HDC hps)
     657{
     658   pDCData pHps = (pDCData)GpiQueryDCData ((HPS)hps);
     659
     660   if (pHps) {
     661      if (pHps->hrgnHDC)
     662         GpiDestroyRegion (pHps->hps, pHps->hrgnHDC);
     663
     664      GpiSetBitmap (pHps->hps, NULL);
     665      _O32_DeleteObject (pHps->nullBitmapHandle);
     666      GpiDestroyPS(pHps->hps);
     667
     668      if (pHps->hdc)
     669         DevCloseDC(pHps->hdc);
     670
     671// how can a memory chunk allocated by GpiAllocateDCData freed by delete?
     672//      delete pHps;
     673   }
     674}
     675
    651676HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)
    652677{
     
    916941      PRECTL pr;
    917942      int i;
     943      LONG height = OSLibQueryScreenHeight();
    918944
    919945      if (!hrgn)
     
    931957      success = TRUE;
    932958      if (flags & DCX_EXCLUDERGN_W)
    933          for (; (i > 0) && success; i--, pr++)
     959         for (; (i > 0) && success; i--, pr++) {
     960            LONG y = pr->yBottom;
     961
     962            pr->yBottom = height - pr->yTop;
     963            pr->yTop    = height - y;
    934964            success &= GpiExcludeClipRectangle (pHps->hps, pr);
     965         }
    935966      else
    936          for (; (i > 0) && success; i--, pr++)
     967         for (; (i > 0) && success; i--, pr++) {
     968            LONG y = pr->yBottom;
     969
     970            pr->yBottom = height - pr->yTop;
     971            pr->yTop    = height - y;
    937972            success &= GpiIntersectClipRectangle (pHps->hps, pr);
     973         }
    938974      if (!success)
    939975         goto error;
     
    9781014}
    9791015
    980 
     1016HDC WIN32API GetWindowDC (HWND hwnd)
     1017{
     1018  return GetDCEx (hwnd, NULL, DCX_WINDOW_W);
     1019}
     1020
     1021int WIN32API ReleaseDC (HWND hwnd, HDC hdc)
     1022{
     1023   USHORT sel = RestoreOS2FS();
     1024   BOOL isOwnDC = FALSE;
     1025   int rc;
     1026
     1027   if (hwnd)
     1028   {
     1029      Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1030      isOwnDC = wnd->isOwnDC();
     1031   }
     1032   if (isOwnDC)
     1033      rc = TRUE;
     1034   else
     1035      rc = _O32_ReleaseDC (0, hdc);
     1036
     1037   SetFS(sel);
     1038   return (rc);
     1039}
    9811040//******************************************************************************
    9821041//******************************************************************************
  • trunk/src/user32/new/makefile

    r896 r923  
    1 # $Id: makefile,v 1.49 1999-09-09 18:08:46 dengert Exp $
     1# $Id: makefile,v 1.50 1999-09-13 16:13:46 dengert Exp $
    22
    33#
     
    106106pmwindow.obj:   pmwindow.cpp win32class.h win32wbase.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h oslibgdi.h oslibwin.h
    107107win32class.obj: win32class.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h
    108 win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h
     108win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h
    109109win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h oslibmenu.h
    110110win32dlg.obj:   win32dlg.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h oslibmsg.h
     
    120120oslibres.obj:   oslibres.cpp oslibwin.h oslibres.h $(PDWIN32_INCLUDE)\winconst.h
    121121oslibdos.obj:   oslibdos.cpp oslibdos.h
    122 dc.obj:         dc.cpp win32wbase.h
     122dc.obj:         dc.cpp win32wbase.h dc.h
    123123
    124124clipboard.obj:  clipboard.cpp
  • trunk/src/user32/new/wingdi.cpp

    r911 r923  
    1 /* $Id: wingdi.cpp,v 1.15 1999-09-12 15:44:20 dengert Exp $ */
     1/* $Id: wingdi.cpp,v 1.16 1999-09-13 16:13:46 dengert Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    3333    return 0;
    3434    }
    35 // !! there is no HDC to paint on !!!    window->MsgEraseBackGround(hdc);
     35// !! there is no HDC to paint on !!!    window->MsgEraseBackGround(hdc);
    3636#ifdef OPEN32_GDI
    3737    hdc = O32_BeginPaint(window->getOS2WindowHandle(),lps);
     
    9797    return GetDC(hwnd);
    9898}
    99 #endif
    10099
    101100//******************************************************************************
     
    112111//******************************************************************************
    113112//******************************************************************************
     113
    114114HDC WIN32API GetWindowDC(HWND hwnd)
    115115{
     
    118118   window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    119119   if(!window) {
    120         dprintf(("GetWindowDC, window %x not found", hwnd));
    121         return 0;
     120        dprintf(("GetWindowDC, window %x not found", hwnd));
     121        return 0;
    122122   }
    123123   dprintf(("GetWindowDC %x", hwnd));
     
    128128#endif
    129129}
     130#endif
    130131//******************************************************************************
    131132//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.