<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>34874</bug_id>
          
          <creation_ts>2010-02-11 19:58:58 -0800</creation_ts>
          <short_desc>[Qt] Unnecessary QBrush construction for doing a solid color stroke</short_desc>
          <delta_ts>2010-02-12 19:07:57 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ariya Hidayat">ariya.hidayat</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>189906</commentid>
    <comment_count>0</comment_count>
      <attachid>48614</attachid>
    <who name="Ariya Hidayat">ariya.hidayat</who>
    <bug_when>2010-02-11 19:58:58 -0800</bug_when>
    <thetext>Created attachment 48614
Patch

Use the similar trick like in r54347, i.e. use the special brush for
solid color to avoid expensive QBrush constructor.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>189908</commentid>
    <comment_count>1</comment_count>
      <attachid>48616</attachid>
    <who name="Ariya Hidayat">ariya.hidayat</who>
    <bug_when>2010-02-11 20:07:11 -0800</bug_when>
    <thetext>Created attachment 48616
2010-02-11  Ariya Hidayat  &lt;ariya.hidayat@gmail.com&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190009</commentid>
    <comment_count>2</comment_count>
      <attachid>48616</attachid>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2010-02-12 04:31:50 -0800</bug_when>
    <thetext>Comment on attachment 48616
2010-02-11  Ariya Hidayat  &lt;ariya.hidayat@gmail.com&gt;


&gt; +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
&gt; @@ -1112,7 +1112,8 @@ void GraphicsContext::setPlatformStrokeColor(const Color&amp; color, ColorSpace colo
&gt;          return;
&gt;      QPainter* p = m_data-&gt;p();
&gt;      QPen newPen(p-&gt;pen());
&gt; -    newPen.setColor(color);
&gt; +    m_data-&gt;solidColor.setColor(color);
&gt; +    newPen.setBrush(m_data-&gt;solidColor);
&gt;      p-&gt;setPen(newPen);
&gt;  }
&gt;  

For me this code is not so clear, so maybe a comment would help?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190035</commentid>
    <comment_count>3</comment_count>
    <who name="Ariya Hidayat">ariya.hidayat</who>
    <bug_when>2010-02-12 06:44:02 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 48616 [details])
&gt; 
&gt; &gt; +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
&gt; &gt; @@ -1112,7 +1112,8 @@ void GraphicsContext::setPlatformStrokeColor(const Color&amp; color, ColorSpace colo
&gt; &gt;          return;
&gt; &gt;      QPainter* p = m_data-&gt;p();
&gt; &gt;      QPen newPen(p-&gt;pen());
&gt; &gt; -    newPen.setColor(color);
&gt; &gt; +    m_data-&gt;solidColor.setColor(color);
&gt; &gt; +    newPen.setBrush(m_data-&gt;solidColor);
&gt; &gt;      p-&gt;setPen(newPen);
&gt; &gt;  }
&gt; &gt;  
&gt; 
&gt; 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).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190059</commentid>
    <comment_count>4</comment_count>
      <attachid>48616</attachid>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2010-02-12 08:17:31 -0800</bug_when>
    <thetext>Comment on attachment 48616
2010-02-11  Ariya Hidayat  &lt;ariya.hidayat@gmail.com&gt;

I would have liked the comment in the actual code, or an inline method with a self described name</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>190231</commentid>
    <comment_count>5</comment_count>
    <who name="Ariya Hidayat">ariya.hidayat</who>
    <bug_when>2010-02-12 19:07:57 -0800</bug_when>
    <thetext>(Added one line comment per Kenneth&apos;s request)

Manually committed in r54746: http://trac.webkit.org/changeset/54746</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>48614</attachid>
            <date>2010-02-11 19:58:58 -0800</date>
            <delta_ts>2010-02-11 20:07:07 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>20100211195856.patch</filename>
            <type>text/plain</type>
            <size>582</size>
            <attacher name="Ariya Hidayat">ariya.hidayat</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvcGxhdGZvcm0vZ3JhcGhpY3MvcXQvR3JhcGhpY3NDb250ZXh0
UXQuY3BwIGIvV2ViQ29yZS9wbGF0Zm9ybS9ncmFwaGljcy9xdC9HcmFwaGljc0NvbnRleHRRdC5j
cHAKaW5kZXggMTA1ZDg2Ni4uMWI4NjgyYiAxMDA2NDQKLS0tIGEvV2ViQ29yZS9wbGF0Zm9ybS9n
cmFwaGljcy9xdC9HcmFwaGljc0NvbnRleHRRdC5jcHAKKysrIGIvV2ViQ29yZS9wbGF0Zm9ybS9n
cmFwaGljcy9xdC9HcmFwaGljc0NvbnRleHRRdC5jcHAKQEAgLTExMTIsNyArMTExMiw4IEBAIHZv
aWQgR3JhcGhpY3NDb250ZXh0OjpzZXRQbGF0Zm9ybVN0cm9rZUNvbG9yKGNvbnN0IENvbG9yJiBj
b2xvciwgQ29sb3JTcGFjZSBjb2xvCiAgICAgICAgIHJldHVybjsKICAgICBRUGFpbnRlciogcCA9
IG1fZGF0YS0+cCgpOwogICAgIFFQZW4gbmV3UGVuKHAtPnBlbigpKTsKLSAgICBuZXdQZW4uc2V0
Q29sb3IoY29sb3IpOworICAgIG1fZGF0YS0+c29saWRDb2xvci5zZXRDb2xvcihjb2xvcik7Cisg
ICAgbmV3UGVuLnNldEJydXNoKG1fZGF0YS0+c29saWRDb2xvcik7CiAgICAgcC0+c2V0UGVuKG5l
d1Blbik7CiB9CiAK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>48616</attachid>
            <date>2010-02-11 20:07:11 -0800</date>
            <delta_ts>2010-02-12 08:17:31 -0800</delta_ts>
            <desc>2010-02-11  Ariya Hidayat  &lt;ariya.hidayat@gmail.com&gt;</desc>
            <filename>bug-34874-20100211200710.patch</filename>
            <type>text/plain</type>
            <size>1307</size>
            <attacher name="Ariya Hidayat">ariya.hidayat</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
ZjNlNDFkMy4uNWMxMDkyZCAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNiBAQAorMjAxMC0wMi0xMSAgQXJpeWEgSGlkYXlh
dCAgPGFyaXlhLmhpZGF5YXRAZ21haWwuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9E
WSAoT09QUyEpLgorCisgICAgICAgIFtRdF0gVW5uZWNlc3Nhc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Y29uc3QgQ29sb3ImIGNvbG9yLCBDb2xvclNwYWNl
IGNvbG8KICAgICAgICAgcmV0dXJuOwogICAgIFFQYWludGVyKiBwID0gbV9kYXRhLT5wKCk7CiAg
ICAgUVBlbiBuZXdQZW4ocC0+cGVuKCkpOwotICAgIG5ld1Blbi5zZXRDb2xvcihjb2xvcik7Cisg
ICAgbV9kYXRhLT5zb2xpZENvbG9yLnNldENvbG9yKGNvbG9yKTsKKyAgICBuZXdQZW4uc2V0QnJ1
c2gobV9kYXRhLT5zb2xpZENvbG9yKTsKICAgICBwLT5zZXRQZW4obmV3UGVuKTsKIH0KIAo=
</data>
<flag name="review"
          id="31328"
          type_id="1"
          status="+"
          setter="kenneth"
    />
          </attachment>
      

    </bug>

</bugzilla>