From e096f55d71f7d85d3e7e014530a290d532a95036 Mon Sep 17 00:00:00 2001 From: Luis Bernardo Date: Sat, 16 Mar 2013 00:48:31 +0000 Subject: [PATCH] FOP-2223: Lines do not span to the end in rounded border cells in AFP; patch submitted by Simon Steiner. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1457188 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/render/afp/AFPPainter.java | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/src/java/org/apache/fop/render/afp/AFPPainter.java b/src/java/org/apache/fop/render/afp/AFPPainter.java index 3a41e5feb..014b70735 100644 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/java/org/apache/fop/render/afp/AFPPainter.java @@ -415,7 +415,7 @@ public class AFPPainter extends AbstractIFPainter { Area background = new Area(area); Area cornerRegion = new Area(); Area[] cornerBorder = new Area[]{new Area(), new Area(), new Area(), new Area()}; - + Area[] clip = new Area[4]; if (roundCorner[TOP_LEFT]) { AffineTransform transform = new AffineTransform(); int beforeRadius = (int)(cornerCorrectionFactor * bpsBefore.getRadiusStart()); @@ -428,9 +428,9 @@ public class AFPPainter extends AbstractIFPainter { background.subtract(makeCornerClip(beforeRadius, startRadius, transform)); - Area clip = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); - clip.transform(transform); - cornerRegion.add(clip); + clip[TOP_LEFT] = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); + clip[TOP_LEFT].transform(transform); + cornerRegion.add(clip[TOP_LEFT]); cornerBorder[TOP].add(makeCornerBorderBPD(beforeRadius, startRadius, beforeWidth, startWidth, transform)); @@ -453,9 +453,9 @@ public class AFPPainter extends AbstractIFPainter { background.subtract(makeCornerClip(beforeRadius, startRadius, transform)); - Area clip = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); - clip.transform(transform); - cornerRegion.add(clip); + clip[TOP_RIGHT] = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); + clip[TOP_RIGHT].transform(transform); + cornerRegion.add(clip[TOP_RIGHT]); cornerBorder[TOP].add(makeCornerBorderBPD(beforeRadius, startRadius, beforeWidth, startWidth, transform)); @@ -478,9 +478,9 @@ public class AFPPainter extends AbstractIFPainter { background.subtract(makeCornerClip(beforeRadius, startRadius, transform)); - Area clip = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); - clip.transform(transform); - cornerRegion.add(clip); + clip[BOTTOM_RIGHT] = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); + clip[BOTTOM_RIGHT].transform(transform); + cornerRegion.add(clip[BOTTOM_RIGHT]); cornerBorder[BOTTOM].add(makeCornerBorderBPD(beforeRadius, startRadius, beforeWidth, startWidth, transform)); @@ -502,9 +502,9 @@ public class AFPPainter extends AbstractIFPainter { background.subtract(makeCornerClip(beforeRadius, startRadius, transform)); - Area clip = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); - clip.transform(transform); - cornerRegion.add(clip); + clip[BOTTOM_LEFT] = new Area(new Rectangle(0, 0, startRadius, beforeRadius)); + clip[BOTTOM_LEFT].transform(transform); + cornerRegion.add(clip[BOTTOM_LEFT]); cornerBorder[BOTTOM].add(makeCornerBorderBPD(beforeRadius, startRadius, beforeWidth, startWidth, transform)); @@ -528,7 +528,12 @@ public class AFPPainter extends AbstractIFPainter { Area border = new Area(borderPath); - border.subtract(cornerRegion); + if (clip[TOP_LEFT] != null) { + border.subtract(clip[TOP_LEFT]); + } + if (clip[TOP_RIGHT] != null) { + border.subtract(clip[TOP_RIGHT]); + } g2d.setColor(bpsBefore.color); g2d.fill(border); @@ -548,7 +553,12 @@ public class AFPPainter extends AbstractIFPainter { Area border = new Area(borderPath); - border.subtract(cornerRegion); + if (clip[BOTTOM_RIGHT] != null) { + border.subtract(clip[BOTTOM_RIGHT]); + } + if (clip[TOP_RIGHT] != null) { + border.subtract(clip[TOP_RIGHT]); + } g2d.setColor(bpsEnd.color); g2d.fill(border); @@ -565,9 +575,12 @@ public class AFPPainter extends AbstractIFPainter { borderPath.lineTo(bpsStart == null ? 0 : bpsStart.width, borderRect.height - bpsAfter.width); Area border = new Area(borderPath); - - border.subtract(cornerRegion); - + if (clip[BOTTOM_LEFT] != null) { + border.subtract(clip[BOTTOM_LEFT]); + } + if (clip[BOTTOM_RIGHT] != null) { + border.subtract(clip[BOTTOM_RIGHT]); + } g2d.setColor(bpsAfter.color); g2d.fill(border); g2d.fill(cornerBorder[BOTTOM]); @@ -585,8 +598,12 @@ public class AFPPainter extends AbstractIFPainter { Area border = new Area(borderPath); - border.subtract(cornerRegion); - + if (clip[BOTTOM_LEFT] != null) { + border.subtract(clip[BOTTOM_LEFT]); + } + if (clip[TOP_LEFT] != null) { + border.subtract(clip[TOP_LEFT]); + } g2d.setColor(bpsStart.color); g2d.fill(border); g2d.fill(cornerBorder[LEFT]); -- 2.39.5