1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

ImageViewer: Transform the image's dimension accordingly to the metadata

Exif metadata have two tags to store the pixel density along each axis.
If both values are different and no action is taken, the resulting image
will appear deformed. This commit scales the displayed bitmap
accordingly to these tags in order to show the image in its intended
shape. This unfortunately includes a lot of plumbing to get this
information through IPC.
This commit is contained in:
Lucas CHOLLET 2024-02-14 01:15:06 -05:00 committed by Sam Atkins
parent 8dd887b3c8
commit 8e2102fb73
6 changed files with 27 additions and 8 deletions

View file

@ -48,6 +48,7 @@ Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data, Optional
DecodedImage image;
image.is_animated = response.is_animated();
image.loop_count = response.loop_count();
image.scale = response.scale();
image.frames.ensure_capacity(response.bitmaps().size());
auto bitmaps = response.take_bitmaps();
for (size_t i = 0; i < bitmaps.size(); ++i) {