Skip to content

Commit fdbaafe

Browse files
Merge branch 'js/gif-fixes' into js/png-pallete
2 parents 3325380 + 4b15595 commit fdbaafe

58 files changed

Lines changed: 1801 additions & 276 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
*.bmp filter=lfs diff=lfs merge=lfs -text
119119
*.gif filter=lfs diff=lfs merge=lfs -text
120120
*.png filter=lfs diff=lfs merge=lfs -text
121+
*.qoi filter=lfs diff=lfs merge=lfs -text
121122
*.tif filter=lfs diff=lfs merge=lfs -text
122123
*.tiff filter=lfs diff=lfs merge=lfs -text
123124
*.tga filter=lfs diff=lfs merge=lfs -text

ImageSharp.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tga", "Tga", "{5DFC394F-136
646646
tests\Images\Input\Tga\targa_8bit_rle.tga = tests\Images\Input\Tga\targa_8bit_rle.tga
647647
EndProjectSection
648648
EndProject
649+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Qoi", "Qoi", "{E801B508-4935-41CD-BA85-CF11BFF55A45}"
650+
ProjectSection(SolutionItems) = preProject
651+
tests\Images\Input\Qoi\dice.qoi = tests\Images\Input\Qoi\dice.qoi
652+
tests\Images\Input\Qoi\edgecase.qoi = tests\Images\Input\Qoi\edgecase.qoi
653+
tests\Images\Input\Qoi\kodim10.qoi = tests\Images\Input\Qoi\kodim10.qoi
654+
tests\Images\Input\Qoi\kodim23.qoi = tests\Images\Input\Qoi\kodim23.qoi
655+
tests\Images\Input\Qoi\qoi_logo.qoi = tests\Images\Input\Qoi\qoi_logo.qoi
656+
tests\Images\Input\Qoi\testcard.qoi = tests\Images\Input\Qoi\testcard.qoi
657+
tests\Images\Input\Qoi\testcard_rgba.qoi = tests\Images\Input\Qoi\testcard_rgba.qoi
658+
tests\Images\Input\Qoi\wikipedia_008.qoi = tests\Images\Input\Qoi\wikipedia_008.qoi
659+
EndProjectSection
660+
EndProject
649661
Global
650662
GlobalSection(SolutionConfigurationPlatforms) = preSolution
651663
Debug|Any CPU = Debug|Any CPU
@@ -698,6 +710,7 @@ Global
698710
{FC527290-2F22-432C-B77B-6E815726B02C} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
699711
{670DD46C-82E9-499A-B2D2-00A802ED0141} = {E1C42A6F-913B-4A7B-B1A8-2BB62843B254}
700712
{5DFC394F-136F-4B76-9BCA-3BA786515EFC} = {9DA226A1-8656-49A8-A58A-A8B5C081AD66}
713+
{E801B508-4935-41CD-BA85-CF11BFF55A45} = {9DA226A1-8656-49A8-A58A-A8B5C081AD66}
701714
EndGlobalSection
702715
GlobalSection(ExtensibilityGlobals) = postSolution
703716
SolutionGuid = {5F8B9D1F-CD8B-4CC5-8216-D531E25BD795}

src/ImageSharp/Color/Color.Conversions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public Color(Vector4 vector)
139139
/// </summary>
140140
/// <param name="color">The <see cref="Color"/>.</param>
141141
/// <returns>The <see cref="Vector4"/>.</returns>
142-
public static explicit operator Vector4(Color color) => color.ToVector4();
142+
public static explicit operator Vector4(Color color) => color.ToScaledVector4();
143143

144144
/// <summary>
145145
/// Converts an <see cref="Vector4"/> to <see cref="Color"/>.
@@ -228,7 +228,7 @@ internal Bgr24 ToBgr24()
228228
}
229229

230230
[MethodImpl(InliningOptions.ShortMethod)]
231-
internal Vector4 ToVector4()
231+
internal Vector4 ToScaledVector4()
232232
{
233233
if (this.boxedHighPrecisionPixel is null)
234234
{

src/ImageSharp/Common/Helpers/Numerics.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,30 @@ public static int LeastCommonMultiple(int a, int b)
7373
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7474
public static nint Modulo8(nint x) => x & 7;
7575

76+
/// <summary>
77+
/// Calculates <paramref name="x"/> % 64
78+
/// </summary>
79+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
80+
public static int Modulo64(int x) => x & 63;
81+
82+
/// <summary>
83+
/// Calculates <paramref name="x"/> % 64
84+
/// </summary>
85+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
86+
public static nint Modulo64(nint x) => x & 63;
87+
88+
/// <summary>
89+
/// Calculates <paramref name="x"/> % 256
90+
/// </summary>
91+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
92+
public static int Modulo256(int x) => x & 255;
93+
94+
/// <summary>
95+
/// Calculates <paramref name="x"/> % 256
96+
/// </summary>
97+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
98+
public static nint Modulo256(nint x) => x & 255;
99+
76100
/// <summary>
77101
/// Fast (x mod m) calculator, with the restriction that
78102
/// <paramref name="m"/> should be power of 2.

src/ImageSharp/Configuration.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using SixLabors.ImageSharp.Formats.Jpeg;
99
using SixLabors.ImageSharp.Formats.Pbm;
1010
using SixLabors.ImageSharp.Formats.Png;
11+
using SixLabors.ImageSharp.Formats.Qoi;
1112
using SixLabors.ImageSharp.Formats.Tga;
1213
using SixLabors.ImageSharp.Formats.Tiff;
1314
using SixLabors.ImageSharp.Formats.Webp;
@@ -212,6 +213,7 @@ public void Configure(IImageFormatConfigurationModule configuration)
212213
/// <see cref="TgaConfigurationModule"/>.
213214
/// <see cref="TiffConfigurationModule"/>.
214215
/// <see cref="WebpConfigurationModule"/>.
216+
/// <see cref="QoiConfigurationModule"/>.
215217
/// </summary>
216218
/// <returns>The default configuration of <see cref="Configuration"/>.</returns>
217219
internal static Configuration CreateDefaultInstance() => new(
@@ -222,5 +224,6 @@ public void Configure(IImageFormatConfigurationModule configuration)
222224
new PbmConfigurationModule(),
223225
new TgaConfigurationModule(),
224226
new TiffConfigurationModule(),
225-
new WebpConfigurationModule());
227+
new WebpConfigurationModule(),
228+
new QoiConfigurationModule());
226229
}

0 commit comments

Comments
 (0)