void MarkupBase::render(const Rect& finalRect, const Rect& finalClip) { size_t len = m_text.length(); std::vector<PTextLine>::const_iterator i = m_textlines.begin(); std::vector<PTextLine>::const_iterator end = m_textlines.end(); while(i != end) { const TextLine* line = (*i).get(); size_t offset = line->start; Rect rl(line->area); std::vector<PText>::const_iterator c = line->children.begin(); std::vector<PText>::const_iterator stop = line->children.end(); while(c != stop) { const Text* chunk = (*c).get(); if(chunk->len > 0 && chunk->len <= len) { FontPtr f = chunk->font; Color col = chunk->selected ? chunk->selcol : chunk->col; std::string buf = m_text.substr(chunk->start + offset, chunk->len); Rect rc(chunk->area); rc.offset(rl.getPosition()); rc.offset(finalRect.getPosition()); f->drawText(buf, rc, 1.0f, finalClip, LeftAligned, col, 1.f, 1.f); } ++c; } ++i; } Renderer& r = m_system.getRenderer(); std::vector<PImg>::const_iterator cimg = m_images.begin(); std::vector<PImg>::const_iterator cimgend = m_images.end(); while(cimg != cimgend) { const Img* img = (*cimg).get(); Rect rc(img->area); rc.offset(finalRect.getPosition()); if (img->img) { r.draw(*img->img, rc, 1.f, finalClip, m_backColor, Stretch, Stretch); } ++cimg; } }