mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Wrong byte order when read JPEG image using libturbojpeg under macOS (issue #1290)
(cherry picked from commit 337c6ef4dc)
This commit is contained in:
parent
a1855fc64a
commit
dbdb689e61
1 changed files with 19 additions and 5 deletions
|
|
@ -107,11 +107,25 @@ begin
|
|||
|
||||
TLazIntfImage(Img).DataDescription:= QueryDescription([riqfRGB, riqfAlpha], AWidth, AHeight);
|
||||
|
||||
case TLazIntfImage(Img).DataDescription.RedShift of
|
||||
0: AFormat:= TJPF_RGBA;
|
||||
8: AFormat:= TJPF_ARGB;
|
||||
16: AFormat:= TJPF_BGRA;
|
||||
24: AFormat:= TJPF_ABGR;
|
||||
with TLazIntfImage(Img).DataDescription do
|
||||
begin
|
||||
if ByteOrder = riboLSBFirst then
|
||||
begin
|
||||
case RedShift of
|
||||
0: AFormat:= TJPF_RGBA;
|
||||
8: AFormat:= TJPF_ARGB;
|
||||
16: AFormat:= TJPF_BGRA;
|
||||
24: AFormat:= TJPF_ABGR;
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
case RedShift of
|
||||
0: AFormat:= TJPF_ABGR;
|
||||
8: AFormat:= TJPF_BGRA;
|
||||
16: AFormat:= TJPF_ARGB;
|
||||
24: AFormat:= TJPF_RGBA;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if tjDecompress2(jpegDecompressor, AStream.Memory, ASize, TLazIntfImage(Img).PixelData, AWidth, 0, AHeight, cint(AFormat), TJFLAG_ACCURATEDCT) < 0 then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue