mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 20:20:45 +00:00
Unload burnin effect when not in use.
This commit is contained in:
parent
92e82c203f
commit
2ec21f5eba
@ -2,10 +2,10 @@ import QtQuick 2.0
|
||||
|
||||
import "utils.js" as Utils
|
||||
|
||||
Item {
|
||||
Loader {
|
||||
id: burnInEffect
|
||||
|
||||
readonly property alias source: burnInEffectSource
|
||||
property ShaderEffectSource source: item ? item.source : null
|
||||
|
||||
property real lastUpdate: 0
|
||||
property real prevLastUpdate: 0
|
||||
@ -16,10 +16,12 @@ Item {
|
||||
property real _minBurnInFadeTime: 160
|
||||
property real _maxBurnInFadeTime: 1600
|
||||
|
||||
active: appSettings.burnIn !== 0
|
||||
|
||||
function completelyUpdate() {
|
||||
prevLastUpdate = lastUpdate;
|
||||
lastUpdate = timeManager.time;
|
||||
burnInEffectSource.scheduleUpdate();
|
||||
item.source.scheduleUpdate();
|
||||
}
|
||||
|
||||
function restartBlurSource(){
|
||||
@ -28,9 +30,24 @@ Item {
|
||||
completelyUpdate()
|
||||
}
|
||||
|
||||
sourceComponent: Item {
|
||||
property alias source: burnInEffectSource
|
||||
|
||||
property int burnInScaling: scaleTexture * appSettings.burnInQuality
|
||||
|
||||
width: appSettings.lowResolutionFont
|
||||
? kterminal.width * Math.max(1, burnInScaling)
|
||||
: kterminal.width * scaleTexture * appSettings.burnInQuality
|
||||
|
||||
height: appSettings.lowResolutionFont
|
||||
? kterminal.height * Math.max(1, burnInScaling)
|
||||
: kterminal.height * scaleTexture * appSettings.burnInQuality
|
||||
|
||||
ShaderEffectSource {
|
||||
id: burnInEffectSource
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
sourceItem: burnInShaderEffect
|
||||
live: false
|
||||
recursive: true
|
||||
@ -63,21 +80,13 @@ Item {
|
||||
ShaderEffect {
|
||||
id: burnInShaderEffect
|
||||
|
||||
property int burnInScaling: scaleTexture * appSettings.burnInQuality
|
||||
|
||||
width: appSettings.lowResolutionFont
|
||||
? kterminal.width * Math.max(1, burnInScaling)
|
||||
: kterminal.width * scaleTexture * appSettings.burnInQuality
|
||||
|
||||
height: appSettings.lowResolutionFont
|
||||
? kterminal.height * Math.max(1, burnInScaling)
|
||||
: kterminal.height * scaleTexture * appSettings.burnInQuality
|
||||
|
||||
property variant txt_source: kterminalSource
|
||||
property variant burnInSource: burnInEffectSource
|
||||
property real burnInTime: burnInFadeTime
|
||||
property alias lastUpdate: burnInEffect.lastUpdate
|
||||
property alias prevLastUpdate: burnInEffect.prevLastUpdate
|
||||
property real lastUpdate: burnInEffect.lastUpdate
|
||||
property real prevLastUpdate: burnInEffect.prevLastUpdate
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
blending: false
|
||||
|
||||
@ -105,7 +114,7 @@ Item {
|
||||
"void main() {
|
||||
vec2 coords = qt_TexCoord0;
|
||||
|
||||
vec3 txtColor = texture2D(txt_source, coords).rgb * 0.70;
|
||||
vec3 txtColor = texture2D(txt_source, coords).rgb * 0.5;
|
||||
vec4 accColor = texture2D(burnInSource, coords);
|
||||
|
||||
float prevMask = accColor.a;
|
||||
@ -123,4 +132,5 @@ Item {
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user