Minor fixes
This commit is contained in:
@@ -502,6 +502,8 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath
|
||||
// the 2-bit cache file format, but caching is disabled in this path
|
||||
// (BmpViewerActivity passes an empty cachePath).
|
||||
ctx.renderModeIsBW = (renderer.getRenderMode() == GfxRenderer::BW);
|
||||
LOG_DBG("PNG", "Render mode at decode: %d (BW=%d) -> 1bit dither=%d", (int)renderer.getRenderMode(),
|
||||
(int)GfxRenderer::BW, ctx.renderModeIsBW ? 1 : 0);
|
||||
if (ctx.renderModeIsBW) {
|
||||
ctx.atkinson1BitDitherer = new (std::nothrow) Atkinson1BitDitherer(ctx.dstWidth);
|
||||
if (!ctx.atkinson1BitDitherer) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <Serialization.h>
|
||||
#include <Txt.h>
|
||||
#include <Xtc.h>
|
||||
#include <esp_system.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <new>
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "fontIds.h"
|
||||
#include "images/Logo120.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// Context passed through PNGdec's decode() user-pointer to the per-scanline draw callback.
|
||||
@@ -216,9 +218,9 @@ size_t pickSleepImageIndex(size_t numFiles) {
|
||||
if (last == SIZE_MAX || last >= numFiles) return 0;
|
||||
return (last + 1) % numFiles;
|
||||
}
|
||||
size_t idx = random(numFiles);
|
||||
size_t idx = static_cast<size_t>(esp_random() % numFiles);
|
||||
while (numFiles > 1 && APP_STATE.lastSleepImage != SIZE_MAX && idx == APP_STATE.lastSleepImage) {
|
||||
idx = random(numFiles);
|
||||
idx = static_cast<size_t>(esp_random() % numFiles);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user