From 82f2bd62319c59eadc163c8989b9254f34a21fb8 Mon Sep 17 00:00:00 2001
From: Filippo Scognamiglio <flscogna@gmail.com>
Date: Wed, 21 Nov 2018 18:18:18 +0100
Subject: [PATCH] Fix a couple of issues with burnIn.

---
 app/qml/BurnInEffect.qml   | 10 +++++++---
 app/qml/ShaderTerminal.qml |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml
index 3dfad30..7d1a9e8 100644
--- a/app/qml/BurnInEffect.qml
+++ b/app/qml/BurnInEffect.qml
@@ -25,9 +25,9 @@ Loader {
     }
 
     function restartBlurSource(){
-        prevLastUpdate = 0;
-        lastUpdate = 0;
-        completelyUpdate()
+        prevLastUpdate = timeManager.time;
+        lastUpdate = prevLastUpdate;
+        completelyUpdate();
     }
 
     sourceComponent: Item {
@@ -56,6 +56,10 @@ Loader {
 
             format: ShaderEffectSource.RGBA
 
+            // Enabling smooth with a low burnInQuality causes bad artifacts because the FBO
+            // has different values when it's read back. This lowers the quality, but makes it more consistent.
+            smooth: appSettings.burnInQuality === 1.0
+
             visible: false
 
             Connections {
diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml
index bdaa97d..e76ac2e 100644
--- a/app/qml/ShaderTerminal.qml
+++ b/app/qml/ShaderTerminal.qml
@@ -310,7 +310,7 @@ ShaderEffect {
             " : "") +
 
             (burnIn !== 0 ? "
-                vec4 txt_blur = texture2D(burnInSource, txt_coords);
+                vec4 txt_blur = texture2D(burnInSource, staticCoords);
                 float blurDecay = clamp((time - burnInLastUpdate) * burnInTime, 0.0, 1.0);
                 txt_color = max(txt_color, 0.5 * (txt_blur.rgb - vec3(blurDecay)));"
             : "") +