Bug fixes

This commit is contained in:
Sven Vogel 2021-07-06 14:17:53 +02:00
parent 5b90fee738
commit 979133f314
8 changed files with 34 additions and 19 deletions

View File

@ -30,7 +30,7 @@ namespace Matrix_App
public const int FilterPreviewWidth = 32; public const int FilterPreviewWidth = 32;
public const int FilterPreviewHeight = 32; public const int FilterPreviewHeight = 32;
public const int ArduinoSuccessByte = 21; public const int ArduinoSuccessByte = 75;
public const int ArduinoCommandQueueSize = 2; public const int ArduinoCommandQueueSize = 2;
public const int ArduinoReceiveBufferSize = 1 + 1 + 1 + MatrixLimitedWidth * MatrixLimitedHeight; public const int ArduinoReceiveBufferSize = 1 + 1 + 1 + MatrixLimitedWidth * MatrixLimitedHeight;

View File

@ -119,7 +119,13 @@ namespace Matrix_App
Text = FieldWidgets.GetBetterFieldName(generator.GetType().Name) Text = FieldWidgets.GetBetterFieldName(generator.GetType().Name)
}; };
button.Width = anchor.ClientSize.Width - button.Margin.Right - button.Margin.Left; button.Width = anchor.ClientSize.Width - button.Margin.Right - button.Margin.Left;
button.Click += (sender, e) => OpenGeneratorUi(generator, matrix); button.Click += (sender, e) =>
{
lock (matrix)
{
OpenGeneratorUi(generator, matrix);
}
};
button.Image = CreateSnapshot(generator); button.Image = CreateSnapshot(generator);
button.TextImageRelation = TextImageRelation.ImageBeforeText; button.TextImageRelation = TextImageRelation.ImageBeforeText;
button.TextAlign = ContentAlignment.MiddleRight; button.TextAlign = ContentAlignment.MiddleRight;

View File

@ -72,11 +72,7 @@ namespace Matrix_App
} catch (ThreadInterruptedException) } catch (ThreadInterruptedException)
{ {
Thread.CurrentThread.Interrupt(); Thread.CurrentThread.Interrupt();
} }
catch (Exception)
{
// omit
}
} }
[SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)] [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)]

View File

@ -524,8 +524,8 @@ namespace Matrix_App
matrixView.SetPixelNoRefresh(x, y, pixel); matrixView.SetPixelNoRefresh(x, y, pixel);
gifBuffer[i][index * 3] = pixel.G; gifBuffer[i][index * 3 + 0] = pixel.R;
gifBuffer[i][index * 3 + 1] = pixel.R; gifBuffer[i][index * 3 + 1] = pixel.G;
gifBuffer[i][index * 3 + 2] = pixel.B; gifBuffer[i][index * 3 + 2] = pixel.B;
} }
} }
@ -547,8 +547,8 @@ namespace Matrix_App
int index = x + y * bitmap.Width; int index = x + y * bitmap.Width;
gifBuffer[Timeline.Value][index * 3] = pixel.G; gifBuffer[Timeline.Value][index * 3 + 0] = pixel.R;
gifBuffer[Timeline.Value][index * 3 + 1] = pixel.R; gifBuffer[Timeline.Value][index * 3 + 1] = pixel.G;
gifBuffer[Timeline.Value][index * 3 + 2] = pixel.B; gifBuffer[Timeline.Value][index * 3 + 2] = pixel.B;
} }
} }
@ -633,8 +633,8 @@ namespace Matrix_App
var color = matrixView.GetPixel(x, y); var color = matrixView.GetPixel(x, y);
gifBuffer[Timeline.Value][tmp] = color.G; gifBuffer[Timeline.Value][tmp + 0] = color.R;
gifBuffer[Timeline.Value][tmp + 1] = color.R; gifBuffer[Timeline.Value][tmp + 1] = color.G;
gifBuffer[Timeline.Value][tmp + 2] = color.B; gifBuffer[Timeline.Value][tmp + 2] = color.B;
} }
} }
@ -756,13 +756,27 @@ namespace Matrix_App
int width = data[0]; int width = data[0];
int height = data[1]; int height = data[1];
this.matrixWidth.Value = width; matrixWidth.Value = width;
this.matrixHeight.Value = height; matrixHeight.Value = height;
for (var x = 0; x < width * height * 3; x++) for (var y = 0; y < height; y++)
{ {
gifBuffer[0][x] = data[2 + x]; for (var x = 0; x < width; x++)
{
var i0 = x * 3 + y * width * 3;
var x1 = height - y - 1;
var y1 = width - x - 1;
var i1 = x1 * 3 + y1 * width * 3;
// degamma
gifBuffer[0][i0 + 0] = (byte) MathF.Sqrt(data[i1 + 0 + 2] / 258.0f * 65536.0f);
gifBuffer[0][i0 + 1] = (byte) MathF.Sqrt(data[i1 + 1 + 2] / 258.0f * 65536.0f);
gifBuffer[0][i0 + 2] = (byte) MathF.Sqrt(data[i1 + 2 + 2] / 258.0f * 65536.0f);
}
} }
Timeline.Value = 1; Timeline.Value = 1;
Timeline.Value = 0; Timeline.Value = 0;
} }
@ -835,7 +849,6 @@ namespace Matrix_App
gammaImage[i0 + 2] = rgbImageData[i1 + 2]; gammaImage[i0 + 2] = rgbImageData[i1 + 2];
} }
} }
for (var i = 0; i < rgbImageData.Length; i++) for (var i = 0; i < rgbImageData.Length; i++)
{ {