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

Commit c6c9d273 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "SnapdragonGallery: check for valid background before saving"

parents b47ac6f1 53106863
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
@@ -368,6 +368,11 @@ public class SaveImage {
            if(hasFusion) {
                previewBmp = flattenFusion(Uri.parse(fusionRep.getUnderlay()), mPreviewImage,
                        Math.max(mPreviewImage.getWidth(), mPreviewImage.getHeight()), 0);
                // If we fail to flatten, save original image
                if(previewBmp == null) {
                    previewBmp = mPreviewImage;
                    hasFusion = false;
                }
            } else {
                previewBmp = mPreviewImage;
            }
@@ -447,10 +452,11 @@ public class SaveImage {
                if(hasFusion) {
                    Bitmap underlay = flattenFusion(
                            Uri.parse(fusionRep.getUnderlay()), bitmap, 0, sampleSize);

                    if(underlay != null) {
                        bitmap.recycle();
                        bitmap = underlay;
                    }
                }

                updateProgress();

@@ -820,6 +826,7 @@ public class SaveImage {
            underlay = ImageLoader.loadBitmapWithBackouts(mContext, underlayUri, sampleSize);
        }

        if(underlay != null) {
            RectF destRect = new RectF();
            Rect imageBounds = MasterImage.getImage().getImageBounds();
            Rect underlayBounds = MasterImage.getImage().getFusionBounds();
@@ -839,7 +846,7 @@ public class SaveImage {
            paint.setDither(true);

            canvas.drawBitmap(bitmap, null, destRect, paint);

        }
        return underlay;
    }
}