Commit fdb0a4a2 authored by Jeff Muizelaar's avatar Jeff Muizelaar

Avoid prescaling images when printing.

Adds a function for letting the CairoOutputDev know whether it is targetting a
screen or not. It then uses this knowledge to avoid prescaling images. This way
cairo gets the full resolution image for use in the printed output.
parent 5915e57e
......@@ -425,6 +425,7 @@ _poppler_page_render (PopplerPage *page,
output_dev = page->document->output_dev;
output_dev->setCairo (cairo);
output_dev->setPrinting (printing);
/* NOTE: instead of passing -1 we should/could use cairo_clip_extents()
* to get a bounding box */
......
......@@ -88,6 +88,7 @@ CairoOutputDev::CairoOutputDev() {
cairo = NULL;
currentFont = NULL;
prescaleImages = gTrue;
printing = gTrue;
groupColorSpaceStack = NULL;
group = NULL;
......@@ -908,7 +909,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
cairo_get_matrix (cairo, &matrix);
//XXX: it is possible that we should only do sub pixel positioning if
// we are rendering fonts */
if (prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
drawImageMaskPrescaled(state, ref, str, width, height, invert, inlineImg);
} else {
drawImageMaskRegular(state, ref, str, width, height, invert, inlineImg);
......
......@@ -193,6 +193,7 @@ public:
GBool isReverseVideo() { return gFalse; }
void setCairo (cairo_t *cr);
void setPrinting (GBool printing) { this->printing = printing; }
protected:
void doPath(cairo_t *cairo, GfxState *state, GfxPath *path);
......@@ -210,6 +211,7 @@ protected:
cairo_t *cairo;
cairo_matrix_t orig_matrix;
GBool needFontUpdate; // set when the font needs to be updated
GBool printing;
cairo_surface_t *surface;
cairo_glyph_t *glyphs;
int glyphCount;
......
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