Skip to content

Commit eb4889c

Browse files
authored
fix: negative dx/dy in feOffset (#2515)
# Summary While working on #2514 I've noticed that negative dx/dy were treated as positive. ## Test Plan Add FeOffset filter with negative dx/dy to an element. It should move closer to upper left corner. ## Compatibility | OS | Implemented | | ------- | :---------: | | Android | ✅ |
1 parent e6a27f8 commit eb4889c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/java/com/horcrux/svg/FeOffsetView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ public Bitmap applyFilter(HashMap<String, Bitmap> resultsMap, Bitmap prevResult)
4444
float dy = this.mDy != null ? (float) this.relativeOnHeight(this.mDy) : 0;
4545
RectF frame = new RectF(0, 0, dx, dy);
4646
this.getSvgView().getCtm().mapRect(frame);
47+
dx = frame.left < 0 ? frame.left : frame.width();
48+
dy = frame.top < 0 ? frame.top : frame.height();
4749

48-
canvas.drawBitmap(source, frame.width(), frame.height(), null);
50+
canvas.drawBitmap(source, dx, dy, null);
4951

5052
return result;
5153
}

0 commit comments

Comments
 (0)