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:
+11
-1
@@ -173,13 +173,23 @@ begin
|
||||
Inc(DstRow, DstX * 4);
|
||||
for X := SX0 to SX1 - 1 do
|
||||
begin
|
||||
// KEY_COLOR is clFuchsia in pf32bit B,G,R order.
|
||||
{$IFDEF DARWIN}
|
||||
// ARGB layout: byte0=A, byte1=R, byte2=G, byte3=B
|
||||
if not ((SrcRow[1] = $FF) and (SrcRow[2] = $00) and (SrcRow[3] = $FF)) then
|
||||
begin
|
||||
DstRow[1] := Byte((Alpha * SrcRow[1] + InvA * DstRow[1]) div 255);
|
||||
DstRow[2] := Byte((Alpha * SrcRow[2] + InvA * DstRow[2]) div 255);
|
||||
DstRow[3] := Byte((Alpha * SrcRow[3] + InvA * DstRow[3]) div 255);
|
||||
end;
|
||||
{$ELSE}
|
||||
// BGRA layout: byte0=B, byte1=G, byte2=R
|
||||
if not ((SrcRow[0] = $FF) and (SrcRow[1] = $00) and (SrcRow[2] = $FF)) then
|
||||
begin
|
||||
DstRow[0] := Byte((Alpha * SrcRow[0] + InvA * DstRow[0]) div 255);
|
||||
DstRow[1] := Byte((Alpha * SrcRow[1] + InvA * DstRow[1]) div 255);
|
||||
DstRow[2] := Byte((Alpha * SrcRow[2] + InvA * DstRow[2]) div 255);
|
||||
end;
|
||||
{$ENDIF}
|
||||
Inc(SrcRow, 4);
|
||||
Inc(DstRow, 4);
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user