Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion binding/Binding.Shared/PlatformConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static string LinuxFlavor
set => linuxFlavor = value;
}

#if WINDOWS_UWP
#if WINDOWS_UWP || __IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__
public static bool IsGlibc { get; }
#else
private static readonly Lazy<bool> isGlibcLazy = new Lazy<bool> (IsGlibcImplementation);
Expand Down
5 changes: 4 additions & 1 deletion binding/SkiaSharp/PlatformLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ public static IPlatformLock Create ()
/// <returns>A reference to a new platform lock implementation</returns>
public static IPlatformLock DefaultFactory ()
{
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
if (PlatformConfiguration.IsWindows)
return new NonAlertableWin32Lock ();
else
#endif
return new ReadWriteLock ();
}

Expand All @@ -90,6 +92,7 @@ class ReadWriteLock : IPlatformLock
ReaderWriterLockSlim _lock = new ReaderWriterLockSlim ();
}

#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
/// <summary>
/// Windows platform lock uses Win32 CRITICAL_SECTION
/// </summary>
Expand Down Expand Up @@ -169,6 +172,6 @@ public struct CRITICAL_SECTION
static extern void LeaveCriticalSection (IntPtr lpCriticalSection);
#endif
}
#endif
}

}
6 changes: 6 additions & 0 deletions binding/SkiaSharp/SKAutoCoInitialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ public partial class SKAutoCoInitialize : IDisposable

public SKAutoCoInitialize()
{
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
if (PlatformConfiguration.IsWindows)
hResult = CoInitializeEx(IntPtr.Zero, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
else
#endif
hResult = S_OK;
}

Expand All @@ -24,8 +26,10 @@ public void Uninitialize()
{
if (hResult >= 0)
{
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
if (PlatformConfiguration.IsWindows)
CoUninitialize();
#endif

hResult = -1;
}
Expand All @@ -41,6 +45,7 @@ public void Uninitialize()
private const uint COINIT_DISABLE_OLE1DDE = 0x4;
private const uint COINIT_SPEED_OVER_MEMORY = 0x8;

#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
#if USE_LIBRARY_IMPORT
[LibraryImport("ole32.dll", SetLastError = true)]
private static partial long CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
Expand All @@ -51,6 +56,7 @@ public void Uninitialize()
private static extern long CoInitializeEx([In, Optional] IntPtr pvReserved, [In] uint dwCoInit);
[DllImport("ole32.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
private static extern void CoUninitialize();
#endif
#endif
}
}