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

Commit 7bd2520d authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix how ExifInterface creates VP8X chunks for WebP files"

parents a3862537 0d30ebca
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3826,7 +3826,7 @@ public class ExifInterface {
                    int widthAndHeight = 0;
                    int width = 0;
                    int height = 0;
                    int alpha = 0;
                    boolean alpha = false;
                    // Save VP8 frame data for later
                    byte[] vp8Frame = new byte[3];

@@ -3861,7 +3861,7 @@ public class ExifInterface {
                        width = ((widthAndHeight << 18) >> 18) + 1;
                        height = ((widthAndHeight << 4) >> 18) + 1;
                        // Retrieve alpha bit
                        alpha = widthAndHeight & (1 << 3);
                        alpha = (widthAndHeight & (1 << 28)) != 0;
                        bytesToRead -= (1 /* VP8L signature */ + 4);
                    }

@@ -3869,10 +3869,12 @@ public class ExifInterface {
                    nonHeaderOutputStream.write(WEBP_CHUNK_TYPE_VP8X);
                    nonHeaderOutputStream.writeInt(WEBP_CHUNK_TYPE_VP8X_DEFAULT_LENGTH);
                    byte[] data = new byte[WEBP_CHUNK_TYPE_VP8X_DEFAULT_LENGTH];
                    // ALPHA flag
                    if (alpha) {
                        data[0] = (byte) (data[0] | (1 << 4));
                    }
                    // EXIF flag
                    data[0] = (byte) (data[0] | (1 << 3));
                    // ALPHA flag
                    data[0] = (byte) (data[0] | (alpha << 4));
                    // VP8X stores Width - 1 and Height - 1 values
                    width -= 1;
                    height -= 1;