Changeset View
Changeset View
Standalone View
Standalone View
src/lib/datamatrixbarcode.cpp
Show All 27 Lines | 16 | { | |||
---|---|---|---|---|---|
28 | DmtxPassFail result = dmtxEncodeDataMatrix(enc, trimmedData.length(), | 28 | DmtxPassFail result = dmtxEncodeDataMatrix(enc, trimmedData.length(), | ||
29 | reinterpret_cast<unsigned char*>(trimmedData.data())); | 29 | reinterpret_cast<unsigned char*>(trimmedData.data())); | ||
30 | if(result == DmtxFail) { | 30 | if(result == DmtxFail) { | ||
31 | dmtxEncodeDestroy(&enc); | 31 | dmtxEncodeDestroy(&enc); | ||
32 | return QImage(); | 32 | return QImage(); | ||
33 | } | 33 | } | ||
34 | Q_ASSERT(enc->image->width == enc->image->height); | 34 | Q_ASSERT(enc->image->width == enc->image->height); | ||
35 | 35 | | |||
36 | setMinimumSize(QSizeF(enc->image->width,enc->image->height)); | | |||
37 | QImage ret; | 36 | QImage ret; | ||
38 | 37 | | |||
39 | if(foregroundColor()==Qt::black && backgroundColor() == Qt::white) { | 38 | if(foregroundColor()==Qt::black && backgroundColor() == Qt::white) { | ||
40 | QImage tmp(enc->image->pxl,enc->image->width,enc->image->height, QImage::Format_ARGB32); | 39 | QImage tmp(enc->image->pxl,enc->image->width,enc->image->height, QImage::Format_ARGB32); | ||
41 | //we need to copy, because QImage generated from a char pointer requires the | 40 | //we need to copy, because QImage generated from a char pointer requires the | ||
42 | //char pointer to be kept around forever, and manually deleted. | 41 | //char pointer to be kept around forever, and manually deleted. | ||
43 | ret=tmp.copy(); | 42 | ret=tmp.copy(); | ||
44 | } else { | 43 | } else { | ||
Show All 34 Lines |