Browse Source

skia lcl: added unit to load libsk4d with an error if not found

mattias 1 year ago
parent
commit
3eabc728b0
1 changed files with 28 additions and 0 deletions
  1. 28 0
      demo/LCLSkiaPaintBox/LCL.SkiaInit.pas

+ 28 - 0
demo/LCLSkiaPaintBox/LCL.SkiaInit.pas

@@ -0,0 +1,28 @@
+{
+  The System.Skia.API unit loads the libsk4d library in its class constructors,
+  which eats any error message.
+  This unit logs an error via the LazLogger unit.
+
+}
+unit LCL.SkiaInit;
+
+{$mode ObjFPC}{$H+}
+
+interface
+
+uses
+  SysUtils, LazLogger, System.Skia.API;
+
+implementation
+
+initialization
+  try
+    SkInitialize;
+  except
+    on E: Exception do begin
+      DebugLn('Failed loading skia libb: '+E.Message);
+      Halt(1);
+    end;
+  end;
+end.
+