diff options
| author | JosJuice <josjuice@gmail.com> | 2022-12-11 12:10:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-11 12:10:55 +0100 |
| commit | 82e87cf7b9bd253a2e17d126fbf9adbcf8a844d3 (patch) | |
| tree | b4e75c08e70fb7f0a2bb9003625ca6838b6915cd /Source/Android | |
| parent | cac5d0b8f5b7c799487b6e76b678d941aa1141eb (diff) | |
| parent | 3accb06fe1ae18b0769bca2cb4f93be1ff3ee6e7 (diff) | |
Merge pull request #9944 from JosJuice/android-nonsquare-buttons
Android: Allow non-square overlay control images
Diffstat (limited to 'Source/Android')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java index 4923398082..7d949befed 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java @@ -106,11 +106,14 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener // Determine the button size based on the smaller screen dimension. // This makes sure the buttons are the same size in both portrait and landscape. DisplayMetrics dm = context.getResources().getDisplayMetrics(); - int minDimension = Math.min(dm.widthPixels, dm.heightPixels); + int minScreenDimension = Math.min(dm.widthPixels, dm.heightPixels); + + int maxBitmapDimension = Math.max(bitmap.getWidth(), bitmap.getHeight()); + float bitmapScale = scale * minScreenDimension / maxBitmapDimension; return Bitmap.createScaledBitmap(bitmap, - (int) (minDimension * scale), - (int) (minDimension * scale), + (int) (bitmap.getWidth() * bitmapScale), + (int) (bitmap.getHeight() * bitmapScale), true); } |
