Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SKMetalView on tvOS #3114

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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/SkiaSharp/GRBackendRenderTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GRBackendRenderTarget (int width, int height, GRVkImageInfo vkImageInfo)
CreateVulkan (width, height, vkImageInfo);
}

#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__

[Obsolete ("Use GRBackendRenderTarget(int width, int height, GRMtlTextureInfo mtlInfo) instead.")]
public GRBackendRenderTarget (int width, int height, int sampleCount, GRMtlTextureInfo mtlInfo)
Expand Down
4 changes: 2 additions & 2 deletions binding/SkiaSharp/GRDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public IntPtr TextureHandle {
readonly get => _textureHandle;
set {
_textureHandle = value;
#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
_texture = null;
#endif
}
}

#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
private Metal.IMTLTexture _texture;
public GRMtlTextureInfo (Metal.IMTLTexture texture)
{
Expand Down
6 changes: 3 additions & 3 deletions binding/SkiaSharp/GRMtlBackendContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#nullable disable

using System;
#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
using Metal;
#endif

Expand All @@ -25,13 +25,13 @@ public IntPtr QueueHandle {
get => _queueHandle;
set {
_queueHandle = value;
#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
_queue = null;
#endif
}
}

#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
private IMTLDevice _device;
private IMTLCommandQueue _queue;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
using System;
using System.ComponentModel;
using System.Diagnostics;
Expand All @@ -11,6 +11,8 @@
namespace SkiaSharp.Views.iOS
#elif __MACOS__
namespace SkiaSharp.Views.Mac
#elif __TVOS__
namespace SkiaSharp.Views.tvOS
#endif
{
[Register(nameof(SKMetalView))]
Expand Down Expand Up @@ -104,7 +106,7 @@ void IMTKViewDelegate.DrawableSizeWillChange(MTKView view, CGSize size)
CanvasSize = size.ToSKSize();

if (Paused && EnableSetNeedsDisplay)
#if __IOS__
#if __IOS__ || __TVOS__
SetNeedsDisplay();
#elif __MACOS__
NeedsDisplay = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#if __IOS__ || __MACOS__
#if __IOS__ || __MACOS__ || __TVOS__
using System;

#if __IOS__
namespace SkiaSharp.Views.iOS
#elif __MACOS__
namespace SkiaSharp.Views.Mac
#elif __TVOS__
namespace SkiaSharp.Views.tvOS
#endif
{
public class SKPaintMetalSurfaceEventArgs : EventArgs
Expand Down