Adding adjustable scanline quality. Textures are now always smoothed. Terminal texture is now scaled (by integer factors) depending on the scaling level.

This commit is contained in:
Filippo Scognamiglio 2014-09-29 21:26:41 +02:00
parent 1dd633be0b
commit 2ff6c71c23
3 changed files with 63 additions and 8 deletions

View File

@ -85,6 +85,9 @@ Item{
property int rasterization: no_rasterization
property int scanline_quality: 3
onScanline_qualityChanged: handleFontChanged();
ListModel{
id: framelist
ListElement{text: "No frame"; source: "./frames/NoFrame.qml"; reflections: false}
@ -170,7 +173,8 @@ Item{
fontScalingIndex: fontScalingIndex,
fontIndexes: fontIndexes,
frameReflections: _frameReflections,
showMenubar: showMenubar
showMenubar: showMenubar,
scanline_quality: scanline_quality
}
return JSON.stringify(settings);
}
@ -240,6 +244,8 @@ Item{
_frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections;
showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar;
scanline_quality = settings.scanline_quality !== undefined ? settings.scanline_quality : scanline_quality;
}
function loadProfileString(profileString){

View File

@ -84,6 +84,8 @@ Item{
colorScheme: "cool-retro-term"
smooth: false
session: KSession {
id: ksession
kbScheme: "xterm"
@ -109,6 +111,12 @@ Item{
width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);});
height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);});
var scaleTexture = Math.max(Math.round(screenScaling / shadersettings.scanline_quality), 1.0);
kterminalSource.textureSize = Qt.binding(function () {
return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
});
setLineSpacing(lineSpacing);
update();
restartBlurredSource();
@ -176,7 +184,6 @@ Item{
id: kterminalSource
sourceItem: kterminal
hideSource: true
smooth: mScanlines == shadersettings.no_rasterization
wrapMode: ShaderEffectSource.ClampToEdge
live: false
@ -202,8 +209,6 @@ Item{
hideSource: true
wrapMode: kterminalSource.wrapMode
smooth: mScanlines == shadersettings.no_rasterization
function restartBlurSource(){
livetimer.restart();
}
@ -230,12 +235,17 @@ Item{
livetimer.restart();
}
}
Connections{
target: shadersettings
onScanline_qualityChanged: restartBlurredSource();
}
}
}
Loader{
id: blurredTerminalLoader
anchors.fill: kterminal
width: kterminalSource.textureSize.width
height: kterminalSource.textureSize.height
active: mBlur !== 0
sourceComponent: ShaderEffect {

View File

@ -28,7 +28,6 @@ Tab{
GroupBox{
title: qsTr("General")
Layout.fillWidth: true
Layout.columnSpan: 2
anchors.left: parent.left
anchors.right: parent.right
GridLayout{
@ -64,14 +63,54 @@ Tab{
Text{text: Math.round(txtslider.value * 100) + "%"}
}
}
GroupBox{
title: qsTr("Rasterization")
Layout.fillWidth: true
anchors.left: parent.left
anchors.right: parent.right
GridLayout{
id: scanlineQualityContainer
anchors.fill: parent
columns: 3
property alias valsIndex: scanlineQualitySlider.value
property var vals: [4,3,2]
property var valsStrings: [
qsTr("Low"),
qsTr("Medium"),
qsTr("High"),
qsTr("Very high")
]
onValsIndexChanged: shadersettings.scanline_quality = vals[valsIndex];
Text{text: qsTr("Scanline quality")}
Slider{
id: scanlineQualitySlider
Layout.fillWidth: true
onValueChanged: parent.valsIndex = value;
stepSize: 1
Component.onCompleted: {
minimumValue = 0;
maximumValue = 2;
value = parent.vals.indexOf(shadersettings.scanline_quality);
}
Connections{
target: shadersettings
onScanline_qualityChanged:
scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(shadersettings.scanline_quality);
}
}
Text{
text: parent.valsStrings[parent.valsIndex];
}
}
}
GroupBox{
title: qsTr("Frame")
Layout.fillWidth: true
Layout.columnSpan: 2
anchors.left: parent.left
anchors.right: parent.right
CheckBox{
Layout.columnSpan: 3
checked: !shadersettings._frameReflections
text: qsTr("Disable reflections")
onCheckedChanged: shadersettings._frameReflections = !checked