From 0edecdc00ee9325ac2ac7e0e0f854de41e4ce2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 13 Nov 2024 13:32:29 +0100 Subject: [PATCH] BBitmap: Amend special-casing for B_RGB32 in SetBits. * Spirograph uses SetBits with length 1 und 4, which can't work as expected. As Spirograph uses the same source and target colorspace, the memcpy codepath is used with the right length. * fix #12931 Change-Id: I4f27e748fb842c2d81d4161e7c94586844995bdf Reviewed-on: https://review.haiku-os.org/c/haiku/+/8562 Tested-by: Commit checker robot Reviewed-by: Adrien Destugues Haiku-Format: Haiku-format Bot --- src/kits/interface/Bitmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index e5bdfe2bcb..a78db5ec85 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -665,8 +665,8 @@ BBitmap::SetBits(const void* data, int32 length, int32 offset, int32 inBPR = -1; // tweaks to mimic R5 behavior if (error == B_OK) { - if (colorSpace == B_RGB32) { - // B_RGB32 means actually unpadded B_RGB24_BIG + if (colorSpace == B_RGB32 && (length % 3) == 0) { + // B_RGB32 could actually mean unpadded B_RGB24_BIG colorSpace = B_RGB24_BIG; inBPR = width * 3; } else if (colorSpace == B_CMAP8 && fColorSpace != B_CMAP8) {