--------------------------------------------------------------------------
| 680 | |
| 681 | //-------------------------------------------------------------------------- |
| 682 | void GuiMessageVectorCtrl::onRender(Point2I offset, |
| 683 | const RectI& updateRect) |
| 684 | { |
| 685 | GFXDrawUtil *drawer = GFX->getDrawUtil(); |
| 686 | |
| 687 | Parent::onRender(offset, updateRect); |
| 688 | if (isAttached()) { |
| 689 | U32 linePixels = mProfile->mFont->getHeight() + mLineSpacingPixels; |
| 690 | U32 currLine = 0; |
| 691 | ColorI lastColor = mProfile->mFontColor; |
| 692 | for (U32 i = 0; i < mMessageVector->getNumLines(); i++) { |
| 693 | |
| 694 | TextElement* pElement = mLineElements[i].headLineElements; |
| 695 | while (pElement != NULL) { |
| 696 | Point2I localStart(pElement == mLineElements[i].headLineElements ? 0 : mLineContinuationIndent, currLine * linePixels); |
| 697 | |
| 698 | Point2I globalCheck = localToGlobalCoord(localStart); |
| 699 | U32 globalRangeStart = globalCheck.y; |
| 700 | U32 globalRangeEnd = globalCheck.y + mProfile->mFont->getHeight(); |
| 701 | if (globalRangeStart > updateRect.point.y + updateRect.extent.y || |
| 702 | globalRangeEnd < updateRect.point.y) { |
| 703 | currLine++; |
| 704 | pElement = pElement->nextPhysicalLine; |
| 705 | continue; |
| 706 | } |
| 707 | |
| 708 | TextElement* walkAcross = pElement; |
| 709 | while (walkAcross) { |
| 710 | if (walkAcross->start > walkAcross->end) |
| 711 | break; |
| 712 | |
| 713 | Point2I globalStart = localToGlobalCoord(localStart); |
| 714 | |
| 715 | U32 strWidth; |
| 716 | if (walkAcross->specialReference == -1) { |
| 717 | drawer->setBitmapModulation(lastColor); |
| 718 | drawer->setTextAnchorColor(mProfile->mFontColor); |
| 719 | strWidth = drawer->drawTextN(mProfile->mFont, globalStart, &mMessageVector->getLine(i).message[walkAcross->start], |
| 720 | walkAcross->end - walkAcross->start + 1, mProfile->mFontColors, mMaxColorIndex); |
| 721 | drawer->getBitmapModulation(&lastColor); // in case an embedded color tag changed it |
| 722 | } else { |
| 723 | drawer->getBitmapModulation( &lastColor ); |
| 724 | drawer->setBitmapModulation(mSpecialColor); |
| 725 | drawer->setTextAnchorColor(mProfile->mFontColor); |
| 726 | strWidth = drawer->drawTextN(mProfile->mFont, globalStart, &mMessageVector->getLine(i).message[walkAcross->start], |
| 727 | walkAcross->end - walkAcross->start + 1); |
| 728 | |
| 729 | // in case we have 2 in a row... |
| 730 | drawer->setBitmapModulation(lastColor); |
| 731 | } |
| 732 | |
| 733 | // drawTextN returns the rightmost X coord, so subtract leftmost coord to get the width |
| 734 | strWidth -= globalStart.x; |
| 735 | |
| 736 | if (walkAcross->specialReference != -1) { |
| 737 | Point2I lineStart = localStart; |
| 738 | Point2I lineEnd = localStart; |
| 739 | lineStart.y += mProfile->mFont->getBaseline() + 1; |
nothing calls this directly
no test coverage detected