Small Todos for the next session, some clean up
Some checks failed
Build ptprnt / build (push) Failing after 32s
Some checks failed
Build ptprnt / build (push) Failing after 32s
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#include "spdlog/fmt/bin_to_hex.h"
|
||||
|
||||
// as long as DRYRUN is defined, no data is actually send to the printer, we need to save some tape ;)
|
||||
//#define DRYRUN
|
||||
#define DRYRUN
|
||||
|
||||
namespace ptprnt::printer {
|
||||
|
||||
|
@@ -178,7 +178,8 @@ void PtouchPrint::setupLogger(spdlog::level::level_enum lvl) {
|
||||
consoleSink->set_level(lvl);
|
||||
if (spdlog::level::level_enum::debug == lvl || spdlog::level::level_enum::trace == lvl) {
|
||||
// This will enable file and line number for debug and trace macros
|
||||
consoleSink->set_pattern("%^%L:%$ %v (%s:%#)");
|
||||
// TODO: line number and functions only work with macros
|
||||
consoleSink->set_pattern("%^%L:%$ %v");
|
||||
} else {
|
||||
consoleSink->set_pattern("%^%L:%$ %v");
|
||||
}
|
||||
|
@@ -19,18 +19,15 @@
|
||||
|
||||
#include "Bitmap.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace ptprnt::graphics {
|
||||
template <class T>
|
||||
Bitmap<T>::Bitmap(uint16_t width, uint16_t height)
|
||||
: mWidth{width}, mHeight{height}, mPixels(width * height) {}
|
||||
Bitmap<T>::Bitmap(uint16_t width, uint16_t height) : mWidth{width}, mHeight{height}, mPixels(width * height) {}
|
||||
|
||||
template <class T>
|
||||
[[nodiscard]] uint16_t Bitmap<T>::getWidth() const {
|
||||
@@ -45,8 +42,7 @@ template <class T>
|
||||
template <class T>
|
||||
bool Bitmap<T>::setPixels(const std::vector<T>& pixels) {
|
||||
if (pixels.size() != mPixels.size()) {
|
||||
spdlog::error("Invalid pixel buffer size (got {} vs. {} bitmap size).", pixels.size(),
|
||||
mPixels.size());
|
||||
spdlog::error("Invalid pixel buffer size (got {} vs. {} bitmap size).", pixels.size(), mPixels.size());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,6 +67,7 @@ template <class T>
|
||||
return std::vector<T>(lineStart, lineEnd);
|
||||
}
|
||||
|
||||
// TODO: I guess this is borked
|
||||
template <class T>
|
||||
[[nodiscard]] std::optional<std::vector<T>> Bitmap<T>::getCol(uint16_t col) const {
|
||||
if (col >= mWidth) {
|
||||
|
@@ -118,7 +118,9 @@ bool Label::create(const std::string& labelText) {
|
||||
mLayoutHeight /= PANGO_SCALE;
|
||||
|
||||
spdlog::debug("Layout width: {}, height: {}", mLayoutWidth, mLayoutHeight);
|
||||
mSurface = cairo_image_surface_create(CAIRO_FORMAT_A8, mLayoutWidth, mPrinterHeight);
|
||||
auto alignedWidth = mLayoutWidth + (8 - (mLayoutWidth % 8));
|
||||
|
||||
mSurface = cairo_image_surface_create(CAIRO_FORMAT_A8, alignedWidth, mPrinterHeight);
|
||||
cairo_t* cr = cairo_create(mSurface);
|
||||
|
||||
// Adjust Cairo cursor position to respect the vertical alignment
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
@@ -40,7 +38,6 @@ void Monochrome::invert(bool shouldInvert) {
|
||||
std::vector<uint8_t> Monochrome::get() {
|
||||
std::vector<uint8_t> outPixels(
|
||||
(static_cast<unsigned int>((mPixels.size() / 8)) + (std::floor(mPixels.size() % 8 + 0.9))));
|
||||
|
||||
unsigned int outIndex = 0;
|
||||
|
||||
for (unsigned int byteNo = 0; byteNo < mPixels.size(); byteNo += 8) {
|
||||
|
Reference in New Issue
Block a user