CodeFactor refactors

This commit is contained in:
Jaex 2020-08-31 12:53:04 +03:00
parent 61553ecd38
commit 74d57ccc12
4 changed files with 4 additions and 5 deletions

View file

@ -80,7 +80,7 @@ public bool CheckClipboard()
{
colorPicker.ChangeColor(clipboardColor);
btnClipboardStatus.Text = "Clipboard: " + text;
btnClipboardStatus.Location = new Point(btnClipboardColorPicker.Left + btnClipboardColorPicker.Width / 2 - btnClipboardStatus.Width / 2,
btnClipboardStatus.Location = new Point(btnClipboardColorPicker.Left + (btnClipboardColorPicker.Width / 2) - (btnClipboardStatus.Width / 2),
btnClipboardColorPicker.Top - btnClipboardStatus.Height - 5);
clipboardStatusHider.Show();
return true;

View file

@ -296,7 +296,7 @@ public static Bitmap BuildImage(byte[] sourceData, int width, int height, int st
int targetStride = targetData.Stride;
long scan0 = targetData.Scan0.ToInt64();
for (int y = 0; y < height; y++)
Marshal.Copy(sourceData, y * stride, new IntPtr(scan0 + y * targetStride), newDataWidth);
Marshal.Copy(sourceData, y * stride, new IntPtr(scan0 + (y * targetStride)), newDataWidth);
newImage.UnlockBits(targetData);
// Fix negative stride on BMP format.
if (isFlipped)

View file

@ -551,7 +551,7 @@ private static float DistanceToThreshold(UnsafeBitmap unsafeBitmap, int x, int y
int maxx = Math.Min(x + radius, unsafeBitmap.Width - 1);
int miny = Math.Max(y - radius, 0);
int maxy = Math.Min(y + radius, unsafeBitmap.Height - 1);
int dist2 = radius * radius + 1;
int dist2 = (radius * radius) + 1;
for (int tx = minx; tx <= maxx; tx++)
{
@ -563,7 +563,7 @@ private static float DistanceToThreshold(UnsafeBitmap unsafeBitmap, int x, int y
{
int dx = tx - x;
int dy = ty - y;
int test_dist2 = dx * dx + dy * dy;
int test_dist2 = (dx * dx) + (dy * dy);
if (test_dist2 < dist2)
{
dist2 = test_dist2;

View file

@ -52,7 +52,6 @@ public object GetValue(object target)
catch
{
}
}
return value;