swapped red and blue channels because it was messed up in the first PR#10331
swapped red and blue channels because it was messed up in the first PR#10331sandreas wants to merge 11 commits intoslint-ui:masterfrom
Conversation
|
Hi @sandreas . thanks for the patch. I'm wondering: doesn't from_rgb() need to be adjusted as well? And if yes, isn't the the implementation identical with Xrgb888? If it is, then I suppose one type could be removed. What do you think? |
Thank you for the quick feedback. Probably you're right. First I was just trying to fix that slint somehow reported the BA24 Renderer (which turned out to internally by Unfortunately it took a while until I noticed that the colors were switched - first I thought it had to do something with dark mode (which I was experimenting with at the time). So I think I need to test this on the device I'm working with to ensure not patching the wrong thing (see https://github.com/sandreas/rust-slint-riscv64-musl-demo?tab=readme-ov-file#hardware). This might take some days, I'll report back. |
|
An alias makes sense, or a more generic name (bgra8888 and we just also use it for the kernel's xrgb) Anyway, take your time to test it on the device:) |
…th a match clause
|
@tronical However, now everything seems to work with an alias and I removed a lot of duplicated code. I don't know why I did not notice that an alias is enough in the first place - well, I learned a lot of Rust in the last weeks :-) Screenshot with test images and rectangles that show it is now working as expected: |
|
Something still seems off in this patch. Before this patch, this was the encoding for Bgra: red: (v >> 0) as u8,
green: (v >> 8) as u8,
blue: (v >> 16) as u8,
alpha: (v >> 24) as u8,This could be interpreted as "rgba" or "abgr", but somehow not as "bgra" I think. With this patch, I think at this point we need your help with testing to find the right encoding, as you have the necessary hardware. My guts feeling is that what's in the git repo now is almost correct, just that the blue and red channels are swapped, so perhaps the existing Bgra target pixel implementation just needs fixing. |
…e software renderer
The implementation was essentially ABGR instead of BGRA. BGRA is defined like this:
[31:0] B:G:R:A 8:8:8:8 little endian
Replaces #10331




This is a follow up for #9914 which somehow seems to have messed up the red and blue channel (see attached screenshot vs the original image).
I hope this fixes the problem - I'm going to do more research if it does not.