@@ -147,6 +147,7 @@ private static void ApplyNNResizeFrameTransform(
147
147
var operation = new NNRowOperation (
148
148
sourceRectangle ,
149
149
destinationRectangle ,
150
+ interest ,
150
151
widthFactor ,
151
152
heightFactor ,
152
153
source ,
@@ -197,6 +198,7 @@ private static void ApplyResizeFrameTransform(
197
198
{
198
199
private readonly Rectangle sourceBounds ;
199
200
private readonly Rectangle destinationBounds ;
201
+ private readonly Rectangle interest ;
200
202
private readonly float widthFactor ;
201
203
private readonly float heightFactor ;
202
204
private readonly ImageFrame < TPixel > source ;
@@ -206,13 +208,15 @@ private static void ApplyResizeFrameTransform(
206
208
public NNRowOperation (
207
209
Rectangle sourceBounds ,
208
210
Rectangle destinationBounds ,
211
+ Rectangle interest ,
209
212
float widthFactor ,
210
213
float heightFactor ,
211
214
ImageFrame < TPixel > source ,
212
215
ImageFrame < TPixel > destination )
213
216
{
214
217
this . sourceBounds = sourceBounds ;
215
218
this . destinationBounds = destinationBounds ;
219
+ this . interest = interest ;
216
220
this . widthFactor = widthFactor ;
217
221
this . heightFactor = heightFactor ;
218
222
this . source = source ;
@@ -224,19 +228,19 @@ public void Invoke(int y)
224
228
{
225
229
int sourceX = this . sourceBounds . X ;
226
230
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 ;
231
235
232
236
// 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 ) ) ;
234
238
Span < TPixel > targetRow = this . destination . GetPixelRowSpan ( y ) ;
235
239
236
240
for ( int x = destLeft ; x < destRight ; x ++ )
237
241
{
238
242
// 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 ) ] ;
240
244
}
241
245
}
242
246
}
0 commit comments