~ubuntu-branches/ubuntu/gutsy/plotutils/gutsy

« back to all changes in this revision

Viewing changes to libxmi/mi_widelin.c

  • Committer: Bazaar Package Importer
  • Author(s): Floris Bruynooghe
  • Date: 2007-05-10 19:48:54 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070510194854-mrr3lgwzpxd8hovo
Tags: 2.5-2
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the GNU libxmi package.  
 
2
 
 
3
   Copyright (C) 1985, 1986, 1987, 1988, 1989, X Consortium.  For an
 
4
   associated permission notice, see the accompanying file README-X.
 
5
   
 
6
   GNU enhancements Copyright (C) 1998, 1999, 2000, 2005, Free Software
 
7
   Foundation, Inc.
 
8
 
 
9
   The GNU libxmi package is free software.  You may redistribute it
 
10
   and/or modify it under the terms of the GNU General Public License as
 
11
   published by the Free Software foundation; either version 2, or (at your
 
12
   option) any later version.
 
13
 
 
14
   The GNU libxmi package is distributed in the hope that it will be
 
15
   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
   General Public License for more details.
 
18
 
 
19
   You should have received a copy of the GNU General Public License along
 
20
   with the GNU plotutils package; see the file COPYING.  If not, write to
 
21
   the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
 
22
   Boston, MA 02110-1301, USA. */
 
23
 
1
24
#include "sys-defines.h"
2
25
#include "extern.h"
3
26
 
26
49
#define hypot(x, y) sqrt((x)*(x) + (y)*(y))
27
50
 
28
51
/* internal functions that do painting of pixels */
29
 
static void miFillPolyHelper ____P((miPaintedSet *paintedSet, miPixel pixel, int y, unsigned int overall_height, PolyEdge *left, PolyEdge *right, int left_count, int right_count));
30
 
static void miFillRectPolyHelper ____P((miPaintedSet *paintedSet, miPixel pixel, int x, int y, unsigned int w, unsigned int h));
31
 
static void miLineArc ____P((miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, LineFace *leftFace, LineFace *rightFace, double xorg, double yorg, bool isInt));
32
 
static void miLineJoin ____P((miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, LineFace *pLeft, LineFace *pRight));
33
 
static void miLineProjectingCap ____P((miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, const LineFace *face, bool isLeft, bool isInt));
34
 
static void miWideDashSegment ____P((miPaintedSet *paintedSet, const miGC *pGC, int *pDashNum, int *pDashIndex, int *pDashOffset, int x1, int y1, int x2, int y2, bool projectLeft, bool projectRight, LineFace *leftFace, LineFace *rightFace));
35
 
static void miWideSegment ____P((miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, int x1, int y1, int x2, int y2, bool projectLeft, bool projectRight, LineFace *leftFace, LineFace *rightFace));
 
52
static void miFillPolyHelper (miPaintedSet *paintedSet, miPixel pixel, int y, unsigned int overall_height, PolyEdge *left, PolyEdge *right, int left_count, int right_count);
 
53
static void miFillRectPolyHelper (miPaintedSet *paintedSet, miPixel pixel, int x, int y, unsigned int w, unsigned int h);
 
54
static void miLineArc (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, LineFace *leftFace, LineFace *rightFace, double xorg, double yorg, bool isInt);
 
55
static void miLineJoin (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, LineFace *pLeft, LineFace *pRight);
 
56
static void miLineProjectingCap (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, const LineFace *face, bool isLeft, bool isInt);
 
57
static void miWideDashSegment (miPaintedSet *paintedSet, const miGC *pGC, int *pDashNum, int *pDashIndex, int *pDashOffset, int x1, int y1, int x2, int y2, bool projectLeft, bool projectRight, LineFace *leftFace, LineFace *rightFace);
 
58
static void miWideSegment (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, int x1, int y1, int x2, int y2, bool projectLeft, bool projectRight, LineFace *leftFace, LineFace *rightFace);
36
59
 
37
60
/* internal functions that don't do painting of pixels */
38
 
static int miLineArcD ____P((const miGC *pGC, double xorg, double yorg, miPoint *points, unsigned int *widths, PolyEdge *edge1, int edgey1, bool edgeleft1, PolyEdge *edge2, int edgey2, bool edgeleft2));
39
 
