[poppler] poppler/GlobalParams.cc poppler/GlobalParams.h poppler/PSOutputDev.cc poppler/PSOutputDev.h utils/pdftops.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Jan 18 05:49:51 PST 2015
poppler/GlobalParams.cc | 32 --------------------------------
poppler/GlobalParams.h | 7 -------
poppler/PSOutputDev.cc | 18 +++++++-----------
poppler/PSOutputDev.h | 6 ++++++
utils/pdftops.cc | 7 ++++---
5 files changed, 17 insertions(+), 53 deletions(-)
New commits:
commit 4992ff7fa062462507733494827fdad7eaaa95b3
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jan 18 13:57:36 2015 +0100
Move raster mono and resolution from GlobalParams to PSOutputDev
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index c39c725..26c3120 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -606,8 +606,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
psOPI = gFalse;
psASCIIHex = gFalse;
psBinary = gFalse;
- psRasterResolution = 300;
- psRasterMono = gFalse;
textEncoding = new GooString("UTF-8");
#if defined(_WIN32)
textEOL = eolDOS;
@@ -1625,24 +1623,6 @@ GBool GlobalParams::getPSBinary() {
return binary;
}
-double GlobalParams::getPSRasterResolution() {
- double res;
-
- lockGlobalParams;
- res = psRasterResolution;
- unlockGlobalParams;
- return res;
-}
-
-GBool GlobalParams::getPSRasterMono() {
- GBool mono;
-
- lockGlobalParams;
- mono = psRasterMono;
- unlockGlobalParams;
- return mono;
-}
-
GooString *GlobalParams::getTextEncodingName() {
GooString *s;
@@ -1987,18 +1967,6 @@ void GlobalParams::setPSBinary(GBool binary) {
unlockGlobalParams;
}
-void GlobalParams::setPSRasterResolution(double res) {
- lockGlobalParams;
- psRasterResolution = res;
- unlockGlobalParams;
-}
-
-void GlobalParams::setPSRasterMono(GBool mono) {
- lockGlobalParams;
- psRasterMono = mono;
- unlockGlobalParams;
-}
-
void GlobalParams::setTextEncoding(char *encodingName) {
lockGlobalParams;
delete textEncoding;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 6ee258f..98d2bad 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -175,7 +175,6 @@ public:
GBool getPSOPI();
GBool getPSASCIIHex();
GBool getPSBinary();
- double getPSRasterResolution();
GBool getPSRasterMono();
GooString *getTextEncodingName();
EndOfLineKind getTextEOL();
@@ -224,8 +223,6 @@ public:
void setPSOPI(GBool opi);
void setPSASCIIHex(GBool hex);
void setPSBinary(GBool binary);
- void setPSRasterResolution(double res);
- void setPSRasterMono(GBool mono);
void setTextEncoding(char *encodingName);
GBool setTextEOL(char *s);
void setTextPageBreaks(GBool pageBreaks);
@@ -321,10 +318,6 @@ private:
GBool psOPI; // generate PostScript OPI comments?
GBool psASCIIHex; // use ASCIIHex instead of ASCII85?
GBool psBinary; // use binary instead of hex
- double psRasterResolution; // PostScript rasterization resolution (dpi)
- GBool psRasterMono; // true to do PostScript rasterization
- // in monochrome (gray); false to do it
- // in color (RGB/CMYK)
GooString *textEncoding; // encoding (unicodeMap) to use for text
// output
EndOfLineKind textEOL; // type of EOL marker to use for text
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 8f29a31..4139d0b 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1230,6 +1230,8 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
}
// initialize
+ rasterMono = gFalse;
+ rasterResolution = 300;
uncompressPreloadedImages = gFalse;
rasterAntialias = gFalse;
displayText = gTrue;
@@ -3144,8 +3146,6 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
PreScanOutputDev *scan;
GBool rasterize;
#if HAVE_SPLASH
- GBool mono;
- double dpi;
SplashOutputDev *splashOut;
SplashColor paperColor;
PDFRectangle box;
@@ -3182,12 +3182,8 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
}
#if HAVE_SPLASH
- // get the rasterization parameters
- dpi = globalParams->getPSRasterResolution();
- mono = globalParams->getPSRasterMono();
-
// start the PS page
- page->makeBox(dpi, dpi, rotateA, useMediaBox, gFalse,
+ page->makeBox(rasterResolution, rasterResolution, rotateA, useMediaBox, gFalse,
sliceX, sliceY, sliceW, sliceH, &box, &crop);
rotateA += page->getRotate();
if (rotateA >= 360) {
@@ -3195,12 +3191,12 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
} else if (rotateA < 0) {
rotateA += 360;
}
- state = new GfxState(dpi, dpi, &box, rotateA, gFalse);
+ state = new GfxState(rasterResolution, rasterResolution, &box, rotateA, gFalse);
startPage(page->getNum(), state, xref);
delete state;
// set up the SplashOutputDev
- if (mono || level == psLevel1) {
+ if (rasterMono || level == psLevel1) {
numComps = 1;
paperColor[0] = 0xff;
splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse,
@@ -3224,8 +3220,8 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
splashOut->startDoc(doc);
// break the page into stripes
- hDPI2 = xScale * dpi;
- vDPI2 = yScale * dpi;
+ hDPI2 = xScale * rasterResolution;
+ vDPI2 = yScale * rasterResolution;
if (sliceW < 0 || sliceH < 0) {
if (useMediaBox) {
box = *page->getMediaBox();
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 500ad51..46f065c 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -309,6 +309,8 @@ public:
void setDisplayText(GBool display) { displayText = display; }
void setRasterAntialias(GBool a) { rasterAntialias = a; }
+ void setRasterResolution(double r) { rasterResolution = r; }
+ void setRasterMono(GBool b) { rasterMono = b; }
void setUncompressPreloadedImages(GBool b) { uncompressPreloadedImages = b; }
private:
@@ -493,6 +495,10 @@ private:
GBool displayText; // displayText
GBool rasterAntialias; // antialias on rasterize
GBool uncompressPreloadedImages;
+ double rasterResolution; // PostScript rasterization resolution (dpi)
+ GBool rasterMono; // true to do PostScript rasterization
+ // in monochrome (gray); false to do it
+ // in color (RGB/CMYK)
#if OPI_SUPPORT
int opi13Nest; // nesting level of OPI 1.3 objects
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 43234db..391ec04 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -297,9 +297,6 @@ int main(int argc, char *argv[]) {
if (level1 || level1Sep || level2 || level2Sep || level3 || level3Sep) {
globalParams->setPSLevel(level);
}
- if (splashResolution > 0) {
- globalParams->setPSRasterResolution(splashResolution);
- }
if (noEmbedT1Fonts) {
globalParams->setPSEmbedType1(!noEmbedT1Fonts);
}
@@ -423,6 +420,10 @@ int main(int argc, char *argv[]) {
}
}
+ if (splashResolution > 0) {
+ psOut->setRasterResolution(splashResolution);
+ }
+
psOut->setRasterAntialias(rasterAntialias);
if (psOut->isOk()) {
for (int i = firstPage; i <= lastPage; ++i) {
More information about the poppler
mailing list