PDF doesn't require the alpha paintengine
Remove the inheritance from the alpha paint engine for the PDF generator. The alpha engine was only required to support transparency on Postscript. Change-Id: If09a00a3123f73e4c36f708651a3abae014187a3 Reviewed-on: http://codereview.qt.nokia.com/3204 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
This commit is contained in:
parent
2df117b8ad
commit
e0972ba5ed
@ -928,12 +928,12 @@ void QPdfPage::streamImage(int w, int h, int object)
|
|||||||
|
|
||||||
|
|
||||||
QPdfEngine::QPdfEngine(QPdfEnginePrivate &dd)
|
QPdfEngine::QPdfEngine(QPdfEnginePrivate &dd)
|
||||||
: QAlphaPaintEngine(dd, qt_pdf_decide_features())
|
: QPaintEngine(dd, qt_pdf_decide_features())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QPdfEngine::QPdfEngine()
|
QPdfEngine::QPdfEngine()
|
||||||
: QAlphaPaintEngine(*new QPdfEnginePrivate(), qt_pdf_decide_features())
|
: QPaintEngine(*new QPdfEnginePrivate(), qt_pdf_decide_features())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,11 +985,6 @@ void QPdfEngine::drawRects (const QRectF *rects, int rectCount)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfEngine);
|
||||||
if (d->useAlphaEngine) {
|
|
||||||
QAlphaPaintEngine::drawRects(rects, rectCount);
|
|
||||||
if (!continueCall())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->clipEnabled && d->allClipped)
|
if (d->clipEnabled && d->allClipped)
|
||||||
return;
|
return;
|
||||||
@ -1018,12 +1013,6 @@ void QPdfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
|
|||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
|
||||||
QAlphaPaintEngine::drawPolygon(points, pointCount, mode);
|
|
||||||
if (!continueCall())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!points || !pointCount)
|
if (!points || !pointCount)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1060,12 +1049,6 @@ void QPdfEngine::drawPath (const QPainterPath &p)
|
|||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
|
||||||
QAlphaPaintEngine::drawPath(p);
|
|
||||||
if (!continueCall())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->clipEnabled && d->allClipped)
|
if (d->clipEnabled && d->allClipped)
|
||||||
return;
|
return;
|
||||||
if (!d->hasPen && !d->hasBrush)
|
if (!d->hasPen && !d->hasBrush)
|
||||||
@ -1176,12 +1159,6 @@ void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
|
|||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
|
||||||
QAlphaPaintEngine::drawTextItem(p, textItem);
|
|
||||||
if (!continueCall())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!d->hasPen || (d->clipEnabled && d->allClipped))
|
if (!d->hasPen || (d->clipEnabled && d->allClipped))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1213,12 +1190,6 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
|
|||||||
{
|
{
|
||||||
Q_D(QPdfEngine);
|
Q_D(QPdfEngine);
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
|
||||||
QAlphaPaintEngine::updateState(state);
|
|
||||||
if (!continueCall())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPaintEngine::DirtyFlags flags = state.state();
|
QPaintEngine::DirtyFlags flags = state.state();
|
||||||
|
|
||||||
if (flags & DirtyTransform)
|
if (flags & DirtyTransform)
|
||||||
@ -1335,31 +1306,6 @@ void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op)
|
|||||||
d->clips.clear();
|
d->clips.clear();
|
||||||
d->clips.append(path);
|
d->clips.append(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->useAlphaEngine) {
|
|
||||||
// if we have an alpha region, we have to subtract that from the
|
|
||||||
// any existing clip region since that region will be filled in
|
|
||||||
// later with images
|
|
||||||
QPainterPath alphaClip = qt_regionToPath(alphaClipping());
|
|
||||||
if (!alphaClip.isEmpty()) {
|
|
||||||
if (!d->clipEnabled) {
|
|
||||||
QRect r = d->fullPage ? d->paperRect() : d->pageRect();
|
|
||||||
QPainterPath dev;
|
|
||||||
dev.addRect(QRect(0, 0, r.width(), r.height()));
|
|
||||||
if (path.isEmpty())
|
|
||||||
path = dev;
|
|
||||||
else
|
|
||||||
path = path.intersected(dev);
|
|
||||||
d->clipEnabled = true;
|
|
||||||
} else {
|
|
||||||
path = painter()->clipPath();
|
|
||||||
path = d->stroker.matrix.map(path);
|
|
||||||
}
|
|
||||||
path = path.subtracted(alphaClip);
|
|
||||||
d->clips.clear();
|
|
||||||
d->clips.append(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPdfEngine::setPen()
|
void QPdfEngine::setPen()
|
||||||
@ -1517,7 +1463,6 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
|
|||||||
|
|
||||||
QPdfEnginePrivate::QPdfEnginePrivate()
|
QPdfEnginePrivate::QPdfEnginePrivate()
|
||||||
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
|
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
|
||||||
useAlphaEngine(false),
|
|
||||||
outDevice(0), fd(-1),
|
outDevice(0), fd(-1),
|
||||||
fullPage(false), embedFonts(true),
|
fullPage(false), embedFonts(true),
|
||||||
landscape(false),
|
landscape(false),
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
#include "QtCore/qstring.h"
|
#include "QtCore/qstring.h"
|
||||||
#include "QtCore/qvector.h"
|
#include "QtCore/qvector.h"
|
||||||
#include "private/qstroker_p.h"
|
#include "private/qstroker_p.h"
|
||||||
#include "private/qpaintengine_alpha_p.h"
|
#include "private/qpaintengine_p.h"
|
||||||
#include "private/qfontengine_p.h"
|
#include "private/qfontengine_p.h"
|
||||||
#include "private/qfontsubset_p.h"
|
#include "private/qfontsubset_p.h"
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ private:
|
|||||||
|
|
||||||
class QPdfEnginePrivate;
|
class QPdfEnginePrivate;
|
||||||
|
|
||||||
class QPdfEngine : public QAlphaPaintEngine
|
class QPdfEngine : public QPaintEngine
|
||||||
{
|
{
|
||||||
Q_DECLARE_PRIVATE(QPdfEngine)
|
Q_DECLARE_PRIVATE(QPdfEngine)
|
||||||
public:
|
public:
|
||||||
@ -209,7 +209,7 @@ private:
|
|||||||
void updateClipPath(const QPainterPath & path, Qt::ClipOperation op);
|
void updateClipPath(const QPainterPath & path, Qt::ClipOperation op);
|
||||||
};
|
};
|
||||||
|
|
||||||
class QPdfEnginePrivate : public QAlphaPaintEnginePrivate
|
class QPdfEnginePrivate : public QPaintEnginePrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_PUBLIC(QPdfEngine)
|
Q_DECLARE_PUBLIC(QPdfEngine)
|
||||||
public:
|
public:
|
||||||
@ -259,7 +259,6 @@ public:
|
|||||||
bool hasBrush;
|
bool hasBrush;
|
||||||
bool simplePen;
|
bool simplePen;
|
||||||
qreal opacity;
|
qreal opacity;
|
||||||
bool useAlphaEngine;
|
|
||||||
|
|
||||||
QHash<QFontEngine::FaceId, QFontSubset *> fonts;
|
QHash<QFontEngine::FaceId, QFontSubset *> fonts;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user