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

« back to all changes in this revision

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