Commit 4992ff7f authored by Albert Astals Cid's avatar Albert Astals Cid

Move raster mono and resolution from GlobalParams to PSOutputDev

parent 54908f67
......@@ -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;
......
......@@ -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
......
......@@ -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();
......
......@@ -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
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment