modification details:
commented gRectCount -- recording the number of rects that have already been drawn.
Number of rects is not limited.