Skip to content

Commit

Permalink
fix: mask render on android (#1981)
Browse files Browse the repository at this point in the history
It seems that the bug comes from the fact that on iOS we are making a Rect from those values, which takes its starting positions and than width and height as argument, whereas on Android the arguments are strictly 4 bounds, therefore we need to add the starting points to the right and bottom argument.
  • Loading branch information
Aflexon authored Mar 24, 2023
1 parent baf011f commit ccda91c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion android/src/main/java/com/horcrux/svg/RenderableView.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void render(Canvas canvas, Paint paint, float opacity) {
float maskY = (float) relativeOnHeight(mask.mY);
float maskWidth = (float) relativeOnWidth(mask.mW);
float maskHeight = (float) relativeOnHeight(mask.mH);
maskCanvas.clipRect(maskX, maskY, maskWidth, maskHeight);
maskCanvas.clipRect(maskX, maskY, maskWidth + maskX, maskHeight + maskY);

Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mask.draw(maskCanvas, maskPaint, 1);
Expand Down

0 comments on commit ccda91c

Please sign in to comment.