Skip to content

Commit daa3481

Browse files
committed
Plot area clipping fixed.
1 parent 8e43103 commit daa3481

File tree

4 files changed

+71
-65
lines changed

4 files changed

+71
-65
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## [Unreleased]
44

5-
## [0.3.2]
5+
## [0.3.2] - 2021-10-14
66
### Added
77

88
- Parts of markers outside of plot area are getting clipped. This behaviour can
99
be controlled by style.plot.overflow parameter.
10-
- channel title parameter has "auto" value by default. "null" will title switch
11-
off.
10+
- channel title parameter has "auto" value by default. "null" will switch the
11+
title off.
1212

1313
### Fixed
1414

src/chart/rendering/drawdiagram.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,7 @@ drawDiagram::drawDiagram(const Geom::Rect &rect,
3131

3232
auto clip = style.plot.overflow == Styles::Overflow::hidden;
3333

34-
if (clip)
35-
{
36-
canvas.save();
37-
38-
std::array<Geom::Point, 4> points =
39-
{
40-
Geom::Point(0.0, 0.0),
41-
Geom::Point(0.0, 1.0),
42-
Geom::Point(1.0, 1.0),
43-
Geom::Point(1.0, 0.0)
44-
};
45-
painter.drawPolygon(points, true);
46-
}
34+
if (clip) clipPlotArea();
4735

4836
if (!drawOptions.onlyEssentials())
4937
{
@@ -62,6 +50,23 @@ drawDiagram::drawDiagram(const Geom::Rect &rect,
6250
}
6351
}
6452

53+
void drawDiagram::clipPlotArea()
54+
{
55+
canvas.save();
56+
57+
std::array<Geom::Point, 4> points =
58+
{
59+
Geom::Point(0.0, 0.0),
60+
Geom::Point(0.0, 1.0),
61+
Geom::Point(1.0, 1.0),
62+
Geom::Point(1.0, 0.0)
63+
};
64+
painter.setPolygonToCircleFactor(0.0);
65+
painter.setPolygonStraightFactor(0.0);
66+
painter.setResMode(ResolutionMode::High);
67+
painter.drawPolygon(points, true);
68+
}
69+
6570
void drawDiagram::drawMarkerGuides()
6671
{
6772
auto &style = diagram.getStyle().plot.marker.guides;

src/chart/rendering/drawdiagram.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class drawDiagram : private DrawingContext
2525

2626
Guides guides;
2727

28+
void clipPlotArea();
2829
void drawMarkerGuides();
2930
void drawMarkers();
3031
void drawMarkerLabels();

0 commit comments

Comments
 (0)