From e0972ba5edbd25ba8f0521da38c68cdb019b28a9 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2011 11:43:58 +0200 Subject: 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 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpdf.cpp | 59 ++--------------------------------------------- src/gui/painting/qpdf_p.h | 7 +++--- 2 files changed, 5 insertions(+), 61 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 5f496777af..dce3eec6fa 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -928,12 +928,12 @@ void QPdfPage::streamImage(int w, int h, int object) QPdfEngine::QPdfEngine(QPdfEnginePrivate &dd) - : QAlphaPaintEngine(dd, qt_pdf_decide_features()) + : QPaintEngine(dd, qt_pdf_decide_features()) { } 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; Q_D(QPdfEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawRects(rects, rectCount); - if (!continueCall()) - return; - } if (d->clipEnabled && d->allClipped) return; @@ -1018,12 +1013,6 @@ void QPdfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM { Q_D(QPdfEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawPolygon(points, pointCount, mode); - if (!continueCall()) - return; - } - if (!points || !pointCount) return; @@ -1060,12 +1049,6 @@ void QPdfEngine::drawPath (const QPainterPath &p) { Q_D(QPdfEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawPath(p); - if (!continueCall()) - return; - } - if (d->clipEnabled && d->allClipped) return; if (!d->hasPen && !d->hasBrush) @@ -1176,12 +1159,6 @@ void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) { Q_D(QPdfEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawTextItem(p, textItem); - if (!continueCall()) - return; - } - if (!d->hasPen || (d->clipEnabled && d->allClipped)) return; @@ -1213,12 +1190,6 @@ void QPdfEngine::updateState(const QPaintEngineState &state) { Q_D(QPdfEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::updateState(state); - if (!continueCall()) - return; - } - QPaintEngine::DirtyFlags flags = state.state(); if (flags & DirtyTransform) @@ -1335,31 +1306,6 @@ void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) d->clips.clear(); 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() @@ -1517,7 +1463,6 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const QPdfEnginePrivate::QPdfEnginePrivate() : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), - useAlphaEngine(false), outDevice(0), fd(-1), fullPage(false), embedFonts(true), landscape(false), diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 6cd0700554..b373fcec67 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -56,7 +56,7 @@ #include "QtCore/qstring.h" #include "QtCore/qvector.h" #include "private/qstroker_p.h" -#include "private/qpaintengine_alpha_p.h" +#include "private/qpaintengine_p.h" #include "private/qfontengine_p.h" #include "private/qfontsubset_p.h" @@ -164,7 +164,7 @@ private: class QPdfEnginePrivate; -class QPdfEngine : public QAlphaPaintEngine +class QPdfEngine : public QPaintEngine { Q_DECLARE_PRIVATE(QPdfEngine) public: @@ -209,7 +209,7 @@ private: void updateClipPath(const QPainterPath & path, Qt::ClipOperation op); }; -class QPdfEnginePrivate : public QAlphaPaintEnginePrivate +class QPdfEnginePrivate : public QPaintEnginePrivate { Q_DECLARE_PUBLIC(QPdfEngine) public: @@ -259,7 +259,6 @@ public: bool hasBrush; bool simplePen; qreal opacity; - bool useAlphaEngine; QHash fonts; -- cgit v1.2.3