-
-
Notifications
You must be signed in to change notification settings - Fork 887
Description
This follows from a conversation with @JimBobSquarePants on gitter.
Overview
There are parts of the ImageSharp codebase that were written before C# 7.3 came out, so in particular there are two missing features: the unmanaged type constraint, and the readonly modifier for struct types, or struct members.
We should consider doing a polishing pass around the codebase, including:
- Upgrading all the various
structconstraints to unmanaged (eg. inwhere TPixel : unmanaged, IPixel<TPixel>, instead of the previouswhere TPixel : struct, IPixel<TPixel>) - Marking all the
struct-s, or at least all the various method/property getters/etc. asreadonlyas possible (this is more expressive and avoids safety copies by the compiler)
In particular, some of these changes were in the (now reverted) commits in #1107: 4b7718e.
Roadmap
The plan now is to wait for #1107 and #1109 to be merged, and then proceed with these changes. Side note: another unrelated follow up to do when those PRs get merged is to reintroduce the changes from 1835475 and customize processors to let them pick the right value delegate depending on their needs.