Skip to content

Commit

Permalink
Fixed highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed Dec 2, 2021
1 parent 8cb2576 commit 33f1ee8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion PixiEditor/Models/Tools/Brushes/Brush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ namespace PixiEditor.Models.Tools.Brushes
{
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);
}
}
3 changes: 1 addition & 2 deletions PixiEditor/Models/Tools/Brushes/CircleBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ namespace PixiEditor.Models.Tools.Brushes
{
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 modifier = toolSize % 2 != 0 ? 1 : 0;
Coordinates topLeft = new Coordinates(coordinates.X - halfSize + modifier, coordinates.Y - halfSize + modifier);
Expand Down
2 changes: 1 addition & 1 deletion PixiEditor/Models/Tools/MatrixBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public MatrixBrush()
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);
}
Expand Down
4 changes: 2 additions & 2 deletions PixiEditor/Models/Tools/Tools/PenTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public override void Use(Layer layer, List<Coordinates> coordinates, SKColor col

if (!pixelPerfect)
{
Brush.Draw(layer, this, latestCords, paint);
Brush.Draw(layer, toolSize, latestCords, paint);
lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
return;
}
Expand All @@ -104,7 +104,7 @@ public override void Use(Layer layer, List<Coordinates> coordinates, SKColor col
confirmedPixels.Add(latestCords);
}

Brush.Draw(layer, this, latestCords, paint);
Brush.Draw(layer, toolSize, latestCords, paint);

lineTool.DrawLine(layer, startingCoords, latestCords, color, toolSize, blendMode, cap);
SetPixelToCheck(LineTool.GetBresenhamLine(startingCoords, latestCords));
Expand Down

0 comments on commit 33f1ee8

Please sign in to comment.