Fix oversight

This commit is contained in:
jpirnay
2026-04-11 20:29:57 +02:00
parent 8add255bc3
commit 155f0c77ac
3 changed files with 7 additions and 4 deletions
@@ -129,7 +129,8 @@ uint8_t ditherGray(JpegContext& ctx, uint8_t gray, int localX, int outX, int out
// File I/O callbacks use pFile->fHandle to access the FsFile*, // File I/O callbacks use pFile->fHandle to access the FsFile*,
// avoiding the need for global file state. // avoiding the need for global file state.
void* jpegOpen(const char* filename, int32_t* size) { void* jpegOpen(const char* filename, int32_t* size) {
FsFile* f = new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to JPEGDEC callbacks FsFile* f =
new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to JPEGDEC callbacks
if (!Storage.openFileForRead("JPG", std::string(filename), *f)) { if (!Storage.openFileForRead("JPG", std::string(filename), *f)) {
delete f; // NOLINT(cppcoreguidelines-owning-memory) delete f; // NOLINT(cppcoreguidelines-owning-memory)
return nullptr; return nullptr;
@@ -133,7 +133,8 @@ uint8_t ditherGray(PngContext& ctx, uint8_t gray, int localX, int outX, int outY
// File I/O callbacks use pFile->fHandle to access the FsFile*, // File I/O callbacks use pFile->fHandle to access the FsFile*,
// avoiding the need for global file state. // avoiding the need for global file state.
void* pngOpenWithHandle(const char* filename, int32_t* size) { void* pngOpenWithHandle(const char* filename, int32_t* size) {
FsFile* f = new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks FsFile* f =
new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks
if (!Storage.openFileForRead("PNG", std::string(filename), *f)) { if (!Storage.openFileForRead("PNG", std::string(filename), *f)) {
delete f; // NOLINT(cppcoreguidelines-owning-memory) delete f; // NOLINT(cppcoreguidelines-owning-memory)
return nullptr; return nullptr;
+3 -2
View File
@@ -48,7 +48,8 @@ struct PngOverlayCtx {
// PNGdec file I/O callbacks — mirror the pattern in PngToFramebufferConverter.cpp. // PNGdec file I/O callbacks — mirror the pattern in PngToFramebufferConverter.cpp.
void* pngSleepOpen(const char* filename, int32_t* size) { void* pngSleepOpen(const char* filename, int32_t* size) {
FsFile* f = new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks FsFile* f =
new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks
if (!Storage.openFileForRead("SLP", std::string(filename), *f)) { if (!Storage.openFileForRead("SLP", std::string(filename), *f)) {
delete f; // NOLINT(cppcoreguidelines-owning-memory) delete f; // NOLINT(cppcoreguidelines-owning-memory)
return nullptr; return nullptr;
@@ -901,7 +902,7 @@ void SleepActivity::renderOverlaySleepScreen() const {
ctx.yScale = yScale; ctx.yScale = yScale;
ctx.lastDstY = -1; ctx.lastDstY = -1;
ctx.transparentColor = -2; // will be resolved on first draw callback (after tRNS is parsed) ctx.transparentColor = -2; // will be resolved on first draw callback (after tRNS is parsed)
ctx.pngObj = png; ctx.pngObj = png.get();
rc = png->decode(&ctx, 0); rc = png->decode(&ctx, 0);
png->close(); png->close();