~ubuntu-branches/ubuntu/lucid/xpdf/lucid-updates

« back to all changes in this revision

Viewing changes to splash/SplashPath.cc

  • Committer: Bazaar Package Importer
  • Author(s): Andy Price
  • Date: 2007-05-17 22:04:33 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517220433-gzcx2lrvllkbl7mr
Tags: 3.02-1ubuntu1
* Merge from Debian unstable (LP: #113365), remaining changes:
  - Added back 09_xpdfrc_manpage.dpatch (LP #71753)
  - Set Ubuntu maintainer

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
  flags = NULL;
36
36
  length = size = 0;
37
37
  curSubpath = 0;
 
38
  hints = NULL;
 
39
  hintsLength = hintsSize = 0;
38
40
}
39
41
 
40
42
SplashPath::SplashPath(SplashPath *path) {
45
47
  memcpy(pts, path->pts, length * sizeof(SplashPathPoint));
46
48
  memcpy(flags, path->flags, length * sizeof(Guchar));
47
49
  curSubpath = path->curSubpath;
 
50
  if (path->hints) {
 
51
    hintsLength = hintsSize = path->hintsLength;
 
52
    hints = (SplashPathHint *)gmallocn(hintsSize, sizeof(SplashPathHint));
 
53
    memcpy(hints, path->hints, hintsLength * sizeof(SplashPathHint));
 
54
  } else {
 
55
    hints = NULL;
 
56
  }
48
57
}
49
58
 
50
59
SplashPath::~SplashPath() {
51
60
  gfree(pts);
52
61
  gfree(flags);
 
62
  gfree(hints);
53
63
}
54
64
 
55
65
// Add space for <nPts> more points.
126
136
  return splashOk;
127
137
}
128
138
 
129
 
SplashError SplashPath::arcCWTo(SplashCoord x1, SplashCoord y1,
130
 
                                SplashCoord xc, SplashCoord yc) {
131
 
  if (noCurrentPoint()) {
132
 
    return splashErrNoCurPt;
133
 
  }
134
 
  flags[length-1] &= ~splashPathLast;
135
 
  grow(2);
136
 
  pts[length].x = xc;
137
 
  pts[length].y = yc;
138
 
  flags[length] = splashPathArcCW;
139
 
  ++length;
140
 
  pts[length].x = x1;
141
 
  pts[length].y = y1;
142
 
  flags[length] = splashPathLast;
143
 
  ++length;
144
 
  return splashOk;
145
 
}
146
 
 
147
139
SplashError SplashPath::close() {
148
140
  if (noCurrentPoint()) {
149
141
    return splashErrNoCurPt;
159
151
  return splashOk;
160
152
}
161
153
 
 
154
void SplashPath::addStrokeAdjustHint(int ctrl0, int ctrl1,
 
155
                                     int firstPt, int lastPt) {
 
156
  if (hintsLength == hintsSize) {
 
157
    hintsSize = hintsLength ? 2 * hintsLength : 8;
 
158
    hints = (SplashPathHint *)greallocn(hints, hintsSize,
 
159
                                        sizeof(SplashPathHint));
 
160
  }
 
161
  hints[hintsLength].ctrl0 = ctrl0;
 
162
  hints[hintsLength].ctrl1 = ctrl1;
 
163
  hints[hintsLength].firstPt = firstPt;
 
164
  hints[hintsLength].lastPt = lastPt;
 
165
  ++hintsLength;
 
166
}
 
167
 
162
168
void SplashPath::offset(SplashCoord dx, SplashCoord dy) {
163
169
  int i;
164
170