summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-11-24 12:37:28 +0000
committerMoonchild <moonchild@palemoon.org>2022-11-26 02:43:18 +0000
commit7eb7d67f7ad856a8fa4a7bd978fe8d642f39c439 (patch)
tree74fbf2ae896a1f099330f05d000016884812dd4c
parente28860ba7f238f6202ed3c45292deefadbe4598d (diff)
downloaduxp-7eb7d67f7ad856a8fa4a7bd978fe8d642f39c439.tar.gz
Issue #2033 - Temporary fix of R<->B channel swap.
We have a BGR/RGB channel ordering mismatch here. to at least provide proper display, a quick&dirty byte swap on the output buffer will fix this for now, but we should look into seeing where the surface mismatch is caused. std::swap() should optimize pretty well in any of the used compilers, but if necessary, a full buffer ASM routine can be slotted in (although on current hardware I doubt this will be even noticeable as it is)
-rw-r--r--image/decoders/nsJXLDecoder.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/image/decoders/nsJXLDecoder.cpp b/image/decoders/nsJXLDecoder.cpp
index 07a7849e28..7c0a743c6a 100644
--- a/image/decoders/nsJXLDecoder.cpp
+++ b/image/decoders/nsJXLDecoder.cpp
@@ -141,6 +141,11 @@ nsJXLDecoder::ReadJXLData(const char* aData, size_t aLength)
Nothing(), SurfacePipeFlags());
for (uint8_t* rowPtr = mOutBuffer.begin(); rowPtr < mOutBuffer.end();
rowPtr += mInfo.xsize * 4) {
+ // FIXME: Quick and dirty BGRA to RGBA conversion.
+ // We currently have a channel ordering mis-match here.
+ for (uint8_t* pixPtr = rowPtr; pixPtr < rowPtr + mInfo.xsize * 4; pixPtr+=4){
+ std::swap(pixPtr[0], pixPtr[2]);
+ }
pipe->WriteBuffer(reinterpret_cast<uint32_t*>(rowPtr));
}