Example #1
0
/* Invalidate, using window coordinates */
static void WM_InvalidateBWin1(WM_HWIN hWin, const GUI_RECT*pRect) {
  GUI_RECT r;
  WM_Obj* pWin = WM_H2P(hWin);
  WM__GetClientRectWin(pWin, &r);
  if (pRect)
    GUI__IntersectRect(&r, pRect);
  if (WM__RectIsNZ(&r)) {
    if (pWin->Status & WM_SF_INVALID) {
      GUI_MergeRect(&pWin->InvalidRect, &pWin->InvalidRect, &r);
    } else {
      pWin->InvalidRect = r;
      pWin->Status |= WM_SF_INVALID;
      WM__NumInvalidWindows++;
      /* Debug code: shows invalid areas */
      #if (WM_SHOW_INVALID)
      {
        GUI_CONTEXT Context = GUI_Context;
        WM_SelectWindow(hWin);
        GUI_SetBkColor(GUI_GREEN);
        GUI_ClearRect(r.x0, r.y0, r.x1, r.y1);
        GUI_Context = Context;
      }
      #endif


    }
  }
}
Example #2
0
/*********************************************************************
*
*       WM_ValidateRect
*
  Use this function with great care ! It should under most circumstances not
  be necessary to use it, as validation is done automatically as soon as
  a window has been redrawn. If you validate a section of a window, this
  part will not be included in the paint-command and could therefor not
  be updated.
*/
void WM_ValidateRect(WM_HWIN hWin, const GUI_RECT*pRect) {
  WM_Obj* pWin;
  if (hWin) {
    WM_LOCK();
    pWin = WM_HANDLE2PTR(hWin);
    if (pWin->Status & WM_SF_INVALID) {
      if (pRect) {
        _SubRect(&pWin->InvalidRect, &pWin->InvalidRect, pRect);
        if (WM__RectIsNZ(&pWin->InvalidRect))
          goto Done;
      }
      pWin->Status &= ~WM_SF_INVALID;
      WM__NumInvalidWindows--;
    }
  Done:
    WM_UNLOCK();
  }
}