@@ -147,6 +147,7 @@ private static void ApplyNNResizeFrameTransform(
147147 var operation = new NNRowOperation (
148148 sourceRectangle ,
149149 destinationRectangle ,
150+ interest ,
150151 widthFactor ,
151152 heightFactor ,
152153 source ,
@@ -197,6 +198,7 @@ private static void ApplyResizeFrameTransform(
197198 {
198199 private readonly Rectangle sourceBounds ;
199200 private readonly Rectangle destinationBounds ;
201+ private readonly Rectangle interest ;
200202 private readonly float widthFactor ;
201203 private readonly float heightFactor ;
202204 private readonly ImageFrame < TPixel > source ;
@@ -206,13 +208,15 @@ private static void ApplyResizeFrameTransform(
206208 public NNRowOperation (
207209 Rectangle sourceBounds ,
208210 Rectangle destinationBounds ,
211+ Rectangle interest ,
209212 float widthFactor ,
210213 float heightFactor ,
211214 ImageFrame < TPixel > source ,
212215 ImageFrame < TPixel > destination )
213216 {
214217 this . sourceBounds = sourceBounds ;
215218 this . destinationBounds = destinationBounds ;
219+ this . interest = interest ;
216220 this . widthFactor = widthFactor ;
217221 this . heightFactor = heightFactor ;
218222 this . source = source ;
@@ -224,19 +228,19 @@ public void Invoke(int y)
224228 {
225229 int sourceX = this . sourceBounds . X ;
226230 int sourceY = this . sourceBounds . Y ;
227- int destX = this . destinationBounds . X ;
228- int destY = this . destinationBounds . Y ;
229- int destLeft = this . destinationBounds . Left ;
230- int destRight = this . destinationBounds . Right ;
231+ int destOriginX = this . destinationBounds . X ;
232+ int destOriginY = this . destinationBounds . Y ;
233+ int destLeft = this . interest . Left ;
234+ int destRight = this . interest . Right ;
231235
232236 // Y coordinates of source points
233- Span < TPixel > sourceRow = this . source . GetPixelRowSpan ( ( int ) ( ( ( y - destY ) * this . heightFactor ) + sourceY ) ) ;
237+ Span < TPixel > sourceRow = this . source . GetPixelRowSpan ( ( int ) ( ( ( y - destOriginY ) * this . heightFactor ) + sourceY ) ) ;
234238 Span < TPixel > targetRow = this . destination . GetPixelRowSpan ( y ) ;
235239
236240 for ( int x = destLeft ; x < destRight ; x ++ )
237241 {
238242 // X coordinates of source points
239- targetRow [ x ] = sourceRow [ ( int ) ( ( ( x - destX ) * this . widthFactor ) + sourceX ) ] ;
243+ targetRow [ x ] = sourceRow [ ( int ) ( ( ( x - destOriginX ) * this . widthFactor ) + sourceX ) ] ;
240244 }
241245 }
242246 }
0 commit comments