diff --git a/Gauss.CPP/Gauss.CPP.cpp b/Gauss.CPP/Gauss.CPP.cpp index b4412ca..033875a 100644 --- a/Gauss.CPP/Gauss.CPP.cpp +++ b/Gauss.CPP/Gauss.CPP.cpp @@ -121,5 +121,5 @@ void ComputeGaussBlur(ThreadParameters params) delete[] mask; for (int y = 0; y < params.ImageHeight; y++) - memcpy(¶ms.ImgByteArrayPtr[54 + y * params.ImageWidth * 3], pixels[y], sizeof(unsigned char) * 3 * params.ImageWidth); + memcpy(¶ms.ImgByteArrayPtr[params.CurrentImgOffset + y * row_padded], pixels[y], sizeof(unsigned char) * 3 * params.ImageWidth); } \ No newline at end of file diff --git a/Gauss.GUI/Core/GaussImageManager.cs b/Gauss.GUI/Core/GaussImageManager.cs index 802c5a8..7670799 100644 --- a/Gauss.GUI/Core/GaussImageManager.cs +++ b/Gauss.GUI/Core/GaussImageManager.cs @@ -65,7 +65,7 @@ private unsafe Size GetLoadedImageSizes() fixed (byte* imgArray = SourceFile) { - width = *(int*)&imgArray[18]; + width = *(int*)&imgArray[18]; height = *(int*)&imgArray[22]; } @@ -93,6 +93,8 @@ private ThreadParameters ComputeThreadParams(int threadId, GeneratorParameters g sumOfOffsetLines += numOfLinesOfCurrentThread; } + sumOfOffsetLines -= threadId*(generatorParams.GaussMaskSize - 1); + return new ThreadParameters { CurrentImgOffset = sumOfOffsetLines * rowPadded, diff --git a/Gauss.GUI/Views/MainWindow.xaml b/Gauss.GUI/Views/MainWindow.xaml index fb0e620..75476c7 100644 --- a/Gauss.GUI/Views/MainWindow.xaml +++ b/Gauss.GUI/Views/MainWindow.xaml @@ -4,8 +4,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModels="clr-namespace:Gauss.GUI.ViewModels" - mc:Ignorable="d" MinHeight="600" MinWidth="1000" Background="DimGray" - Title="Gauss Blur - Szymon Bartnik (Silesian University Of Technology)" Height="600" Width="1000" + mc:Ignorable="d" MinHeight="700" MinWidth="1200" Background="DimGray" + Title="Gauss Blur - Szymon Bartnik (Silesian University Of Technology)" Height="680" Width="1150" d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel, IsDesignTimeCreatable=True}"> @@ -13,7 +13,7 @@ - + @@ -25,10 +25,10 @@ - + - + @@ -40,21 +40,21 @@ Margin="0 5 5 5" VerticalAlignment="Center" HorizontalAlignment="Center" /> - + - + - + - + @@ -80,17 +80,17 @@ Visibility="{Binding ProgramState, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter=Computing}" HorizontalAlignment="Center" Foreground="GreenYellow" />