Browse Source

Merge branch 'quickfill' of github.com:PixiEditor/PixiEditor into quickfill

CPKreuz 3 years ago
parent
commit
e0fcab5b3e

+ 1 - 1
PixiEditor/Models/Tools/Brushes/Brush.cs

@@ -8,6 +8,6 @@ namespace PixiEditor.Models.Tools.Brushes
 {
 {
     public abstract class Brush
     public abstract class Brush
     {
     {
-        public abstract void Draw(Layer layer, Tool tool, Coordinates coordinates, SKPaint paint);
+        public abstract void Draw(Layer layer, int toolSize, Coordinates coordinates, SKPaint paint);
     }
     }
 }
 }

+ 1 - 2
PixiEditor/Models/Tools/Brushes/CircleBrush.cs

@@ -9,9 +9,8 @@ namespace PixiEditor.Models.Tools.Brushes
 {
 {
     public class CircleBrush : Brush
     public class CircleBrush : Brush
     {
     {
-        public override void Draw(Layer layer, Tool tool, Coordinates coordinates, SKPaint paint)
+        public override void Draw(Layer layer, int toolSize, Coordinates coordinates, SKPaint paint)
         {
         {
-            int toolSize = tool.Toolbar.GetSetting<SizeSetting>("ToolSize").Value;
             int halfSize = (int)Math.Ceiling(toolSize / 2f);
             int halfSize = (int)Math.Ceiling(toolSize / 2f);
             int modifier = toolSize % 2 != 0 ? 1 : 0;
             int modifier = toolSize % 2 != 0 ? 1 : 0;
             Coordinates topLeft = new Coordinates(coordinates.X - halfSize + modifier, coordinates.Y - halfSize + modifier);
             Coordinates topLeft = new Coordinates(coordinates.X - halfSize + modifier, coordinates.Y - halfSize + modifier);

+ 1 - 1
PixiEditor/Models/Tools/MatrixBrush.cs

@@ -22,7 +22,7 @@ namespace PixiEditor.Models.Tools
             InitMatrix();
             InitMatrix();
         }
         }
 
 
-        public override void Draw(Layer layer, Tool tool, Coordinates coordinates, SKPaint paint)
+        public override void Draw(Layer layer, int toolSize, Coordinates coordinates, SKPaint paint)
         {
         {
             layer.LayerBitmap.SkiaSurface.Canvas.DrawPoints(SKPointMode.Points, GetAtPoint(coordinates, layer.OffsetX, layer.OffsetY), paint);
             layer.LayerBitmap.SkiaSurface.Canvas.DrawPoints(SKPointMode.Points, GetAtPoint(coordinates, layer.OffsetX, layer.OffsetY), paint);
         }
         }

+ 2 - 2
PixiEditor/Models/Tools/Tools/PenTool.cs

@@ -92,7 +92,7 @@ namespace PixiEditor.Models.Tools.Tools
 
 
             if (!pixelPerfect)
             if (!pixelPerfect)
             {
             {
-                Brush.Draw(layer, this, latestCords, paint);
+                Brush.Draw(layer, toolSize, latestCords, paint);
                 lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
                 lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
                 return;
                 return;
             }
             }
@@ -104,7 +104,7 @@ namespace PixiEditor.Models.Tools.Tools
                     confirmedPixels.Add(latestCords);
                     confirmedPixels.Add(latestCords);
                 }
                 }
 
 
-                Brush.Draw(layer, this, latestCords, paint);
+                Brush.Draw(layer, toolSize, latestCords, paint);
 
 
                 lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
                 lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
                 SetPixelToCheck(LineTool.GetBresenhamLine(startingCoords, latestCords));
                 SetPixelToCheck(LineTool.GetBresenhamLine(startingCoords, latestCords));