diff --git a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj index 5110d6b1f..b83d68e93 100644 --- a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj +++ b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj @@ -24,6 +24,6 @@ - + diff --git a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj index c5fdf1040..143a9b863 100644 --- a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj +++ b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj @@ -19,6 +19,6 @@ - + diff --git a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj index b403aab33..6a12382c1 100644 --- a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj +++ b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj @@ -23,6 +23,6 @@ - + diff --git a/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj b/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj index d1501f43d..e6c9e6321 100644 --- a/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj +++ b/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj index 5e245db55..e1057b930 100644 --- a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj +++ b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj @@ -20,8 +20,8 @@ - - - + + + diff --git a/src/Greenshot.Addon.Jira/JiraConnector.cs b/src/Greenshot.Addon.Jira/JiraConnector.cs index 634cdc78b..450448e5c 100644 --- a/src/Greenshot.Addon.Jira/JiraConnector.cs +++ b/src/Greenshot.Addon.Jira/JiraConnector.cs @@ -206,7 +206,7 @@ namespace Greenshot.Addon.Jira { try { - return await _jiraClient.Issue.GetAsync(issueKey, cancellationToken).ConfigureAwait(false); + return await _jiraClient.Issue.GetAsync(issueKey, null, null, cancellationToken).ConfigureAwait(false); } catch { diff --git a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj index eeb87fafd..bdcaef952 100644 --- a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj +++ b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj @@ -23,6 +23,6 @@ - + \ No newline at end of file diff --git a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj index bcd3db5fa..f2bd1ffae 100644 --- a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj +++ b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj @@ -22,6 +22,6 @@ - + \ No newline at end of file diff --git a/src/Greenshot.Addons/Greenshot.Addons.csproj b/src/Greenshot.Addons/Greenshot.Addons.csproj index 2a3973ebd..381147203 100644 --- a/src/Greenshot.Addons/Greenshot.Addons.csproj +++ b/src/Greenshot.Addons/Greenshot.Addons.csproj @@ -20,12 +20,12 @@ - - - - - - + + + + + + diff --git a/src/Greenshot.Core/Greenshot.Core.csproj b/src/Greenshot.Core/Greenshot.Core.csproj index e16005bf8..63748658d 100644 --- a/src/Greenshot.Core/Greenshot.Core.csproj +++ b/src/Greenshot.Core/Greenshot.Core.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs b/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs index 6e04b1846..7280f4e0a 100644 --- a/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs +++ b/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs @@ -22,6 +22,7 @@ using System.Drawing; using System.Drawing.Imaging; using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; +using HashDepot; namespace Greenshot.Gfx.FastBitmap { @@ -336,8 +337,8 @@ namespace Greenshot.Gfx.FastBitmap { var offset = (left ?? Left) * BytesPerPixel + y * Stride; var length = (right ?? Right) - (left ?? Left) * BytesPerPixel; - var hash = new Murmur3(Seed); - return hash.CalculateHash(Pointer, offset, length); + var values = new ReadOnlySpan(Pointer + offset, length); + return XXHash.Hash32(values, Seed); } /// diff --git a/src/Greenshot.Gfx/Greenshot.Gfx.csproj b/src/Greenshot.Gfx/Greenshot.Gfx.csproj index e1f152d86..847c19019 100644 --- a/src/Greenshot.Gfx/Greenshot.Gfx.csproj +++ b/src/Greenshot.Gfx/Greenshot.Gfx.csproj @@ -8,7 +8,8 @@ - + + diff --git a/src/Greenshot.Gfx/Murmur3.cs b/src/Greenshot.Gfx/Murmur3.cs deleted file mode 100644 index 34dc9438b..000000000 --- a/src/Greenshot.Gfx/Murmur3.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -namespace Greenshot.Gfx -{ - /// - /// This is an implementation of the Murmur3 hash algorithm - /// See MurmurHash - /// - public sealed class Murmur3 - { - private const uint C1 = 0xcc9e2d51; - private const uint C2 = 0x1b873593; - private const int R1 = 15; - private const int R2 = 13; - private const uint M = 5; - private const uint N = 0xe6546b64; - - private readonly uint _seed; - - /// - /// Constructor for the Murmur3 algorithm - /// - /// - public Murmur3(uint seed) - { - _seed = seed; - } - - /// - /// Wrapper for byte* - /// - /// uint - public unsafe uint CalculateHash(byte* pointer, int offset, int length) - { - var values = new ReadOnlySpan(pointer+offset, length); - return CalculateHash(values); - } - - /// - /// Wrapper for string etc - /// - /// Type for the span - /// ReadOnlySpan of TSpan - /// uint - public uint CalculateHash(ReadOnlySpan valuesToHash) where TSpan : struct - { - return CalculateHash(MemoryMarshal.Cast(valuesToHash)); - } - - /// - /// Calculate a Murmur3 hash for the specified values - /// - /// ReadOnlySpan of byte - /// uint with the hash - public uint CalculateHash(ReadOnlySpan valuesToHash) - { - var uintSpan = MemoryMarshal.Cast(valuesToHash); - uint hash = _seed; - var uintSpanLength = uintSpan.Length; - // Hash with uints - for (int index = 0; index < uintSpanLength; index++) - { - var k = uintSpan[index]; - unchecked - { - k *= C1; - k = RotateLeft(k, R1); - k *= C2; - hash ^= k; - hash = RotateLeft(hash, R2); - hash = hash * M + N; - } - } - - int valuesToProcess = valuesToHash.Length - (uintSpanLength * 4); - if (valuesToProcess > 0) - { - uint k = 0; - var startingOffset = uintSpanLength * 4; - // Hash the rest - for (int index = 0; index < valuesToProcess; index++) - { - k |= (uint)valuesToHash[startingOffset + index] << (8 * index); - } - - unchecked - { - k *= C1; - k = RotateLeft(k, R1); - k *= C2; - hash ^= k; - } - } - - // Calculate the final hash - hash ^= (uint)valuesToHash.Length; - unchecked - { - hash ^= hash >> 16; - hash *= 0x85ebca6b; - hash ^= hash >> 13; - hash *= 0xc2b2ae35; - hash ^= hash >> 16; - } - return hash; - } - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static uint RotateLeft(uint x, byte r) - { - return (x << r) | (x >> (32 - r)); - } - } -} diff --git a/src/Greenshot.PerformanceTests/Murmur3Performance.cs b/src/Greenshot.PerformanceTests/Murmur3Performance.cs deleted file mode 100644 index 9da15ac63..000000000 --- a/src/Greenshot.PerformanceTests/Murmur3Performance.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -using System; -using BenchmarkDotNet.Attributes; -using Greenshot.Gfx; - -namespace Greenshot.PerformanceTests -{ - /// - /// This defines the benchmarks which can be done - /// - [MinColumn, MaxColumn, MemoryDiagnoser] - public class Murmur3Performance - { - private static readonly string TestString = "The quick brown fox jumps over the lazy dog"; - - [Benchmark] - public void MurmurPerformanceTest() - { - var hashAlgorithm = new Murmur3(0x9747b28c); - hashAlgorithm.CalculateHash(TestString.AsSpan()); - } - } -} diff --git a/src/Greenshot.PerformanceTests/Program.cs b/src/Greenshot.PerformanceTests/Program.cs index 38d4d929f..c6f6b9943 100644 --- a/src/Greenshot.PerformanceTests/Program.cs +++ b/src/Greenshot.PerformanceTests/Program.cs @@ -30,7 +30,6 @@ namespace Greenshot.PerformanceTests // ReSharper disable once UnusedParameter.Local private static void Main(string[] args) { - //BenchmarkRunner.Run(); BenchmarkRunner.Run(); //BenchmarkRunner.Run(); Console.ReadLine(); diff --git a/src/Greenshot.Tests/Greenshot.Tests.csproj b/src/Greenshot.Tests/Greenshot.Tests.csproj index 0629b5cde..eebfa8f6c 100644 --- a/src/Greenshot.Tests/Greenshot.Tests.csproj +++ b/src/Greenshot.Tests/Greenshot.Tests.csproj @@ -31,8 +31,8 @@ - - + + diff --git a/src/Greenshot.Tests/Murmur3Tests.cs b/src/Greenshot.Tests/Murmur3Tests.cs deleted file mode 100644 index 7e398f3b1..000000000 --- a/src/Greenshot.Tests/Murmur3Tests.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -using System; -using System.Text; -using Greenshot.Gfx; -using Greenshot.Tests.Extensions; -using Xunit; - -namespace Greenshot.Tests -{ - /// - /// Some simple tests to prove Murmur3 was correctly implemented - /// - public class Murmur3Tests - { - private static readonly uint Seed = 0x9747b28c; - private static readonly string TestString = "The quick brown fox jumps over the lazy dog"; - - [Fact] - public void Murmur3_Test() - { - var murmur3Span = new Murmur3(Seed); - var testBytes = Encoding.UTF8.GetBytes(TestString); - var hash = murmur3Span.CalculateHash(testBytes.AsSpan()); - Assert.Equal(0x2FA826CDu, hash); - } - } -} diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index 020c4d2a5..b9855df1c 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -38,12 +38,12 @@ - + - - + +