From 095b3813108d0db8a40ff63b547d476ca0ebbbd5 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Mon, 3 Apr 2023 19:18:47 +0200 Subject: [PATCH] BitmapStream: fix grayscale AVIF decoding BitmapStream creates a BBitmap without specifying a bytes per row, but then check the bytes per row matches the header. It is better to ask BBitmap for the desired bytes per row to avoid any difference in padding. Change-Id: Ie1facfd423ad888a14757a0fffc9e8cdf72ef832 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6301 Tested-by: Automation Reviewed-by: waddlesplash --- src/kits/translation/BitmapStream.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/translation/BitmapStream.cpp b/src/kits/translation/BitmapStream.cpp index 8e196d6f4d..7806a2b567 100644 --- a/src/kits/translation/BitmapStream.cpp +++ b/src/kits/translation/BitmapStream.cpp @@ -150,7 +150,7 @@ BBitmapStream::WriteAt(off_t pos, const void* data, size_t size) if (fHeader.bounds.left > 0.0 || fHeader.bounds.top > 0.0) DEBUGGER("non-origin bounds!"); fBitmap = new (std::nothrow )BBitmap(fHeader.bounds, - fHeader.colors); + 0, fHeader.colors, fHeader.rowBytes); if (fBitmap == NULL) return B_ERROR; if (!fBitmap->IsValid()) { @@ -160,7 +160,8 @@ BBitmapStream::WriteAt(off_t pos, const void* data, size_t size) return error; } if ((uint32)fBitmap->BytesPerRow() != fHeader.rowBytes) { - fprintf(stderr, "BitmapStream %" B_PRId32 " %" B_PRId32 "\n", + fprintf(stderr, "BitmapStream BytesPerRow width %" B_PRId32 " does not match " + "value declared in header %" B_PRId32 "\n", fBitmap->BytesPerRow(), fHeader.rowBytes); return B_MISMATCHED_VALUES; }