static int miLineArcI ____P((const miGC *pGC, int xorg, int yorg, miPoint *points, unsigned int *widths));
40
 
static int miPolyBuildEdge ____P((double x0, double y0, double k, int dx, int dy, int xi, int yi, bool left, PolyEdge *edge));
41
 
static int miPolyBuildPoly ____P((const PolyVertex *vertices, const PolySlope *slopes, int count, int xi, int yi, PolyEdge *left, PolyEdge *right, int *pnleft, int *pnright, unsigned int *h));
42
 
static int miRoundCapClip ____P((const LineFace *face, bool isInt, PolyEdge *edge, bool *leftEdge));
43
 
static int miRoundJoinFace ____P((const LineFace *face, PolyEdge *edge, bool *leftEdge));
44
 
static void miRoundJoinClip ____P((LineFace *pLeft, LineFace *pRight, PolyEdge *edge1, PolyEdge *edge2, int *y1, int *y2, bool *left1, bool *left2));
 
61
static int miLineArcD (const miGC *pGC, double xorg, double yorg, miPoint *points, unsigned int *widths, PolyEdge *edge1, int edgey1, bool edgeleft1, PolyEdge *edge2, int edgey2, bool edgeleft2);
 
62
static int miLineArcI (const miGC *pGC, int xorg, int yorg, miPoint *points, unsigned int *widths);
 
63
static int miPolyBuildEdge (double x0, double y0, double k, int dx, int dy, int xi, int yi, bool left, PolyEdge *edge);
 
64
static int miPolyBuildPoly (const PolyVertex *vertices, const PolySlope *slopes, int count, int xi, int yi, PolyEdge *left, PolyEdge *right, int *pnleft, int *pnright, unsigned int *h);
 
65
static int miRoundCapClip (const LineFace *face, bool isInt, PolyEdge *edge, bool *leftEdge);
 
66
static int miRoundJoinFace (const LineFace *face, PolyEdge *edge, bool *leftEdge);
 
67
static void miRoundJoinClip (LineFace *pLeft, LineFace *pRight, PolyEdge *edge1, PolyEdge *edge2, int *y1, int *y2, bool *left1, bool *left2);
45
68
 
46
69
/* Spans-based convex polygon filler.  Paints a convex polygon, supplied as
47
70
   lists of `left' and `right' edges.  Used for painting polygonal line
51
74
   that lie exactly on the boundary of a polygon.  A pixel is not painted
52
75
   if it lies on a `right' or `bottom' edge of the polygon. */
53
76
 
 
77
/* ARGS: y = starting y coor, overall_height = height of entire segment */
54
78
static void
55
 
#ifdef _HAVE_PROTOS
56
79
miFillPolyHelper (miPaintedSet *paintedSet, miPixel pixel, int y, unsigned int overall_height, PolyEdge *left, PolyEdge *right, int left_count, int right_count)
57
 
#else
58
 
miFillPolyHelper (paintedSet, pixel, y, overall_height, left, right, left_count, right_count)
59
 
     miPaintedSet *paintedSet;
60
 
     miPixel pixel;
61
 
     int y;                     /* starting y coordinate */
62
 
     unsigned int overall_height; /* height of entire segment */
63
 
     PolyEdge *left, *right;
64
 
     int left_count, right_count;
65
 
#endif
66
80
{
67
81
  int   left_x = 0, left_e = 0;
68
82
  int   left_stepx = 0;
124
138
   bottom edges) is followed. */
125
139
 
126
140
static void
127
 
#ifdef _HAVE_PROTOS
128
141
miFillRectPolyHelper (miPaintedSet *paintedSet, miPixel pixel, int x, int y, unsigned int w, unsigned int h)
129
 
#else
130
 
miFillRectPolyHelper (paintedSet, pixel, x, y, w, h)
131
 
     miPaintedSet *paintedSet;
132
 
     miPixel pixel;
133
 
     int x, y;
134
 
     unsigned int w, h;
135
 
#endif
136
142
{
137
143
  miPoint *ppt, *pptInit;
138
144
  unsigned int *pwidth, *pwidthInit;
168
174
/* The integer edge data that are computed do not include the `height'
169
175
   field, i.e. the number of scanlines to process. */
170
176
 
 
177
/* ARGS: x0,y0 = starting point of edge (rel. to x1,y1)
 
178
         k = x0 * dy - y0 * dx
 
179
         dx,dy specify rational slope dy/dx
 
180
         xi,yi = integer offsets for coor system
 
181
         left = left edge, not right edge?
 
182
         edge = integer edge data, to be filled in */
 
183
/*ARGSUSED*/
171
184
static int
172
 
#ifdef _HAVE_PROTOS
173
185
miPolyBuildEdge (double x0, double y0, double k, int dx, int dy, int xi, int yi, bool left, PolyEdge *edge)
174
 
#else
175
 
miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
176
 
     double x0, y0;             /* starting point of edge (rel. to (xi,yi)) */
177
 
     double k;                  /* x0 * dy - y0 * dx */
178
 
     int dx, dy;                /* edge has rational slope dy/dx */
179
 
     int xi, yi;                /* integer offset for coordinate system */
180
 
     bool left;                 /* left edge, not right edge? */
181
 
     PolyEdge *edge;            /* integer edge data, to be filled in */
182
 
#endif
183
186
{
184
187
  int x, y, e;
185
188
  int xady;
246
249
   (including a `k' value for each edge), and an integer offset vector.
247
250
   Also return overall vertical range and top (starting) y value. */
248
251
 
 
252
/* ARGS: xi,yi = integer offset for polygon */
249
253
static int
250
 
#ifdef _HAVE_PROTOS
251
254
miPolyBuildPoly (const PolyVertex *vertices, const PolySlope *slopes, int count, int xi, int yi, PolyEdge *left, PolyEdge *right, int *pnleft, int *pnright, unsigned int *h)
252
 
#else
253
 
miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright, h)
254
 
     const PolyVertex *vertices;
255
 
     const PolySlope *slopes;
256
 
     int count;
257
 
     int xi, yi;                /* (xi,yi) = integer offset for polygon */
258
 
     PolyEdge *left, *right;
259
 
     int *pnleft, *pnright;
260
 
     unsigned int *h;
261
 
#endif
262
255
{
263
256
  int       top, bottom;
264
257
  double    miny, maxy;
374
367
   both miWideLine() and miWideDash().  Left and right line faces are
375
368
   supplied, each with its own value of k.  They may be modified. */
376
369
static void
377
 
#ifdef _HAVE_PROTOS
378
370
miLineJoin (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, LineFace *pLeft, LineFace *pRight)
379
 
#else
380
 
miLineJoin (paintedSet, pixel, pGC, pLeft, pRight)
381
 
     miPaintedSet *paintedSet;
382
 
     miPixel pixel;
383
 
     const miGC *pGC;
384
 
     LineFace *pLeft, *pRight;
385
 
#endif
386
371
{
387
372
  double            mx = 0.0, my = 0.0;
388
373
  int               denom = 0;  /* avoid compiler warnings */
599
584
   two line faces.  Used for round capping and round joining respectively.
600
585
   One or two line faces are supplied.  They may be modified. */
601
586
static void
602
 
#ifdef _HAVE_PROTOS
603
587
miLineArc (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, LineFace *leftFace, LineFace *rightFace, double xorg, double yorg, bool isInt)
604
 
#else
605
 
miLineArc (paintedSet, pixel, pGC, leftFace, rightFace, xorg, yorg, isInt)
606
 
     miPaintedSet *paintedSet;
607
 
     miPixel pixel;
608
 
     const miGC *pGC;
609
 
     LineFace *leftFace, *rightFace;
610
 
     double xorg, yorg;
611
 
     bool isInt;
612
 
#endif
613
588
{
614
589
  miPoint    *points;
615
590
  unsigned int  *widths;
685
660
   two edges can be ignored.  Integer coordinates only are used.  Returns
686
661
   number of spans in the Spans. */
687
662
static int
688
 
#ifdef _HAVE_PROTOS
689
663
miLineArcI (const miGC *pGC, int xorg, int yorg, miPoint *points, unsigned int *widths)
690
 
#else
691
 
miLineArcI (pGC, xorg, yorg, points, widths)
692
 
     const miGC *pGC;
693
 
     int xorg, yorg;
694
 
     miPoint *points;
695
 
     unsigned int *widths;
696
 
#endif
697
664
{
698
665
  miPoint *tpts, *bpts;
699
666
  unsigned int *twids, *bwids;
780
747
   wedge).  Floating point coordinates are used.  Returns number of spans
781
748
   in the Spans.  The clipping edges may be modified. */
782
749
static int
783
 
#ifdef _HAVE_PROTOS
784
750
miLineArcD (const miGC *pGC, double xorg, double yorg, miPoint *points, unsigned int *widths, PolyEdge *edge1, int edgey1, bool edgeleft1, PolyEdge *edge2, int edgey2, bool edgeleft2)
785
 
#else
786
 
miLineArcD (pGC, xorg, yorg, points, widths, edge1, edgey1, edgeleft1, edge2, edgey2, edgeleft2)
787
 
     const miGC *pGC;
788
 
     double xorg, yorg;
789
 
     miPoint *points;
790
 
     unsigned int *widths;
791
 
     PolyEdge *edge1;
792
 
     int edgey1;
793
 
     bool edgeleft1;
794
 
     PolyEdge *edge2;
795
 
     int edgey2;
796
 
     bool edgeleft2;
797
 
#endif
798
751
{
799
752
  miPoint *pts;
800
753
  unsigned int *wids;
949
902
/* From two line faces, construct clipping edges that will be used by
950
903
   miLineArcD when drawing a pie wedge.  The line faces may be modified. */
951
904
static void
952
 
#ifdef _HAVE_PROTOS
953
905
miRoundJoinClip (LineFace *pLeft, LineFace *pRight, PolyEdge *edge1, PolyEdge *edge2, int *y1, int *y2, bool *left1, bool *left2)
954
 
#else
955
 
miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
956
 
     LineFace *pLeft, *pRight;
957
 
     PolyEdge *edge1, *edge2;
958
 
     int *y1, *y2;
959
 
     bool *left1, *left2;
960
 
#endif
961
906
{
962
907
  int   denom;
963
908
 
978
923
 
979
924
/* helper function called by the preceding */
980
925
static int
981
 
#ifdef _HAVE_PROTOS
982
926
miRoundJoinFace (const LineFace *face, PolyEdge *edge, bool *leftEdge)
983
 
#else
984
 
miRoundJoinFace (face, edge, leftEdge)
985
 
     const LineFace *face;
986
 
     PolyEdge *edge;
987
 
     bool *leftEdge;
988
 
#endif
989
927
{
990
928
  int       y;
991
929
  int       dx, dy;
1036
974
/* From a line face, construct a clipping edge that will be used by
1037
975
   miLineArcD when drawing a half-disk.  */
1038
976
static int
1039
 
#ifdef _HAVE_PROTOS
1040
977
miRoundCapClip (const LineFace *face, bool isInt, PolyEdge *edge, bool *leftEdge)
1041
 
#else
1042
 
miRoundCapClip (face, isInt, edge, leftEdge)
1043
 
     const LineFace *face;
1044
 
     bool isInt;
1045
 
     PolyEdge *edge;
1046
 
     bool *leftEdge;
1047
 
#endif
1048
978
{
1049
979
  int       y;
1050
980
  int       dx, dy;
1095
1025
/* Paint a projecting rectangular cap on a line face.  Called only by
1096
1026
   miWideDash (with isInt = true); not by miWideLine. */
1097
1027
static void
1098
 
#ifdef _HAVE_PROTOS
1099
1028
miLineProjectingCap (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, const LineFace *face, bool isLeft, bool isInt)
1100
 
#else
1101
 
miLineProjectingCap (paintedSet, pixel, pGC, face, isLeft, isInt)
1102
 
     miPaintedSet *paintedSet;
1103
 
     miPixel pixel;
1104
 
     const miGC *pGC;
1105
 
     const LineFace *face;
1106
 
     bool isLeft;
1107
 
     bool isInt;
1108
 
#endif
1109
1029
{
 
1030
  int           dx, dy;
 
1031
  int           topy, bottomy;
1110
1032
  int           xorgi = 0, yorgi = 0;
1111
 
  int           lw;
 
1033
  int           lw = (int)(pGC->lineWidth);
1112
1034
  PolyEdge      lefts[2], rights[2];
1113
 
  int           lefty, righty, topy, bottomy;
1114
 
  PolyEdge      *left, *right;
1115
 
  PolyEdge      *top, *bottom;
1116
 
  double        xa,ya;
1117
 
  double        k;
1118
 
  double        xap, yap;
1119
 
  int           dx, dy;
1120
 
  double        projectXoff, projectYoff;
1121
 
  double        maxy;
1122
 
  int           finaly;
1123
1035
    
1124
1036
  if (isInt)
1125
1037
    /* in integer case, take (xorgi,yorgi) from face; otherwise (0,0) */
1127
1039
      xorgi = face->x;
1128
1040
      yorgi = face->y;
1129
1041
    }
1130
 
  lw = (int)(pGC->lineWidth);
1131
1042
  dx = face->dx;
1132
1043
  dy = face->dy;
1133
 
  k = face->k;
 
1044
 
1134
1045
  if (dy == 0)
1135
1046
    /* special case: line face is horizontal */
1136
1047
    {
1191
1102
  else
1192
1103
    /* general case: line face is neither horizontal nor vertical */
1193
1104
    {
 
1105
      int       lefty, righty;
 
1106
      int       finaly;
 
1107
      double    xa,ya;
 
1108
      double    xap, yap;
 
1109
      double    maxy;
 
1110
      double    projectXoff, projectYoff;
 
1111
      double    k;
 
1112
      PolyEdge  *left, *right;
 
1113
      PolyEdge  *top, *bottom;
 
1114
 
 
1115
      k = face->k;
1194
1116
      xa = face->xa;
1195
1117
      ya = face->ya;
1196
1118
      projectXoff = -ya;
1197
1119
      projectYoff = xa;
 
1120
 
1198
1121
      if (dx < 0)
1199
1122
        {
1200
1123
          right = &rights[1];
1209
1132
          top = &lefts[0];
1210
1133
          bottom = &rights[1];
1211
1134
        }
 
1135
 
1212
1136
      if (isLeft)
1213
1137
        /* cap goes left; build four edges */
1214
1138
        {
1293
1217
   appropriately.  miWideDashSegment() is called to dash each line
1294
1218
   segment. */
1295
1219
void
1296
 
#ifdef _HAVE_PROTOS
1297
1220
miWideDash (miPaintedSet *paintedSet, const miGC *pGC, miCoordMode mode, int npt, const miPoint *pPts)
1298
 
#else
1299
 
miWideDash (paintedSet, pGC, mode, npt, pPts)
1300
 
     miPaintedSet *paintedSet;
1301
 
     const miGC *pGC;
1302
 
     miCoordMode mode;
1303
 
     int npt;
1304
 
     const miPoint *pPts;
1305
 
#endif
1306
1221
{
1307
1222
  int       x1, y1, x2, y2;
1308
1223
  int       dashNum;            /* absolute number of dash, starts with 0 */
1541
1456
   dash will be given a round cap if lines are drawn in the rounded cap
1542
1457
   style, and a projecting cap if lines are drawn in the projecting cap
1543
1458
   style. */
 
1459
 
 
1460
/* ARGS: pDashNum = absolute number of dash
 
1461
         pDashIndex = index into array (i.e. dashNum % length)
 
1462
         pDashOffset = offset into selected dash */
1544
1463
static void
1545
 
#ifdef _HAVE_PROTOS
1546
1464
miWideDashSegment (miPaintedSet *paintedSet, const miGC *pGC, int *pDashNum, int *pDashIndex, int *pDashOffset, int x1, int y1, int x2, int y2, bool projectLeft, bool projectRight, LineFace *leftFace, LineFace *rightFace)
1547
 
#else
1548
 
miWideDashSegment (paintedSet, pGC, pDashNum, pDashIndex, pDashOffset, x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace)
1549
 
     miPaintedSet *paintedSet;
1550
 
     const miGC *pGC;
1551
 
     int *pDashNum;             /* absolute number of dash */
1552
 
     int *pDashIndex;           /* index into array (i.e. dashNum % length) */
1553
 
     int *pDashOffset;          /* offset into selected dash */
1554
 
     int x1, y1, x2, y2;
1555
 
     bool projectLeft, projectRight;
1556
 
     LineFace *leftFace, *rightFace;
1557
 
#endif
1558
1465
{
1559
1466
  int               dashNum, dashIndex, dashRemain;
1560
1467
  unsigned int      *pDash;
1960
1867
/* FIXME: a negative offset is not supported, and if it is, then some
1961
1868
   places elsewhere in the code, which assume dashNum>=0, may need to be
1962
1869
   fixed too. */
 
1870
 
 
1871
/* ARGS: dist = add'l offset (assumed >= 0)
 
1872
         pDashNum = dash number
 
1873
         pDashIndex = current dash
 
1874
         pDash = dash list
 
1875
         numInDashList = dashlist length
 
1876
         pDashOffset = offset into current dash */
1963
1877
void
1964
 
#ifdef _HAVE_PROTOS
1965
1878
miStepDash (int dist, int *pDashNum, int *pDashIndex, const unsigned int *pDash, int numInDashList, int *pDashOffset)
1966
 
#else
1967
 
miStepDash (dist, pDashNum, pDashIndex, pDash, numInDashList, pDashOffset)
1968
 
     int dist;                  /* additional offset (assumed >= 0) */
1969
 
     int *pDashNum;             /* dash number */
1970
 
     int *pDashIndex;           /* current dash */
1971
 
     const unsigned int *pDash; /* dash list */
1972
 
     int numInDashList;         /* dashlist length */
1973
 
     int *pDashOffset;          /* offset into current dash */
1974
 
#endif
1975
1879
{
1976
1880
  int   dashNum, dashIndex, dashOffset;
1977
1881
  int   totallen;
2020
1924
/* Draw a wide polyline, undashed (if width=0, this simply calls
2021
1925
   miZeroLine) */
2022
1926
void
2023
 
#ifdef _HAVE_PROTOS
2024
1927
miWideLine (miPaintedSet *paintedSet, const miGC *pGC, miCoordMode mode, int npt, const miPoint *pPts)
2025
 
#else
2026
 
miWideLine (paintedSet, pGC, mode, npt, pPts)
2027
 
     miPaintedSet *paintedSet;
2028
 
     const miGC *pGC;
2029
 
     miCoordMode mode;
2030
 
     int npt;
2031
 
     const miPoint *pPts;
2032
 
#endif
2033
1928
{
2034
1929
  int               x1, y1, x2, y2;
2035
1930
  bool              projectLeft, projectRight;
2183
2078
   round caps.  Also pass back left and right faces for the line segment,
2184
2079
   for possible use in adding caps or joins. */
2185
2080
static void
2186
 
#ifdef _HAVE_PROTOS
2187
2081
miWideSegment (miPaintedSet *paintedSet, miPixel pixel, const miGC *pGC, int x1, int y1, int x2, int y2, bool projectLeft, bool projectRight, LineFace *leftFace, LineFace *rightFace)
2188
 
#else
2189
 
miWideSegment (paintedSet, pixel, pGC, x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace)
2190
 
     miPaintedSet *paintedSet;
2191
 
     miPixel pixel;
2192
 
     const miGC *pGC;
2193
 
     int x1, y1, x2, y2;
2194
 
     bool projectLeft, projectRight;
2195
 
     LineFace *leftFace, *rightFace;
2196
 
#endif
2197
2082
{
2198
 
  double        l, L, r;
2199
 
  double        xa, ya;
2200
 
  double        projectXoff = 0.0, projectYoff = 0.0;
2201
 
  double        k;
2202
 
  double        maxy;
2203
2083
  int           dx, dy;
2204
2084
  int           x, y;
2205
 
  int           finaly;
2206
 
  PolyEdge      *left, *right;
2207
 
  PolyEdge      *top, *bottom;
2208
 
  int           lefty, righty, topy, bottomy;
2209
2085
  int           signdx;
2210
 
  PolyEdge      lefts[2], rights[2];
2211
2086
  int           lw = (int)(pGC->lineWidth);
2212
2087
 
2213
2088
  if (y2 < y1 || (y2 == y1 && x2 < x1))
2294
2169
  else
2295
2170
    /* general case: segment is neither horizontal nor vertical */
2296
2171
    {
 
2172
      double    l, L, r;
 
2173
      double    xa, ya;
 
2174
      double    projectXoff = 0.0, projectYoff = 0.0;
 
2175
      double    k;
 
2176
      double    maxy;
 
2177
      int       finaly;
 
2178
      int       lefty, righty, topy, bottomy;
 
2179
      PolyEdge  lefts[2], rights[2];
 
2180
      PolyEdge  *left, *right;
 
2181
      PolyEdge  *top, *bottom;
 
2182
 
2297
2183
      l = 0.5 * ((double) lw);
2298
2184
      L = hypot ((double) dx, (double) dy);
2299
2185