Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,15 @@
# treat as binary
###############################################################################
*.basis binary
*.a binary
*.dll binary
*.dylib binary
*.exe binary
*.pdf binary
*.ppt binary
*.pptx binary
*.pvr binary
*.so binary
*.snk binary
*.xls binary
*.xlsx binary
Expand All @@ -107,6 +110,7 @@
###############################################################################
# Handle image files by git lfs
###############################################################################
*.pdf filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text
Expand Down Expand Up @@ -134,6 +138,12 @@
*.heic filter=lfs diff=lfs merge=lfs -text
*.hif filter=lfs diff=lfs merge=lfs -text
*.avif filter=lfs diff=lfs merge=lfs -text
*.hvc1 filter=lfs diff=lfs merge=lfs -text
*.hvcc filter=lfs diff=lfs merge=lfs -text
*.ivf filter=lfs diff=lfs merge=lfs -text
*.y4m filter=lfs diff=lfs merge=lfs -text
*.yuv filter=lfs diff=lfs merge=lfs -text
*.bit filter=lfs diff=lfs merge=lfs -text
###############################################################################
# Handle ICC files by git lfs
###############################################################################
Expand Down
3 changes: 3 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub Copilot Instructions

Read and follow [AGENTS.md](../AGENTS.md) as the repository-wide source of coding, performance, and verification requirements. Prefer existing local patterns and repository configuration whenever generated code or suggestions are accepted.
30 changes: 15 additions & 15 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,44 +56,44 @@ jobs:
- name: Git Pull LFS
shell: bash
run: git lfs pull

Build:
needs: WarmLFS
strategy:
matrix:
options:
- os: ubuntu-latest
framework: net10.0
sdk: 10.0.x
framework: net11.0
sdk: 11.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: macos-latest
framework: net10.0
sdk: 10.0.x
framework: net11.0
sdk: 11.0.x
sdk-preview: true
runtime: -x64
codecov: true
- os: windows-latest
framework: net10.0
sdk: 10.0.x
framework: net11.0
sdk: 11.0.x
sdk-preview: true
runtime: -x64
codecov: false

- os: ubuntu-latest
framework: net8.0
sdk: 8.0.x
framework: net10.0
sdk: 10.0.x
runtime: -x64
codecov: false
- os: macos-latest
framework: net8.0
sdk: 8.0.x
framework: net10.0
sdk: 10.0.x
runtime: -x64
codecov: false
- os: windows-latest
framework: net8.0
sdk: 8.0.x
framework: net10.0
sdk: 10.0.x
runtime: -x64
codecov: false

Expand Down Expand Up @@ -138,14 +138,14 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
8.0.x
10.0.x

- name: DotNet Setup Preview
if: ${{ matrix.options.sdk-preview == true }}
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
10.0.x
11.0.x

- name: DotNet Build
if: ${{ matrix.options.sdk-preview != true }}
Expand Down
41 changes: 41 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Six Labors AI Coding Guidelines

These instructions apply to the entire repository. More-specific `AGENTS.md` files may add to or override them for their directory tree.

## Working Practices

- Inspect the relevant implementation, tests, benchmarks, project files, and nearby code before proposing or making changes. Do not infer current behavior when the source is available.
- Make the smallest complete change that solves the requested problem. Avoid unrelated cleanup, speculative abstractions, and formatting churn.
- Match established architecture, naming, formatting, documentation, and test patterns. Treat `.editorconfig`, analyzers, and repository build settings as authoritative.
- Preserve public API and observable behavior unless the task explicitly requires a change. Public API documentation must describe observable behavior, not implementation details.
- Do not use reflection against built assemblies, ad hoc assembly loading, or temporary probe projects unless explicitly requested.
- Build .NET projects in Release configuration unless explicitly instructed otherwise.

## Performance

- Treat throughput, latency, memory use, and binary size as design constraints, especially in pixel-processing, drawing, parsing, encoding, and other hot paths.
- Avoid unnecessary allocations, copies, boxing, closures, interface dispatch, repeated enumeration, and extra passes over data.
- Reuse the repository's existing memory ownership, pooling, span, vectorization, and parallelization patterns. Do not introduce a new mechanism when an established one fits.
- Keep hot loops simple and bounds-check-friendly. Hoist invariant work, preserve locality, and use the narrowest suitable data types without sacrificing correctness.
- Do not trade correctness or maintainability for assumed speed. Support non-obvious optimizations with measurements or clear evidence, and add or update benchmarks when performance is the purpose of the change.
- Consider all supported target frameworks and runtime capabilities. Do not regress fallback paths while optimizing newer runtimes.

## C# Conventions

- Follow the existing code around the change; local patterns take precedence over generic preferences.
- Do not use `record` or `record struct` types.
- Prefer established invariants over redundant guards. Validate at real external boundaries and do not add defensive checks for internally controlled states.
- Do not extract single-use helpers merely to name a block. Extract only for genuine reuse, an established local pattern, or meaningful complexity reduction.
- Add vertical whitespace after multi-line statements and declarations and between distinct logical stages. Never add trailing whitespace.
- Document every method, constructor, and property, regardless of whether it is public, internal, protected, or private. Keep public API documentation limited to observable behavior; use private and internal documentation to capture the contract and intent needed to maintain the code.
- Add inline comments throughout complex code. Explain algorithms, formulas, invariants, ownership, compatibility behavior, and performance tradeoffs at the operations and decisions they govern. Explain why the code is shaped that way rather than narrating the syntax.
- Document SIMD code especially thoroughly. Explain the vector layout, lane meaning, widening or narrowing, masks, shuffles, constants, alignment or remainder handling, supported instruction paths, scalar equivalence, and the reason each non-obvious operation is correct.
- Write algorithm and SIMD comments for a maintainer who is unfamiliar with the implementation. The reader should not need to reconstruct intent from external documentation, issue history, or benchmark results.

