Merge branch 'x3-support'
# Conflicts: # lib/GfxRenderer/GfxRenderer.h # open-x4-sdk
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "JpegToBmpConverter.h"
|
||||
|
||||
#include <HalDisplay.h>
|
||||
#include <HalStorage.h>
|
||||
#include <JPEGDEC.h>
|
||||
#include <Logging.h>
|
||||
@@ -19,9 +20,7 @@ constexpr bool USE_ATKINSON = true; // Atkinson dithering (cleaner than
|
||||
constexpr bool USE_FLOYD_STEINBERG = false; // Floyd-Steinberg error diffusion (can cause "worm" artifacts)
|
||||
constexpr bool USE_NOISE_DITHERING = false; // Hash-based noise dithering (good for downsampling)
|
||||
// Pre-resize to target display size (CRITICAL: avoids dithering artifacts from post-downsampling)
|
||||
constexpr bool USE_PRESCALE = true; // true: scale image to target size before dithering
|
||||
constexpr int TARGET_MAX_WIDTH = 480; // Max width for cover images (portrait display width)
|
||||
constexpr int TARGET_MAX_HEIGHT = 800; // Max height for cover images (portrait display height)
|
||||
constexpr bool USE_PRESCALE = true; // true: scale image to target size before dithering
|
||||
// ============================================================================
|
||||
|
||||
inline void write16(Print& out, const uint16_t value) {
|
||||
@@ -540,7 +539,10 @@ bool JpegToBmpConverter::jpegFileToBmpStreamInternal(FsFile& jpegFile, Print& bm
|
||||
|
||||
// Core function: Convert JPEG file to 2-bit BMP (uses default target size)
|
||||
bool JpegToBmpConverter::jpegFileToBmpStream(FsFile& jpegFile, Print& bmpOut, bool crop) {
|
||||
return jpegFileToBmpStreamInternal(jpegFile, bmpOut, TARGET_MAX_WIDTH, TARGET_MAX_HEIGHT, false, crop);
|
||||
// Use runtime display dimensions (swapped for portrait cover sizing)
|
||||
const int targetWidth = display.getDisplayHeight();
|
||||
const int targetHeight = display.getDisplayWidth();
|
||||
return jpegFileToBmpStreamInternal(jpegFile, bmpOut, targetWidth, targetHeight, false, crop);
|
||||
}
|
||||
|
||||
// Convert with custom target size (for thumbnails, 2-bit)
|
||||
|
||||
Reference in New Issue
Block a user