mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-31 02:01:19 +00:00
Reduce minimum scaling value and fix aliasing issues with small fonts and rasterization.
This commit is contained in:
parent
32f7923652
commit
2bc88768b6
@ -26,7 +26,12 @@ import "utils.js" as Utils
|
||||
QtObject{
|
||||
property string version: "1.0.0 RC1"
|
||||
|
||||
// GENERAL SETTINGS ///////////////////////////////////////////////////
|
||||
// STATIC CONSTANTS ////////////////////////////////////////////////////////
|
||||
|
||||
readonly property real minimumFontScaling: 0.25
|
||||
readonly property real maximumFontScaling: 2.50
|
||||
|
||||
// GENERAL SETTINGS ///////////////////////////////////////////////////////
|
||||
|
||||
property bool fullscreen: false
|
||||
property bool showMenubar: true
|
||||
@ -114,12 +119,12 @@ QtObject{
|
||||
}
|
||||
|
||||
function incrementScaling(){
|
||||
fontScaling = Math.min(fontScaling + 0.05, 2.50);
|
||||
fontScaling = Math.min(fontScaling + 0.05, maximumFontScaling);
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
function decrementScaling(){
|
||||
fontScaling = Math.max(fontScaling - 0.05, 0.50);
|
||||
fontScaling = Math.max(fontScaling - 0.05, minimumFontScaling);
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
|
@ -66,8 +66,8 @@ Tab{
|
||||
stepSize: 0.05
|
||||
enabled: false // Another trick to fix initial bad behavior.
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0.5;
|
||||
maximumValue = 2.5;
|
||||
minimumValue = appSettings.minimumFontScaling;
|
||||
maximumValue = appSettings.maximumFontScaling;
|
||||
value = appSettings.fontScaling;
|
||||
enabled = true;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
.pragma library
|
||||
|
||||
function clamp(x, min, max) {
|
||||
if (x <= min)
|
||||
return min;
|
||||
if (x >= max)
|
||||
return max;
|
||||
return x;
|
||||
}
|
||||
function lint(a, b, t) {
|
||||
return (1 - t) * a + (t) * b;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user