Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
1a300bee
U
Uno
项目概览
lindexi_gd
/
Uno
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1a300bee
编写于
6月 24, 2023
作者:
M
Martin Zikmund
提交者:
GitHub
6月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12694 from unoplatform/dev/mazi/image-improvements
fix: Raise `ImageFailed` on Skia, correctly arrange empty `Image`
上级
bc841416
0256a4ff
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
35 deletion
+62
-35
src/SamplesApp/UnoIslands.Skia.WPF/UnoIslands.Skia.Wpf.csproj
...SamplesApp/UnoIslands.Skia.WPF/UnoIslands.Skia.Wpf.csproj
+3
-2
src/SamplesApp/UnoIslandsSamplesApp.Skia.WPF/UnoIslandsSamplesApp.Skia.Wpf.csproj
...sSamplesApp.Skia.WPF/UnoIslandsSamplesApp.Skia.Wpf.csproj
+19
-5
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Image.cs
...untimeTests/Tests/Windows_UI_Xaml_Controls/Given_Image.cs
+17
-10
src/Uno.UI/UI/Xaml/Controls/Image/Image.Android.cs
src/Uno.UI/UI/Xaml/Controls/Image/Image.Android.cs
+8
-1
src/Uno.UI/UI/Xaml/Controls/Image/Image.skia.cs
src/Uno.UI/UI/Xaml/Controls/Image/Image.skia.cs
+13
-17
src/Uno.UI/UI/Xaml/Media/ImageSource.Android.cs
src/Uno.UI/UI/Xaml/Media/ImageSource.Android.cs
+2
-0
未找到文件。
src/SamplesApp/UnoIslands.Skia.WPF/UnoIslands.Skia.Wpf.csproj
浏览文件 @
1a300bee
...
...
@@ -82,7 +82,8 @@
</Compile>
</ItemGroup>
<Import Project="..\..\build\*.Skia.Wpf.props" />
<Import Project="..\..\build\*.Skia.Wpf.targets" />
<Import Project="..\..\..\build\*.Skia.Wpf.props" />
<Import Project="..\..\..\build\*.Skia.Wpf.targets" />
<Import Project="..\..\..\build\uno.winui.runtime-replace.targets" />
</Project>
src/SamplesApp/UnoIslandsSamplesApp.Skia.WPF/UnoIslandsSamplesApp.Skia.Wpf.csproj
浏览文件 @
1a300bee
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>net
472;netcoreapp3.1
</TargetFrameworks>
<TargetFrameworks>net
6.0-windows
</TargetFrameworks>
<!--
Enable implicit dotnet runtime forward rolling, as the specifed target framework
...
...
@@ -9,6 +9,10 @@
<RollForward>Major</RollForward>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildRuntimeType)'=='Core' or '$(BuildingInsideVisualStudio)'=='true'">
<TargetFrameworks>net7.0-windows</TargetFrameworks>
</PropertyGroup>
<Import Project="../../targetframework-override.props" />
<Import Project="../../netcore-build-windows.props" />
...
...
@@ -34,6 +38,7 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<ItemGroup>
...
...
@@ -46,7 +51,15 @@
<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="2.80.3" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="2.88.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net6.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net7.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="7.0.0-rc.1.22426.10" />
</ItemGroup>
<ItemGroup>
...
...
@@ -93,7 +106,8 @@
</None>
</ItemGroup>
<Import Project="..\..\build\*.Skia.Wpf.props" />
<Import Project="..\..\build\*.Skia.Wpf.targets" />
<Import Project="..\..\..\build\*.Skia.Wpf.props" />
<Import Project="..\..\..\build\*.Skia.Wpf.targets" />
<Import Project="..\..\..\build\uno.winui.runtime-replace.targets" />
</Project>
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Image.cs
浏览文件 @
1a300bee
...
...
@@ -452,9 +452,6 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls
[
RunsOnUIThread
]
public
async
Task
When_SVGImageSource
()
{
#if __SKIA__
Assert
.
Inconclusive
();
// SVGImage Load not implemented on Skia
#endif
if
(!
ApiInformation
.
IsTypePresent
(
"Windows.UI.Xaml.Media.Imaging.RenderTargetBitmap"
))
{
Assert
.
Inconclusive
();
// System.NotImplementedException: RenderTargetBitmap is not supported on this platform.;
...
...
@@ -471,10 +468,6 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls
[
RunsOnUIThread
]
public
async
Task
When_SVGImageSource_Uri_Is_Null
()
{
#if __SKIA__
Assert
.
Inconclusive
();
// SVGImage Load not implemented on Skia
#endif
if
(!
ApiInformation
.
IsTypePresent
(
"Windows.UI.Xaml.Media.Imaging.RenderTargetBitmap"
))
{
Assert
.
Inconclusive
();
// System.NotImplementedException: RenderTargetBitmap is not supported on this platform.;
...
...
@@ -490,9 +483,6 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls
[
RunsOnUIThread
]
public
async
Task
When_SVGImageSource_Uri_Is_Set_Null
()
{
#if __SKIA__
Assert
.
Inconclusive
();
// SVGImage Load not implemented on Skia
#endif
if
(!
ApiInformation
.
IsTypePresent
(
"Windows.UI.Xaml.Media.Imaging.RenderTargetBitmap"
))
{
Assert
.
Inconclusive
();
// System.NotImplementedException: RenderTargetBitmap is not supported on this platform.;
...
...
@@ -505,6 +495,23 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls
await
WindowHelper
.
WaitForLoaded
(
image
);
}
[
TestMethod
]
[
RunsOnUIThread
]
public
async
Task
When_ImageFailed
()
{
var
image
=
new
Image
()
{
Width
=
100
,
Height
=
100
};
TestServices
.
WindowHelper
.
WindowContent
=
image
;
await
WindowHelper
.
WaitForLoaded
(
image
);
bool
imageFailedRaised
=
false
;
image
.
ImageFailed
+=
(
s
,
e
)
=>
{
imageFailedRaised
=
true
;
};
image
.
Source
=
new
BitmapImage
(
new
Uri
(
"ms-appx:///image/definitely/does/not/exist.png"
));
await
WindowHelper
.
WaitFor
(()
=>
imageFailedRaised
);
}
[
TestMethod
]
[
RunsOnUIThread
]
#if __MACOS__
...
...
src/Uno.UI/UI/Xaml/Controls/Image/Image.Android.cs
浏览文件 @
1a300bee
...
...
@@ -132,7 +132,7 @@ namespace Windows.UI.Xaml.Controls
_imageFetchDisposable
.
Disposable
=
null
;
if
(
imageSource
!=
null
&&
imageSource
.
UseTargetSize
)
if
(
imageSource
is
not
null
&&
imageSource
.
UseTargetSize
)
{
// If the ImageSource has the UseTargetSize set, the image
// must not be loaded until the first layout has been done.
...
...
@@ -146,6 +146,13 @@ namespace Windows.UI.Xaml.Controls
}
}
if
(
imageSource
?.
ResourceFailed
==
true
)
{
// Currently resource-based images are evaluated immediately
// in the constructor - so we have to raise ImageFailed late.
OnImageFailed
(
imageSource
,
new
InvalidOperationException
(
"Resource could not be found"
));
}
if
(
this
.
Log
().
IsEnabled
(
Uno
.
Foundation
.
Logging
.
LogLevel
.
Debug
))
{
this
.
Log
().
Debug
(
this
.
ToString
()
+
" TryOpenImage - proceeding"
);
...
...
src/Uno.UI/UI/Xaml/Controls/Image/Image.skia.cs
浏览文件 @
1a300bee
...
...
@@ -3,11 +3,11 @@ using System.Linq;
using
System.Numerics
;
using
Uno.Disposables
;
using
Uno.Foundation.Logging
;
using
Uno.UI.Xaml.Media
;
using
Windows.Foundation
;
using
Windows.UI.Composition
;
using
Windows.UI.Xaml.Media
;
using
Windows.UI.Xaml.Media.Imaging
;
using
Uno.UI.Xaml.Media
;
namespace
Windows.UI.Xaml.Controls
{
...
...
@@ -124,24 +124,20 @@ namespace Windows.UI.Xaml.Controls
private
void
TryProcessPendingSource
()
{
if
(
_pendingImageData
.
HasData
)
var
currentData
=
_pendingImageData
;
_pendingImageData
=
new
();
if
(
currentData
.
HasData
)
{
_currentSurface
=
_pendingImage
Data
.
CompositionSurface
;
_currentSurface
=
current
Data
.
CompositionSurface
;
_surfaceBrush
=
Visual
.
Compositor
.
CreateSurfaceBrush
(
_currentSurface
);
_imageSprite
.
Brush
=
_surfaceBrush
;
_pendingImageData
=
new
();
if
(
_pendingImageData
is
not
{
Kind
:
ImageDataKind
.
Error
})
{
ImageOpened
?.
Invoke
(
this
,
new
RoutedEventArgs
(
this
));
}
else
{
ImageFailed
?.
Invoke
(
this
,
new
(
this
,
_pendingImageData
.
Error
?.
Message
??
"Unknown error"
));
}
ImageOpened
?.
Invoke
(
this
,
new
RoutedEventArgs
(
this
));
}
else
if
(
currentData
is
{
Kind
:
ImageDataKind
.
Error
})
{
ImageFailed
?.
Invoke
(
this
,
new
(
this
,
currentData
.
Error
?.
Message
??
"Unknown error"
));
}
}
...
...
@@ -183,7 +179,7 @@ namespace Windows.UI.Xaml.Controls
else
{
_imageSprite
.
Size
=
default
;
return
default
;
return
base
.
ArrangeOverride
(
finalSize
)
;
}
}
...
...
src/Uno.UI/UI/Xaml/Media/ImageSource.Android.cs
浏览文件 @
1a300bee
...
...
@@ -91,6 +91,8 @@ namespace Windows.UI.Xaml.Media
||
ResourceId
!=
null
;
}
internal
bool
ResourceFailed
=>
ResourceString
is
not
null
&&
ResourceId
is
null
;
internal
BitmapDrawable
?
BitmapDrawable
{
get
;
private
set
;
}
internal
int
?
ResourceId
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录