| 697 | |
| 698 | |
| 699 | void CellEngine::UpdateClip() |
| 700 | { |
| 701 | if (rectList != NULL) { |
| 702 | delete [] rectList; |
| 703 | rectList = NULL; |
| 704 | clipRects = 0; |
| 705 | } // if |
| 706 | |
| 707 | if (masked) { |
| 708 | Byte *mem = maskMem; |
| 709 | long rectCount = 0; |
| 710 | long rectBufSize = 256; |
| 711 | RECT *rects = new RECT[rectBufSize]; |
| 712 | RECT *r = NULL; |
| 713 | long xx, yy; |
| 714 | long curRect = -1; |
| 715 | long aboveRect = -1; |
| 716 | for (yy = 0; yy < maskHeight; yy++) { |
| 717 | long isInside = 0; |
| 718 | long wasInside = 0; |
| 719 | for (xx = 0; xx < maskWidth; xx++) { |
| 720 | long pixel = mem[xx]; |
| 721 | isInside = pixel > maskClip; |
| 722 | if (wasInside) { |
| 723 | if (! isInside) { |
| 724 | r->right = xx; |
| 725 | if ((aboveRect != -1) && |
| 726 | (rects[aboveRect].right == xx)) { |
| 727 | // merge with rect above |
| 728 | rects[aboveRect].bottom = r->bottom; |
| 729 | rectCount--; |
| 730 | } // if |
| 731 | wasInside = 0; |
| 732 | curRect = -1; |
| 733 | aboveRect = -1; |
| 734 | } // if (! isInside) |
| 735 | } else { // if (wasInside) |
| 736 | if (isInside) { |
| 737 | wasInside = 1; |
| 738 | |
| 739 | curRect = rectCount++; |
| 740 | |
| 741 | if (rectCount > rectBufSize) { |
| 742 | long i; |
| 743 | RECT *newRects; |
| 744 | |
| 745 | rectBufSize += 256; |
| 746 | newRects = new RECT[rectBufSize]; |
| 747 | for (i = 0; i < curRect; i++) { |
| 748 | newRects[i] = rects[i]; |
| 749 | } // for |
| 750 | delete [] rects; |
| 751 | rects = newRects; |
| 752 | } // if (rectCount > rectBufSize) |
| 753 | |
| 754 | r = &rects[curRect]; |
| 755 | r->left = xx; |
| 756 | r->top = yy; |
nothing calls this directly
no outgoing calls
no test coverage detected