diff --git a/ShareX.HelpersLib/Helpers/ImageHelpers.cs b/ShareX.HelpersLib/Helpers/ImageHelpers.cs index 3cc5af65d..6b384f938 100644 --- a/ShareX.HelpersLib/Helpers/ImageHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ImageHelpers.cs @@ -1390,7 +1390,7 @@ public static void ColorDepth(Bitmap bmp, int bitsPerChannel = 4) byte Remap(byte color, double interval) { - return (byte) Math.Round((Math.Round(color / interval) * interval)); + return (byte)Math.Round(Math.Round(color / interval) * interval); } using (UnsafeBitmap unsafeBitmap = new UnsafeBitmap(bmp, true)) diff --git a/ShareX.ImageEffectsLib/Filters/ColorDepth.cs b/ShareX.ImageEffectsLib/Filters/ColorDepth.cs index 6d714fcd2..8ab8b293d 100644 --- a/ShareX.ImageEffectsLib/Filters/ColorDepth.cs +++ b/ShareX.ImageEffectsLib/Filters/ColorDepth.cs @@ -1,19 +1,50 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2020 ShareX Team + + 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 2 + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +using ShareX.HelpersLib; using System.ComponentModel; using System.Drawing; -using ShareX.HelpersLib; namespace ShareX.ImageEffectsLib { [Description("Color depth")] internal class ColorDepth : ImageEffect { - private int _bitsPerChannel; + private int bitsPerChannel; [DefaultValue(4)] public int BitsPerChannel { - get => this._bitsPerChannel; - set => this._bitsPerChannel = value.Max(1).Min(8); + get + { + return bitsPerChannel; + } + set + { + bitsPerChannel = MathHelpers.Clamp(value, 1, 8); + } } public ColorDepth() @@ -23,7 +54,7 @@ public ColorDepth() public override Bitmap Apply(Bitmap bmp) { - ImageHelpers.ColorDepth(bmp, this.BitsPerChannel); + ImageHelpers.ColorDepth(bmp, BitsPerChannel); return bmp; } } diff --git a/ShareX.MediaLib/Forms/VideoConverterForm.cs b/ShareX.MediaLib/Forms/VideoConverterForm.cs index ad90446b0..091e0f57e 100644 --- a/ShareX.MediaLib/Forms/VideoConverterForm.cs +++ b/ShareX.MediaLib/Forms/VideoConverterForm.cs @@ -174,7 +174,7 @@ private bool StartEncoding() private Task StartEncodingAsync() { - return Task.Run(() => StartEncoding()); + return Task.Run(StartEncoding); } private void Manager_EncodeProgressChanged(float percentage) diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index be109868e..a7e990637 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -34,7 +34,6 @@ false true true - 7.3 true