Skip to content

Commit

Permalink
Sync submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
attah committed May 7, 2023
1 parent c36a6ee commit 1ac8220
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions harbour-seaprint.pro
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ HEADERS += \
ppm2pwg/UrfPgHdr.codable \
ppm2pwg/bytestream/bytestream.h \
ppm2pwg/bytestream/codable.h \
ppm2pwg/bytestream/array.h \
ppm2pwg/argget.h \
src/overrider.h \
src/papersizes.h \
Expand Down
2 changes: 1 addition & 1 deletion ppm2pwg
2 changes: 1 addition & 1 deletion src/convertchecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QProcess>
#include <QtDebug>

ConvertChecker::ConvertChecker() : poppler("libpoppler-glib.so.8")
ConvertChecker::ConvertChecker() : libpoppler("libpoppler-glib.so.8")
{
_calligra = false;

Expand Down
2 changes: 1 addition & 1 deletion src/convertchecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConvertChecker : public QObject
ConvertChecker(const ConvertChecker &);
ConvertChecker& operator=(const ConvertChecker &);

LibLoader poppler;
LibLoader libpoppler;
bool _calligra;
};

Expand Down
4 changes: 3 additions & 1 deletion src/ippprinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,9 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
Params.quality = getAttrOrDefault(jobAttrs, "print-quality").toInt();

QString PrintColorMode = getAttrOrDefault(jobAttrs, "print-color-mode").toString();
Params.colors = PrintColorMode.contains("color") ? 3 : PrintColorMode.contains("monochrome") ? 1 : Params.colors;
Params.colorMode = PrintColorMode.contains("color") ? PrintParameters::sRGB24
: PrintColorMode.contains("monochrome") ? PrintParameters::Gray8
: Params.colorMode;

QJsonArray supportedOperations = _attrs["operations-supported"].toObject()["value"].toArray();

Expand Down
30 changes: 15 additions & 15 deletions src/printerworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,21 +340,21 @@ void PrinterWorker::convertPdf(QString filename, Bytestream header, PrintParamet

OK(cr.write((char*)header.raw(), header.size()));

write_fun WriteFun([&cr](unsigned char const* buf, unsigned int len) -> bool
{
if(len == 0)
return true;
return cr.write((const char*)buf, len);
});

progress_fun ProgressFun([this](size_t page, size_t total) -> void
{
emit progress(page, total);
});
WriteFun writeFun([&cr](unsigned char const* buf, unsigned int len) -> bool
{
if(len == 0)
return true;
return cr.write((const char*)buf, len);
});

ProgressFun progressFun([this](size_t page, size_t total) -> void
{
emit progress(page, total);
});

bool verbose = QLoggingCategory::defaultCategory()->isDebugEnabled();

int res = pdf_to_printable(filename.toStdString(), WriteFun, Params, ProgressFun, verbose);
int res = pdf_to_printable(filename.toStdString(), writeFun, Params, progressFun, verbose);

if(res != 0)
{
Expand Down Expand Up @@ -484,17 +484,17 @@ void PrinterWorker::convertImage(QString filename, Bytestream header, PrintParam

if(inImage.allGray())
{
Params.colors = 1; // No need to waste space/bandwidth...
Params.colorMode = PrintParameters::Gray8; // No need to waste space/bandwidth...
}

outImage.save(&buf, Params.colors==1 ? "pgm" : "ppm");
outImage.save(&buf, Params.getNumberOfColors() == 1 ? "pgm" : "ppm");
buf.seek(0);
// Skip header - TODO consider reimplementing
buf.readLine(255);
buf.readLine(255);
buf.readLine(255);

Bytestream inBts(Params.getPaperSizeWInPixels() * Params.getPaperSizeHInPixels() * Params.colors);
Bytestream inBts(Params.getPaperSizeWInPixels() * Params.getPaperSizeHInPixels() * Params.getNumberOfColors());

if((((size_t)buf.size())-buf.pos()) != inBts.size())
{
Expand Down

0 comments on commit 1ac8220

Please sign in to comment.