Browse Source

Fix Entropy Crop

Former-commit-id: d078a662595f78ac31b27df92fdae70cc5c38731
Former-commit-id: 882d751ab14072058b0e4cfe211c6b602c73b5ce
Former-commit-id: cec29371dc77a78d0b55cd52176cebfb896785dc
af/merge-core
James Jackson-South 10 years ago
parent
commit
798b159585
  1. 17
      src/ImageProcessorCore/Samplers/EntropyCrop.cs

17
src/ImageProcessorCore/Samplers/EntropyCrop.cs

@ -61,9 +61,9 @@ namespace ImageProcessorCore.Samplers
/// <inheritdoc/>
protected override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
// Jump out, we'll deal with that later.
if (source.Bounds == target.Bounds)
{
target.SetPixels(target.Width, target.Height, source.Pixels);
return;
}
@ -71,9 +71,9 @@ namespace ImageProcessorCore.Samplers
int startX = targetRectangle.X;
int targetX = this.cropRectangle.X;
int endX = this.cropRectangle.Width;
int maxX = endX - 1;
int maxX = this.cropRectangle.Right - 1;
int maxY = this.cropRectangle.Bottom - 1;
Parallel.For(
startY,
endY,
@ -89,8 +89,19 @@ namespace ImageProcessorCore.Samplers
target[x, y] = source[offsetX, offsetY];
}
this.OnRowProcessed();
});
}
/// <inheritdoc/>
protected override void AfterApply(ImageBase source, ImageBase target, Rectangle targetRectangle, Rectangle sourceRectangle)
{
// Copy the pixels over.
if (source.Bounds == target.Bounds)
{
target.ClonePixels(target.Width, target.Height, source.Pixels);
}
}
}
}

Loading…
Cancel
Save