Skip to content

Performance: use clipped polygon to draw lines #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/deploy.bat
/GCViewer.ofp
/releasenotes.txt
/*.iml
/.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ public void paintComponent(Graphics2D g2d) {
// don't recompute polygon for each paint event
polygon = computePolygon(getModelChart(), getModelChart().getModel());
}
clippedPolygon = initClippedPolygon(polygon, g2d.getClip());
if (drawPolygon) {
// don't antialias the polygon, if we are going to antialias the bounding lines
Object oldAAHint = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
if (isDrawLine()) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
g2d.setPaint(createPaint(polygon));
clippedPolygon = initClippedPolygon(polygon, g2d.getClip());
g2d.fillPolygon(clippedPolygon);
if (isDrawLine()) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAAHint);
}
}
if (isDrawLine()) {
g2d.setPaint(getLinePaint());
g2d.drawPolyline(polygon.xpoints, polygon.ypoints, polygon.npoints-1);
g2d.drawPolyline(clippedPolygon.xpoints, clippedPolygon.ypoints, clippedPolygon.npoints-1);
}
}

Expand Down