Skip to content

Commit fe7d606

Browse files
author
Benoit Lagae
committed
Only do postdraw for non-grouping elements
DEVSIX-2067
1 parent 746e5a2 commit fe7d606

File tree

241 files changed

+15
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+15
-18
lines changed

svg/src/main/java/com/itextpdf/svg/css/impl/SvgAttributeInheritance.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public class SvgAttributeInheritance implements IStyleInheritance {
6666
SvgConstants.Attributes.STROKE,
6767

6868
//Fill
69-
SvgConstants.Attributes.FILL
69+
SvgConstants.Attributes.FILL,
70+
71+
//clip-rule
72+
SvgConstants.Attributes.CLIP_RULE
7073

7174
));
7275

svg/src/main/java/com/itextpdf/svg/renderers/impl/AbstractBranchSvgNodeRenderer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ protected final void deepCopyChildren(AbstractBranchSvgNodeRenderer deepCopy) {
291291
}
292292
}
293293

294+
@Override void postDraw(SvgDrawContext context) {}
295+
294296
@Override
295297
public abstract ISvgNodeRenderer createDeepCopy();
296298

svg/src/main/java/com/itextpdf/svg/renderers/impl/AbstractSvgNodeRenderer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ void postDraw(SvgDrawContext context) {
254254

255255
// fill-rule
256256
if (partOfClipPath) {
257-
currentCanvas.closePath();
258257
if (SvgConstants.Values.FILL_RULE_EVEN_ODD.equalsIgnoreCase(this.getAttribute(SvgConstants.Attributes.CLIP_RULE))) {
259258
currentCanvas.eoClip();
260259
} else {
@@ -281,7 +280,7 @@ void postDraw(SvgDrawContext context) {
281280
} else if (doStroke) {
282281
currentCanvas.stroke();
283282
}
284-
currentCanvas.closePath();
283+
currentCanvas.closePath(); // TODO: see if this is necessary DEVSIX-2583
285284
}
286285
}
287286
}

svg/src/main/java/com/itextpdf/svg/renderers/impl/ClipPathSvgNodeRenderer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ public ISvgNodeRenderer createDeepCopy() {
6666
return copy;
6767
}
6868

69-
void preDraw(SvgDrawContext context) {}
70-
void postDraw(SvgDrawContext context) {}
69+
@Override void preDraw(SvgDrawContext context) {}
7170

7271
@Override
7372
protected void doDraw(SvgDrawContext context) {

svg/src/main/java/com/itextpdf/svg/renderers/impl/UseSvgNodeRenderer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ protected void doDraw(SvgDrawContext context) {
123123
}
124124
}
125125

126+
@Override void postDraw(SvgDrawContext context) {}
127+
126128
/**
127129
* The reference value will contain a hashtag character. This method will filter that value.
128130
*

svg/src/test/java/com/itextpdf/svg/renderers/impl/ClipPathSvgNodeRendererLowLevelIntegrationTest.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void testRectClipPathRenderer() {
6767
clipRenderer.addChild(rectRenderer);
6868
clipRenderer.draw(sdc);
6969

70-
Assert.assertEquals("q\n% rect\n0 0 300 300 re\nh\nW\nn\nQ\n", new String(cv.getContentStream().getBytes()));
70+
Assert.assertEquals("q\n% rect\n0 0 300 300 re\nW\nn\nQ\n", new String(cv.getContentStream().getBytes()));
7171
}
7272

7373
@Test
@@ -81,7 +81,7 @@ public void testRectClipPathEoRendererNoChange() {
8181
clipRenderer.addChild(rectRenderer);
8282
clipRenderer.draw(sdc);
8383

84-
Assert.assertEquals("q\n% rect\n0 0 300 300 re\nh\nW\nn\nQ\n", new String(cv.getContentStream().getBytes()));
84+
Assert.assertEquals("q\n% rect\n0 0 300 300 re\nW\nn\nQ\n", new String(cv.getContentStream().getBytes()));
8585
}
8686

8787
@Test
@@ -95,7 +95,7 @@ public void testRectEoClipPathRenderer() {
9595
clipRenderer.addChild(rectRenderer);
9696
clipRenderer.draw(sdc);
9797

98-
Assert.assertEquals("q\n% rect\n0 0 300 300 re\nh\nW*\nn\nQ\n", new String(cv.getContentStream().getBytes()));
98+
Assert.assertEquals("q\n% rect\n0 0 300 300 re\nW*\nn\nQ\n", new String(cv.getContentStream().getBytes()));
9999
}
100100

101101
@Test
@@ -118,7 +118,6 @@ public void testAppliedClipPathRenderer() {
118118
String expected = "q\n" +
119119
"% rect\n" +
120120
"0 0 60 60 re\n" +
121-
"h\n" +
122121
"W\n" +
123122
"n\n" +
124123
"0 0 0 rg\n" +
@@ -159,7 +158,6 @@ public void testAppliedGroupClipPathRenderer() {
159158
"q\n" +
160159
"% rect\n" +
161160
"0 0 60 60 re\n" +
162-
"h\n" +
163161
"W\n" +
164162
"n\n" +
165163
"% ellipse\n" +
@@ -171,9 +169,7 @@ public void testAppliedGroupClipPathRenderer() {
171169
"f\n" +
172170
"h\n" +
173171
"Q\n" +
174-
"Q\n" +
175-
"f\n" +
176-
"h\n";
172+
"Q\n";
177173
Assert.assertEquals(expected, new String(cv.getContentStream().getBytes()));
178174
}
179175

@@ -209,7 +205,6 @@ public void testEoAppliedGroupClipPathRenderer() {
209205
"q\n" +
210206
"% rect\n" +
211207
"0 0 60 60 re\n" +
212-
"h\n" +
213208
"W*\n" +
214209
"n\n" +
215210
"% ellipse\n" +
@@ -224,7 +219,6 @@ public void testEoAppliedGroupClipPathRenderer() {
224219
"q\n" +
225220
"% rect\n" +
226221
"0 0 60 60 re\n" +
227-
"h\n" +
228222
"W\n" +
229223
"n\n" +
230224
"% ellipse\n" +
@@ -236,9 +230,7 @@ public void testEoAppliedGroupClipPathRenderer() {
236230
"f\n" +
237231
"h\n" +
238232
"Q\n" +
239-
"Q\n" +
240-
"f\n" +
241-
"h\n";
233+
"Q\n";
242234
Assert.assertEquals(expected, new String(cv.getContentStream().getBytes()));
243235
}
244236
}

0 commit comments

Comments
 (0)