Introducing terminal scaling for performance reasons on old PCs.

This commit is contained in:
Filippo Scognamiglio 2014-04-02 22:07:37 +02:00
parent 3abdb9424c
commit 1b94fb6b22
7 changed files with 38 additions and 19 deletions

View File

@ -25,9 +25,16 @@ Item{
property real ambient_light: 0.2
property real contrast: 0.8
property real brightness: 0.5
//Scaling of the preprocessed terminal with respect to the window.
property real terminal_scaling: 1.0
//Scaling of the whole window
property real window_scaling: 1.0
property real total_scaling: terminal_scaling * window_scaling
function mix(c1, c2, alpha){
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
c1.g * alpha + c2.g * (1-alpha),

View File

@ -31,7 +31,6 @@ Item{
property real motionBlurCoefficient: (_minBlurCoefficient)*mBlur + (_maxBlurCoefficient)*(1.0-mBlur)
property real _minBlurCoefficient: 0.015
property real _maxBlurCoefficient: 0.10
anchors.fill: parent
//Force reload of the blursource when settings change
onScanlinesChanged: restartBlurredSource()
@ -74,7 +73,8 @@ Item{
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
Component.onCompleted: {
font.pointSize = shadersettings.font.pixelSize * shadersettings.font_scaling;
var scaling_factor = shadersettings.font_scaling * shadersettings.terminal_scaling * shadersettings.window_scaling;
font.pointSize = shadersettings.font.pixelSize * scaling_factor;
font.family = shadersettings.font.name;
setLineSpacing(shadersettings.font.lineSpacing);
forceActiveFocus();

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-04-02T19:08:53. -->
<!-- Written by QtCreator 3.0.1, 2014-04-02T21:14:48. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -14,7 +14,10 @@ TerminalFrame{
borderBottom: 232
imageSource: "../images/black-frame.png"
normalsSource: "../images/black-frame-normals.png"
sourceRect: Qt.rect(-80, -90, terminal.width + 160, terminal.height + 180)
sourceRect: Qt.rect(-80 * shadersettings.total_scaling,
-90 * shadersettings.total_scaling,
terminal.width + 160 * shadersettings.total_scaling,
terminal.height + 180 * shadersettings.total_scaling)
shaderString: "FrameShader.qml"
}

View File

@ -12,7 +12,10 @@ TerminalFrame{
borderTop: 116
borderBottom: 116
imageSource: "../images/screen-frame.png"
sourceRect: Qt.rect(-65, -75, terminal.width + 130, terminal.height + 150)
sourceRect: Qt.rect(-65 * shadersettings.total_scaling,
-75 * shadersettings.total_scaling,
terminal.width + 130 * shadersettings.total_scaling,
terminal.height + 150 * shadersettings.total_scaling)
shaderString: "NoFrameShader.qml"
}

View File

@ -13,7 +13,10 @@ TerminalFrame{
borderBottom: 116
imageSource: "../images/screen-frame.png"
normalsSource: "../images/screen-frame-normals.png"
sourceRect: Qt.rect(-65, -75, terminal.width + 130, terminal.height + 150)
sourceRect: Qt.rect(-65 * shadersettings.total_scaling,
-75 * shadersettings.total_scaling,
terminal.width + 130 * shadersettings.total_scaling,
terminal.height + 150 * shadersettings.total_scaling)
shaderString: "FrameShader.qml"
}

View File

@ -67,10 +67,21 @@ ApplicationWindow{
}
}
Loader{
id: frame
property rect sourceRect: item.sourceRect
anchors.fill: parent
z: 2.1
source: shadersettings.frame_source
}
Item{
id: maincontainer
anchors.fill: parent
clip: true
anchors.centerIn: parent
width: parent.width * shadersettings.window_scaling
height: parent.height * shadersettings.window_scaling
scale: 1.0 / shadersettings.window_scaling
clip: false
Image{
id: randtexture
source: "frames/images/randfunction.png"
@ -94,22 +105,14 @@ ApplicationWindow{
}
Terminal{
id: terminal
width: parent.width
height: parent.height
width: parent.width * shadersettings.terminal_scaling
height: parent.height * shadersettings.terminal_scaling
}
ShaderEffectSource{
id: theSource
sourceItem: terminal
sourceRect: frame.sourceRect
}
Loader{
id: frame
property rect sourceRect: item.sourceRect
anchors.fill: parent
z: 2.1
source: shadersettings.frame_source
}
ShaderManager{
id: shadercontainer
anchors.fill: parent