mirror of https://github.com/adamdruppe/arsd.git
Fix downscaler
This commit is contained in:
parent
2005248514
commit
c65c8d462e
|
@ -3068,7 +3068,6 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
|
||||||
ScalingDirection direction,
|
ScalingDirection direction,
|
||||||
)(
|
)(
|
||||||
UDecimal posSrcCenter,
|
UDecimal posSrcCenter,
|
||||||
UDecimal ratioHalf,
|
|
||||||
int sourceMax,
|
int sourceMax,
|
||||||
) {
|
) {
|
||||||
pragma(inline, true);
|
pragma(inline, true);
|
||||||
|
@ -3082,7 +3081,7 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
static if (direction == up) {
|
static if (direction == up || direction == down) {
|
||||||
if (posSrcCenter < udecimalHalf) {
|
if (posSrcCenter < udecimalHalf) {
|
||||||
result = [
|
result = [
|
||||||
0,
|
0,
|
||||||
|
@ -3110,12 +3109,6 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static if (direction == down) {
|
|
||||||
result = [
|
|
||||||
max((posSrcCenter - ratioHalf).roundEven().castTo!uint, 0),
|
|
||||||
min((posSrcCenter + ratioHalf).roundEven().castTo!uint, sourceMax),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3128,7 +3121,6 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
|
||||||
|
|
||||||
const int[2] posSrcY = posSrcCenterToInterpolationTargets!(directionY)(
|
const int[2] posSrcY = posSrcCenterToInterpolationTargets!(directionY)(
|
||||||
posSrcCenterY,
|
posSrcCenterY,
|
||||||
ratiosHalf[idxY],
|
|
||||||
sourceMax[idxY],
|
sourceMax[idxY],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -3156,7 +3148,6 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
|
||||||
|
|
||||||
const int[2] posSrcX = posSrcCenterToInterpolationTargets!(directionX)(
|
const int[2] posSrcX = posSrcCenterToInterpolationTargets!(directionX)(
|
||||||
posSrcCenterX,
|
posSrcCenterX,
|
||||||
ratiosHalf[idxX],
|
|
||||||
sourceMax[idxX],
|
sourceMax[idxX],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -3252,7 +3243,7 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
|
||||||
// ========== Down ==========
|
// ========== Down ==========
|
||||||
static if (directionX == down) {
|
static if (directionX == down) {
|
||||||
static if (mode == SamplingMode.single) {
|
static if (mode == SamplingMode.single) {
|
||||||
const posSampling = Point(posSrcX[idxL], posSrcY[idxT]);
|
const posSampling = posNeighs[idxTL];
|
||||||
const samplingOffset = source.scanTo(posSampling);
|
const samplingOffset = source.scanTo(posSampling);
|
||||||
const srcSamples = () @trusted {
|
const srcSamples = () @trusted {
|
||||||
return source.data.ptr[samplingOffset .. (samplingOffset + nSamples)];
|
return source.data.ptr[samplingOffset .. (samplingOffset + nSamples)];
|
||||||
|
|
Loading…
Reference in New Issue