Rename QPdf(Base)Engine
Rename QPdfBaseEngine to QPdfEngine and QPdfEngine to QPdfPrintEngine. This fit's better with the use cases. Change-Id: Ic208b079581768a957f9fdcc333f0bf87f619d46 Reviewed-on: http://codereview.qt.nokia.com/3202 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
This commit is contained in:
parent
b91d30eae1
commit
941de7608b
@ -936,17 +936,17 @@ void QPdfPage::streamImage(int w, int h, int object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPdfBaseEngine::QPdfBaseEngine(QPdfBaseEnginePrivate &dd, PaintEngineFeatures f)
|
QPdfEngine::QPdfEngine(QPdfEnginePrivate &dd, PaintEngineFeatures f)
|
||||||
: QAlphaPaintEngine(dd, f)
|
: QAlphaPaintEngine(dd, f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount)
|
void QPdfEngine::drawPoints (const QPointF *points, int pointCount)
|
||||||
{
|
{
|
||||||
if (!points)
|
if (!points)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
QPainterPath p;
|
QPainterPath p;
|
||||||
for (int i=0; i!=pointCount;++i) {
|
for (int i=0; i!=pointCount;++i) {
|
||||||
p.moveTo(points[i]);
|
p.moveTo(points[i]);
|
||||||
@ -959,12 +959,12 @@ void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount)
|
|||||||
d->hasBrush = hadBrush;
|
d->hasBrush = hadBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawLines (const QLineF *lines, int lineCount)
|
void QPdfEngine::drawLines (const QLineF *lines, int lineCount)
|
||||||
{
|
{
|
||||||
if (!lines)
|
if (!lines)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
QPainterPath p;
|
QPainterPath p;
|
||||||
for (int i=0; i!=lineCount;++i) {
|
for (int i=0; i!=lineCount;++i) {
|
||||||
p.moveTo(lines[i].p1());
|
p.moveTo(lines[i].p1());
|
||||||
@ -976,12 +976,12 @@ void QPdfBaseEngine::drawLines (const QLineF *lines, int lineCount)
|
|||||||
d->hasBrush = hadBrush;
|
d->hasBrush = hadBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawRects (const QRectF *rects, int rectCount)
|
void QPdfEngine::drawRects (const QRectF *rects, int rectCount)
|
||||||
{
|
{
|
||||||
if (!rects)
|
if (!rects)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
if (d->useAlphaEngine) {
|
if (d->useAlphaEngine) {
|
||||||
QAlphaPaintEngine::drawRects(rects, rectCount);
|
QAlphaPaintEngine::drawRects(rects, rectCount);
|
||||||
if (!continueCall())
|
if (!continueCall())
|
||||||
@ -1011,9 +1011,9 @@ void QPdfBaseEngine::drawRects (const QRectF *rects, int rectCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
|
void QPdfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
if (d->useAlphaEngine) {
|
||||||
QAlphaPaintEngine::drawPolygon(points, pointCount, mode);
|
QAlphaPaintEngine::drawPolygon(points, pointCount, mode);
|
||||||
@ -1053,9 +1053,9 @@ void QPdfBaseEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD
|
|||||||
d->hasBrush = hb;
|
d->hasBrush = hb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawPath (const QPainterPath &p)
|
void QPdfEngine::drawPath (const QPainterPath &p)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
if (d->useAlphaEngine) {
|
||||||
QAlphaPaintEngine::drawPath(p);
|
QAlphaPaintEngine::drawPath(p);
|
||||||
@ -1086,11 +1086,11 @@ void QPdfBaseEngine::drawPath (const QPainterPath &p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr)
|
void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr)
|
||||||
{
|
{
|
||||||
if (sr.isEmpty() || rectangle.isEmpty() || pixmap.isNull())
|
if (sr.isEmpty() || rectangle.isEmpty() || pixmap.isNull())
|
||||||
return;
|
return;
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
QBrush b = d->brush;
|
QBrush b = d->brush;
|
||||||
|
|
||||||
@ -1117,11 +1117,11 @@ void QPdfBaseEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap,
|
|||||||
d->brush = b;
|
d->brush = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags)
|
void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags)
|
||||||
{
|
{
|
||||||
if (sr.isEmpty() || rectangle.isEmpty() || image.isNull())
|
if (sr.isEmpty() || rectangle.isEmpty() || image.isNull())
|
||||||
return;
|
return;
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
QRect sourceRect = sr.toRect();
|
QRect sourceRect = sr.toRect();
|
||||||
QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image;
|
QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image;
|
||||||
@ -1139,9 +1139,9 @@ void QPdfBaseEngine::drawImage(const QRectF &rectangle, const QImage &image, con
|
|||||||
*d->currentPage << "Q\n";
|
*d->currentPage << "Q\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &point)
|
void QPdfEngine::drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &point)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
bool bitmap = (pixmap.depth() == 1);
|
bool bitmap = (pixmap.depth() == 1);
|
||||||
QBrush b = d->brush;
|
QBrush b = d->brush;
|
||||||
@ -1169,9 +1169,9 @@ void QPdfBaseEngine::drawTiledPixmap (const QRectF &rectangle, const QPixmap &pi
|
|||||||
d->brushOrigin = bo;
|
d->brushOrigin = bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
|
void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
if (d->useAlphaEngine) {
|
||||||
QAlphaPaintEngine::drawTextItem(p, textItem);
|
QAlphaPaintEngine::drawTextItem(p, textItem);
|
||||||
@ -1206,9 +1206,9 @@ void QPdfBaseEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPdfBaseEngine::updateState(const QPaintEngineState &state)
|
void QPdfEngine::updateState(const QPaintEngineState &state)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
if (d->useAlphaEngine) {
|
||||||
QAlphaPaintEngine::updateState(state);
|
QAlphaPaintEngine::updateState(state);
|
||||||
@ -1268,9 +1268,9 @@ void QPdfBaseEngine::updateState(const QPaintEngineState &state)
|
|||||||
setupGraphicsState(flags);
|
setupGraphicsState(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags)
|
void QPdfEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
if (flags & DirtyClipPath)
|
if (flags & DirtyClipPath)
|
||||||
flags |= DirtyTransform|DirtyPen|DirtyBrush;
|
flags |= DirtyTransform|DirtyPen|DirtyBrush;
|
||||||
|
|
||||||
@ -1311,9 +1311,9 @@ void QPdfBaseEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags)
|
|||||||
|
|
||||||
extern QPainterPath qt_regionToPath(const QRegion ®ion);
|
extern QPainterPath qt_regionToPath(const QRegion ®ion);
|
||||||
|
|
||||||
void QPdfBaseEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op)
|
void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
QPainterPath path = d->stroker.matrix.map(p);
|
QPainterPath path = d->stroker.matrix.map(p);
|
||||||
//qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op;
|
//qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op;
|
||||||
|
|
||||||
@ -1359,9 +1359,9 @@ void QPdfBaseEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEngine::setPen()
|
void QPdfEngine::setPen()
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
if (d->pen.style() == Qt::NoPen)
|
if (d->pen.style() == Qt::NoPen)
|
||||||
return;
|
return;
|
||||||
QBrush b = d->pen.brush();
|
QBrush b = d->pen.brush();
|
||||||
@ -1416,9 +1416,9 @@ void QPdfBaseEngine::setPen()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPdfBaseEngine::setBrush()
|
void QPdfEngine::setBrush()
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
Qt::BrushStyle style = d->brush.style();
|
Qt::BrushStyle style = d->brush.style();
|
||||||
if (style == Qt::NoBrush)
|
if (style == Qt::NoBrush)
|
||||||
return;
|
return;
|
||||||
@ -1450,9 +1450,9 @@ void QPdfBaseEngine::setBrush()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QPdfBaseEngine::newPage()
|
bool QPdfEngine::newPage()
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
if (!isActive())
|
if (!isActive())
|
||||||
return false;
|
return false;
|
||||||
d->newPage();
|
d->newPage();
|
||||||
@ -1464,16 +1464,16 @@ bool QPdfBaseEngine::newPage()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPaintEngine::Type QPdfBaseEngine::type() const
|
QPaintEngine::Type QPdfEngine::type() const
|
||||||
{
|
{
|
||||||
return QPaintEngine::Pdf;
|
return QPaintEngine::Pdf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
|
int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
|
||||||
{
|
{
|
||||||
Q_D(const QPdfBaseEngine);
|
Q_D(const QPdfEngine);
|
||||||
int val;
|
int val;
|
||||||
QRect r = d->fullPage ? d->paperRect() : d->pageRect();
|
QRect r = d->fullPage ? d->paperRect() : d->pageRect();
|
||||||
switch (metricType) {
|
switch (metricType) {
|
||||||
@ -1511,7 +1511,7 @@ int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPdfBaseEnginePrivate::QPdfBaseEnginePrivate(QPrinter::PrinterMode m)
|
QPdfEnginePrivate::QPdfEnginePrivate(QPrinter::PrinterMode m)
|
||||||
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
|
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
|
||||||
useAlphaEngine(false),
|
useAlphaEngine(false),
|
||||||
outDevice(0), fd(-1),
|
outDevice(0), fd(-1),
|
||||||
@ -1540,9 +1540,9 @@ QPdfBaseEnginePrivate::QPdfBaseEnginePrivate(QPrinter::PrinterMode m)
|
|||||||
fullPage = false;
|
fullPage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPdfBaseEngine::begin(QPaintDevice *pdev)
|
bool QPdfEngine::begin(QPaintDevice *pdev)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
d->pdev = pdev;
|
d->pdev = pdev;
|
||||||
|
|
||||||
d->postscript = false;
|
d->postscript = false;
|
||||||
@ -1577,9 +1577,9 @@ bool QPdfBaseEngine::begin(QPaintDevice *pdev)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPdfBaseEngine::end()
|
bool QPdfEngine::end()
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
d->writeTail();
|
d->writeTail();
|
||||||
|
|
||||||
d->stream->unsetDevice();
|
d->stream->unsetDevice();
|
||||||
@ -1593,14 +1593,14 @@ bool QPdfBaseEngine::end()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPdfBaseEnginePrivate::~QPdfBaseEnginePrivate()
|
QPdfEnginePrivate::~QPdfEnginePrivate()
|
||||||
{
|
{
|
||||||
qDeleteAll(fonts);
|
qDeleteAll(fonts);
|
||||||
delete currentPage;
|
delete currentPage;
|
||||||
delete stream;
|
delete stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect QPdfBaseEnginePrivate::paperRect() const
|
QRect QPdfEnginePrivate::paperRect() const
|
||||||
{
|
{
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
@ -1626,7 +1626,7 @@ QRect QPdfBaseEnginePrivate::paperRect() const
|
|||||||
return QRect(0, 0, h, w);
|
return QRect(0, 0, h, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect QPdfBaseEnginePrivate::pageRect() const
|
QRect QPdfEnginePrivate::pageRect() const
|
||||||
{
|
{
|
||||||
if(fullPage)
|
if(fullPage)
|
||||||
return paperRect();
|
return paperRect();
|
||||||
@ -1672,7 +1672,7 @@ QRect QPdfBaseEnginePrivate::pageRect() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::writeHeader()
|
void QPdfEnginePrivate::writeHeader()
|
||||||
{
|
{
|
||||||
addXrefEntry(0,false);
|
addXrefEntry(0,false);
|
||||||
|
|
||||||
@ -1707,7 +1707,7 @@ void QPdfBaseEnginePrivate::writeHeader()
|
|||||||
"endobj\n");
|
"endobj\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::writeInfo()
|
void QPdfEnginePrivate::writeInfo()
|
||||||
{
|
{
|
||||||
info = addXrefEntry(-1);
|
info = addXrefEntry(-1);
|
||||||
xprintf("<<\n/Title ");
|
xprintf("<<\n/Title ");
|
||||||
@ -1730,7 +1730,7 @@ void QPdfBaseEnginePrivate::writeInfo()
|
|||||||
"endobj\n");
|
"endobj\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::writePageRoot()
|
void QPdfEnginePrivate::writePageRoot()
|
||||||
{
|
{
|
||||||
addXrefEntry(pageRoot);
|
addXrefEntry(pageRoot);
|
||||||
|
|
||||||
@ -1752,7 +1752,7 @@ void QPdfBaseEnginePrivate::writePageRoot()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::embedFont(QFontSubset *font)
|
void QPdfEnginePrivate::embedFont(QFontSubset *font)
|
||||||
{
|
{
|
||||||
//qDebug() << "embedFont" << font->object_id;
|
//qDebug() << "embedFont" << font->object_id;
|
||||||
int fontObject = font->object_id;
|
int fontObject = font->object_id;
|
||||||
@ -1864,7 +1864,7 @@ void QPdfBaseEnginePrivate::embedFont(QFontSubset *font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::writeFonts()
|
void QPdfEnginePrivate::writeFonts()
|
||||||
{
|
{
|
||||||
for (QHash<QFontEngine::FaceId, QFontSubset *>::iterator it = fonts.begin(); it != fonts.end(); ++it) {
|
for (QHash<QFontEngine::FaceId, QFontSubset *>::iterator it = fonts.begin(); it != fonts.end(); ++it) {
|
||||||
embedFont(*it);
|
embedFont(*it);
|
||||||
@ -1873,7 +1873,7 @@ void QPdfBaseEnginePrivate::writeFonts()
|
|||||||
fonts.clear();
|
fonts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::writePage()
|
void QPdfEnginePrivate::writePage()
|
||||||
{
|
{
|
||||||
if (pages.empty())
|
if (pages.empty())
|
||||||
return;
|
return;
|
||||||
@ -1957,7 +1957,7 @@ void QPdfBaseEnginePrivate::writePage()
|
|||||||
xprintf("%d\nendobj\n",len);
|
xprintf("%d\nendobj\n",len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::writeTail()
|
void QPdfEnginePrivate::writeTail()
|
||||||
{
|
{
|
||||||
writePage();
|
writePage();
|
||||||
writeFonts();
|
writeFonts();
|
||||||
@ -1981,7 +1981,7 @@ void QPdfBaseEnginePrivate::writeTail()
|
|||||||
xrefPositions.size()-1, info, catalog, xrefPositions.last());
|
xrefPositions.size()-1, info, catalog, xrefPositions.last());
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPdfBaseEnginePrivate::addXrefEntry(int object, bool printostr)
|
int QPdfEnginePrivate::addXrefEntry(int object, bool printostr)
|
||||||
{
|
{
|
||||||
if (object < 0)
|
if (object < 0)
|
||||||
object = requestObject();
|
object = requestObject();
|
||||||
@ -1996,7 +1996,7 @@ int QPdfBaseEnginePrivate::addXrefEntry(int object, bool printostr)
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::printString(const QString &string) {
|
void QPdfEnginePrivate::printString(const QString &string) {
|
||||||
// The 'text string' type in PDF is encoded either as PDFDocEncoding, or
|
// The 'text string' type in PDF is encoded either as PDFDocEncoding, or
|
||||||
// Unicode UTF-16 with a Unicode byte order mark as the first character
|
// Unicode UTF-16 with a Unicode byte order mark as the first character
|
||||||
// (0xfeff), with the high-order byte first.
|
// (0xfeff), with the high-order byte first.
|
||||||
@ -2017,7 +2017,7 @@ void QPdfBaseEnginePrivate::printString(const QString &string) {
|
|||||||
|
|
||||||
|
|
||||||
// For strings up to 10000 bytes only !
|
// For strings up to 10000 bytes only !
|
||||||
void QPdfBaseEnginePrivate::xprintf(const char* fmt, ...)
|
void QPdfEnginePrivate::xprintf(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
if (!stream)
|
if (!stream)
|
||||||
return;
|
return;
|
||||||
@ -2037,7 +2037,7 @@ void QPdfBaseEnginePrivate::xprintf(const char* fmt, ...)
|
|||||||
streampos += bufsize;
|
streampos += bufsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPdfBaseEnginePrivate::writeCompressed(QIODevice *dev)
|
int QPdfEnginePrivate::writeCompressed(QIODevice *dev)
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_COMPRESS
|
#ifndef QT_NO_COMPRESS
|
||||||
if (do_compress) {
|
if (do_compress) {
|
||||||
@ -2111,7 +2111,7 @@ int QPdfBaseEnginePrivate::writeCompressed(QIODevice *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPdfBaseEnginePrivate::writeCompressed(const char *src, int len)
|
int QPdfEnginePrivate::writeCompressed(const char *src, int len)
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_COMPRESS
|
#ifndef QT_NO_COMPRESS
|
||||||
if(do_compress) {
|
if(do_compress) {
|
||||||
@ -2134,7 +2134,7 @@ int QPdfBaseEnginePrivate::writeCompressed(const char *src, int len)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPdfBaseEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth,
|
int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth,
|
||||||
int maskObject, int softMaskObject, bool dct)
|
int maskObject, int softMaskObject, bool dct)
|
||||||
{
|
{
|
||||||
int image = addXrefEntry(-1);
|
int image = addXrefEntry(-1);
|
||||||
@ -2182,7 +2182,7 @@ int QPdfBaseEnginePrivate::writeImage(const QByteArray &data, int width, int hei
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_NATIVE_GRADIENTS
|
#ifdef USE_NATIVE_GRADIENTS
|
||||||
int QPdfBaseEnginePrivate::gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject)
|
int QPdfEnginePrivate::gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject)
|
||||||
{
|
{
|
||||||
const QGradient *gradient = b.gradient();
|
const QGradient *gradient = b.gradient();
|
||||||
if (!gradient)
|
if (!gradient)
|
||||||
@ -2281,7 +2281,7 @@ int QPdfBaseEnginePrivate::gradientBrush(const QBrush &b, const QMatrix &matrix,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int QPdfBaseEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
|
int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
|
||||||
{
|
{
|
||||||
if (brushAlpha == 255 && penAlpha == 255)
|
if (brushAlpha == 255 && penAlpha == 255)
|
||||||
return 0;
|
return 0;
|
||||||
@ -2301,7 +2301,7 @@ int QPdfBaseEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPdfBaseEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, int *gStateObject)
|
int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, int *gStateObject)
|
||||||
{
|
{
|
||||||
int paintType = 2; // Uncolored tiling
|
int paintType = 2; // Uncolored tiling
|
||||||
int w = 8;
|
int w = 8;
|
||||||
@ -2390,7 +2390,7 @@ int QPdfBaseEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyCol
|
|||||||
/*!
|
/*!
|
||||||
* Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed.
|
* Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed.
|
||||||
*/
|
*/
|
||||||
int QPdfBaseEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_no)
|
int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_no)
|
||||||
{
|
{
|
||||||
if (img.isNull())
|
if (img.isNull())
|
||||||
return -1;
|
return -1;
|
||||||
@ -2518,9 +2518,9 @@ int QPdfBaseEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 seri
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
|
void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
|
||||||
{
|
{
|
||||||
Q_Q(QPdfBaseEngine);
|
Q_Q(QPdfEngine);
|
||||||
|
|
||||||
if (ti.charFormat.isAnchor()) {
|
if (ti.charFormat.isAnchor()) {
|
||||||
qreal size = ti.fontEngine->fontDef.pixelSize;
|
qreal size = ti.fontEngine->fontDef.pixelSize;
|
||||||
@ -2682,7 +2682,7 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t
|
|||||||
*currentPage << "ET\n";
|
*currentPage << "ET\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
QTransform QPdfBaseEnginePrivate::pageMatrix() const
|
QTransform QPdfEnginePrivate::pageMatrix() const
|
||||||
{
|
{
|
||||||
qreal scale = 72./resolution;
|
qreal scale = 72./resolution;
|
||||||
QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height());
|
QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height());
|
||||||
@ -2693,7 +2693,7 @@ QTransform QPdfBaseEnginePrivate::pageMatrix() const
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfBaseEnginePrivate::newPage()
|
void QPdfEnginePrivate::newPage()
|
||||||
{
|
{
|
||||||
if (currentPage && currentPage->pageSize.isEmpty())
|
if (currentPage && currentPage->pageSize.isEmpty())
|
||||||
currentPage->pageSize = QSize(width(), height());
|
currentPage->pageSize = QSize(width(), height());
|
||||||
|
@ -175,14 +175,14 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class QPdfBaseEnginePrivate;
|
class QPdfEnginePrivate;
|
||||||
|
|
||||||
class QPdfBaseEngine : public QAlphaPaintEngine
|
class QPdfEngine : public QAlphaPaintEngine
|
||||||
{
|
{
|
||||||
Q_DECLARE_PRIVATE(QPdfBaseEngine)
|
Q_DECLARE_PRIVATE(QPdfEngine)
|
||||||
public:
|
public:
|
||||||
QPdfBaseEngine(QPdfBaseEnginePrivate &d, PaintEngineFeatures f);
|
QPdfEngine(QPdfEnginePrivate &d, PaintEngineFeatures f);
|
||||||
~QPdfBaseEngine() {}
|
~QPdfEngine() {}
|
||||||
|
|
||||||
// reimplementations QPaintEngine
|
// reimplementations QPaintEngine
|
||||||
bool begin(QPaintDevice *pdev);
|
bool begin(QPaintDevice *pdev);
|
||||||
@ -218,12 +218,12 @@ private:
|
|||||||
void updateClipPath(const QPainterPath & path, Qt::ClipOperation op);
|
void updateClipPath(const QPainterPath & path, Qt::ClipOperation op);
|
||||||
};
|
};
|
||||||
|
|
||||||
class QPdfBaseEnginePrivate : public QAlphaPaintEnginePrivate
|
class QPdfEnginePrivate : public QAlphaPaintEnginePrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_PUBLIC(QPdfBaseEngine)
|
Q_DECLARE_PUBLIC(QPdfEngine)
|
||||||
public:
|
public:
|
||||||
QPdfBaseEnginePrivate(QPrinter::PrinterMode m);
|
QPdfEnginePrivate(QPrinter::PrinterMode m);
|
||||||
~QPdfBaseEnginePrivate();
|
~QPdfEnginePrivate();
|
||||||
|
|
||||||
inline uint requestObject() { return currentObject++; }
|
inline uint requestObject() { return currentObject++; }
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
QPdfWriterPrivate()
|
QPdfWriterPrivate()
|
||||||
: QObjectPrivate()
|
: QObjectPrivate()
|
||||||
{
|
{
|
||||||
engine = new QPdfEngine(QPrinter::HighResolution);
|
engine = new QPdfPrintEngine(QPrinter::HighResolution);
|
||||||
output = 0;
|
output = 0;
|
||||||
}
|
}
|
||||||
~QPdfWriterPrivate()
|
~QPdfWriterPrivate()
|
||||||
@ -60,7 +60,7 @@ public:
|
|||||||
delete output;
|
delete output;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPdfEngine *engine;
|
QPdfPrintEngine *engine;
|
||||||
QFile *output;
|
QFile *output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,10 +81,10 @@ inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features()
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPdfEngine::QPdfEngine(QPrinter::PrinterMode m)
|
QPdfPrintEngine::QPdfPrintEngine(QPrinter::PrinterMode m)
|
||||||
: QPdfBaseEngine(*new QPdfEnginePrivate(m), qt_pdf_decide_features())
|
: QPdfEngine(*new QPdfPrintEnginePrivate(m), qt_pdf_decide_features())
|
||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfPrintEngine);
|
||||||
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||||
if (QCUPSSupport::isAvailable()) {
|
if (QCUPSSupport::isAvailable()) {
|
||||||
QCUPSSupport cups;
|
QCUPSSupport cups;
|
||||||
@ -113,13 +113,13 @@ QPdfEngine::QPdfEngine(QPrinter::PrinterMode m)
|
|||||||
state = QPrinter::Idle;
|
state = QPrinter::Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPdfEngine::~QPdfEngine()
|
QPdfPrintEngine::~QPdfPrintEngine()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPdfEngine::begin(QPaintDevice *pdev)
|
bool QPdfPrintEngine::begin(QPaintDevice *pdev)
|
||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfPrintEngine);
|
||||||
|
|
||||||
if (!d->openPrintDevice()) {
|
if (!d->openPrintDevice()) {
|
||||||
state = QPrinter::Error;
|
state = QPrinter::Error;
|
||||||
@ -127,14 +127,14 @@ bool QPdfEngine::begin(QPaintDevice *pdev)
|
|||||||
}
|
}
|
||||||
state = QPrinter::Active;
|
state = QPrinter::Active;
|
||||||
|
|
||||||
return QPdfBaseEngine::begin(pdev);
|
return QPdfEngine::begin(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPdfEngine::end()
|
bool QPdfPrintEngine::end()
|
||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfPrintEngine);
|
||||||
|
|
||||||
QPdfBaseEngine::end();
|
QPdfEngine::end();
|
||||||
|
|
||||||
d->closePrintDevice();
|
d->closePrintDevice();
|
||||||
state = QPrinter::Idle;
|
state = QPrinter::Idle;
|
||||||
@ -142,19 +142,19 @@ bool QPdfEngine::end()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPdfEngine::newPage()
|
bool QPdfPrintEngine::newPage()
|
||||||
{
|
{
|
||||||
return QPdfBaseEngine::newPage();
|
return QPdfEngine::newPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric m) const
|
int QPdfPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const
|
||||||
{
|
{
|
||||||
return QPdfBaseEngine::metric(m);
|
return QPdfEngine::metric(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
|
void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
|
||||||
{
|
{
|
||||||
Q_D(QPdfBaseEngine);
|
Q_D(QPdfEngine);
|
||||||
switch (int(key)) {
|
switch (int(key)) {
|
||||||
case PPK_CollateCopies:
|
case PPK_CollateCopies:
|
||||||
d->collate = value.toBool();
|
d->collate = value.toBool();
|
||||||
@ -240,9 +240,9 @@ void QPdfEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QPdfEngine::property(PrintEnginePropertyKey key) const
|
QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
|
||||||
{
|
{
|
||||||
Q_D(const QPdfBaseEngine);
|
Q_D(const QPdfEngine);
|
||||||
|
|
||||||
QVariant ret;
|
QVariant ret;
|
||||||
switch (int(key)) {
|
switch (int(key)) {
|
||||||
@ -380,7 +380,7 @@ static void closeAllOpenFds()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool QPdfEnginePrivate::openPrintDevice()
|
bool QPdfPrintEnginePrivate::openPrintDevice()
|
||||||
{
|
{
|
||||||
if(outDevice)
|
if(outDevice)
|
||||||
return false;
|
return false;
|
||||||
@ -521,7 +521,7 @@ bool QPdfEnginePrivate::openPrintDevice()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfEnginePrivate::closePrintDevice()
|
void QPdfPrintEnginePrivate::closePrintDevice()
|
||||||
{
|
{
|
||||||
if (!outDevice)
|
if (!outDevice)
|
||||||
return;
|
return;
|
||||||
@ -618,12 +618,12 @@ void QPdfEnginePrivate::closePrintDevice()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
QPdfEnginePrivate::QPdfEnginePrivate(QPrinter::PrinterMode m)
|
QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m)
|
||||||
: QPdfBaseEnginePrivate(m)
|
: QPdfEnginePrivate(m)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QPdfEnginePrivate::~QPdfEnginePrivate()
|
QPdfPrintEnginePrivate::~QPdfPrintEnginePrivate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,16 +79,16 @@ class QPen;
|
|||||||
class QPointF;
|
class QPointF;
|
||||||
class QRegion;
|
class QRegion;
|
||||||
class QFile;
|
class QFile;
|
||||||
class QPdfEngine;
|
class QPdfPrintEngine;
|
||||||
|
|
||||||
class QPdfEnginePrivate;
|
class QPdfPrintEnginePrivate;
|
||||||
|
|
||||||
class QPdfEngine : public QPdfBaseEngine, public QPrintEngine
|
class QPdfPrintEngine : public QPdfEngine, public QPrintEngine
|
||||||
{
|
{
|
||||||
Q_DECLARE_PRIVATE(QPdfEngine)
|
Q_DECLARE_PRIVATE(QPdfPrintEngine)
|
||||||
public:
|
public:
|
||||||
QPdfEngine(QPrinter::PrinterMode m);
|
QPdfPrintEngine(QPrinter::PrinterMode m);
|
||||||
virtual ~QPdfEngine();
|
virtual ~QPdfPrintEngine();
|
||||||
|
|
||||||
// reimplementations QPaintEngine
|
// reimplementations QPaintEngine
|
||||||
bool begin(QPaintDevice *pdev);
|
bool begin(QPaintDevice *pdev);
|
||||||
@ -108,21 +108,21 @@ public:
|
|||||||
QPrinter::PrinterState state;
|
QPrinter::PrinterState state;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QPdfEngine)
|
Q_DISABLE_COPY(QPdfPrintEngine)
|
||||||
};
|
};
|
||||||
|
|
||||||
class QPdfEnginePrivate : public QPdfBaseEnginePrivate
|
class QPdfPrintEnginePrivate : public QPdfEnginePrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_PUBLIC(QPdfEngine)
|
Q_DECLARE_PUBLIC(QPdfPrintEngine)
|
||||||
public:
|
public:
|
||||||
QPdfEnginePrivate(QPrinter::PrinterMode m);
|
QPdfPrintEnginePrivate(QPrinter::PrinterMode m);
|
||||||
~QPdfEnginePrivate();
|
~QPdfPrintEnginePrivate();
|
||||||
|
|
||||||
bool openPrintDevice();
|
bool openPrintDevice();
|
||||||
void closePrintDevice();
|
void closePrintDevice();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QPdfEnginePrivate)
|
Q_DISABLE_COPY(QPdfPrintEnginePrivate)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void QPrinterPrivate::createDefaultEngines()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QPrinter::PdfFormat: {
|
case QPrinter::PdfFormat: {
|
||||||
QPdfEngine *pdfEngine = new QPdfEngine(printerMode);
|
QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode);
|
||||||
paintEngine = pdfEngine;
|
paintEngine = pdfEngine;
|
||||||
printEngine = pdfEngine;
|
printEngine = pdfEngine;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||||
# include <private/qcups_p.h>
|
# include <private/qcups_p.h>
|
||||||
# include <cups/cups.h>
|
# include <cups/cups.h>
|
||||||
# include <private/qpdf_p.h>
|
# include <private/qprintengine_pdf_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
|
||||||
# include <private/qcups_p.h>
|
# include <private/qcups_p.h>
|
||||||
# include <cups/cups.h>
|
# include <cups/cups.h>
|
||||||
# include <private/qpdf_p.h>
|
# include <private/qprintengine_pdf_p.h>
|
||||||
#else
|
#else
|
||||||
# include <QtCore/qlibrary.h>
|
# include <QtCore/qlibrary.h>
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user