question: private void limitRectCoords ( GrowableRectArray rects , int index ) { if ( ( rects . getX ( index ) + rects . getWidth ( index ) ) > MASK_SIZE ) { rects . setWidth ( index , MASK_SIZE - rects . getX ( index ) ) ; } if ( ( rects . getY ( index ) + rects . getHeight ( index ) ) > MASK_SIZE ) { rects . setHeight ( index , MASK_SIZE - rects . getY ( index ) ) ; } if ( rects . getX ( index ) < 0 ) { rects . setWidth ( index , rects . getWidth ( index ) + rects . getX ( index ) ) ; rects . setX ( index , 0 ) ; } if ( rects . getY ( index ) < 0 ) { rects . setHeight ( index , rects . getHeight ( index ) + rects . getY ( index ) ) ; rects . setY ( index , 0 ) ; } }
target:  Limits the rect's coordinates to the mask coordinates. The result is used by growDirtyRegion.