[Peek]Adds QOI file support (#29919)

* Adds QOI support to Peek

* Reduce allocations on QoiImage

* Add to QOI to Peek's NOTICE as well.

* Ensure file stream is closed after reading QOI
This commit is contained in:
Pedro Lamas
2023-12-18 15:54:17 +00:00
committed by GitHub
parent ee22581913
commit 4c3e5348f0
22 changed files with 294 additions and 205 deletions

View File

@@ -61,6 +61,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\common\Common.UI\Common.UI.csproj" />
<ProjectReference Include="..\..\..\common\FilePreviewCommon\FilePreviewCommon.csproj" />
<ProjectReference Include="..\..\..\common\GPOWrapper\GPOWrapper.vcxproj" />
<ProjectReference Include="..\..\..\common\interop\PowerToys.Interop.vcxproj" />
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />

View File

@@ -3,9 +3,9 @@
// See the LICENSE file in the project root for more information.
using Common;
using Microsoft.PowerToys.FilePreviewCommon;
using Microsoft.PowerToys.PreviewHandler.Qoi.Telemetry.Events;
using Microsoft.PowerToys.Telemetry;
using PreviewHandlerCommon.Utilities;
namespace Microsoft.PowerToys.PreviewHandler.Qoi
{
@@ -63,7 +63,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Qoi
throw new ArgumentException($"{nameof(dataSource)} for {nameof(QoiPreviewHandlerControl)} must be a string but was a '{typeof(T)}'");
}
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
using FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
thumbnail = QoiImage.FromStream(fs);