/[classpath]/classpath/java/awt/geom/GeneralPath.java
ViewVC logotype

Diff of /classpath/java/awt/geom/GeneralPath.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by brawer, Tue Oct 21 09:37:24 2003 UTC revision 1.6 by brawer, Tue Oct 21 10:09:50 2003 UTC
# Line 148  public final class GeneralPath implement Line 148  public final class GeneralPath implement
148    {    {
149      append(s.getPathIterator(null), connect);      append(s.getPathIterator(null), connect);
150    }    }
151    public void append(PathIterator i, boolean connect)  
152    
153      /**
154       * Appends the segments of a PathIterator to this GeneralPath.
155       * Optionally, the initial {@link PathIterator#SEG_MOVETO} segment
156       * of the appended path is changed into a {@link
157       * PathIterator#SEG_LINETO} segment.
158       *
159       * @param iter the PathIterator specifying which segments shall be
160       * appended.
161       *
162       * @param connect <code>true</code> for substituting the initial
163       * {@link PathIterator#SEG_MOVETO} segment by a {@link
164       * PathIterator#SEG_LINETO}, or <code>false</code> for not
165       * performing any substitution. If this GeneralPath is currently
166       * empty, <code>connect</code> is assumed to be <code>false</code>,
167       * thus leaving the initial {@link PathIterator#SEG_MOVETO}
168       * unchanged.
169       */
170      public void append(PathIterator iter, boolean connect)
171    {    {
172        // A bad implementation of this method had caused Classpath bug #6076.
173      float[] f = new float[6];      float[] f = new float[6];
174      while (! i.isDone())      while (!iter.isDone())
175        {
176          switch (iter.currentSegment(f))
177        {        {
178          int result = i.currentSegment(f);        case PathIterator.SEG_MOVETO:
179          switch (result)          if (!connect || (index == 0))
180            {          {
181            case PathIterator.SEG_MOVETO:            moveTo(f[0], f[1]);
182              if (! connect)            break;
183                {          }
184                  moveTo(f[0], f[1]);  
185                  break;          if ((index >= 2) && (types[(index - 2) >> 2] == PathIterator.SEG_CLOSE)
186                }              && (f[0] == points[index - 2]) && (f[1] == points[index - 1]))
187              if (subpath >= 0 && f[0] == points[subpath]            break;
188                  && f[1] == points[subpath + 1])          
189                break;          // Fall through.
190              // Fallthrough.  
191            case PathIterator.SEG_LINETO:        case PathIterator.SEG_LINETO:
192              lineTo(f[0], f[1]);          lineTo(f[0], f[1]);
193              break;          break;
194            case PathIterator.SEG_QUADTO:  
195              quadTo(f[0], f[1], f[2], f[3]);        case PathIterator.SEG_QUADTO:
196              break;          quadTo(f[0], f[1], f[2], f[3]);
197            case PathIterator.SEG_CUBICTO:          break;
198              curveTo(f[0], f[1], f[2], f[3], f[4], f[5]);  
199              break;        case PathIterator.SEG_CUBICTO:
200            default:          curveTo(f[0], f[1], f[2], f[3], f[4], f[5]);
201              closePath();          break;
202            }  
203          connect = false;        case PathIterator.SEG_CLOSE:
204            closePath();
205            break;
206        }        }
207    
208          connect = false;
209          iter.next();
210        }
211    }    }
212    
213    
214    public int getWindingRule()    public int getWindingRule()
215    {    {
216      return rule;      return rule;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26