@@ -112,21 +112,15 @@ public void Blend<TPixelSrc>(
112112 Span < Vector4 > backgroundSpan = buffer . Slice ( destination . Length , destination . Length ) ;
113113 Span < Vector4 > sourceSpan = buffer . Slice ( destination . Length * 2 , destination . Length ) ;
114114
115- PixelOperations < TPixel > . Instance . ToScaledVector4 (
116- configuration ,
117- background . Slice ( 0 , background . Length ) ,
118- backgroundSpan ) ;
119- PixelOperations < TPixelSrc > . Instance . ToScaledVector4 (
120- configuration ,
121- source . Slice ( 0 , background . Length ) ,
122- sourceSpan ) ;
115+ ReadOnlySpan < TPixel > sourcePixels = background . Slice ( 0 , background . Length ) ;
116+ PixelOperations < TPixel > . Instance . ToVector4 ( configuration , sourcePixels , backgroundSpan , PixelConversionModifiers . Scale ) ;
117+ ReadOnlySpan < TPixelSrc > sourcePixels1 = source . Slice ( 0 , background . Length ) ;
118+ PixelOperations < TPixelSrc > . Instance . ToVector4 ( configuration , sourcePixels1 , sourceSpan , PixelConversionModifiers . Scale ) ;
123119
124120 this . BlendFunction ( destinationSpan , backgroundSpan , sourceSpan , amount ) ;
125121
126- PixelOperations < TPixel > . Instance . FromScaledVector4 (
127- configuration ,
128- destinationSpan . Slice ( 0 , background . Length ) ,
129- destination ) ;
122+ Span < Vector4 > sourceVectors = destinationSpan . Slice ( 0 , background . Length ) ;
123+ PixelOperations < TPixel > . Instance . FromVector4Destructive ( configuration , sourceVectors , destination , PixelConversionModifiers . Scale ) ;
130124 }
131125 }
132126
@@ -161,21 +155,15 @@ public void Blend<TPixelSrc>(
161155 Span < Vector4 > backgroundSpan = buffer . Slice ( destination . Length , destination . Length ) ;
162156 Span < Vector4 > sourceSpan = buffer . Slice ( destination . Length * 2 , destination . Length ) ;
163157
164- PixelOperations < TPixel > . Instance . ToScaledVector4 (
165- configuration ,
166- background . Slice ( 0 , background . Length ) ,
167- backgroundSpan ) ;
168- PixelOperations < TPixelSrc > . Instance . ToScaledVector4 (
169- configuration ,
170- source . Slice ( 0 , background . Length ) ,
171- sourceSpan ) ;
158+ ReadOnlySpan < TPixel > sourcePixels = background . Slice ( 0 , background . Length ) ;
159+ PixelOperations < TPixel > . Instance . ToVector4 ( configuration , sourcePixels , backgroundSpan , PixelConversionModifiers . Scale ) ;
160+ ReadOnlySpan < TPixelSrc > sourcePixels1 = source . Slice ( 0 , background . Length ) ;
161+ PixelOperations < TPixelSrc > . Instance . ToVector4 ( configuration , sourcePixels1 , sourceSpan , PixelConversionModifiers . Scale ) ;
172162
173163 this . BlendFunction ( destinationSpan , backgroundSpan , sourceSpan , amount ) ;
174164
175- PixelOperations < TPixel > . Instance . FromScaledVector4 (
176- configuration ,
177- destinationSpan . Slice ( 0 , background . Length ) ,
178- destination ) ;
165+ Span < Vector4 > sourceVectors = destinationSpan . Slice ( 0 , background . Length ) ;
166+ PixelOperations < TPixel > . Instance . FromVector4Destructive ( configuration , sourceVectors , destination , PixelConversionModifiers . Scale ) ;
179167 }
180168 }
181169 }
0 commit comments