mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Fix macOS pixel format: use ARGB byte order in all raw ScanLine blending
On macOS Cocoa, TBitmap.pf32bit stores pixels in ARGB order
(byte0=A, byte1=R, byte2=G, byte3=B) rather than BGRA used on
Linux/Windows. All raw ScanLine pixel blending and channel mapping
is now guarded with { DARWIN} to use the correct offsets.
Also fix PortAudio library discovery on macOS: probe .dylib names
(including Homebrew paths) before falling through to .so/.dll.
This commit is contained in:
+13
-4
@@ -185,10 +185,15 @@ begin
|
||||
Src := PByte(B.ScanLine[Y]);
|
||||
for X := 0 to T.W - 1 do
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
// ARGB: byte0=A, byte1=R, byte2=G, byte3=B
|
||||
IsKey := Keyed and (Src[1] = $FF) and (Src[2] = $00) and (Src[3] = $FF);
|
||||
Buf[I] := Src[1]; Buf[I+1] := Src[2]; Buf[I+2] := Src[3];
|
||||
{$ELSE}
|
||||
// BGRA: byte0=B, byte1=G, byte2=R
|
||||
IsKey := Keyed and (Src[0] = $FF) and (Src[1] = $00) and (Src[2] = $FF);
|
||||
Buf[I] := Src[2];
|
||||
Buf[I + 1] := Src[1];
|
||||
Buf[I + 2] := Src[0];
|
||||
Buf[I] := Src[2]; Buf[I+1] := Src[1]; Buf[I+2] := Src[0];
|
||||
{$ENDIF}
|
||||
if IsKey then Buf[I + 3] := 0 else Buf[I + 3] := FixedAlpha;
|
||||
Inc(Src, 4);
|
||||
Inc(I, 4);
|
||||
@@ -230,7 +235,11 @@ begin
|
||||
Src := PByte(B.ScanLine[Y]);
|
||||
for X := 0 to T.W - 1 do
|
||||
begin
|
||||
A := Max(Src[0], Max(Src[1], Src[2]));
|
||||
{$IFDEF DARWIN}
|
||||
A := Max(Src[1], Max(Src[2], Src[3])); // ARGB: R,G,B at bytes 1,2,3
|
||||
{$ELSE}
|
||||
A := Max(Src[0], Max(Src[1], Src[2])); // BGRA: B,G,R at bytes 0,1,2
|
||||
{$ENDIF}
|
||||
Buf[I] := R;
|
||||
Buf[I + 1] := G;
|
||||
Buf[I + 2] := BB;
|
||||
|
||||
Reference in New Issue
Block a user