[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/khtml
From: Leo Savernik <l.savernik () aon ! at>
Date: 2005-02-27 19:42:26
Message-ID: 20050227194226.9D102148A2 () office ! kde ! org
[Download RAW message or body]
CVS commit by savernik:
Heavy optimisation on painting large text runs.
This leads to a more than ten-fold increase on a 6mb <pre> element.
Text selection is still slow in this case, but an order of magnitudes better
than before.
BUG: 90422
M +5 -0 ChangeLog 1.389
M +7 -1 rendering/font.cpp 1.34
M +2 -1 rendering/render_text.cpp 1.267
--- kdelibs/khtml/ChangeLog #1.388:1.389
@@ -1,2 +1,7 @@
+2005-02-27 Leo Savernik <l.savernik@aon.at>
+
+ * rendering/font.cpp (drawText): Only pass text from inline text box to
+ QPainter::drawText, not the whole RenderText's text.
+
2005-02-27 Harri Porten <porten@kde.org>
--- kdelibs/khtml/rendering/font.cpp #1.33:1.34
@@ -105,5 +105,11 @@ void Font::drawText( QPainter *p, int x,
if ( !scFont && !letterSpacing && !wordSpacing && !toAdd && from==-1 ) {
// simply draw it
- p->drawText( x, y, qstr, pos, len, d );
+ // Due to some unfounded cause QPainter::drawText traverses the
+ // *whole* string when painting, not only the specified
+ // [pos, pos + len) segment. This makes painting *extremely* slow for
+ // long render texts (in the order of several megabytes).
+ // Hence, only hand over the piece of text of the actual inline text box
+ QConstString cstr = QConstString(str + pos, len);
+ p->drawText( x, y, cstr.string(), 0, len, d );
} else {
if (from < 0) from = 0;
--- kdelibs/khtml/rendering/render_text.cpp #1.266:1.267
@@ -137,5 +137,5 @@ void InlineTextBox::paintSelection(const
p->setPen(hc);
- //kdDebug( 6040 ) << "textRun::painting(" << QConstString(text->str->s + \
m_start, m_len).string() << ") at(" << m_x+tx << "/" << m_y+ty << ")" << endl; + \
//kdDebug( 6040 ) << "textRun::painting(" << QConstString(text->str->s + m_start, \
m_len).string().left(30) << ") at(" << m_x+tx << "/" << m_y+ty << ")" \
<< endl;
f->drawText(p, m_x + tx, m_y + ty + m_baseline, text->str->s, text->str->l,
m_start, m_len, m_toAdd,
@@ -946,4 +946,5 @@ void RenderText::paint( PaintInfo& pI, i
s->paintShadow(pI.p, font, tx, ty, _style->textShadow());
#endif
+// kdDebug(6040) << QConstString(str->s + s->m_start, s->m_len).string().left(40) << \
endl;
font->drawText(pI.p, s->m_x + tx, s->m_y + ty + s->m_baseline, \
str->s, str->l, s->m_start, s->m_len,
s->m_toAdd, s->m_reversed ? QPainter::RTL : \
QPainter::LTR);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic