Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec94f5ea authored by Mark Harman's avatar Mark Harman
Browse files

Bitmaps need to be mutable for panorama without renderscript, for Android 7 emulator at least.

parent a6de48e7
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -1135,7 +1135,7 @@ public class ImageSaver extends Thread {
        }
        }
    }
    }


    /** Converts the array of jpegs to Bitmaps. The bitmap with index mutable_id will be marked as mutable (or set to -1 to have no mutable bitmaps).
    /** Converts the array of jpegs to Bitmaps. The bitmap with index mutable_id will be marked as mutable (or set to -1 to have no mutable bitmaps, or -2 to have all be mutable bitmaps).
     */
     */
    private List<Bitmap> loadBitmaps(List<byte []> jpeg_images, int mutable_id, int inSampleSize) {
    private List<Bitmap> loadBitmaps(List<byte []> jpeg_images, int mutable_id, int inSampleSize) {
        if( MyDebug.LOG ) {
        if( MyDebug.LOG ) {
@@ -1150,7 +1150,7 @@ public class ImageSaver extends Thread {
        setBitmapOptionsSampleSize(options, inSampleSize);
        setBitmapOptionsSampleSize(options, inSampleSize);
        LoadBitmapThread [] threads = new LoadBitmapThread[jpeg_images.size()];
        LoadBitmapThread [] threads = new LoadBitmapThread[jpeg_images.size()];
        for(int i=0;i<jpeg_images.size();i++) {
        for(int i=0;i<jpeg_images.size();i++) {
            threads[i] = new LoadBitmapThread( i==mutable_id ? mutable_options : options, jpeg_images.get(i) );
            threads[i] = new LoadBitmapThread( (i==mutable_id || mutable_id==-2) ? mutable_options : options, jpeg_images.get(i) );
        }
        }
        // start threads
        // start threads
        if( MyDebug.LOG )
        if( MyDebug.LOG )
@@ -1813,7 +1813,10 @@ public class ImageSaver extends Thread {
                Collections.reverse(request.gyro_rotation_matrix);
                Collections.reverse(request.gyro_rotation_matrix);
            }
            }


            List<Bitmap> bitmaps = loadBitmaps(request.jpeg_images, -1, 1);
            // need all to be mutable for use_renderscript==false - n.b., in practice setting to -1
            // doesn't cause a problem on some devices e.g. Galaxy S24+ because the bitmaps may be made
            // mutable in rotateForExif, but this can be reproduced on on emulator at least
            List<Bitmap> bitmaps = loadBitmaps(request.jpeg_images, -2, 1);
            if( bitmaps == null ) {
            if( bitmaps == null ) {
                if( MyDebug.LOG )
                if( MyDebug.LOG )
                    Log.e(TAG, "failed to load bitmaps");
                    Log.e(TAG, "failed to load bitmaps");