summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/PsSpecialHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/dvisvgm/src/PsSpecialHandler.cpp')
-rw-r--r--dviware/dvisvgm/src/PsSpecialHandler.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/dviware/dvisvgm/src/PsSpecialHandler.cpp b/dviware/dvisvgm/src/PsSpecialHandler.cpp
index cb3a8a6bac..a2dc107215 100644
--- a/dviware/dvisvgm/src/PsSpecialHandler.cpp
+++ b/dviware/dvisvgm/src/PsSpecialHandler.cpp
@@ -28,7 +28,7 @@
#include "Message.hpp"
#include "PathClipper.hpp"
#include "PSPattern.hpp"
-#include "PSPreviewFilter.hpp"
+#include "PSPreviewHandler.hpp"
#include "PsSpecialHandler.hpp"
#include "SpecialActions.hpp"
#include "SVGElement.hpp"
@@ -47,7 +47,7 @@ string PsSpecialHandler::BITMAP_FORMAT;
bool PsSpecialHandler::EMBED_BITMAP_DATA = false;
-PsSpecialHandler::PsSpecialHandler () : _psi(this), _previewFilter(_psi)
+PsSpecialHandler::PsSpecialHandler () : _psi(this), _previewHandler(_psi)
{
_psi.setImageDevice(BITMAP_FORMAT);
}
@@ -123,9 +123,8 @@ void PsSpecialHandler::enterBodySection () {
// Check for information generated by preview.sty. If the tightpage options
// was set, don't execute the bop-hook but allow the PS filter to read
// the bbox data present at the beginning of the page.
- _psi.setFilter(&_previewFilter);
- _previewFilter.activate();
- if (!_previewFilter.tightpage())
+ _previewHandler.init();
+ if (!_previewHandler.tightpage())
_psi.execute("userdict/bop-hook known{bop-hook}if\n", false);
}
}
@@ -155,9 +154,7 @@ void PsSpecialHandler::executeAndSync (istream &is, bool updatePos) {
_actions->getColor().getRGB(r, g, b);
ostringstream oss;
oss << '\n' << r << ' ' << g << ' ' << b << " setrgbcolor ";
- PSFilter *filter = _psi.setFilter(nullptr); // don't apply any filters here
_psi.execute(oss.str(), false);
- _psi.setFilter(filter);
}
_psi.execute(is);
if (updatePos) {
@@ -540,14 +537,15 @@ void PsSpecialHandler::dviBeginPage (unsigned int pageno, SpecialActions &action
void PsSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) {
+ _previewHandler.readDataFromStack();
BoundingBox bbox;
- if (_previewFilter.getBoundingBox(bbox)) { // is there any data written by preview package?
+ if (_previewHandler.getBoundingBox(bbox)) { // is there any data written by preview package?
double w=0, h=0, d=0;
if (actions.getBBoxFormatString() == "preview" || actions.getBBoxFormatString() == "min") {
if (actions.getBBoxFormatString() == "preview") {
- w = max(0.0, _previewFilter.width());
- h = max(0.0, _previewFilter.height());
- d = max(0.0, _previewFilter.depth());
+ w = max(0.0, _previewHandler.width());
+ h = max(0.0, _previewHandler.height());
+ d = max(0.0, _previewHandler.depth());
actions.bbox() = bbox;
Message::mstream() << "\napplying bounding box set by";
}
@@ -557,7 +555,7 @@ void PsSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) {
d = max(0.0, actions.bbox().maxY());
Message::mstream() << "\ncomputing extents based on data set by";
}
- Message::mstream() << " preview package (version " << _previewFilter.version() << ")\n";
+ Message::mstream() << " preview package (version " << _previewHandler.version() << ")\n";
// apply page transformations to box extents
Matrix pagetrans = actions.getPageTransformation();