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 <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
This commit is contained in:
Jérôme Duval 2024-11-13 13:32:29 +01:00
parent f72d1684e5
commit 0edecdc00e

View File

@ -665,8 +665,8 @@ BBitmap::SetBits(const void* data, int32 length, int32 offset,
int32 inBPR = -1; int32 inBPR = -1;
// tweaks to mimic R5 behavior // tweaks to mimic R5 behavior
if (error == B_OK) { if (error == B_OK) {
if (colorSpace == B_RGB32) { if (colorSpace == B_RGB32 && (length % 3) == 0) {
// B_RGB32 means actually unpadded B_RGB24_BIG // B_RGB32 could actually mean unpadded B_RGB24_BIG
colorSpace = B_RGB24_BIG; colorSpace = B_RGB24_BIG;
inBPR = width * 3; inBPR = width * 3;
} else if (colorSpace == B_CMAP8 && fColorSpace != B_CMAP8) { } else if (colorSpace == B_CMAP8 && fColorSpace != B_CMAP8) {