mirror of https://github.com/qt/qtgraphs.git
Prevent improper fill for area series on the zero-axis
When an area series had consecutive points on the y=0 axis,
the renderer would draw a horizontal line segment which caused
visual glitches when filled.
This change avoids filling that problematic segment on the y=0
axis, which fixes the improper fill.
Pick-to: 6.9 6.8
Fixes: QTBUG-139112
Change-Id: I4461cbf80af9b059ccfcc714234fed5039d0cd43
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
(cherry picked from commit 52c5d1d3ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6d2194f90d
commit
c0829ec48a
|
|
@ -168,21 +168,26 @@ void AreaRenderer::handlePolish(QAreaSeries *series)
|
|||
int extraPointCount = lower ? 0 : 3;
|
||||
|
||||
if (series->isVisible()) {
|
||||
qreal prevUpperY = 0;
|
||||
for (int i = 0, j = 0; i < upperPoints.size() + extraPointCount; ++i, ++j) {
|
||||
qreal x;
|
||||
qreal y;
|
||||
if (i == upperPoints.size())
|
||||
calculateRenderCoordinates(series,
|
||||
upperPoints[upperPoints.size() - 1].x(),
|
||||
0,
|
||||
&x,
|
||||
&y);
|
||||
else if (i == upperPoints.size() + 1)
|
||||
calculateRenderCoordinates(series, upperPoints[0].x(), 0, &x, &y);
|
||||
else if (i == upperPoints.size() + 2)
|
||||
calculateRenderCoordinates(series, upperPoints[0].x(), upperPoints[0].y(), &x, &y);
|
||||
else
|
||||
calculateRenderCoordinates(series, upperPoints[i].x(), upperPoints[i].y(), &x, &y);
|
||||
qreal upperX;
|
||||
qreal upperY;
|
||||
if (i == upperPoints.size()) {
|
||||
upperX = upperPoints[upperPoints.size() - 1].x();
|
||||
upperY = 0;
|
||||
} else if (i == upperPoints.size() + 1) {
|
||||
upperX = upperPoints[0].x();
|
||||
upperY = 0;
|
||||
} else if (i == upperPoints.size() + 2) {
|
||||
upperX = upperPoints[0].x();
|
||||
upperY = upperPoints[0].y();
|
||||
} else {
|
||||
upperX = upperPoints[i].x();
|
||||
upperY = upperPoints[i].y();
|
||||
}
|
||||
calculateRenderCoordinates(series, upperX, upperY, &x, &y);
|
||||
|
||||
if (i == 0) {
|
||||
painterPath.moveTo(x, y);
|
||||
|
|
@ -205,8 +210,13 @@ void AreaRenderer::handlePolish(QAreaSeries *series)
|
|||
++j;
|
||||
} else {
|
||||
painterPath.lineTo(x, y);
|
||||
if (i != 0 && i < upper->points().size()
|
||||
&& upperY == 0 && prevUpperY == 0) {
|
||||
painterPath.moveTo(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
prevUpperY = upperY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue