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

« back to all changes in this revision

Viewing changes to pdftoopvp/oprs/OPVPSplashClip.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
 
#include <config.h>
2
 
#include "splash/SplashXPathScanner.h"
3
 
#include "OPVPSplashClip.h"
4
 
 
5
 
void OPVPSplashClip::getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA)
6
 
{
7
 
  int i;
8
 
  int cxMin = splashRound(xMin), cyMin = splashRound(yMin);
9
 
  int cxMax = splashRound(xMax), cyMax = splashRound(yMax);
10
 
  int txMin, tyMin, txMax, tyMax;
11
 
 
12
 
  for (i = 0; i < length; ++i) {
13
 
    scanners[i]->getBBox(&txMin,&tyMin,&txMax,&tyMax);
14
 
    if (txMin > cxMin) cxMin = txMin;
15
 
    if (tyMin > cyMin) cyMin = tyMin;
16
 
    if (txMax < cxMax) cxMax = txMax;
17
 
    if (tyMax < cyMax) cyMax = tyMax;
18
 
  }
19
 
  *xMinA = cxMin;
20
 
  *yMinA = cyMin;
21
 
  *xMaxA = cxMax;
22
 
  *yMaxA = cyMax;
23
 
}
24
 
 
25
 
OPVPSplashPath *OPVPSplashClip::makePath()
26
 
{
27
 
  int i,j;
28
 
  int y, x0, x1;
29
 
  int txMin, tyMin, txMax, tyMax;
30
 
  int tsxMin, tsyMin, tsxMax, tsyMax;
31
 
  Guchar *cbuf,*tbuf;
32
 
  int blen;
33
 
  OPVPSplashPath *p = new OPVPSplashPath();
34
 
 
35
 
  getBBox(&txMin,&tyMin,&txMax,&tyMax);
36
 
  if (txMin > txMax || tyMin > tyMax) return p;
37
 
  blen = txMax-txMin+1;
38
 
  cbuf = new Guchar[blen];
39
 
  tbuf = new Guchar[blen];
40
 
  
41
 
  /* dummy call to clear state */
42
 
  scanners[0]->getBBox(&tsxMin,&tsyMin,&tsxMax,&tsyMax);
43
 
  scanners[0]->getNextSpan(tsyMin-2,&x0,&x1);
44
 
 
45
 
  for (y = tyMin;y <= tyMax;y++) {
46
 
    /* clear buffer */
47
 
    for (i = 0;i < blen;i++) {
48
 
      cbuf[i] = 0;
49
 
    }
50
 
    while (scanners[0]->getNextSpan(y,&x0,&x1)) {
51
 
      if (x0 < txMin) x0 = txMin;
52
 
      if (x1 > txMax) x1 = txMax;
53
 
      for (i = x0;i < x1;i++) {
54
 
        cbuf[i-txMin] = 1;
55
 
      }
56
 
    }
57
 
    for (j = 1; j < length; ++j) {
58
 
      /* clear buffer */
59
 
      for (i = 0;i < blen;i++) {
60
 
        tbuf[i] = 0;
61
 
      }
62
 
      while (scanners[j]->getNextSpan(y,&x0,&x1)) {
63
 
        if (x0 < txMin) x0 = txMin;
64
 
        if (x1 > txMax) x1 = txMax;
65
 
        for (i = x0;i < x1;i++) {
66
 
          tbuf[i-txMin] = 1;
67
 
        }
68
 
      }
69
 
      /* and buffer */
70
 
      for (i = 0;i < blen;i++) {
71
 
        cbuf[i] &= tbuf[i];
72
 
      }
73
 
    }
74
 
    /* scan buffer and add path */
75
 
    for (i = 0;i < blen;i = j) {
76
 
      if (cbuf[i] != 0) {
77
 
        p->moveTo(i+txMin,y);
78
 
        for (j = i+1;j < blen && cbuf[j] != 0;j++);
79
 
        p->lineTo(j-1+txMin,y);
80
 
        p->lineTo(j-1+txMin,y+1);
81
 
        p->lineTo(i+txMin,y+1);
82
 
        p->close();
83
 
      } else {
84
 
        j = i+1;
85
 
      }
86
 
    }
87
 
  }
88
 
  delete[] cbuf;
89
 
  delete[] tbuf;
90
 
  return p;
91
 
}