Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.8.0
-
None
-
Qt 5.8.0 32Bit
Windows 10 PC x64.
Compiling with MSVC 2015 x86.
Description
When painting in a QQuickPaintedItem with QPainter, there is an error in how gradients are painted.
Having two gradients with the same colorstops, one from vertical center to top and the other from vertical center to bottom, one would assume, that these gradients are the same, just flipped at the center.
But this is not the case when painted on an QImage render target. However it works fine when using a FrameBufferObject target. This is one of the reason why I'm certain it's an error.
One interesting thing is, that the severety of the problem seems to be related to the height of the item. Depending on the height, the difference is nearly not visible or very clearly visible. But it's not a even/odd pixel problem. Generally it seems like the problem is more visible with bigger heights.
If you draw a QRadialGradient in the item and put its center in the vertical center, the pixels at the top and bottom are the same, just flipped. It fits perfectly with the QLinearGradient from vertical center to top, but not with the one from vertical center to bottom.
I tried several "workarounds" like adding or removing pixels to the top or bottom, or shifting the whole gradient, but i can't get it to be identical to the other gradient at the top.
I also tried using different painting mechanism, like painter.fillRect, QPainterPath, painter.drawLine. It is all the same. It does not work with QImage target, but with FrameBufferObject target it looks good.
A small demo application which shows the problem is attached.