Remove janky faux-linear scaler

This commit is contained in:
Elias Batek 2025-02-02 01:56:44 +01:00
parent 122e60da83
commit f2c15f0e31
2 changed files with 1 additions and 25 deletions

View File

@ -2957,15 +2957,6 @@ enum ScalingFilter {
+/
bilinear,
/++
Unweighted linear interpolation
$(TIP
Visual impression: blocky, pixelated
)
+/
fauxLinear,
///
linear = bilinear,
}
@ -3038,7 +3029,7 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
}
// ==== Bilinear ====
static if ((filter == ScalingFilter.bilinear) || (filter == ScalingFilter.fauxLinear)) {
static if (filter == ScalingFilter.bilinear) {
void scaleToLinearImpl(ScalingDirection directionX, ScalingDirection directionY)() {
alias InterPixel = ulong[4];
@ -3171,19 +3162,6 @@ private void scaleToImpl(ScalingFilter filter)(const Pixmap source, Pixmap targe
enum idxTL = 0, idxTR = 1, idxBL = 2, idxBR = 3;
// ====== Faux bilinear ======
static if (filter == ScalingFilter.fauxLinear) {
auto pxInt = Pixel(0, 0, 0, 0);
foreach (immutable ib, ref c; pxInt.components) {
uint sum = 0;
foreach (const pxNeigh; pxNeighs) {
sum += (() @trusted => pxNeigh.components.ptr[ib])();
}
c = (sum >> 2).castTo!ubyte;
}
}
// ====== Proper bilinear (up) + Avg (down) ======
static if (filter == ScalingFilter.bilinear) {
auto pxInt = Pixel(0, 0, 0, 0);

View File

@ -630,7 +630,6 @@ final class OpenGl3PixmapRenderer : PixmapRenderer {
final switch (_poc.config.renderer.filter) with (ScalingFilter) {
case nearest:
case fauxLinear:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
break;
@ -740,7 +739,6 @@ final class OpenGl1PixmapRenderer : PixmapRenderer {
final switch (_poc.config.renderer.filter) with (ScalingFilter) {
case nearest:
case fauxLinear:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
break;