Skip to content

Commit

Permalink
merge of resharper changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Dec 13, 2024
2 parents 16e007b + c6696a3 commit 5c38e0b
Show file tree
Hide file tree
Showing 5 changed files with 310 additions and 314 deletions.
33 changes: 17 additions & 16 deletions src/Consolonia.Core/Drawing/ConsoloniaRenderInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,35 @@ public IGeometryImpl CreateCombinedGeometry(GeometryCombineMode combineMode, IGe
if (g1 is not StreamGeometryImpl stream1 || g2 is not StreamGeometryImpl stream2)
throw new ArgumentException("Only StreamGeometryImpl is supported");

var newGeometry = CreateStreamGeometry();
using (var ctx = newGeometry.Open())
IStreamGeometryImpl newGeometry = CreateStreamGeometry();
using (IStreamGeometryContextImpl ctx = newGeometry.Open())
{
// Resharper disable UnusedVariable
var hasLeftStroke = stream2.Bounds.X.IsNearlyEqual(1);
var hasTopStroke = stream2.Bounds.Y.IsNearlyEqual(1);
var hasRightStroke = (stream1.Bounds.Width - stream2.Bounds.Width).IsNearlyEqual(stream2.Bounds.X + 1);
var hasBottomStroke = (stream1.Bounds.Height - stream2.Bounds.Height).IsNearlyEqual(stream2.Bounds.Y + 1);
var topLeft = stream1.Bounds.TopLeft;
var topRight = stream1.Bounds.TopRight;
var bottomLeft = stream1.Bounds.BottomLeft;
var bottomRight = stream1.Bounds.BottomRight;
var topStroke = stream1.Strokes[0];
var rightStroke = stream1.Strokes[1];
var bottomStroke = stream1.Strokes[2];
var leftStroke = stream1.Strokes[3];
bool hasLeftStroke = stream2.Bounds.X.IsNearlyEqual(1);
bool hasTopStroke = stream2.Bounds.Y.IsNearlyEqual(1);
bool hasRightStroke = (stream1.Bounds.Width - stream2.Bounds.Width).IsNearlyEqual(stream2.Bounds.X + 1);
bool hasBottomStroke =
(stream1.Bounds.Height - stream2.Bounds.Height).IsNearlyEqual(stream2.Bounds.Y + 1);
Point topLeft = stream1.Bounds.TopLeft;
Point topRight = stream1.Bounds.TopRight;
Point bottomLeft = stream1.Bounds.BottomLeft;
Point bottomRight = stream1.Bounds.BottomRight;
Line topStroke = stream1.Strokes[0];
Line rightStroke = stream1.Strokes[1];
Line bottomStroke = stream1.Strokes[2];
Line leftStroke = stream1.Strokes[3];
// Resharper enable UnusedVariable

// add "null" strokes to establish boundries of box even when there is a single real stroke.
AddStroke(ctx, topLeft, topLeft);
AddStroke(ctx, bottomRight, bottomRight);

if (hasTopStroke)
AddStroke(ctx, topStroke.PStart, topStroke.PEnd + new Vector(-1, 0));
if (hasRightStroke)
AddStroke(ctx, rightStroke.PStart + new Vector(-1, 0), rightStroke.PEnd + new Vector(-1, -1));
if (hasBottomStroke)
AddStroke(ctx, bottomStroke.PStart + new Vector(0,-1), bottomStroke.PEnd + new Vector(-1, -1));
AddStroke(ctx, bottomStroke.PStart + new Vector(0, -1), bottomStroke.PEnd + new Vector(-1, -1));
if (hasLeftStroke)
AddStroke(ctx, leftStroke.PStart, leftStroke.PEnd + new Vector(0, -1));
}
Expand Down
Loading

0 comments on commit 5c38e0b

Please sign in to comment.