Introduce extended pixel conversion#869
Conversation
| /// knowing the pixel type. | ||
| /// </summary> | ||
| [Flags] | ||
| internal enum PixelConversionModifiers |
There was a problem hiding this comment.
Please review my namings here!
Codecov Report
@@ Coverage Diff @@
## master #869 +/- ##
==========================================
- Coverage 88.89% 88.87% -0.02%
==========================================
Files 1014 1017 +3
Lines 44295 44438 +143
Branches 3209 3228 +19
==========================================
+ Hits 39376 39495 +119
+ Misses 4198 4181 -17
- Partials 721 762 +41
Continue to review full report at Codecov.
|
JimBobSquarePants
left a comment
There was a problem hiding this comment.
I much, much, much prefer this approach to the tree of methods in my PR. Much easier for us to optimize single methods.
| PixelConversionModifiers conversionModifiers = PixelConversionModifiers.Premultiply; | ||
| if (this.Compand) | ||
| { | ||
| conversionModifiers |= PixelConversionModifiers.Scale | PixelConversionModifiers.SRgbCompand; |
There was a problem hiding this comment.
Maybe we could shortcut this? It's something to remember every time. (Unless that's a good thing for greater understanding?)
There was a problem hiding this comment.
I think we'll leave it as-is. It's explicit and should be well understood.
There was a problem hiding this comment.
Companding always indicates scaling (otherwise colors are incorrect), right?
There was a problem hiding this comment.
Yeah, the algorithm requires scaling.
| /// knowing the pixel type. | ||
| /// </summary> | ||
| [Flags] | ||
| internal enum PixelConversionModifiers |
| internal static class PixelConversionModifiersExtensions | ||
| { | ||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static bool IsDefined(this PixelConversionModifiers modifiers, PixelConversionModifiers expected) => |
| /// <summary> | ||
| /// Select <see cref="IPixel.ToScaledVector4"/> and <see cref="IPixel.FromScaledVector4"/> instead the standard (non scaled) variants. | ||
| /// </summary> | ||
| Scale = 1 << 0, |
There was a problem hiding this comment.
@JimBobSquarePants I keep thinking whether we should replace Scaled / Scale with Normalized / Normalize in our terminology. Seems more precize to me. Or is this wrong thinking?
There was a problem hiding this comment.
Or is this wrong thinking?
Actually no. Normalization in our situation is exactly what we are doing and I think I prefer it!
It means breaking IPixel for consistency but you have my blessing to do so. I'd really like to ensure we have our naming correct for RC1.
|
I'm merging this now to unblock stuff like #870. Naming tweaks could be added in a follow-up PR. |
Prerequisites
Description
This is a replacement PR for #847 introducing extended bulk conversion controlled by flags.
Vector4buffers is destructive for performance, yet it's cleanRgb24andBgr24.