Skip to content

Commit

Permalink
rename scriptinstance_communication unit
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Nov 27, 2023
1 parent 2253ffc commit dd619e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Project: Simba (https://github.com/MerlijnWajer/Simba)
License: GNU General Public License (https://www.gnu.org/licenses/gpl-3.0)
}
unit simba.scriptinstance_communication;
unit simba.scriptcommunication;

{$i simba.inc}

interface

uses
classes, sysutils, forms, extctrls, graphics,
Classes, SysUtils, Forms, ExtCtrls, Graphics,
simba.mufasatypes, simba.ipc, simba.scripttab;

type
Expand Down Expand Up @@ -208,6 +208,7 @@ procedure TSimbaScriptInstanceCommunication.DebugImage_Show;
procedure TSimbaScriptInstanceCommunication.DebugImage_Update;

// Modified from LazImage_FromData in simba.image_lazbridge
// Could maybe do this off main thread with only Begin/EndUpdate synced
procedure Execute;
var
Width, Height: Integer;
Expand All @@ -217,11 +218,6 @@ procedure TSimbaScriptInstanceCommunication.DebugImage_Update;
SourcePtr, DestPtr: PByte;

procedure BGR;
type
PRGB24 = ^TRGB24;
TRGB24 = packed record
B, G, R : Byte;
end;
var
Y: Integer;
begin
Expand All @@ -234,10 +230,10 @@ procedure TSimbaScriptInstanceCommunication.DebugImage_Update;

while (PtrUInt(SourcePtr) < SourceUpper) do
begin
PRGB24(DestPtr)^ := PRGB24(SourcePtr)^; // Can just use first three bytes
PColorRGB(DestPtr)^ := PColorRGB(SourcePtr)^; // Can just use first three bytes

Inc(SourcePtr, SizeOf(TColorBGRA));
Inc(DestPtr, SizeOf(TRGB24));
Inc(DestPtr, SizeOf(TColorRGB));
end;

Inc(Dest, DestBytesPerLine);
Expand All @@ -258,11 +254,6 @@ procedure TSimbaScriptInstanceCommunication.DebugImage_Update;
end;

procedure ARGB;
type
PARGB = ^TARGB;
TARGB = packed record
A, R, G, B: Byte;
end;
var
Y: Integer;
begin
Expand All @@ -275,13 +266,10 @@ procedure TSimbaScriptInstanceCommunication.DebugImage_Update;

while (PtrUInt(SourcePtr) < SourceUpper) do
begin
PARGB(DestPtr)^.R := PColorBGRA(SourcePtr)^.R;
PARGB(DestPtr)^.G := PColorBGRA(SourcePtr)^.G;
PARGB(DestPtr)^.B := PColorBGRA(SourcePtr)^.B;
PARGB(DestPtr)^.A := PColorBGRA(SourcePtr)^.A;
PUInt32(DestPtr)^ := SwapEndian(PUInt32(SourcePtr)^);

Inc(SourcePtr, SizeOf(TColorBGRA));
Inc(DestPtr, SizeOf(TARGB));
Inc(DestPtr, SizeOf(TColorARGB));
end;

Inc(Dest, DestBytesPerLine);
Expand Down
5 changes: 2 additions & 3 deletions Source/simba.scripttab.pas
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
interface

uses
Classes, SysUtils, ComCtrls, Controls, Dialogs, Process,
SynEdit, SynEditTypes,
Classes, SysUtils, ComCtrls, Controls, Dialogs, Process, SynEdit, SynEditTypes,
simba.mufasatypes, simba.editor, simba.outputform, simba.component_tabcontrol, simba.windowhandle;

type
Expand Down Expand Up @@ -151,7 +150,7 @@ implementation
Forms,
simba.files, simba.settings, simba.ide_events,
simba.main, simba.env, simba.ide_showdeclaration, simba.threading,
simba.scriptinstance_communication, simba.scripttabsform, simba.datetime;
simba.scriptcommunication, simba.scripttabsform, simba.datetime;

procedure TSimbaScriptTabRunner.DoOutputThread;
var
Expand Down

0 comments on commit dd619e3

Please sign in to comment.