mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-07 13:41:27 +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{
|
QtObject{
|
||||||
property string version: "1.0.0 RC1"
|
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 fullscreen: false
|
||||||
property bool showMenubar: true
|
property bool showMenubar: true
|
||||||
@ -114,12 +119,12 @@ QtObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function incrementScaling(){
|
function incrementScaling(){
|
||||||
fontScaling = Math.min(fontScaling + 0.05, 2.50);
|
fontScaling = Math.min(fontScaling + 0.05, maximumFontScaling);
|
||||||
handleFontChanged();
|
handleFontChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
function decrementScaling(){
|
function decrementScaling(){
|
||||||
fontScaling = Math.max(fontScaling - 0.05, 0.50);
|
fontScaling = Math.max(fontScaling - 0.05, minimumFontScaling);
|
||||||
handleFontChanged();
|
handleFontChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ Tab{
|
|||||||
stepSize: 0.05
|
stepSize: 0.05
|
||||||
enabled: false // Another trick to fix initial bad behavior.
|
enabled: false // Another trick to fix initial bad behavior.
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
minimumValue = 0.5;
|
minimumValue = appSettings.minimumFontScaling;
|
||||||
maximumValue = 2.5;
|
maximumValue = appSettings.maximumFontScaling;
|
||||||
value = appSettings.fontScaling;
|
value = appSettings.fontScaling;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
import "utils.js" as Utils
|
||||||
|
|
||||||
ShaderEffect {
|
ShaderEffect {
|
||||||
property ShaderEffectSource source
|
property ShaderEffectSource source
|
||||||
property ShaderEffectSource blurredSource
|
property ShaderEffectSource blurredSource
|
||||||
@ -56,6 +58,12 @@ ShaderEffect {
|
|||||||
|
|
||||||
property real screen_brightness: appSettings.brightness * 1.5 + 0.5
|
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 dispX
|
||||||
property real dispY
|
property real dispY
|
||||||
property size virtual_resolution
|
property size virtual_resolution
|
||||||
@ -153,6 +161,7 @@ ShaderEffect {
|
|||||||
uniform lowp float screen_brightness;
|
uniform lowp float screen_brightness;
|
||||||
|
|
||||||
uniform highp vec2 virtual_resolution;
|
uniform highp vec2 virtual_resolution;
|
||||||
|
uniform highp vec2 rasterizationSmooth;
|
||||||
uniform highp float dispX;
|
uniform highp float dispX;
|
||||||
uniform highp float dispY;" +
|
uniform highp float dispY;" +
|
||||||
|
|
||||||
@ -198,9 +207,11 @@ ShaderEffect {
|
|||||||
highp float result = 1.0;" +
|
highp float result = 1.0;" +
|
||||||
|
|
||||||
(appSettings.rasterization != appSettings.no_rasterization ?
|
(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 ?
|
(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;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
.pragma library
|
.pragma library
|
||||||
|
function clamp(x, min, max) {
|
||||||
|
if (x <= min)
|
||||||
|
return min;
|
||||||
|
if (x >= max)
|
||||||
|
return max;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
function lint(a, b, t) {
|
function lint(a, b, t) {
|
||||||
return (1 - t) * a + (t) * b;
|
return (1 - t) * a + (t) * b;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user