Skip to content
Open
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: 1 addition & 1 deletion .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Fetch Source
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup Java
uses: actions/setup-java@v3.11.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: gradle/wrapper-validation-action@v3
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Configure JDK
uses: actions/setup-java@v3.11.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}
...
dependencies {
implementation 'com.github.ainceborn:PdfBox-Android-3:3.0.1'
implementation 'com.github.ainceborn:PdfBox-Android-3:3.0.2'
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=1024m -Dkotlin.daemon.jvm.opti
org.gradle.parallel=true
org.gradle.caching=true

VERSION_NAME=3.0.1
VERSION_NAME=3.0.2
VERSION_CODE=1

ANDROID_BUILD_MIN_SDK_VERSION=26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,15 @@ public void drawTilingPattern(Canvas canvas,
Path savedLinePath = this.linePath;
Path.FillType savedClipFillType = this.clipWindingRule;
Region savedLastClip = this.lastClip;
int savedClipSaveCount = this.clipSaveCount; // must save/restore to avoid corrupting main canvas state
Path savedInitialClip = this.initialClip;
boolean savedFlipTG = this.flipTG;

this.canvas = canvas;
this.linePath = new Path();
this.clipWindingRule = Path.FillType.WINDING;
this.lastClip = null;
this.clipSaveCount = 0; // reset for the tiling pattern's canvas
this.initialClip = null;
this.flipTG = true;
setRenderingHints();
Expand All @@ -298,6 +300,7 @@ public void drawTilingPattern(Canvas canvas,
this.canvas = savedCanvas;
this.linePath = savedLinePath;
this.lastClip = savedLastClip;
this.clipSaveCount = savedClipSaveCount; // restore main canvas clip state
this.initialClip = savedInitialClip;
this.clipWindingRule = savedClipFillType;
}
Expand Down Expand Up @@ -761,8 +764,16 @@ public void fillAndStrokePath(Path.FillType windingRule) throws IOException
@Override
public void clip(Path.FillType windingRule)
{
// the clipping path will not be updated until the succeeding painting operator is called
clipWindingRule = windingRule;
// Apply clip immediately like original PDFBox (not deferred to endPath)
// PDFBOX-4949: don't clip if path is empty ("W n" only, no actual path)
if (!linePath.isEmpty())
{
linePath.setFillType(windingRule);
getGraphicsState().intersectClippingPath(linePath);
}
// PDFBOX-3836: reset lastClip so setClip() re-evaluates on next draw call
lastClip = null;
clipWindingRule = null;
}

@Override
Expand Down Expand Up @@ -855,6 +866,9 @@ public void drawImage(PDImage pdImage) throws IOException
}
}

// Apply current clipping path before drawing image (matches original PDFBox behaviour)
setClip();

if (pdImage.isStencil())
{
if (graphicsState.getNonStrokingColor().getColorSpace() instanceof PDPattern)
Expand Down Expand Up @@ -1010,8 +1024,6 @@ else if (scaleX != 0 && scaleY != 0)
// the setRenderingHint method, so we re-set all hints, see PDFBOX-2302
setRenderingHints();
}

canvas.save();
}

private void drawBufferedImageV2(PDImage pdImage, Bitmap image, AffineTransform at, Canvas canvas) throws IOException
Expand Down
Loading