Skip to content

Commit ae231ab

Browse files
committed
Support SKMetalView on tvOS
1 parent 2387a33 commit ae231ab

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

binding/SkiaSharp/GRBackendRenderTarget.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public GRBackendRenderTarget (int width, int height, GRVkImageInfo vkImageInfo)
3030
CreateVulkan (width, height, vkImageInfo);
3131
}
3232

33-
#if __IOS__ || __MACOS__
33+
#if __IOS__ || __MACOS__ || __TVOS__
3434

3535
[Obsolete ("Use GRBackendRenderTarget(int width, int height, GRMtlTextureInfo mtlInfo) instead.")]
3636
public GRBackendRenderTarget (int width, int height, int sampleCount, GRMtlTextureInfo mtlInfo)

binding/SkiaSharp/GRDefinitions.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public IntPtr TextureHandle {
8787
readonly get => _textureHandle;
8888
set {
8989
_textureHandle = value;
90-
#if __IOS__ || __MACOS__
90+
#if __IOS__ || __MACOS__ || __TVOS__
9191
_texture = null;
9292
#endif
9393
}
9494
}
9595

96-
#if __IOS__ || __MACOS__
96+
#if __IOS__ || __MACOS__ || __TVOS__
9797
private Metal.IMTLTexture _texture;
9898
public GRMtlTextureInfo (Metal.IMTLTexture texture)
9999
{

binding/SkiaSharp/GRMtlBackendContext.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#nullable disable
22

33
using System;
4-
#if __IOS__ || __MACOS__
4+
#if __IOS__ || __MACOS__ || __TVOS__
55
using Metal;
66
#endif
77

@@ -25,13 +25,13 @@ public IntPtr QueueHandle {
2525
get => _queueHandle;
2626
set {
2727
_queueHandle = value;
28-
#if __IOS__ || __MACOS__
28+
#if __IOS__ || __MACOS__ || __TVOS__
2929
_queue = null;
3030
#endif
3131
}
3232
}
3333

34-
#if __IOS__ || __MACOS__
34+
#if __IOS__ || __MACOS__ || __TVOS__
3535
private IMTLDevice _device;
3636
private IMTLCommandQueue _queue;
3737

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKMetalView.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if __IOS__ || __MACOS__
1+
#if __IOS__ || __MACOS__ || __TVOS__
22
using System;
33
using System.ComponentModel;
44
using System.Diagnostics;
@@ -11,6 +11,8 @@
1111
namespace SkiaSharp.Views.iOS
1212
#elif __MACOS__
1313
namespace SkiaSharp.Views.Mac
14+
#elif __TVOS__
15+
namespace SkiaSharp.Views.tvOS
1416
#endif
1517
{
1618
[Register(nameof(SKMetalView))]
@@ -104,7 +106,7 @@ void IMTKViewDelegate.DrawableSizeWillChange(MTKView view, CGSize size)
104106
CanvasSize = size.ToSKSize();
105107

106108
if (Paused && EnableSetNeedsDisplay)
107-
#if __IOS__
109+
#if __IOS__ || __TVOS__
108110
SetNeedsDisplay();
109111
#elif __MACOS__
110112
NeedsDisplay = true;

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKPaintMetalSurfaceEventArgs.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#if __IOS__ || __MACOS__
1+
#if __IOS__ || __MACOS__ || __TVOS__
22
using System;
33

44
#if __IOS__
55
namespace SkiaSharp.Views.iOS
66
#elif __MACOS__
77
namespace SkiaSharp.Views.Mac
8+
#elif __TVOS__
9+
namespace SkiaSharp.Views.tvOS
810
#endif
911
{
1012
public class SKPaintMetalSurfaceEventArgs : EventArgs

0 commit comments

Comments
 (0)