summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpdf.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-08-17 11:26:51 +0200
committerLars Knoll <lars.knoll@nokia.com>2011-08-19 09:16:12 +0200
commit9ebdc333a6a6485fd60a50a742a1d6edec211f53 (patch)
tree29f47352fac722f29bf3e394214b375977cdcea7 /src/gui/painting/qpdf.cpp
parent64f94fa373900aca357f5f94c5ef16f481dc11b7 (diff)
Introduce a paged paintdevice and use it
Introduce a QPagedPaintDevice class that has a newPage() method and page dimensions. QPdfWriter and QPrinter inherit from it. Add a bit of API to QPdfWriter. Change-Id: Ibf23e7fe741f3a5ed854faf5d249a272acc75f35 Reviewed-on: http://codereview.qt.nokia.com/3206 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/gui/painting/qpdf.cpp')
-rw-r--r--src/gui/painting/qpdf.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index dce3eec6fa..47687e4a53 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1463,7 +1463,7 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
QPdfEnginePrivate::QPdfEnginePrivate()
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
- outDevice(0), fd(-1),
+ outDevice(0), ownsDevice(false),
fullPage(false), embedFonts(true),
landscape(false),
grayscale(false),
@@ -1497,6 +1497,7 @@ bool QPdfEngine::begin(QPaintDevice *pdev)
} else {
return false;
}
+ d->ownsDevice = true;
}
d->postscript = false;
@@ -1543,15 +1544,8 @@ bool QPdfEngine::end()
delete d->currentPage;
d->currentPage = 0;
- if (d->outDevice) {
+ if (d->outDevice && d->ownsDevice) {
d->outDevice->close();
- if (d->fd >= 0)
- #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400
- ::_close(d->fd);
- #else
- ::close(d->fd);
- #endif
- d->fd = -1;
delete d->outDevice;
d->outDevice = 0;
}