Use explicit types everywhere

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-15 09:10:18 -07:00
1 親 27c629f3b4
コミット 16c0fc9aab
74ファイル変更
+455 -446

検索条件に一致するファイルはありません

+1 -1
ファイルの表示
@@ -77,7 +77,7 @@ public sealed partial class HlslBokehBlurProcessor : IImageProcessor
ThrowHelper.ThrowInvalidOperationException("This processor only supports the RGBA32 pixel format.");
}
var processor = new Implementation(this, configuration, Unsafe.As<Image<ImageSharpRgba32>>(source), sourceRectangle);
Implementation processor = new Implementation(this, configuration, Unsafe.As<Image<ImageSharpRgba32>>(source), sourceRectangle);
return Unsafe.As<IImageProcessor<TPixel>>(processor);
}
+6 -5
ファイルの表示
@@ -76,8 +76,9 @@ public sealed partial class HlslBokehBlurProcessor
componentsCount = definition.Components;
// Reuse the initialized values from the cache, if possible
var parameters = (radius, componentsCount);
if (Cache.TryGetValue(parameters, out var info))
(int radius, int componentsCount) parameters = (radius, componentsCount);
if (Cache.TryGetValue(parameters, out (Vector4[] Parameters, float Scale, Complex64[][] Kernels) info))
{
kernelParameters = info.Parameters;
kernelsScale = info.Scale;
@@ -171,7 +172,7 @@ public sealed partial class HlslBokehBlurProcessor
/// </summary>
private Complex64[][] CreateComplexKernels()
{
var kernels = new Complex64[kernelParameters.Length][];
Complex64[][] kernels = new Complex64[kernelParameters.Length][];
ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan());
for (int i = 0; i < kernelParameters.Length; i++)
@@ -191,7 +192,7 @@ public sealed partial class HlslBokehBlurProcessor
/// <param name="b">The angle component for each complex component.</param>
private Complex64[] CreateComplex1DKernel(float a, float b)
{
var kernel = new Complex64[kernelSize];
Complex64[] kernel = new Complex64[kernelSize];
ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan());
int r = radius;
int n = -r;
@@ -286,7 +287,7 @@ public sealed partial class HlslBokehBlurProcessor
kernel.CopyFrom(kernels[j]);
using var context = graphicsDevice.CreateComputeContext();
using ComputeContext context = graphicsDevice.CreateComputeContext();
context.For<VerticalConvolutionProcessor>(
source.Width,
+1 -1
ファイルの表示
@@ -82,7 +82,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor
ThrowHelper.ThrowInvalidOperationException("This processor only supports the RGBA32 pixel format.");
}
var processor = new Implementation(this, configuration, Unsafe.As<Image<ImageSharpRgba32>>(source), sourceRectangle);
Implementation processor = new Implementation(this, configuration, Unsafe.As<Image<ImageSharpRgba32>>(source), sourceRectangle);
return Unsafe.As<IImageProcessor<TPixel>>(processor);
}
+1 -1
ファイルの表示
@@ -104,7 +104,7 @@ public sealed partial class HlslGaussianBlurProcessor
using ReadWriteTexture2D<Rgba32, float4> firstPassTexture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(source.Width, source.Height);
using ReadOnlyBuffer<float> kernelBuffer = graphicsDevice.AllocateReadOnlyBuffer(kernel);
using (var context = graphicsDevice.CreateComputeContext())
using (ComputeContext context = graphicsDevice.CreateComputeContext())
{
context.For<VerticalConvolutionProcessor>(source.Width, source.Height, new(sourceTexture, firstPassTexture, kernelBuffer));
context.Barrier(firstPassTexture);
+1 -1
ファイルの表示
@@ -15,7 +15,7 @@ string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly()
using Image<ImageSharpRgba32> image = Image.Load<ImageSharpRgba32>(path);
// Apply a series of processors and save the results
foreach (var effect in new (string Name, IImageProcessor Processor)[]
foreach ((string Name, IImageProcessor Processor) effect in new (string Name, IImageProcessor Processor)[]
{
("bokeh", new HlslBokehBlurProcessor(80, 2)),
("gaussian", new HlslGaussianBlurProcessor(80))