@@ -17,6 +17,6 @@ namespace PixiEditorDotNetCore3.Models.Images
WriteableBitmap bitmap = BitmapFactory.New(currentBitmapWidth, currentBitmapHeight);
bitmap.FromByteArray(byteArray);
return bitmap;
- }
+ }
}
@@ -46,10 +46,12 @@ namespace PixiEditorDotNetCore3.Models.Layers
public void ApplyPixels(BitmapPixelChanges pixels, Color color)
{
+ LayerBitmap.Lock();
foreach (var coords in pixels.ChangedCoordinates)
LayerBitmap.SetPixel(Math.Clamp(coords.X, 0, Width - 1), Math.Clamp(coords.Y, 0, Height - 1), color);
+ LayerBitmap.Unlock();
@@ -1,29 +0,0 @@
-using PixiEditor.Helpers;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PixiEditorDotNetCore3.Models.Tools
-{
- class ToolManager : NotifyableObject
- {
- private ToolType _activeTool;
- public ToolType ActiveTool
- get { return _activeTool; }
- set
- if (_activeTool != value)
- _activeTool = value;
- RaisePropertyChanged("ActiveTool");
-}
@@ -11,7 +11,7 @@
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- Title="Pixi" Height="1000" Width="1600" Background="#FF252424" WindowStartupLocation="CenterScreen" WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
+ Title="PixiEditor" Height="1000" Width="1600" Background="#FF252424" WindowStartupLocation="CenterScreen" WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
<Window.Resources>
<vm:ViewModelMain x:Key="ViewModelMain"/>
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
@@ -0,0 +1,28 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Media.Imaging;
+
+namespace PixiEditorTests.PerformanceTests
+{
+ [TestFixture]
+ public class BitmapOperationsTests
+ {
+ [TestCase(16,16)]
+ [TestCase(128, 128)]
+ [TestCase(512, 512)]
+ [TestCase(1024, 1024)]
+ [TestCase(2046, 2046)]
+ [TestCase(4096, 4096)]
+ public void FillBitmapWithPixelsTest(int width, int height)
+ WriteableBitmap bitmap = BitmapFactory.New(width, height);
+ for (int i = 0; i < width * height; i++)
+ bitmap.SetPixeli(i, 0xFFFFF);
+ Assert.Pass();
+}