fix cover art sizing options
This commit is contained in:
parent
9493fb1f18
commit
6b533207e1
@ -161,21 +161,30 @@ void GfxRenderer::drawBitmap(const Bitmap& bitmap, const int x, const int y, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
bool isScaled = false;
|
|
||||||
int cropPixX = std::floor(bitmap.getWidth() * cropX / 2.0f);
|
int cropPixX = std::floor(bitmap.getWidth() * cropX / 2.0f);
|
||||||
int cropPixY = std::floor(bitmap.getHeight() * cropY / 2.0f);
|
int cropPixY = std::floor(bitmap.getHeight() * cropY / 2.0f);
|
||||||
Serial.printf("[%lu] [GFX] Cropping %dx%d by %dx%d pix, is %s\n", millis(), bitmap.getWidth(), bitmap.getHeight(),
|
Serial.printf("[%lu] [GFX] Cropping %dx%d by %dx%d pix, is %s\n", millis(), bitmap.getWidth(), bitmap.getHeight(),
|
||||||
cropPixX, cropPixY, bitmap.isTopDown() ? "top-down" : "bottom-up");
|
cropPixX, cropPixY, bitmap.isTopDown() ? "top-down" : "bottom-up");
|
||||||
|
|
||||||
if (maxWidth > 0 && (1.0f - cropX) * bitmap.getWidth() > maxWidth) {
|
// Calculate effective image dimensions after cropping
|
||||||
scale = static_cast<float>(maxWidth) / static_cast<float>((1.0f - cropX) * bitmap.getWidth());
|
const int effectiveWidth = static_cast<int>((1.0f - cropX) * bitmap.getWidth());
|
||||||
isScaled = true;
|
const int effectiveHeight = static_cast<int>((1.0f - cropY) * bitmap.getHeight());
|
||||||
|
|
||||||
|
// Calculate scale to fit within maxWidth/maxHeight (supports both up and down scaling)
|
||||||
|
if (maxWidth > 0 && maxHeight > 0) {
|
||||||
|
const float scaleX = static_cast<float>(maxWidth) / static_cast<float>(effectiveWidth);
|
||||||
|
const float scaleY = static_cast<float>(maxHeight) / static_cast<float>(effectiveHeight);
|
||||||
|
scale = std::min(scaleX, scaleY);
|
||||||
|
} else if (maxWidth > 0) {
|
||||||
|
scale = static_cast<float>(maxWidth) / static_cast<float>(effectiveWidth);
|
||||||
|
} else if (maxHeight > 0) {
|
||||||
|
scale = static_cast<float>(maxHeight) / static_cast<float>(effectiveHeight);
|
||||||
}
|
}
|
||||||
if (maxHeight > 0 && (1.0f - cropY) * bitmap.getHeight() > maxHeight) {
|
|
||||||
scale = std::min(scale, static_cast<float>(maxHeight) / static_cast<float>((1.0f - cropY) * bitmap.getHeight()));
|
const bool isUpscaling = scale > 1.0f;
|
||||||
isScaled = true;
|
const bool isDownscaling = scale < 1.0f;
|
||||||
}
|
Serial.printf("[%lu] [GFX] Scaling by %f - %s\n", millis(), scale,
|
||||||
Serial.printf("[%lu] [GFX] Scaling by %f - %s\n", millis(), scale, isScaled ? "scaled" : "not scaled");
|
isUpscaling ? "upscaling" : (isDownscaling ? "downscaling" : "no scaling"));
|
||||||
|
|
||||||
// Calculate output row size (2 bits per pixel, packed into bytes)
|
// Calculate output row size (2 bits per pixel, packed into bytes)
|
||||||
// IMPORTANT: Use int, not uint8_t, to avoid overflow for images > 1020 pixels wide
|
// IMPORTANT: Use int, not uint8_t, to avoid overflow for images > 1020 pixels wide
|
||||||
@ -190,18 +199,10 @@ void GfxRenderer::drawBitmap(const Bitmap& bitmap, const int x, const int y, con
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int bmpY = 0; bmpY < (bitmap.getHeight() - cropPixY); bmpY++) {
|
// Track the last drawn Y position for upscaling (to fill gaps)
|
||||||
// The BMP's (0, 0) is the bottom-left corner (if the height is positive, top-left if negative).
|
int lastDrawnY = -1;
|
||||||
// Screen's (0, 0) is the top-left corner.
|
|
||||||
int screenY = -cropPixY + (bitmap.isTopDown() ? bmpY : bitmap.getHeight() - 1 - bmpY);
|
|
||||||
if (isScaled) {
|
|
||||||
screenY = std::floor(screenY * scale);
|
|
||||||
}
|
|
||||||
screenY += y; // the offset should not be scaled
|
|
||||||
if (screenY >= getScreenHeight()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (int bmpY = 0; bmpY < bitmap.getHeight(); bmpY++) {
|
||||||
if (bitmap.readNextRow(outputRow, rowBytes) != BmpReaderError::Ok) {
|
if (bitmap.readNextRow(outputRow, rowBytes) != BmpReaderError::Ok) {
|
||||||
Serial.printf("[%lu] [GFX] Failed to read row %d from bitmap\n", millis(), bmpY);
|
Serial.printf("[%lu] [GFX] Failed to read row %d from bitmap\n", millis(), bmpY);
|
||||||
free(outputRow);
|
free(outputRow);
|
||||||
@ -209,36 +210,51 @@ void GfxRenderer::drawBitmap(const Bitmap& bitmap, const int x, const int y, con
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screenY < 0) {
|
// Skip rows in the crop area
|
||||||
|
if (bmpY < cropPixY || bmpY >= bitmap.getHeight() - cropPixY) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmpY < cropPixY) {
|
// Calculate the source Y coordinate (relative to cropped area)
|
||||||
// Skip the row if it's outside the crop area
|
const int srcY = bmpY - cropPixY;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int bmpX = cropPixX; bmpX < bitmap.getWidth() - cropPixX; bmpX++) {
|
// The BMP's (0, 0) is the bottom-left corner (if the height is positive, top-left if negative).
|
||||||
int screenX = bmpX - cropPixX;
|
// Screen's (0, 0) is the top-left corner.
|
||||||
if (isScaled) {
|
const int logicalY = bitmap.isTopDown() ? srcY : (effectiveHeight - 1 - srcY);
|
||||||
screenX = std::floor(screenX * scale);
|
|
||||||
}
|
|
||||||
screenX += x; // the offset should not be scaled
|
|
||||||
if (screenX >= getScreenWidth()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (screenX < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t val = outputRow[bmpX / 4] >> (6 - ((bmpX * 2) % 8)) & 0x3;
|
// Calculate screen Y position
|
||||||
|
const int screenYStart = y + static_cast<int>(std::floor(logicalY * scale));
|
||||||
|
// For upscaling, calculate the end position for this source row
|
||||||
|
const int screenYEnd = isUpscaling ? (y + static_cast<int>(std::floor((logicalY + 1) * scale))) : (screenYStart + 1);
|
||||||
|
|
||||||
if (renderMode == BW && val < 3) {
|
// Draw to all Y positions this source row maps to (for upscaling, this fills gaps)
|
||||||
drawPixel(screenX, screenY);
|
for (int screenY = screenYStart; screenY < screenYEnd; screenY++) {
|
||||||
} else if (renderMode == GRAYSCALE_MSB && (val == 1 || val == 2)) {
|
if (screenY < 0) continue;
|
||||||
drawPixel(screenX, screenY, false);
|
if (screenY >= getScreenHeight()) break;
|
||||||
} else if (renderMode == GRAYSCALE_LSB && val == 1) {
|
|
||||||
drawPixel(screenX, screenY, false);
|
for (int bmpX = cropPixX; bmpX < bitmap.getWidth() - cropPixX; bmpX++) {
|
||||||
|
const int srcX = bmpX - cropPixX;
|
||||||
|
|
||||||
|
// Calculate screen X position
|
||||||
|
const int screenXStart = x + static_cast<int>(std::floor(srcX * scale));
|
||||||
|
// For upscaling, calculate the end position for this source pixel
|
||||||
|
const int screenXEnd = isUpscaling ? (x + static_cast<int>(std::floor((srcX + 1) * scale))) : (screenXStart + 1);
|
||||||
|
|
||||||
|
const uint8_t val = outputRow[bmpX / 4] >> (6 - ((bmpX * 2) % 8)) & 0x3;
|
||||||
|
|
||||||
|
// Draw to all X positions this source pixel maps to (for upscaling, this fills gaps)
|
||||||
|
for (int screenX = screenXStart; screenX < screenXEnd; screenX++) {
|
||||||
|
if (screenX < 0) continue;
|
||||||
|
if (screenX >= getScreenWidth()) break;
|
||||||
|
|
||||||
|
if (renderMode == BW && val < 3) {
|
||||||
|
drawPixel(screenX, screenY);
|
||||||
|
} else if (renderMode == GRAYSCALE_MSB && (val == 1 || val == 2)) {
|
||||||
|
drawPixel(screenX, screenY, false);
|
||||||
|
} else if (renderMode == GRAYSCALE_LSB && val == 1) {
|
||||||
|
drawPixel(screenX, screenY, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,16 +266,20 @@ void GfxRenderer::drawBitmap(const Bitmap& bitmap, const int x, const int y, con
|
|||||||
void GfxRenderer::drawBitmap1Bit(const Bitmap& bitmap, const int x, const int y, const int maxWidth,
|
void GfxRenderer::drawBitmap1Bit(const Bitmap& bitmap, const int x, const int y, const int maxWidth,
|
||||||
const int maxHeight) const {
|
const int maxHeight) const {
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
bool isScaled = false;
|
|
||||||
if (maxWidth > 0 && bitmap.getWidth() > maxWidth) {
|
// Calculate scale to fit within maxWidth/maxHeight (supports both up and down scaling)
|
||||||
|
if (maxWidth > 0 && maxHeight > 0) {
|
||||||
|
const float scaleX = static_cast<float>(maxWidth) / static_cast<float>(bitmap.getWidth());
|
||||||
|
const float scaleY = static_cast<float>(maxHeight) / static_cast<float>(bitmap.getHeight());
|
||||||
|
scale = std::min(scaleX, scaleY);
|
||||||
|
} else if (maxWidth > 0) {
|
||||||
scale = static_cast<float>(maxWidth) / static_cast<float>(bitmap.getWidth());
|
scale = static_cast<float>(maxWidth) / static_cast<float>(bitmap.getWidth());
|
||||||
isScaled = true;
|
} else if (maxHeight > 0) {
|
||||||
}
|
scale = static_cast<float>(maxHeight) / static_cast<float>(bitmap.getHeight());
|
||||||
if (maxHeight > 0 && bitmap.getHeight() > maxHeight) {
|
|
||||||
scale = std::min(scale, static_cast<float>(maxHeight) / static_cast<float>(bitmap.getHeight()));
|
|
||||||
isScaled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool isUpscaling = scale > 1.0f;
|
||||||
|
|
||||||
// For 1-bit BMP, output is still 2-bit packed (for consistency with readNextRow)
|
// For 1-bit BMP, output is still 2-bit packed (for consistency with readNextRow)
|
||||||
const int outputRowSize = (bitmap.getWidth() + 3) / 4;
|
const int outputRowSize = (bitmap.getWidth() + 3) / 4;
|
||||||
auto* outputRow = static_cast<uint8_t*>(malloc(outputRowSize));
|
auto* outputRow = static_cast<uint8_t*>(malloc(outputRowSize));
|
||||||
@ -282,33 +302,39 @@ void GfxRenderer::drawBitmap1Bit(const Bitmap& bitmap, const int x, const int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate screen Y based on whether BMP is top-down or bottom-up
|
// Calculate screen Y based on whether BMP is top-down or bottom-up
|
||||||
const int bmpYOffset = bitmap.isTopDown() ? bmpY : bitmap.getHeight() - 1 - bmpY;
|
const int logicalY = bitmap.isTopDown() ? bmpY : bitmap.getHeight() - 1 - bmpY;
|
||||||
int screenY = y + (isScaled ? static_cast<int>(std::floor(bmpYOffset * scale)) : bmpYOffset);
|
|
||||||
if (screenY >= getScreenHeight()) {
|
|
||||||
continue; // Continue reading to keep row counter in sync
|
|
||||||
}
|
|
||||||
if (screenY < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int bmpX = 0; bmpX < bitmap.getWidth(); bmpX++) {
|
// Calculate screen Y position
|
||||||
int screenX = x + (isScaled ? static_cast<int>(std::floor(bmpX * scale)) : bmpX);
|
const int screenYStart = y + static_cast<int>(std::floor(logicalY * scale));
|
||||||
if (screenX >= getScreenWidth()) {
|
// For upscaling, calculate the end position for this source row
|
||||||
break;
|
const int screenYEnd = isUpscaling ? (y + static_cast<int>(std::floor((logicalY + 1) * scale))) : (screenYStart + 1);
|
||||||
}
|
|
||||||
if (screenX < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get 2-bit value (result of readNextRow quantization)
|
// Draw to all Y positions this source row maps to (for upscaling, this fills gaps)
|
||||||
const uint8_t val = outputRow[bmpX / 4] >> (6 - ((bmpX * 2) % 8)) & 0x3;
|
for (int screenY = screenYStart; screenY < screenYEnd; screenY++) {
|
||||||
|
if (screenY < 0) continue;
|
||||||
|
if (screenY >= getScreenHeight()) continue;
|
||||||
|
|
||||||
// For 1-bit source: 0 or 1 -> map to black (0,1,2) or white (3)
|
for (int bmpX = 0; bmpX < bitmap.getWidth(); bmpX++) {
|
||||||
// val < 3 means black pixel (draw it)
|
// Calculate screen X position
|
||||||
if (val < 3) {
|
const int screenXStart = x + static_cast<int>(std::floor(bmpX * scale));
|
||||||
drawPixel(screenX, screenY, true);
|
// For upscaling, calculate the end position for this source pixel
|
||||||
|
const int screenXEnd = isUpscaling ? (x + static_cast<int>(std::floor((bmpX + 1) * scale))) : (screenXStart + 1);
|
||||||
|
|
||||||
|
// Get 2-bit value (result of readNextRow quantization)
|
||||||
|
const uint8_t val = outputRow[bmpX / 4] >> (6 - ((bmpX * 2) % 8)) & 0x3;
|
||||||
|
|
||||||
|
// For 1-bit source: 0 or 1 -> map to black (0,1,2) or white (3)
|
||||||
|
// val < 3 means black pixel (draw it)
|
||||||
|
if (val < 3) {
|
||||||
|
// Draw to all X positions this source pixel maps to (for upscaling, this fills gaps)
|
||||||
|
for (int screenX = screenXStart; screenX < screenXEnd; screenX++) {
|
||||||
|
if (screenX < 0) continue;
|
||||||
|
if (screenX >= getScreenWidth()) break;
|
||||||
|
drawPixel(screenX, screenY, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// White pixels (val == 3) are not drawn (leave background)
|
||||||
}
|
}
|
||||||
// White pixels (val == 3) are not drawn (leave background)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class CrossPointSettings {
|
|||||||
|
|
||||||
// Should match with SettingsActivity text
|
// Should match with SettingsActivity text
|
||||||
enum SLEEP_SCREEN_MODE { DARK = 0, LIGHT = 1, CUSTOM = 2, COVER = 3, BLANK = 4 };
|
enum SLEEP_SCREEN_MODE { DARK = 0, LIGHT = 1, CUSTOM = 2, COVER = 3, BLANK = 4 };
|
||||||
enum SLEEP_SCREEN_COVER_MODE { FIT = 0, CROP = 1 };
|
enum SLEEP_SCREEN_COVER_MODE { FIT = 0, CROP = 1, ACTUAL = 2 };
|
||||||
|
|
||||||
// Status bar display type enum
|
// Status bar display type enum
|
||||||
enum STATUS_BAR_MODE { NONE = 0, NO_PROGRESS = 1, FULL = 2 };
|
enum STATUS_BAR_MODE { NONE = 0, NO_PROGRESS = 1, FULL = 2 };
|
||||||
|
|||||||
@ -141,58 +141,79 @@ void SleepActivity::renderBitmapSleepScreen(const Bitmap& bitmap) const {
|
|||||||
const auto pageWidth = renderer.getScreenWidth();
|
const auto pageWidth = renderer.getScreenWidth();
|
||||||
const auto pageHeight = renderer.getScreenHeight();
|
const auto pageHeight = renderer.getScreenHeight();
|
||||||
float cropX = 0, cropY = 0;
|
float cropX = 0, cropY = 0;
|
||||||
|
int drawWidth = pageWidth;
|
||||||
|
int drawHeight = pageHeight;
|
||||||
|
|
||||||
Serial.printf("[%lu] [SLP] bitmap %d x %d, screen %d x %d\n", millis(), bitmap.getWidth(), bitmap.getHeight(),
|
Serial.printf("[%lu] [SLP] bitmap %d x %d, screen %d x %d\n", millis(), bitmap.getWidth(), bitmap.getHeight(),
|
||||||
pageWidth, pageHeight);
|
pageWidth, pageHeight);
|
||||||
if (bitmap.getWidth() > pageWidth || bitmap.getHeight() > pageHeight) {
|
|
||||||
// image will scale, make sure placement is right
|
|
||||||
float ratio = static_cast<float>(bitmap.getWidth()) / static_cast<float>(bitmap.getHeight());
|
|
||||||
const float screenRatio = static_cast<float>(pageWidth) / static_cast<float>(pageHeight);
|
|
||||||
|
|
||||||
Serial.printf("[%lu] [SLP] bitmap ratio: %f, screen ratio: %f\n", millis(), ratio, screenRatio);
|
const float bitmapRatio = static_cast<float>(bitmap.getWidth()) / static_cast<float>(bitmap.getHeight());
|
||||||
if (ratio > screenRatio) {
|
const float screenRatio = static_cast<float>(pageWidth) / static_cast<float>(pageHeight);
|
||||||
// image wider than viewport ratio, scaled down image needs to be centered vertically
|
Serial.printf("[%lu] [SLP] bitmap ratio: %f, screen ratio: %f\n", millis(), bitmapRatio, screenRatio);
|
||||||
if (SETTINGS.sleepScreenCoverMode == CrossPointSettings::SLEEP_SCREEN_COVER_MODE::CROP) {
|
|
||||||
cropX = 1.0f - (screenRatio / ratio);
|
const auto coverMode = SETTINGS.sleepScreenCoverMode;
|
||||||
Serial.printf("[%lu] [SLP] Cropping bitmap x: %f\n", millis(), cropX);
|
|
||||||
ratio = (1.0f - cropX) * static_cast<float>(bitmap.getWidth()) / static_cast<float>(bitmap.getHeight());
|
if (coverMode == CrossPointSettings::SLEEP_SCREEN_COVER_MODE::ACTUAL) {
|
||||||
}
|
// ACTUAL mode: Show image at actual size, centered (no scaling)
|
||||||
x = 0;
|
|
||||||
y = std::round((static_cast<float>(pageHeight) - static_cast<float>(pageWidth) / ratio) / 2);
|
|
||||||
Serial.printf("[%lu] [SLP] Centering with ratio %f to y=%d\n", millis(), ratio, y);
|
|
||||||
} else {
|
|
||||||
// image taller than viewport ratio, scaled down image needs to be centered horizontally
|
|
||||||
if (SETTINGS.sleepScreenCoverMode == CrossPointSettings::SLEEP_SCREEN_COVER_MODE::CROP) {
|
|
||||||
cropY = 1.0f - (ratio / screenRatio);
|
|
||||||
Serial.printf("[%lu] [SLP] Cropping bitmap y: %f\n", millis(), cropY);
|
|
||||||
ratio = static_cast<float>(bitmap.getWidth()) / ((1.0f - cropY) * static_cast<float>(bitmap.getHeight()));
|
|
||||||
}
|
|
||||||
x = std::round((static_cast<float>(pageWidth) - static_cast<float>(pageHeight) * ratio) / 2);
|
|
||||||
y = 0;
|
|
||||||
Serial.printf("[%lu] [SLP] Centering with ratio %f to x=%d\n", millis(), ratio, x);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// center the image
|
|
||||||
x = (pageWidth - bitmap.getWidth()) / 2;
|
x = (pageWidth - bitmap.getWidth()) / 2;
|
||||||
y = (pageHeight - bitmap.getHeight()) / 2;
|
y = (pageHeight - bitmap.getHeight()) / 2;
|
||||||
|
// Don't constrain to screen dimensions - drawBitmap will clip
|
||||||
|
drawWidth = 0;
|
||||||
|
drawHeight = 0;
|
||||||
|
Serial.printf("[%lu] [SLP] ACTUAL mode: centering at %d, %d\n", millis(), x, y);
|
||||||
|
} else if (coverMode == CrossPointSettings::SLEEP_SCREEN_COVER_MODE::CROP) {
|
||||||
|
// CROP mode: Scale to fill screen completely (may crop edges)
|
||||||
|
// Calculate crop values to fill the screen while maintaining aspect ratio
|
||||||
|
if (bitmapRatio > screenRatio) {
|
||||||
|
// Image is wider than screen ratio - crop horizontally
|
||||||
|
cropX = 1.0f - (screenRatio / bitmapRatio);
|
||||||
|
Serial.printf("[%lu] [SLP] CROP mode: cropping x by %f\n", millis(), cropX);
|
||||||
|
} else if (bitmapRatio < screenRatio) {
|
||||||
|
// Image is taller than screen ratio - crop vertically
|
||||||
|
cropY = 1.0f - (bitmapRatio / screenRatio);
|
||||||
|
Serial.printf("[%lu] [SLP] CROP mode: cropping y by %f\n", millis(), cropY);
|
||||||
|
}
|
||||||
|
// After cropping, the image should fill the screen exactly
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
Serial.printf("[%lu] [SLP] CROP mode: drawing at 0, 0 with crop %f, %f\n", millis(), cropX, cropY);
|
||||||
|
} else {
|
||||||
|
// FIT mode (default): Scale to fit entire image within screen (may have letterboxing)
|
||||||
|
// Calculate the scaled dimensions
|
||||||
|
float scale;
|
||||||
|
if (bitmapRatio > screenRatio) {
|
||||||
|
// Image is wider than screen ratio - fit to width
|
||||||
|
scale = static_cast<float>(pageWidth) / static_cast<float>(bitmap.getWidth());
|
||||||
|
} else {
|
||||||
|
// Image is taller than screen ratio - fit to height
|
||||||
|
scale = static_cast<float>(pageHeight) / static_cast<float>(bitmap.getHeight());
|
||||||
|
}
|
||||||
|
const int scaledWidth = static_cast<int>(bitmap.getWidth() * scale);
|
||||||
|
const int scaledHeight = static_cast<int>(bitmap.getHeight() * scale);
|
||||||
|
|
||||||
|
// Center the scaled image
|
||||||
|
x = (pageWidth - scaledWidth) / 2;
|
||||||
|
y = (pageHeight - scaledHeight) / 2;
|
||||||
|
Serial.printf("[%lu] [SLP] FIT mode: scale %f, scaled size %d x %d, position %d, %d\n", millis(), scale,
|
||||||
|
scaledWidth, scaledHeight, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.printf("[%lu] [SLP] drawing to %d x %d\n", millis(), x, y);
|
Serial.printf("[%lu] [SLP] drawing to %d x %d\n", millis(), x, y);
|
||||||
renderer.clearScreen();
|
renderer.clearScreen();
|
||||||
renderer.drawBitmap(bitmap, x, y, pageWidth, pageHeight, cropX, cropY);
|
renderer.drawBitmap(bitmap, x, y, drawWidth, drawHeight, cropX, cropY);
|
||||||
renderer.displayBuffer(EInkDisplay::HALF_REFRESH);
|
renderer.displayBuffer(EInkDisplay::HALF_REFRESH);
|
||||||
|
|
||||||
if (bitmap.hasGreyscale()) {
|
if (bitmap.hasGreyscale()) {
|
||||||
bitmap.rewindToData();
|
bitmap.rewindToData();
|
||||||
renderer.clearScreen(0x00);
|
renderer.clearScreen(0x00);
|
||||||
renderer.setRenderMode(GfxRenderer::GRAYSCALE_LSB);
|
renderer.setRenderMode(GfxRenderer::GRAYSCALE_LSB);
|
||||||
renderer.drawBitmap(bitmap, x, y, pageWidth, pageHeight, cropX, cropY);
|
renderer.drawBitmap(bitmap, x, y, drawWidth, drawHeight, cropX, cropY);
|
||||||
renderer.copyGrayscaleLsbBuffers();
|
renderer.copyGrayscaleLsbBuffers();
|
||||||
|
|
||||||
bitmap.rewindToData();
|
bitmap.rewindToData();
|
||||||
renderer.clearScreen(0x00);
|
renderer.clearScreen(0x00);
|
||||||
renderer.setRenderMode(GfxRenderer::GRAYSCALE_MSB);
|
renderer.setRenderMode(GfxRenderer::GRAYSCALE_MSB);
|
||||||
renderer.drawBitmap(bitmap, x, y, pageWidth, pageHeight, cropX, cropY);
|
renderer.drawBitmap(bitmap, x, y, drawWidth, drawHeight, cropX, cropY);
|
||||||
renderer.copyGrayscaleMsbBuffers();
|
renderer.copyGrayscaleMsbBuffers();
|
||||||
|
|
||||||
renderer.displayGrayBuffer();
|
renderer.displayGrayBuffer();
|
||||||
|
|||||||
@ -15,7 +15,7 @@ constexpr int displaySettingsCount = 5;
|
|||||||
const SettingInfo displaySettings[displaySettingsCount] = {
|
const SettingInfo displaySettings[displaySettingsCount] = {
|
||||||
// Should match with SLEEP_SCREEN_MODE
|
// Should match with SLEEP_SCREEN_MODE
|
||||||
SettingInfo::Enum("Sleep Screen", &CrossPointSettings::sleepScreen, {"Dark", "Light", "Custom", "Cover", "None"}),
|
SettingInfo::Enum("Sleep Screen", &CrossPointSettings::sleepScreen, {"Dark", "Light", "Custom", "Cover", "None"}),
|
||||||
SettingInfo::Enum("Sleep Screen Cover Mode", &CrossPointSettings::sleepScreenCoverMode, {"Fit", "Crop"}),
|
SettingInfo::Enum("Sleep Screen Cover Mode", &CrossPointSettings::sleepScreenCoverMode, {"Fit", "Crop", "Actual"}),
|
||||||
SettingInfo::Enum("Status Bar", &CrossPointSettings::statusBar, {"None", "No Progress", "Full"}),
|
SettingInfo::Enum("Status Bar", &CrossPointSettings::statusBar, {"None", "No Progress", "Full"}),
|
||||||
SettingInfo::Enum("Hide Battery %", &CrossPointSettings::hideBatteryPercentage, {"Never", "In Reader", "Always"}),
|
SettingInfo::Enum("Hide Battery %", &CrossPointSettings::hideBatteryPercentage, {"Never", "In Reader", "Always"}),
|
||||||
SettingInfo::Enum("Refresh Frequency", &CrossPointSettings::refreshFrequency,
|
SettingInfo::Enum("Refresh Frequency", &CrossPointSettings::refreshFrequency,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user