[Webkit-unassigned] [Bug 34874] [Qt] Unnecessary QBrush construction for doing a solid color stroke

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 12 06:44:03 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34874





--- Comment #3 from Ariya Hidayat <ariya.hidayat at gmail.com>  2010-02-12 06:44:02 PST ---
(In reply to comment #2)
> (From update of attachment 48616 [details])
> 
> > +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
> > @@ -1112,7 +1112,8 @@ void GraphicsContext::setPlatformStrokeColor(const Color& color, ColorSpace colo
> >          return;
> >      QPainter* p = m_data->p();
> >      QPen newPen(p->pen());
> > -    newPen.setColor(color);
> > +    m_data->solidColor.setColor(color);
> > +    newPen.setBrush(m_data->solidColor);
> >      p->setPen(newPen);
> >  }
> >  
> 
> For me this code is not so clear, so maybe a comment would help?

This is common QBrush problem,please see http://trac.webkit.org/changeset/54347
which refers also to http://trac.webkit.org/changeset/37421. Basically it
avoids QBrush::QBrush() because the said constructor is expensive, involving
allocating QTransform from the heap, necessary for transformed gradient/pattern
brush but completely useless for a solid color brush. So we keep our own brush
for the solid color which we reuse for this purpose (just change the color, but
not construct a new QBrush).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list