From: Tomas Wenström Date: Tue, 9 Apr 2019 18:05:43 +0000 (+0200) Subject: Bugfix - draw leds black when list is off instead of skipping X-Git-Url: http://dolda2000.com/gitweb/?p=kaka%2Fcakelight.git;a=commitdiff_plain;h=a4fb845a65eb734bc9ee681e4756cf1a405c4ac8 Bugfix - draw leds black when list is off instead of skipping --- diff --git a/src/kaka/cakelight/Color.java b/src/kaka/cakelight/Color.java index fe010c7..c3f782f 100644 --- a/src/kaka/cakelight/Color.java +++ b/src/kaka/cakelight/Color.java @@ -1,6 +1,8 @@ package kaka.cakelight; public class Color { + public static final Color BLACK = Color.rgb(0, 0, 0); + private static int[] gammaCorrection = new int[256]; public static void calculateGammaCorrection(double gamma) { diff --git a/src/kaka/cakelight/VideoFrame.java b/src/kaka/cakelight/VideoFrame.java index e77dcd9..6435242 100644 --- a/src/kaka/cakelight/VideoFrame.java +++ b/src/kaka/cakelight/VideoFrame.java @@ -172,10 +172,27 @@ public class VideoFrame { public LedFrame getLedFrame() { LedFrame frame = LedFrame.from(config); int led = 0; - if (config.video.list.bottom) for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.BOTTOM, i)); - if (config.video.list.right) for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.RIGHT, i)); - if (config.video.list.top) for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.TOP, i)); - if (config.video.list.left) for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.LEFT, i)); + + if (config.video.list.bottom) + for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.BOTTOM, i)); + else + for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, Color.BLACK); + + if (config.video.list.right) + for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.RIGHT, i)); + else + for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, Color.BLACK); + + if (config.video.list.top) + for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.TOP, i)); + else + for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, Color.BLACK); + + if (config.video.list.left) + for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.LEFT, i)); + else + for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, Color.BLACK); + return frame; } }