Ignore:
Timestamp:
Jul 22, 2000, 2:51:59 PM (25 years ago)
Author:
sandervl
Message:

BeginPaint fix

File:
1 edited

Legend:

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

    r3864 r3888  
    1 /* $Id: dc.cpp,v 1.68 2000-07-19 19:05:24 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.69 2000-07-22 12:51:59 sandervl Exp $ */
    22
    33/*
     
    329329//******************************************************************************
    330330//******************************************************************************
    331 HRGN selectClientArea(Win32BaseWindow *window, pDCData pHps, PRECTL prclPaint)
     331void selectClientArea(Win32BaseWindow *window, pDCData pHps)
    332332{
    333333   // This function checks to see if the DC needs to be adjusted to a client
     
    345345   {
    346346        //client rectangle = frame rectangle -> no change necessary
    347         //only setup the clip region
    348         goto setupclipregion;
     347        return;
    349348   }
    350349   if(pHps->isClientArea) {
    351350        //TODO: counter
    352351        dprintf(("WARNING: selectClientArea; already selected!!"));
    353         goto setupclipregion;
     352        return;
    354353   }
    355354   pHps->isClient = TRUE;
     
    412411   // Destroy the region now we have finished with it.
    413412   GreDestroyRegion(pHps->hps, hrgnRect);
    414 
    415 setupclipregion:
    416    if(prclPaint) {
    417 #if 0
    418         hrgnClip = GpiQueryClipRegion(pHps->hps);
    419         if(hrgnClip) {
    420                 rc = GreIntersectClipRectangle(pHps->hps, prclPaint);
    421                 if(rc == RGN_ERROR) {
    422                         dprintf(("selectClientArea: GreIntersectClipRectangle returned RGN_ERROR!"));
    423                 }
    424         }
    425         else {
    426 #endif
    427                 hrgnClip = GreCreateRectRegion(pHps->hps, prclPaint, 1);
    428                 GreSelectClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
    429 //      }
    430    }
    431 
    432    return hrgnOldClip;
    433413}
    434414//******************************************************************************
     
    572552 HPS      hPS_ownDC = NULLHANDLE, hpsPaint = 0;
    573553 RECTL    rectl = {0, 0, 1, 1};
    574  HRGN     hrgnUpdate, hrgnOld, hrgnOldClip;
     554 HRGN     hrgnOldClip;
    575555 LONG     lComplexity;
    576556 RECTL    rectlClient;
     
    612592   }
    613593
     594   //testest
     595   if(hwnd == 0x6800000f) {
     596        lComplexity = 1;
     597   }
     598
    614599   if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) {
    615600        memset(&rectl, 0, sizeof(rectl));
    616601        dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!"));
    617602
    618 //      mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
    619 //      WinOffsetRect(NULL, &rectlClient, -rectlClient.xLeft, -rectlClient.yBottom);
    620 
    621         hrgnOldClip = selectClientArea(wnd, pHps, &rectl);
     603        selectClientArea(wnd, pHps);
     604
     605        HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl);
     606        GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
     607
    622608        //save old clip region (restored for CS_OWNDC windows in EndPaint)
    623609        wnd->SetClipRegion(hrgnOldClip);
     
    625611   }
    626612   else {
    627         WinValidateRect(hwndClient, &rectl, FALSE);
     613        rectlClip.yBottom = rectlClip.xLeft = 0;
     614        rectlClip.yTop = rectlClip.xRight = 1;
     615
     616        //Query update region
     617        HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectlClip);
     618        WinQueryUpdateRegion(hwndClient, hrgnClip);
     619        WinValidateRegion(hwndClient, hrgnClip, FALSE);
    628620
    629621        mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
    630622        WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient);
    631623        WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom);
    632  
    633         hrgnOldClip = selectClientArea(wnd, pHps, &rectlClip);
     624
     625        //change presentation space for client window
     626        selectClientArea(wnd, pHps);
     627
     628        //clip update region with client window rectangle
     629        HRGN hrgnClient = GpiCreateRegion(pHps->hps, 1, &rectlClient);
     630        GpiCombineRegion(pHps->hps, hrgnClip, hrgnClip, hrgnClient, CRGN_AND);
     631        GpiDestroyRegion(pHps->hps, hrgnClient);
     632
     633        //change origin of clip region (window -> client)
     634        POINTL point = {-rectlClient.xLeft, -rectlClient.yBottom};
     635        GpiOffsetRegion(pHps->hps, hrgnClip, &point);
     636
     637        //set clip region
     638        GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
    634639
    635640        //save old clip region (restored for CS_OWNDC windows in EndPaint)
     
    808813            goto error;
    809814
    810         selectClientArea(wnd, pHps, NULL);
     815        selectClientArea(wnd, pHps);
    811816
    812817        //TODO: Is this always necessary??
     
    876881   if(!(flags & DCX_WINDOW_W))
    877882   {
    878         selectClientArea(wnd, pHps, NULL);
     883        selectClientArea(wnd, pHps);
    879884   }
    880885   else removeClientArea(pHps);
     
    11731178        if(redraw & RDW_ERASENOW_W && wnd->needsEraseBkgnd())
    11741179                wnd->setEraseBkgnd(sendEraseBkgnd(wnd) == 0);
    1175         if(redraw & RDW_ALLCHILDREN_W) {
    1176                 EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw);
    1177         }
     1180//      if(redraw & RDW_ALLCHILDREN_W) {
     1181//              EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw);
     1182//      }
    11781183   }
    11791184   else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
Note: See TracChangeset for help on using the changeset viewer.