-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add WinUI native helper for GetByteBuffer (#3039)
- Loading branch information
1 parent
f6cf2b9
commit 94a2734
Showing
31 changed files
with
697 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Content Include="$(MSBuildThisFileDirectory)..\output\native\winui\any\*.dll" Visible="False" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) and '$(Platform)' != 'AnyCPU' and '$(Platform)' != 'Any CPU'"> | ||
<Content Include="$(MSBuildThisFileDirectory)..\output\native\winui\$(Platform)\*" Visible="False" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) and ('$(Platform)' == 'AnyCPU' or '$(Platform)' == 'Any CPU')"> | ||
<Content Include="$(MSBuildThisFileDirectory)..\output\native\winui\x64\*" Condition="'$(RuntimeIdentifier)' == 'win10-x64'" Visible="False" /> | ||
<Content Include="$(MSBuildThisFileDirectory)..\output\native\winui\x86\*" Condition="'$(RuntimeIdentifier)' == 'win10-x86'" Visible="False" /> | ||
<Content Include="$(MSBuildThisFileDirectory)..\output\native\winui\arm64\*" Condition="'$(RuntimeIdentifier)' == 'win10-arm64'" Visible="False" /> | ||
<Content Include="$(MSBuildThisFileDirectory)..\output\native\winui\x64\*" Condition="'$(RuntimeIdentifier)' == ''" Visible="False" CopyToOutputDirectory="PreserveNewest" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...kiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native.Projection/Directory.Build.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\source\SkiaSharp.Build.props" /> | ||
|
||
</Project> |
5 changes: 5 additions & 0 deletions
5
...aSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native.Projection/Directory.Build.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\source\SkiaSharp.Build.targets" /> | ||
|
||
</Project> |
26 changes: 26 additions & 0 deletions
26
...ve/SkiaSharp.Views.WinUI.Native.Projection/SkiaSharp.Views.WinUI.Native.Projection.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(WindowsTargetFrameworks)</TargetFrameworks> | ||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> | ||
<PackageId>SkiaSharp.Views.WinUI</PackageId> | ||
<PackagingGroup>SkiaSharp.Views.WinUI</PackagingGroup> | ||
<IsPackable>false</IsPackable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch> | ||
<CsWinRTIncludes>SkiaSharp.Views.WinUI.Native</CsWinRTIncludes> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.4" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\SkiaSharp.Views.WinUI.Native\SkiaSharp.Views.WinUI.Native.vcxproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
61 changes: 61 additions & 0 deletions
61
native/winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34310.174 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkiaSharp.Views.WinUI.Native", "SkiaSharp.Views.WinUI.Native\SkiaSharp.Views.WinUI.Native.vcxproj", "{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.WinUI.Native.Projection", "SkiaSharp.Views.WinUI.Native.Projection\SkiaSharp.Views.WinUI.Native.Projection.csproj", "{95E9FEB4-DCD3-4514-8208-A87688788BB2}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|ARM64 = Debug|ARM64 | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|ARM64 = Release|ARM64 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|Any CPU.ActiveCfg = Debug|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|Any CPU.Build.0 = Debug|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|x64.ActiveCfg = Debug|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|x64.Build.0 = Debug|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Debug|x86.Build.0 = Debug|Win32 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|Any CPU.ActiveCfg = Release|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|Any CPU.Build.0 = Release|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|ARM64.Build.0 = Release|ARM64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|x64.ActiveCfg = Release|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|x64.Build.0 = Release|x64 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|x86.ActiveCfg = Release|Win32 | ||
{730AF4C9-82D2-4FA7-AA32-154F3524EBD2}.Release|x86.Build.0 = Release|Win32 | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|ARM64.ActiveCfg = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|ARM64.Build.0 = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|x64.Build.0 = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Debug|x86.Build.0 = Debug|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|ARM64.ActiveCfg = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|ARM64.Build.0 = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|x64.ActiveCfg = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|x64.Build.0 = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|x86.ActiveCfg = Release|Any CPU | ||
{95E9FEB4-DCD3-4514-8208-A87688788BB2}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {FB8DA12F-84B5-4D7F-A6E1-7F0A53AA4535} | ||
EndGlobalSection | ||
EndGlobal |
16 changes: 16 additions & 0 deletions
16
native/winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native/BufferExtensions.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "pch.h" | ||
#include "BufferExtensions.h" | ||
#include "BufferExtensions.g.cpp" | ||
|
||
using namespace winrt::Windows::Storage::Streams; | ||
|
||
namespace winrt::SkiaSharp::Views::WinUI::Native::implementation | ||
{ | ||
intptr_t BufferExtensions::GetByteBuffer(IBuffer const& buffer) | ||
{ | ||
byte* current_data = nullptr; | ||
auto bufferByteAccess = buffer.as<winrt::impl::IBufferByteAccess>(); | ||
bufferByteAccess->Buffer(¤t_data); | ||
return (intptr_t)current_data; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
native/winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native/BufferExtensions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "BufferExtensions.g.h" | ||
|
||
using namespace winrt::Windows::Storage::Streams; | ||
|
||
namespace winrt::SkiaSharp::Views::WinUI::Native::implementation | ||
{ | ||
struct BufferExtensions | ||
{ | ||
BufferExtensions() = default; | ||
|
||
static intptr_t GetByteBuffer(IBuffer const& buffer); | ||
}; | ||
} | ||
|
||
namespace winrt::SkiaSharp::Views::WinUI::Native::factory_implementation | ||
{ | ||
struct BufferExtensions : BufferExtensionsT<BufferExtensions, implementation::BufferExtensions> | ||
{ | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
native/winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native/BufferExtensions.idl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace SkiaSharp.Views.WinUI.Native | ||
{ | ||
static runtimeclass BufferExtensions | ||
{ | ||
static Int64 GetByteBuffer(Windows.Storage.Streams.IBuffer buffer); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native/PropertySetExtensions.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "pch.h" | ||
#include "PropertySetExtensions.h" | ||
#include "PropertySetExtensions.g.cpp" | ||
|
||
using namespace winrt::Windows::Foundation; | ||
using namespace winrt::Windows::Foundation::Collections; | ||
|
||
namespace winrt::SkiaSharp::Views::WinUI::Native::implementation | ||
{ | ||
void PropertySetExtensions::AddSingle(PropertySet const& propertySet, hstring const& key, float value) | ||
{ | ||
propertySet.Insert(key, PropertyValue::CreateSingle(value)); | ||
} | ||
|
||
void PropertySetExtensions::AddSize(PropertySet const& propertySet, hstring const& key, Size const& height) | ||
{ | ||
propertySet.Insert(key, PropertyValue::CreateSize(height)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...e/winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native/PropertySetExtensions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include "PropertySetExtensions.g.h" | ||
|
||
using namespace winrt::Windows::Foundation; | ||
using namespace winrt::Windows::Foundation::Collections; | ||
|
||
namespace winrt::SkiaSharp::Views::WinUI::Native::implementation | ||
{ | ||
struct PropertySetExtensions | ||
{ | ||
PropertySetExtensions() = default; | ||
|
||
static void AddSingle(PropertySet const& propertySet, hstring const& key, float value); | ||
static void AddSize(PropertySet const& propertySet, hstring const& key, Size const& value); | ||
}; | ||
} | ||
|
||
namespace winrt::SkiaSharp::Views::WinUI::Native::factory_implementation | ||
{ | ||
struct PropertySetExtensions : PropertySetExtensionsT<PropertySetExtensions, implementation::PropertySetExtensions> | ||
{ | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
...winui/SkiaSharp.Views.WinUI.Native/SkiaSharp.Views.WinUI.Native/PropertySetExtensions.idl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace SkiaSharp.Views.WinUI.Native | ||
{ | ||
static runtimeclass PropertySetExtensions | ||
{ | ||
static void AddSingle(Windows.Foundation.Collections.PropertySet propertySet, String key, Single value); | ||
static void AddSize(Windows.Foundation.Collections.PropertySet propertySet, String key, Windows.Foundation.Size value); | ||
} | ||
} |
Oops, something went wrong.