Skip to content

Commit

Permalink
pr comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jinek committed Dec 25, 2024
1 parent 99959c8 commit f8adc28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Consolonia.Core.Drawing
{
public static class BrushExtensions
public static class BrushExtensions //todo: investigate why resharper does not complain about wrong file naming
{
public static Color FromPosition(IBrush brush, int x, int y, int width, int height)
public static Color FromPosition(this IBrush brush, int x, int y, int width, int height)
{
//todo: apply brush opacity
ArgumentNullException.ThrowIfNull(brush);
Expand Down
2 changes: 1 addition & 1 deletion src/Consolonia.Core/Drawing/DrawingContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ private void FillRectangleWithBrush(IBrush brush, IPen pen, Rect r)
int px = (int)(r2.TopLeft.X + x);
int py = (int)(r2.TopLeft.Y + y);

Color backgroundColor = BrushExtensions.FromPosition(brush, x, y, (int)width, (int)height);
Color backgroundColor = brush.FromPosition(x, y, (int)width, (int)height);
CurrentClip.ExecuteWithClipping(new Point(px, py), () =>
{
_pixelBuffer.Set(new PixelBufferCoordinate((ushort)px, (ushort)py),
Expand Down
14 changes: 8 additions & 6 deletions src/Consolonia.Core/Drawing/PixelBufferImplementation/Pixel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,17 @@ public Pixel Blend(Pixel pixelAbove)
}
else
{
newForeground = new PixelForeground(Foreground.Symbol,
MergeColors(Foreground.Color, pixelAbove.Background.Color),
Foreground.Weight,
Foreground.Style,
Foreground.TextDecoration);

// merge the PixelForeground color with the pixelAbove background color

if (pixelAbove.Background.Color.A == 0xFF)
// non-transparent layer above
newForeground = new PixelForeground();
else
newForeground = new PixelForeground(Foreground.Symbol,
MergeColors(Foreground.Color, pixelAbove.Background.Color),
Foreground.Weight,
Foreground.Style,
Foreground.TextDecoration);
}

newIsCaret = pixelAbove.IsCaret;
Expand Down

0 comments on commit f8adc28

Please sign in to comment.