From 9c7d56c760478cd20fbad2bb23d3e62b0665e814 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Tschumperl=C3=A9?= <david.tschumperle@gmail.com>
Date: Wed, 14 Nov 2018 15:32:28 +0100
Subject: [PATCH] .

---
 examples/CImg_demo.cpp | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/examples/CImg_demo.cpp b/examples/CImg_demo.cpp
index effe051..49f4882 100644
--- a/examples/CImg_demo.cpp
+++ b/examples/CImg_demo.cpp
@@ -653,14 +653,13 @@ void* item_plasma() {
     if ((pos+=2)>lwidth + 2) pos = 0;
     cimg_forX(visu,x) {
       const int y0 = (int)(visu.height()/2 + visu.height()/4*std::sin(ts + x/(70 + 30*std::cos(beta))));
-      cimg_forY(scroll,y) {
-        if (scroll(x,y)) {
-          const unsigned int y1 = y0 + y + 2; visu(x,y1,0)*=0.7; visu(x,y1,1)*=0.7; visu(x,y1,2)*=0.7;
-          const unsigned int y2 = y1 - 6;
-          const float c = scroll(x,y)/255.0f;
-          (visu(x,y2,0)*= 1 - c)+=254*c;
-          (visu(x,y2,1)*= 1 - c)+=254*c;
-          (visu(x,y2,2)*= 1 - c)+=254*c;
+      cimg_forY(scroll,y) if (scroll(x,y)) {
+        const unsigned int y1 = y0 + y + 2;
+        const unsigned int y2 = y1 - 6;
+        const float c = scroll(x,y)/255.0f;
+        cimg_forC(visu,k) {
+          visu(x,y1,k) = (unsigned char)(visu(x,y1,k)*0.7f);
+          visu(x,y2,k) = (unsigned char)(visu(x,y2,k)*(1 - c) + 254*c);
         }
       }
     }
-- 
GitLab