1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-11-01 15:42:12 +00:00

Reduce minimum scaling value and fix aliasing issues with small fonts and rasterization.

This commit is contained in:
Filippo Scognamiglio
2015-01-20 00:57:23 +01:00
parent 32f7923652
commit 2bc88768b6
4 changed files with 30 additions and 8 deletions

View File

@@ -21,6 +21,8 @@
import QtQuick 2.2
import QtGraphicalEffects 1.0
import "utils.js" as Utils
ShaderEffect {
property ShaderEffectSource source
property ShaderEffectSource blurredSource
@@ -56,6 +58,12 @@ ShaderEffect {
property real screen_brightness: appSettings.brightness * 1.5 + 0.5
// This is the average value of the abs(sin) function. Needed to avoid aliasing.
readonly property real absSinAvg: 0.63661828335466886
property size rasterizationSmooth: Qt.size(
Utils.clamp(2.0 * virtual_resolution.width / width, 0.0, 1.0),
Utils.clamp(2.0 * virtual_resolution.height / height, 0.0, 1.0))
property real dispX
property real dispY
property size virtual_resolution
@@ -153,6 +161,7 @@ ShaderEffect {
uniform lowp float screen_brightness;
uniform highp vec2 virtual_resolution;
uniform highp vec2 rasterizationSmooth;
uniform highp float dispX;
uniform highp float dispY;" +
@@ -198,9 +207,11 @@ ShaderEffect {
highp float result = 1.0;" +
(appSettings.rasterization != appSettings.no_rasterization ?
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
"float val = abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));
result *= mix(val, " + absSinAvg + ", rasterizationSmooth.y);" : "") +
(appSettings.rasterization == appSettings.pixel_rasterization ?
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
"val = abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));
result *= mix(val, " + absSinAvg + ", rasterizationSmooth.x);" : "") + "
return result;
}