< prev index next >

src/java.desktop/share/classes/sun/java2d/Spans.java

Print this page

        

*** 39,60 **** public class Spans { /** * This class will sort and collapse its span * entries after this many span additions via ! * the <code>add</code> method. */ private static final int kMaxAddsSinceSort = 256; /** * Holds a list of individual * Span instances. */ private List<Span> mSpans = new Vector<>(kMaxAddsSinceSort); /** ! * The number of <code>Span</code> * instances that have been added * to this object without a sort * and collapse taking place. */ private int mAddsSinceSort = 0; --- 39,60 ---- public class Spans { /** * This class will sort and collapse its span * entries after this many span additions via ! * the {@code add} method. */ private static final int kMaxAddsSinceSort = 256; /** * Holds a list of individual * Span instances. */ private List<Span> mSpans = new Vector<>(kMaxAddsSinceSort); /** ! * The number of {@code Span} * instances that have been added * to this object without a sort * and collapse taking place. */ private int mAddsSinceSort = 0;
*** 63,74 **** } /** * Add a span covering the half open interval ! * including <code>start</code> up to ! * but not including <code>end</code>. */ public void add(float start, float end) { if (mSpans != null) { mSpans.add(new Span(start, end)); --- 63,74 ---- } /** * Add a span covering the half open interval ! * including {@code start} up to ! * but not including {@code end}. */ public void add(float start, float end) { if (mSpans != null) { mSpans.add(new Span(start, end));
*** 80,103 **** } /** * Add a span which covers the entire range. * This call is logically equivalent to ! * <code>add(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY)</code> * The result of making this call is that ! * all future <code>add</code> calls are ignored ! * and the <code>intersects</code> method always * returns true. */ public void addInfinite() { mSpans = null; } /** * Returns true if the span defined by the half-open ! * interval from <code>start</code> up to, ! * but not including, <code>end</code> intersects * any of the spans defined by this instance. */ public boolean intersects(float start, float end) { boolean doesIntersect; --- 80,103 ---- } /** * Add a span which covers the entire range. * This call is logically equivalent to ! * {@code add(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY)} * The result of making this call is that ! * all future {@code add} calls are ignored ! * and the {@code intersects} method always * returns true. */ public void addInfinite() { mSpans = null; } /** * Returns true if the span defined by the half-open ! * interval from {@code start} up to, ! * but not including, {@code end} intersects * any of the spans defined by this instance. */ public boolean intersects(float start, float end) { boolean doesIntersect;
*** 229,286 **** */ private float mEnd; /** * Create a half-open interval including ! * <code>start</code> but not including ! * <code>end</code>. */ Span(float start, float end) { mStart = start; mEnd = end; } /** ! * Return the start of the <code>Span</code>. * The start is considered part of the * half-open interval. */ final float getStart() { return mStart; } /** ! * Return the end of the <code>Span</code>. * The end is not considered part of the * half-open interval. */ final float getEnd() { return mEnd; } /** * Change the initial position of the ! * <code>Span</code>. */ final void setStart(float start) { mStart = start; } /** * Change the terminal position of the ! * <code>Span</code>. */ final void setEnd(float end) { mEnd = end; } /** ! * Attempt to alter this <code>Span</code> ! * to include <code>otherSpan</code> without * altering this span's starting position. ! * If <code>otherSpan</code> can be so consumed ! * by this <code>Span</code> then <code>true</code> * is returned. */ boolean subsume(Span otherSpan) { /* We can only subsume 'otherSpan' if --- 229,286 ---- */ private float mEnd; /** * Create a half-open interval including ! * {@code start} but not including ! * {@code end}. */ Span(float start, float end) { mStart = start; mEnd = end; } /** ! * Return the start of the {@code Span}. * The start is considered part of the * half-open interval. */ final float getStart() { return mStart; } /** ! * Return the end of the {@code Span}. * The end is not considered part of the * half-open interval. */ final float getEnd() { return mEnd; } /** * Change the initial position of the ! * {@code Span}. */ final void setStart(float start) { mStart = start; } /** * Change the terminal position of the ! * {@code Span}. */ final void setEnd(float end) { mEnd = end; } /** ! * Attempt to alter this {@code Span} ! * to include {@code otherSpan} without * altering this span's starting position. ! * If {@code otherSpan} can be so consumed ! * by this {@code Span} then {@code true} * is returned. */ boolean subsume(Span otherSpan) { /* We can only subsume 'otherSpan' if
*** 302,312 **** } /** * Return true if the passed in position * lies in the half-open interval defined ! * by this <code>Span</code>. */ boolean contains(float pos) { return mStart <= pos && pos < mEnd; } --- 302,312 ---- } /** * Return true if the passed in position * lies in the half-open interval defined ! * by this {@code Span}. */ boolean contains(float pos) { return mStart <= pos && pos < mEnd; }
*** 335,349 **** } } /** ! * This class ranks a pair of <code>Span</code> * instances. If the instances intersect they * are deemed equal otherwise they are ranked * by their relative position. Use ! * <code>SpanIntersection.instance</code> to * get the single instance of this class. */ static class SpanIntersection implements Comparator<Span> { /** --- 335,349 ---- } } /** ! * This class ranks a pair of {@code Span} * instances. If the instances intersect they * are deemed equal otherwise they are ranked * by their relative position. Use ! * {@code SpanIntersection.instance} to * get the single instance of this class. */ static class SpanIntersection implements Comparator<Span> { /**
< prev index next >