A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: Use default member initializers for JpegContext and PngContext (#1435)

## Summary

**What is the goal of this PR?**

Replace verbose constructor initializer lists with in-class default
member initializers in JpegContext and PngContext

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_

authored by

Zach Nelson and committed by
GitHub
f429f903 11984f8f

+23 -50
+11 -24
lib/Epub/Epub/converters/JpegToFramebufferConverter.cpp
··· 19 19 // The draw callback receives this via pDraw->pUser (set by setUserPointer()). 20 20 // The file I/O callbacks receive the FsFile* via pFile->fHandle (set by jpegOpen()). 21 21 struct JpegContext { 22 - GfxRenderer* renderer; 23 - const RenderConfig* config; 24 - int screenWidth; 25 - int screenHeight; 22 + GfxRenderer* renderer{nullptr}; 23 + const RenderConfig* config{nullptr}; 24 + int screenWidth{0}; 25 + int screenHeight{0}; 26 26 27 27 // Source dimensions after JPEGDEC's built-in scaling 28 - int scaledSrcWidth; 29 - int scaledSrcHeight; 28 + int scaledSrcWidth{0}; 29 + int scaledSrcHeight{0}; 30 30 31 31 // Final output dimensions 32 - int dstWidth; 33 - int dstHeight; 32 + int dstWidth{0}; 33 + int dstHeight{0}; 34 34 35 35 // Fine scale in 16.16 fixed-point (ESP32-C3 has no FPU) 36 - int32_t fineScaleFP; // src -> dst mapping 37 - int32_t invScaleFP; // dst -> src mapping 36 + int32_t fineScaleFP{1 << 16}; // src -> dst mapping 37 + int32_t invScaleFP{1 << 16}; // dst -> src mapping 38 38 39 39 PixelCache cache; 40 - bool caching; 41 - 42 - JpegContext() 43 - : renderer(nullptr), 44 - config(nullptr), 45 - screenWidth(0), 46 - screenHeight(0), 47 - scaledSrcWidth(0), 48 - scaledSrcHeight(0), 49 - dstWidth(0), 50 - dstHeight(0), 51 - fineScaleFP(1 << 16), 52 - invScaleFP(1 << 16), 53 - caching(false) {} 40 + bool caching{false}; 54 41 }; 55 42 56 43 // File I/O callbacks use pFile->fHandle to access the FsFile*,
+12 -26
lib/Epub/Epub/converters/PngToFramebufferConverter.cpp
··· 19 19 // The draw callback receives this via pDraw->pUser (set by png.decode()). 20 20 // The file I/O callbacks receive the FsFile* via pFile->fHandle (set by pngOpen()). 21 21 struct PngContext { 22 - GfxRenderer* renderer; 23 - const RenderConfig* config; 24 - int screenWidth; 25 - int screenHeight; 22 + GfxRenderer* renderer{nullptr}; 23 + const RenderConfig* config{nullptr}; 24 + int screenWidth{0}; 25 + int screenHeight{0}; 26 26 27 27 // Scaling state 28 - float scale; 29 - int srcWidth; 30 - int srcHeight; 31 - int dstWidth; 32 - int dstHeight; 33 - int lastDstY; // Track last rendered destination Y to avoid duplicates 28 + float scale{1.f}; 29 + int srcWidth{0}; 30 + int srcHeight{0}; 31 + int dstWidth{0}; 32 + int dstHeight{0}; 33 + int lastDstY{-1}; // Track last rendered destination Y to avoid duplicates 34 34 35 35 PixelCache cache; 36 - bool caching; 37 - 38 - uint8_t* grayLineBuffer; 36 + bool caching{false}; 39 37 40 - PngContext() 41 - : renderer(nullptr), 42 - config(nullptr), 43 - screenWidth(0), 44 - screenHeight(0), 45 - scale(1.0f), 46 - srcWidth(0), 47 - srcHeight(0), 48 - dstWidth(0), 49 - dstHeight(0), 50 - lastDstY(-1), 51 - caching(false), 52 - grayLineBuffer(nullptr) {} 38 + uint8_t* grayLineBuffer{nullptr}; 53 39 }; 54 40 55 41 // File I/O callbacks use pFile->fHandle to access the FsFile*,