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

Commit da79afaa authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix how ExifInterface creates VP8X chunks for WebP files" am: 7bd2520d am: a3487965

parents 15cb6559 a3487965
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3829,7 +3829,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];

@@ -3864,7 +3864,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);
                    }

@@ -3872,10 +3872,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;