Skip to content

Commit 7a64a51

Browse files
committed
coloring: Check for RGB565 before falling back to RGB24 if there is no colored-gray support.
1 parent 446c13b commit 7a64a51

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

LibDmd/RenderGraph.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,11 @@ public IDisposable StartRendering(Action onCompleted, Action<Exception> onError
353353
if (destColoredGray2 != null && !Converter.IsConnected(dest, FrameFormat.ColoredGray2, FrameFormat.ColoredGray2)) {
354354
Connect(sourceConverterColoredGray2, destColoredGray2, FrameFormat.ColoredGray2, FrameFormat.ColoredGray2);
355355

356-
// try to convert to rgb24
356+
// try to convert to rgb
357+
} else if (destRgb565 != null && !Converter.IsConnected(dest, FrameFormat.ColoredGray2, FrameFormat.Rgb565)) {
358+
Logger.Warn(" -- Destination doesn't support colored 2-bit frames from converter, converting to RGB565 source.");
359+
Connect(sourceConverterColoredGray2, destRgb565, FrameFormat.ColoredGray2, FrameFormat.Rgb565);
360+
357361
} else if (destRgb24 != null && !Converter.IsConnected(dest, FrameFormat.ColoredGray2, FrameFormat.Rgb24)) {
358362
Logger.Warn(" -- Destination doesn't support colored 2-bit frames from converter, converting to RGB source.");
359363
Connect(sourceConverterColoredGray2, destRgb24, FrameFormat.ColoredGray2, FrameFormat.Rgb24);
@@ -363,7 +367,7 @@ public IDisposable StartRendering(Action onCompleted, Action<Exception> onError
363367
Connect(sourceConverterColoredGray2, destBitmap, FrameFormat.ColoredGray2, FrameFormat.Bitmap);
364368

365369
} else {
366-
Logger.Warn(" -- Destination doesn't support colored 2-bit frames from converter, ignoring converter.");
370+
Logger.Warn(" -- Destination doesn't support colored 2-bit frames or RGB from converter, ignoring converter.");
367371
}
368372
}
369373

@@ -373,7 +377,11 @@ public IDisposable StartRendering(Action onCompleted, Action<Exception> onError
373377
if (destColoredGray4 != null && !Converter.IsConnected(dest, FrameFormat.ColoredGray4,FrameFormat.ColoredGray4)) {
374378
Connect(sourceConverterColoredGray4, destColoredGray4, FrameFormat.ColoredGray4, FrameFormat.ColoredGray4);
375379

376-
// otherwise, convert to rgb24
380+
// try to convert to rgb
381+
} else if (destRgb565 != null && !Converter.IsConnected(dest, FrameFormat.ColoredGray4, FrameFormat.Rgb565)) {
382+
Logger.Warn(" -- Destination doesn't support colored 4-bit frames from converter, converting to RGB565 source.");
383+
Connect(sourceConverterColoredGray4, destRgb565, FrameFormat.ColoredGray4, FrameFormat.Rgb565);
384+
377385
} else if (destRgb24 != null && !Converter.IsConnected(dest, FrameFormat.ColoredGray4,FrameFormat.Rgb24)) {
378386
Logger.Warn(" -- Destination doesn't support colored 4-bit frames from converter, converting to RGB source.");
379387
Connect(sourceConverterColoredGray4, destRgb24, FrameFormat.ColoredGray4, FrameFormat.Rgb24);

0 commit comments

Comments
 (0)