Пример #1
0
/*********************************************************************
* Function: void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom)
*
* PreCondition: none
*
* Input: left,top,right,bottom - rectangle borders
*
* Output: none
*
* Side Effects: none
*
* Overview: marks objects with parts in the rectangle to be redrawn
*
* Note: none
*
********************************************************************/
void  GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom){
OBJ_HEADER *pCurrentObj;

    pCurrentObj = _pGolObjects;

    while(pCurrentObj != NULL){
        
        if( !( (pCurrentObj->left > right) ||
             (pCurrentObj->right < left) ||       
             (pCurrentObj->top > bottom) ||
             (pCurrentObj->bottom < top) ) )

		if( ( (pCurrentObj->left >= left)&&
              (pCurrentObj->left <= right) ) ||

            ( (pCurrentObj->right >= left)&&
              (pCurrentObj->right <= right) ) ||

            ( (pCurrentObj->top >= top)&&
              (pCurrentObj->top <= bottom) )||

            ( (pCurrentObj->bottom >= top)&&
              (pCurrentObj->bottom <= bottom) ) ){

                GOLRedraw(pCurrentObj);

        }

        pCurrentObj = pCurrentObj->pNxtObj;            

    }//end of while
}
Пример #2
0
/*********************************************************************
* Function: void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom)
*
* PreCondition: none
*
* Input: left,top,right,bottom - rectangle borders
*
* Output: none
*
* Side Effects: none
*
* Overview: marks objects with parts in the rectangle to be redrawn
*
* Note: none
*
********************************************************************/
void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom)
{

   OBJ_HEADER  *pCurrentObj;
    int overlapX, overlapY;

    pCurrentObj = _pGolObjects;

    while(pCurrentObj != NULL)
    {
        overlapX = overlapY = 0;

        // check overlaps in x direction
        if( ((pCurrentObj->left <= left) &&  (pCurrentObj->right >= left))    ||  \
            ((pCurrentObj->left <= right) &&  (pCurrentObj->right >= right))  ||  \
            ((pCurrentObj->left <= left) &&  (pCurrentObj->right >= right))   ||  \
            ((pCurrentObj->left >= left) &&  (pCurrentObj->right <= right))       \
          )
            overlapX = 1;
    
        // check overlaps in y direction
        if( ((pCurrentObj->top <= top) &&  (pCurrentObj->bottom >= top))      ||  \
            ((pCurrentObj->top <= bottom) &&  (pCurrentObj->bottom >= bottom))||  \
            ((pCurrentObj->top <= top) &&  (pCurrentObj->bottom >= bottom))   ||  \
            ((pCurrentObj->top >= top) &&  (pCurrentObj->bottom <= bottom))       \
          )
            overlapY = 1;
        
        // when any portion of the widget is touched by the defined rectangle the
        // x and y overlaps will exist.
        if (overlapX & overlapY)
		{
        	GOLRedraw(pCurrentObj);
        }
    
        pCurrentObj = (OBJ_HEADER *)pCurrentObj->pNxtObj;
    }   //end of while

}