[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: [calligra] krita/ui/tool: fix artefacts on qpainter canvas
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2011-06-19 17:01:25
Message-ID: BANLkTinrsNk48_SE1agk-Zv=LvFfacw9jQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Great! I always believed those hardcoded const values are not the real
solution! =)

On Sun, Jun 19, 2011 at 4:17 PM, Sven Langkamp <sven.langkamp@gmail.com>wrote:

> Git commit 7be561f4b4c5bd900133c0d82c2b8c6d51122cbf by Sven Langkamp.
> Committed on 19/06/2011 at 14:15.
> Pushed by langkamp into branch 'master'.
>
> fix artefacts on qpainter canvas
> BUG:275829
>
> M  +9    -6    krita/ui/tool/kis_tool_freehand.cc
>
> http://commits.kde.org/calligra/7be561f4b4c5bd900133c0d82c2b8c6d51122cbf
>
> diff --git a/krita/ui/tool/kis_tool_freehand.cc
> b/krita/ui/tool/kis_tool_freehand.cc
> index 71a4f43..0d0e429 100644
> --- a/krita/ui/tool/kis_tool_freehand.cc
> +++ b/krita/ui/tool/kis_tool_freehand.cc
> @@ -677,12 +677,15 @@ void KisToolFreehand::updateOutlineRect()
>         canvas()->updateCanvas(m_oldOutlineRect);
>     }
>
> -#ifdef __GNUC__
> -#warning "Remove adjusted() call -- it smells hacky"
> -#else
> -#pragma WARNING( "Remove adjusted() call -- it smells hacky" )
> -#endif
> -    m_oldOutlineRect = outlineDocRect.adjusted(-2,-2,2,2);
> +    // This adjusted call is needed as we paint with a 3 pixel wide brush
> and the pen is outside the bounds of the path
> +    // Pen uses view coordinates so we have to zoom the document value to
> match 2 pixel in view coordiates
> +    // See BUG 275829
> +    qreal zoomX;
> +    qreal zoomY;
> +    canvas()->viewConverter()->zoom(&zoomX, &zoomY);
> +    qreal xoffset = 2.0/zoomX;
> +    qreal yoffset = 2.0/zoomY;
> +    m_oldOutlineRect =
> outlineDocRect.adjusted(-xoffset,-yoffset,xoffset,yoffset);
>
>     canvas()->updateCanvas(m_oldOutlineRect);
>  }
>



-- 
Dmitry Kazakov

[Attachment #5 (text/html)]

Great! I always believed those hardcoded const values are not the real solution! \
=)<br><br><div class="gmail_quote">On Sun, Jun 19, 2011 at 4:17 PM, Sven Langkamp \
<span dir="ltr">&lt;<a \
href="mailto:sven.langkamp@gmail.com">sven.langkamp@gmail.com</a>&gt;</span> \
wrote:<br> <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; \
border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Git commit \
7be561f4b4c5bd900133c0d82c2b8c6d51122cbf by Sven Langkamp.<br> Committed on \
19/06/2011 at 14:15.<br> Pushed by langkamp into branch &#39;master&#39;.<br>
<br>
fix artefacts on qpainter canvas<br>
BUG:275829<br>
<br>
M   +9      -6      krita/ui/tool/kis_tool_freehand.cc<br>
<br>
<a href="http://commits.kde.org/calligra/7be561f4b4c5bd900133c0d82c2b8c6d51122cbf" \
target="_blank">http://commits.kde.org/calligra/7be561f4b4c5bd900133c0d82c2b8c6d51122cbf</a><br>
 <br>
diff --git a/krita/ui/tool/kis_tool_freehand.cc \
b/krita/ui/tool/kis_tool_freehand.cc<br> index 71a4f43..0d0e429 100644<br>
--- a/krita/ui/tool/kis_tool_freehand.cc<br>
+++ b/krita/ui/tool/kis_tool_freehand.cc<br>
@@ -677,12 +677,15 @@ void KisToolFreehand::updateOutlineRect()<br>
             canvas()-&gt;updateCanvas(m_oldOutlineRect);<br>
       }<br>
<br>
-#ifdef __GNUC__<br>
-#warning &quot;Remove adjusted() call -- it smells hacky&quot;<br>
-#else<br>
-#pragma WARNING( &quot;Remove adjusted() call -- it smells hacky&quot; )<br>
-#endif<br>
-      m_oldOutlineRect = outlineDocRect.adjusted(-2,-2,2,2);<br>
+      // This adjusted call is needed as we paint with a 3 pixel wide brush and the \
pen is outside the bounds of the path<br> +      // Pen uses view coordinates so we \
have to zoom the document value to match 2 pixel in view coordiates<br> +      // See \
BUG 275829<br> +      qreal zoomX;<br>
+      qreal zoomY;<br>
+      canvas()-&gt;viewConverter()-&gt;zoom(&amp;zoomX, &amp;zoomY);<br>
+      qreal xoffset = 2.0/zoomX;<br>
+      qreal yoffset = 2.0/zoomY;<br>
+      m_oldOutlineRect = \
outlineDocRect.adjusted(-xoffset,-yoffset,xoffset,yoffset);<br> <br>
       canvas()-&gt;updateCanvas(m_oldOutlineRect);<br>
  }<br>
</blockquote></div><br><br clear="all"><br>-- <br>Dmitry Kazakov<br>



_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic