From f2ffeb687d002f4a41b52a6ef5bb2580eb6a4ed6 Mon Sep 17 00:00:00 2001 From: Mark Murphy Date: Sat, 9 Feb 2019 12:18:34 -0500 Subject: [PATCH] bug fix for image size --- .../android/andshooter/ImageTransmogrifier.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MediaProjection/andshooter/app/src/main/java/com/commonsware/android/andshooter/ImageTransmogrifier.java b/MediaProjection/andshooter/app/src/main/java/com/commonsware/android/andshooter/ImageTransmogrifier.java index 672b12c3c..6f3a7d940 100644 --- a/MediaProjection/andshooter/app/src/main/java/com/commonsware/android/andshooter/ImageTransmogrifier.java +++ b/MediaProjection/andshooter/app/src/main/java/com/commonsware/android/andshooter/ImageTransmogrifier.java @@ -37,7 +37,7 @@ public class ImageTransmogrifier implements ImageReader.OnImageAvailableListener Display display=svc.getWindowManager().getDefaultDisplay(); Point size=new Point(); - display.getSize(size); + display.getRealSize(size); int width=size.x; int height=size.y; @@ -79,10 +79,7 @@ public void onImageAvailable(ImageReader reader) { } latestBitmap.copyPixelsFromBuffer(buffer); - - if (image != null) { - image.close(); - } + image.close(); ByteArrayOutputStream baos=new ByteArrayOutputStream(); Bitmap cropped=Bitmap.createBitmap(latestBitmap, 0, 0,