~ubuntu-branches/debian/experimental/cups-filters/experimental

« back to all changes in this revision

Viewing changes to filter/pdftoopvp/oprs/OPVPSplashState.cxx

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2012-07-22 18:57:32 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20120722185732-26kkte5p1lth3rt5
Tags: 1.0.20-0bzr1
* New upstream release
   - pdftops: Added another workaround for Kyocera printers: Some
     models get very slow on images which request interpolation,
     so now we remove the image interpolation requests by additional
     PostScript code only inserted for Kyocera printers (LP: #1026974).
   - Made the Poppler-based filters pdftopdf and pdftoopvp build with
     both Poppler 0.18.x and 0.20.x (Upstream bug #1055).
   - Fixes according to Coverity scan results (Upstream bug #1054).
   - Switched build system to autotools. This especially fixes several
     build problems in Gentoo. Also build-tested with CUPS 1.6.0b1.
   - Fixes for compatibility with clang/gcc-4.7.
   - textonly: Filter did not work as a pipe with copies=1 (Upstream bug
     #1032).
   - texttopdf: Avoid trimming the results of FcFontSort(), as this may
     miss some reasonable candidates under certain circumstances. BTW,
     fix passing a non-pointer as a pointer to "result" (Closes: #670055).
   - Corrected documentation. The option for the maximum image rendering
     resolution in pdftops is "pdftops-max-image-resolution", not
     "pdftops-max-image-resolution-default".
* debian/patches/fcfontsort-no-trim.patch: Removed, fixed upstream.
* debian/rules: Updated options for ./configure and make for the new autotools
  build system.
* debian/watch: Switched to bz2 upstream packages.
* debian/rules, debian/copyright, debian/cups-filters.docs: Updated for
  renamed documentation files.
* debian/control, debian/libfontembed1.install,
  debian/libfontembed-dev.install: Added new binary packages for libfontembed.
* debian/copyright: Updated for recent file additions, and rearrangement of
  directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//========================================================================
 
2
//
 
3
// SplashState.cc
 
4
//
 
5
//========================================================================
 
6
 
 
7
#include <config.h>
 
8
 
 
9
#ifdef USE_GCC_PRAGMAS
 
10
#pragma implementation
 
11
#endif
 
12
 
 
13
#include <string.h>
 
14
#ifdef HAVE_CPP_POPPLER_VERSION_H
 
15
#include "cpp/poppler-version.h"
 
16
#endif
 
17
#include "goo/gmem.h"
 
18
#include "splash/SplashPattern.h"
 
19
#include "splash/SplashScreen.h"
 
20
#include "splash/SplashBitmap.h"
 
21
#include "splash/SplashState.h"
 
22
#include "OPVPSplashState.h"
 
23
#include "OPVPSplashClip.h"
 
24
 
 
25
//------------------------------------------------------------------------
 
26
// SplashState
 
27
//------------------------------------------------------------------------
 
28
 
 
29
// number of components in each color mode
 
30
static int opvpSplashColorModeNComps[] = {
 
31
  1, 1, 3, 3, 4
 
32
};
 
33
 
 
34
OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
 
35
                         SplashScreenParams *screenParams) {
 
36
  SplashColor color;
 
37
 
 
38
  matrix[0] = 1;  matrix[1] = 0;
 
39
  matrix[2] = 0;  matrix[3] = 1;
 
40
  matrix[4] = 0;  matrix[5] = 0;
 
41
  memset(&color, 0, sizeof(SplashColor));
 
42
  strokePattern = new SplashSolidColor(color);
 
43
  fillPattern = new SplashSolidColor(color);
 
44
  screen = new SplashScreen(screenParams);
 
45
  blendFunc = NULL;
 
46
  strokeAlpha = 1;
 
47
  fillAlpha = 1;
 
48
  lineWidth = 0;
 
49
  lineCap = splashLineCapButt;
 
50
  lineJoin = splashLineJoinMiter;
 
51
  miterLimit = 10;
 
52
  flatness = 1;
 
53
  lineDash = NULL;
 
54
  lineDashLength = 0;
 
55
  lineDashPhase = 0;
 
56
  strokeAdjust = gFalse;
 
57
  clip = new OPVPSplashClip(0, 0, width - 0.001,
 
58
               height - 0.001, vectorAntialias);
 
59
  softMask = NULL;
 
60
  deleteSoftMask = gFalse;
 
61
  inNonIsolatedGroup = gFalse;
 
62
  next = NULL;
 
63
}
 
64
 
 
65
OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
 
66
                         SplashScreen *screenA) {
 
67
  SplashColor color;
 
68
 
 
69
  matrix[0] = 1;  matrix[1] = 0;
 
70
  matrix[2] = 0;  matrix[3] = 1;
 
71
  matrix[4] = 0;  matrix[5] = 0;
 
72
  memset(&color, 0, sizeof(SplashColor));
 
73
  strokePattern = new SplashSolidColor(color);
 
74
  fillPattern = new SplashSolidColor(color);
 
75
  screen = screenA->copy();
 
76
  blendFunc = NULL;
 
77
  strokeAlpha = 1;
 
78
  fillAlpha = 1;
 
79
  lineWidth = 0;
 
80
  lineCap = splashLineCapButt;
 
81
  lineJoin = splashLineJoinMiter;
 
82
  miterLimit = 10;
 
83
  flatness = 1;
 
84
  lineDash = NULL;
 
85
  lineDashLength = 0;
 
86
  lineDashPhase = 0;
 
87
  strokeAdjust = gFalse;
 
88
  clip = new OPVPSplashClip(0, 0, width - 0.001,
 
89
               height - 0.001, vectorAntialias);
 
90
  softMask = NULL;
 
91
  deleteSoftMask = gFalse;
 
92
  inNonIsolatedGroup = gFalse;
 
93
  next = NULL;
 
94
}
 
95
 
 
96
OPVPSplashState::OPVPSplashState(OPVPSplashState *state) {
 
97
  memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord));
 
98
  strokePattern = state->strokePattern->copy();
 
99
  fillPattern = state->fillPattern->copy();
 
100
  screen = state->screen->copy();
 
101
  blendFunc = state->blendFunc;
 
102
  strokeAlpha = state->strokeAlpha;
 
103
  fillAlpha = state->fillAlpha;
 
104
  lineWidth = state->lineWidth;
 
105
  lineCap = state->lineCap;
 
106
  lineJoin = state->lineJoin;
 
107
  miterLimit = state->miterLimit;
 
108
  flatness = state->flatness;
 
109
  if (state->lineDash) {
 
110
    lineDashLength = state->lineDashLength;
 
111
    lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
 
112
    memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
 
113
  } else {
 
114
    lineDash = NULL;
 
115
    lineDashLength = 0;
 
116
  }
 
117
  lineDashPhase = state->lineDashPhase;
 
118
  strokeAdjust = state->strokeAdjust;
 
119
  clip = state->clip->copy();
 
120
  softMask = state->softMask;
 
121
  deleteSoftMask = gFalse;
 
122
  inNonIsolatedGroup = state->inNonIsolatedGroup;
 
123
  next = NULL;
 
124
}
 
125
 
 
126
OPVPSplashState::~OPVPSplashState() {
 
127
  delete strokePattern;
 
128
  delete fillPattern;
 
129
  delete screen;
 
130
  gfree(lineDash);
 
131
  delete clip;
 
132
  if (deleteSoftMask && softMask) {
 
133
    delete softMask;
 
134
  }
 
135
}
 
136
 
 
137
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
 
138
void OPVPSplashState::setState(Splash *osplash) {
 
139
  osplash->setMatrix(matrix);
 
140
  osplash->setFlatness(flatness);
 
141
  osplash->setLineDash(lineDash,lineDashLength,lineDashPhase);
 
142
  osplash->setLineCap(lineCap);
 
143
  osplash->setStrokeAdjust(strokeAdjust);
 
144
  osplash->setMiterLimit(miterLimit);
 
145
  osplash->setLineJoin(lineJoin);
 
146
}
 
147
#endif
 
148
 
 
149
void OPVPSplashState::setStrokePattern(SplashPattern *strokePatternA) {
 
150
  delete strokePattern;
 
151
  strokePattern = strokePatternA;
 
152
}
 
153
 
 
154
void OPVPSplashState::setFillPattern(SplashPattern *fillPatternA) {
 
155
  delete fillPattern;
 
156
  fillPattern = fillPatternA;
 
157
}
 
158
 
 
159
void OPVPSplashState::setScreen(SplashScreen *screenA) {
 
160
  delete screen;
 
161
  screen = screenA;
 
162
}
 
163
 
 
164
void OPVPSplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
 
165
                              SplashCoord lineDashPhaseA) {
 
166
  gfree(lineDash);
 
167
  lineDashLength = lineDashLengthA;
 
168
  if (lineDashLength > 0) {
 
169
    lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
 
170
    memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
 
171
  } else {
 
172
    lineDash = NULL;
 
173
  }
 
174
  lineDashPhase = lineDashPhaseA;
 
175
}
 
176
 
 
177
void OPVPSplashState::setSoftMask(SplashBitmap *softMaskA) {
 
178
  if (deleteSoftMask) {
 
179
    delete softMask;
 
180
  }
 
181
  softMask = softMaskA;
 
182
  deleteSoftMask = gTrue;
 
183
}