From f2c15f0e3136c2d4480c2865d0329bb553809621 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Sun, 2 Feb 2025 01:56:44 +0100 Subject: [PATCH] Remove janky faux-linear scaler --- pixmappaint.d | 24 +----------------------- pixmappresenter.d | 2 -- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/pixmappaint.d b/pixmappaint.d index bbe2698..b0a441a 100644 --- a/pixmappaint.d +++ b/pixmappaint.d @@ -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); diff --git a/pixmappresenter.d b/pixmappresenter.d index 9cbfecd..01fed24 100644 --- a/pixmappresenter.d +++ b/pixmappresenter.d @@ -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;