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

View File

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

View File

@ -28,7 +28,6 @@ Tab{
GroupBox{ GroupBox{
title: qsTr("General") title: qsTr("General")
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 2
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
GridLayout{ GridLayout{
@ -64,14 +63,54 @@ Tab{
Text{text: Math.round(txtslider.value * 100) + "%"} 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{ GroupBox{
title: qsTr("Frame") title: qsTr("Frame")
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 2
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
CheckBox{ CheckBox{
Layout.columnSpan: 3
checked: !shadersettings._frameReflections checked: !shadersettings._frameReflections
text: qsTr("Disable reflections") text: qsTr("Disable reflections")
onCheckedChanged: shadersettings._frameReflections = !checked onCheckedChanged: shadersettings._frameReflections = !checked