[patch] cosmetic fix for KPlotWidget
Zack Rusin
zack at kde.org
Fri Nov 30 19:25:11 GMT 2007
On Friday 30 November 2007 12:30:17 pm Jason Harris wrote:
> > > To become OT again: Jason's patch is the right workaround for this bug
> > > in Qt AFAICS. ;-p
> >
> > You call this a bug - would that mean as soon as this is fixed we're
> > gonna see fuzzy lines again?
>
> Yes, for the interval of time between a hypothetical fix entering qt-copy,
> and someone (me) noticing it and removing the fix in KPlotWidget.
Except that there is no bug in Qt.
In Qt the coordinate system with the identity world matrix overlaps the pixel
grid. This is the only reasonable thing to do, otherwise the center of the
coordinate system occupies 0.5 pixel boundry and suddenly the integer
coordinate system gets out of whack with the floating point coordinate
system.
Not to even mention the fact that as soon as the world matrix is not an
identity matrix (this is vector graphics so this is /very/ common) the
overlap with the pixel grid will be lost no matter what.
Personally I don't think the patch is correct. Shifting the whole coordinate
system just means that other parts of the rendered primitives now fall out of
pixel bounderies. So you're effectively exchanging certain parts of the
anti-aliased lines that happen to be anti-aliased in a way you don't like for
others which will be anti-aliased in a way you don't like. But then again I
haven't looked at the code for KPlotWidget and don't have time for it so I
don't think my voice counts.
The only way to get pixel snapping working is to pixel snap coordinates of the
primitives themselves not to shift the whole world matrix. Disabling
antialiasing for horizontal/vertical lines and drawing them in a seperate
pass would also work.
One could probably ask trolls to pixel-snap horizontal/vertical lines in
qpainter if it happens to be drawing with the identity matrix. But again,
personally I think it's up to developers to decide how they want their
rendering to look like, Qt's job is to do exactly what the developers tell it
to do and not try to magically figure out for developers what they want.
z
More information about the kde-core-devel
mailing list