## Verification

- Add or update focused tests when behavior changes, following the test framework and conventions already used by the project.
- Never hack, weaken, skip, conditionally bypass, or otherwise manipulate a test to make it pass. Fix the production defect or the genuine test defect while preserving the test's intended coverage and sensitivity.
- Do not update golden files, reference images, snapshots, baselines, or expected-output artifacts to resolve a test failure. Treat a mismatch as evidence to investigate and correct the implementation.
- Run the narrowest relevant formatting, test, and Release build commands, then expand verification in proportion to the risk and scope of the change.
- Report what changed, the verification performed, and any remaining risks or unverified assumptions.
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Claude Code Instructions

Read and follow [AGENTS.md](AGENTS.md) as the repository-wide source of coding, performance, and verification requirements. Apply any more-specific `AGENTS.md` or `CLAUDE.md` found below the files being changed.
3 changes: 3 additions & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Gemini CLI Instructions

Read and follow [AGENTS.md](AGENTS.md) as the repository-wide source of coding, performance, and verification requirements. Apply any more-specific `AGENTS.md` or `GEMINI.md` found below the files being changed.
97 changes: 0 additions & 97 deletions PolygonClipper.sln

This file was deleted.

37 changes: 37 additions & 0 deletions PolygonClipper.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path=".gitattributes" />
<File Path=".gitignore" />
<File Path="ci-build.ps1" />
<File Path="ci-pack.ps1" />
<File Path="ci-test.ps1" />
<File Path="LICENSE" />
<File Path="README.md" />
<File Path="reference/10.1016@j.advengsoft.2013.04.004.pdf" />
<File Path="reference/129902.129906.pdf" />
<File Path="THIRD-PARTY-NOTICES.md" />
</Folder>
<Folder Name="/Solution Items/.github/">
<File Path=".github/CONTRIBUTING.md" />
<File Path=".github/dependabot.yml" />
<File Path=".github/FUNDING.yml" />
<File Path=".github/PULL_REQUEST_TEMPLATE.md" />
</Folder>
<Folder Name="/Solution Items/.github/ISSUE_TEMPLATE/">
<File Path=".github/ISSUE_TEMPLATE/config.yml" />
<File Path=".github/ISSUE_TEMPLATE/oss-bug-report.yml" />
</Folder>
<Folder Name="/Solution Items/.github/workflows/">
<File Path=".github/workflows/build-and-test.yml" />
</Folder>
<Folder Name="/src/">
<Project Path="shared-infrastructure/src/SharedInfrastructure/SharedInfrastructure.shproj" />
<Project Path="src/PolygonClipper/PolygonClipper.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/GeoJson/GeoJson.csproj" />
<Project Path="tests/PolygonClipper.Benchmarks/PolygonClipper.Benchmarks.csproj" />
<Project Path="tests/PolygonClipper.Tests/PolygonClipper.Tests.csproj" />
</Folder>
</Solution>
18 changes: 18 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Pins the .NET SDK to major version 10 or later for all SixLabors repositories.
// The build copies this file to consuming repositories together with .editorconfig and
// the other shared config files (see msbuild/targets/SixLabors.Src.targets).
{
"sdk": {
// The floor, not an exact build: resolution never selects an SDK below major 10.
"version": "10.0.0",

// Select the newest installed SDK at or above the floor. This spans feature bands,
// minor versions, and major versions, so a machine with only stable 10.0.x SDKs
// resolves the newest of those, and a machine with a newer SDK resolves that instead.
"rollForward": "latestMajor",

// Let the CLI and Visual Studio select preview SDKs when one is installed.
// Machines and CI lanes without a preview SDK are unaffected.
"allowPrerelease": true
}
}
2 changes: 1 addition & 1 deletion src/PolygonClipper/PolygonClipper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ private static bool TryTrivialOperationForNonOverlappingBoundingBoxes(

if (operation is BooleanOperation.Union or BooleanOperation.Xor)
{
result = new(subject.Count + clipping.Count);
result = new Polygon(subject.Count + clipping.Count);
result.Join(subject.DeepClone());
result.Join(clipping.DeepClone());
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/PolygonClipper/PolygonClipper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
<!--Bump to v1.0 prior to tagged release.-->
<MinVerMinimumMajorMinor>1.0</MinVerMinimumMajorMinor>
</PropertyGroup>

<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>
Expand Down
4 changes: 2 additions & 2 deletions tests/GeoJson/Converters/FeatureConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
genericArguments),
BindingFlags.Default,
binder: null,
args: new object[] { typedGeometry, (IDictionary<string, object>)properties, id },
args: [typedGeometry, (IDictionary<string, object>)properties, id],
culture: null);
}
else
Expand All @@ -67,7 +67,7 @@ public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
genericArguments),
BindingFlags.Default,
binder: null,
args: new object[] { typedGeometry, typedProperty, id },
args: [typedGeometry, typedProperty, id],
culture: null);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/GeoJson/Converters/GeometryEnumerableConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override ReadOnlyCollection<IGeometryObject> Read(
}

int startDepth = reader.CurrentDepth;
List<IGeometryObject>? result = new();
List<IGeometryObject>? result = [];
while (reader.Read())
{
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
Expand Down
2 changes: 1 addition & 1 deletion tests/GeoJson/Converters/LineStringEnumerableConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override IReadOnlyCollection<LineString> Read(
}

int startDepth = reader.CurrentDepth;
List<LineString>? result = new();
List<LineString>? result = [];
while (reader.Read())
{
if(JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
Expand Down
Loading
Loading