[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Be careful with QPainter::drawRect etc
From: Allen Winter <winter () kde ! org>
Date: 2007-09-18 18:41:08
Message-ID: 200709181441.09234.winter () kde ! org
[Download RAW message or body]
On Tuesday 18 September 2007 1:01:34 pm John Tapsell wrote:
> Hey all,
>
> I have tracked down a bugs in KFormula where the problem was that:
>
> QPainterPath rect;
> rect.addRect(0, -baseLine(), width(), baseLine() );
> painter.drawPath( rect );
>
> and
>
> painter.drawRect(0, -baseLine(), width(), baseLine() );
>
> Draw different rectangles. The reason for this is that addRect takes
> reals, and drawRect takes int. The drawRect thus loses precision, and
> draws incorrectly.
>
> This is a very subtle and very nasty bug, as at 500% zoom, it's off by
> less than 10 pixels typically.
>
> I have grepped the koffice source code and found hundreds of uses of
> drawRect, drawLine etc. I'm sure that many of this are wrong.
>
> Can we put a check for this use ebn? There will be false positives,
> but I think we need to check all uses of this.
>
> (same for drawLine, etc)
>
Sounds like a job for a compiler.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic