From 91b4e6419cfed1ebcb02f7879ac32ec438eda2d3 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Mon, 28 Oct 2024 14:51:21 +0100 Subject: [PATCH] fix: negative dx/dy in feOffset --- android/src/main/java/com/horcrux/svg/FeOffsetView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/horcrux/svg/FeOffsetView.java b/android/src/main/java/com/horcrux/svg/FeOffsetView.java index 8dac0a37b..5e01b3859 100644 --- a/android/src/main/java/com/horcrux/svg/FeOffsetView.java +++ b/android/src/main/java/com/horcrux/svg/FeOffsetView.java @@ -44,8 +44,10 @@ public Bitmap applyFilter(HashMap resultsMap, Bitmap prevResult) float dy = this.mDy != null ? (float) this.relativeOnHeight(this.mDy) : 0; RectF frame = new RectF(0, 0, dx, dy); this.getSvgView().getCtm().mapRect(frame); + dx = frame.left < 0 ? frame.left : frame.width(); + dy = frame.top < 0 ? frame.top : frame.height(); - canvas.drawBitmap(source, frame.width(), frame.height(), null); + canvas.drawBitmap(source, dx, dy, null); return result; }