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**_
This commit is contained in:
@@ -19,38 +19,25 @@ namespace {
|
|||||||
// The draw callback receives this via pDraw->pUser (set by setUserPointer()).
|
// The draw callback receives this via pDraw->pUser (set by setUserPointer()).
|
||||||
// The file I/O callbacks receive the FsFile* via pFile->fHandle (set by jpegOpen()).
|
// The file I/O callbacks receive the FsFile* via pFile->fHandle (set by jpegOpen()).
|
||||||
struct JpegContext {
|
struct JpegContext {
|
||||||
GfxRenderer* renderer;
|
GfxRenderer* renderer{nullptr};
|
||||||
const RenderConfig* config;
|
const RenderConfig* config{nullptr};
|
||||||
int screenWidth;
|
int screenWidth{0};
|
||||||
int screenHeight;
|
int screenHeight{0};
|
||||||
|
|
||||||
// Source dimensions after JPEGDEC's built-in scaling
|
// Source dimensions after JPEGDEC's built-in scaling
|
||||||
int scaledSrcWidth;
|
int scaledSrcWidth{0};
|
||||||
int scaledSrcHeight;
|
int scaledSrcHeight{0};
|
||||||
|
|
||||||
// Final output dimensions
|
// Final output dimensions
|
||||||
int dstWidth;
|
int dstWidth{0};
|
||||||
int dstHeight;
|
int dstHeight{0};
|
||||||
|
|
||||||
// Fine scale in 16.16 fixed-point (ESP32-C3 has no FPU)
|
// Fine scale in 16.16 fixed-point (ESP32-C3 has no FPU)
|
||||||
int32_t fineScaleFP; // src -> dst mapping
|
int32_t fineScaleFP{1 << 16}; // src -> dst mapping
|
||||||
int32_t invScaleFP; // dst -> src mapping
|
int32_t invScaleFP{1 << 16}; // dst -> src mapping
|
||||||
|
|
||||||
PixelCache cache;
|
PixelCache cache;
|
||||||
bool caching;
|
bool caching{false};
|
||||||
|
|
||||||
JpegContext()
|
|
||||||
: renderer(nullptr),
|
|
||||||
config(nullptr),
|
|
||||||
screenWidth(0),
|
|
||||||
screenHeight(0),
|
|
||||||
scaledSrcWidth(0),
|
|
||||||
scaledSrcHeight(0),
|
|
||||||
dstWidth(0),
|
|
||||||
dstHeight(0),
|
|
||||||
fineScaleFP(1 << 16),
|
|
||||||
invScaleFP(1 << 16),
|
|
||||||
caching(false) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// File I/O callbacks use pFile->fHandle to access the FsFile*,
|
// File I/O callbacks use pFile->fHandle to access the FsFile*,
|
||||||
|
|||||||
@@ -19,37 +19,23 @@ namespace {
|
|||||||
// The draw callback receives this via pDraw->pUser (set by png.decode()).
|
// The draw callback receives this via pDraw->pUser (set by png.decode()).
|
||||||
// The file I/O callbacks receive the FsFile* via pFile->fHandle (set by pngOpen()).
|
// The file I/O callbacks receive the FsFile* via pFile->fHandle (set by pngOpen()).
|
||||||
struct PngContext {
|
struct PngContext {
|
||||||
GfxRenderer* renderer;
|
GfxRenderer* renderer{nullptr};
|
||||||
const RenderConfig* config;
|
const RenderConfig* config{nullptr};
|
||||||
int screenWidth;
|
int screenWidth{0};
|
||||||
int screenHeight;
|
int screenHeight{0};
|
||||||
|
|
||||||
// Scaling state
|
// Scaling state
|
||||||
float scale;
|
float scale{1.f};
|
||||||
int srcWidth;
|
int srcWidth{0};
|
||||||
int srcHeight;
|
int srcHeight{0};
|
||||||
int dstWidth;
|
int dstWidth{0};
|
||||||
int dstHeight;
|
int dstHeight{0};
|
||||||
int lastDstY; // Track last rendered destination Y to avoid duplicates
|
int lastDstY{-1}; // Track last rendered destination Y to avoid duplicates
|
||||||
|
|
||||||
PixelCache cache;
|
PixelCache cache;
|
||||||
bool caching;
|
bool caching{false};
|
||||||
|
|
||||||
uint8_t* grayLineBuffer;
|
uint8_t* grayLineBuffer{nullptr};
|
||||||
|
|
||||||
PngContext()
|
|
||||||
: renderer(nullptr),
|
|
||||||
config(nullptr),
|
|
||||||
screenWidth(0),
|
|
||||||
screenHeight(0),
|
|
||||||
scale(1.0f),
|
|
||||||
srcWidth(0),
|
|
||||||
srcHeight(0),
|
|
||||||
dstWidth(0),
|
|
||||||
dstHeight(0),
|
|
||||||
lastDstY(-1),
|
|
||||||
caching(false),
|
|
||||||
grayLineBuffer(nullptr) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// File I/O callbacks use pFile->fHandle to access the FsFile*,
|
// File I/O callbacks use pFile->fHandle to access the FsFile*,
|
||||||
|
|||||||
Reference in New Issue
Block a user