From 73cfd8b2bd911a52a8fdf459ad60672c56ede154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Mon, 19 Aug 2024 15:30:30 +0200 Subject: [PATCH] Fix incorrect application of overlay if bitmap size differs --- .../secuso/privacyfriendlynotes/ui/notes/SketchActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/SketchActivity.kt b/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/SketchActivity.kt index 2264e23..d5437a9 100644 --- a/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/SketchActivity.kt +++ b/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/SketchActivity.kt @@ -322,7 +322,11 @@ class SketchActivity : BaseNoteActivity(DbContract.NoteEntry.TYPE_SKETCH), OnDia val bmOverlay = Bitmap.createBitmap(width, height, config) val canvas = Canvas(bmOverlay) canvas.drawBitmap(this, Matrix(), null) - canvas.drawBitmap(bitmap, 0f, 0f, null) + if (width != bitmap.width || height != bitmap.height) { + canvas.drawBitmap(bitmap, Rect(0, 0, bitmap.width, bitmap.height), Rect(0, 0, width, height), null) + } else { + canvas.drawBitmap(bitmap, 0f, 0f, null) + } return bmOverlay }