@@ -52,23 +52,15 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
5252
5353 int width = maxX - minX ;
5454
55- var solidBrush = this . brush as SolidBrush < TPixel > ;
56-
5755 // If there's no reason for blending, then avoid it.
58- if ( solidBrush != null &&
59- (
60- ( this . options . BlenderMode == PixelBlenderMode . Normal && this . options . BlendPercentage == 1f && solidBrush . Color . ToVector4 ( ) . W == 1f ) ||
61- ( this . options . BlenderMode == PixelBlenderMode . Over && this . options . BlendPercentage == 1f && solidBrush . Color . ToVector4 ( ) . W == 1f ) ||
62- ( this . options . BlenderMode == PixelBlenderMode . Src ) ) )
56+ if ( this . IsSolidBrushWithoutBlending ( out SolidBrush < TPixel > solidBrush ) )
6357 {
6458 Parallel . For (
6559 minY ,
6660 maxY ,
6761 configuration . ParallelOptions ,
6862 y =>
6963 {
70- int offsetY = y - startY ;
71- int offsetX = minX - startX ;
7264 source . GetPixelRowSpan ( y ) . Slice ( minX , width ) . Fill ( solidBrush . Color ) ;
7365 } ) ;
7466 }
@@ -107,5 +99,17 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
10799 }
108100 }
109101 }
102+
103+ private bool IsSolidBrushWithoutBlending ( out SolidBrush < TPixel > solidBrush )
104+ {
105+ solidBrush = this . brush as SolidBrush < TPixel > ;
106+
107+ return solidBrush != null
108+ && ( ( this . options . BlenderMode == PixelBlenderMode . Normal && this . options . BlendPercentage == 1f
109+ && solidBrush . Color . ToVector4 ( ) . W == 1f )
110+ || ( this . options . BlenderMode == PixelBlenderMode . Over && this . options . BlendPercentage == 1f
111+ && solidBrush . Color . ToVector4 ( ) . W == 1f )
112+ || ( this . options . BlenderMode == PixelBlenderMode . Src ) ) ;
113+ }
110114 }
111115}
0 commit comments