jdk/src/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java
author jgodinez
Tue, 04 Aug 2009 17:25:36 -0700
changeset 3927 d717df90e151
parent 2391 3397fe90e591
child 5506 202f599c92aa
permissions -rw-r--r--
6829673: ThinLineTest: A line < 1 pixel disappears. Reviewed-by: igor, prr Contributed-by: rkennke <roman.kennke@sun.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.java2d.pisces;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Shape;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.BasicStroke;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.geom.Path2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.geom.AffineTransform;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.geom.PathIterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.awt.geom.PathConsumer2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.java2d.pipe.Region;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.java2d.pipe.RenderingEngine;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.java2d.pipe.AATileGenerator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public class PiscesRenderingEngine extends RenderingEngine {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    public static Transform4 IdentT4 = new Transform4();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    public static double defaultFlat = 0.1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    static int FloatToS15_16(float flt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        flt = flt * 65536f + 0.5f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        if (flt <= -(65536f * 65536f)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
            return Integer.MIN_VALUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        } else if (flt >= (65536f * 65536f)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
            return Integer.MAX_VALUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
            return (int) Math.floor(flt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    static float S15_16ToFloat(int fix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        return (fix / 65536f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Create a widened path as specified by the parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * The specified {@code src} {@link Shape} is widened according
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * to the specified attribute parameters as per the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * {@link BasicStroke} specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @param src the source path to be widened
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * @param width the width of the widened path as per {@code BasicStroke}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @param caps the end cap decorations as per {@code BasicStroke}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @param join the segment join decorations as per {@code BasicStroke}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @param miterlimit the miter limit as per {@code BasicStroke}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @param dashes the dash length array as per {@code BasicStroke}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @param dashphase the initial dash phase as per {@code BasicStroke}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * @return the widened path stored in a new {@code Shape} object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public Shape createStrokedShape(Shape src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                                    float width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                    int caps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                                    int join,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                                    float miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                                    float dashes[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                                    float dashphase)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        final Path2D p2d = new Path2D.Float();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        strokeTo(src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                 null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                 width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                 caps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                 join,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                 miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                 dashes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                 dashphase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                 new LineSink() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                     public void moveTo(int x0, int y0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                         p2d.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                     public void lineJoin() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                     public void lineTo(int x1, int y1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                         p2d.lineTo(S15_16ToFloat(x1), S15_16ToFloat(y1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                     public void close() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                         p2d.closePath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                     public void end() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                 });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        return p2d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * Sends the geometry for a widened path as specified by the parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * to the specified consumer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * The specified {@code src} {@link Shape} is widened according
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * to the parameters specified by the {@link BasicStroke} object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Adjustments are made to the path as appropriate for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * {@link VALUE_STROKE_NORMALIZE} hint if the {@code normalize}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * boolean parameter is true.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Adjustments are made to the path as appropriate for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * {@link VALUE_ANTIALIAS_ON} hint if the {@code antialias}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * boolean parameter is true.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * The geometry of the widened path is forwarded to the indicated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * {@link PathConsumer2D} object as it is calculated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @param src the source path to be widened
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @param bs the {@code BasicSroke} object specifying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *           decorations to be applied to the widened path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @param normalize indicates whether stroke normalization should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *                  be applied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @param antialias indicates whether or not adjustments appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *                  to antialiased rendering should be applied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @param consumer the {@code PathConsumer2D} instance to forward
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *                 the widened geometry to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public void strokeTo(Shape src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                         AffineTransform at,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                         BasicStroke bs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                         boolean thin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                         boolean normalize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                         boolean antialias,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                         final PathConsumer2D consumer)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        strokeTo(src, at, bs, thin, normalize, antialias,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                 new LineSink() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                     public void moveTo(int x0, int y0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                         consumer.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                     public void lineJoin() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                     public void lineTo(int x1, int y1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                         consumer.lineTo(S15_16ToFloat(x1), S15_16ToFloat(y1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                     public void close() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                         consumer.closePath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                     public void end() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                         consumer.pathDone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                 });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    void strokeTo(Shape src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                  AffineTransform at,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                  BasicStroke bs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                  boolean thin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                  boolean normalize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                  boolean antialias,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                  LineSink lsink)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        float lw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        if (thin) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            if (antialias) {
3927
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   174
                lw = userSpaceLineWidth(at, 0.5f);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            } else {
3927
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   176
                lw = userSpaceLineWidth(at, 1.0f);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            lw = bs.getLineWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        strokeTo(src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                 at,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                 lw,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                 bs.getEndCap(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                 bs.getLineJoin(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                 bs.getMiterLimit(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                 bs.getDashArray(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                 bs.getDashPhase(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                 lsink);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
3927
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   192
    private float userSpaceLineWidth(AffineTransform at, float lw) {
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   193
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   194
        double widthScale;
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   195
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   196
        if ((at.getType() & (AffineTransform.TYPE_GENERAL_TRANSFORM |
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   197
                            AffineTransform.TYPE_GENERAL_SCALE)) != 0) {
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   198
            widthScale = Math.sqrt(at.getDeterminant());
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   199
        } else {
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   200
            /* First calculate the "maximum scale" of this transform. */
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   201
            double A = at.getScaleX();       // m00
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   202
            double C = at.getShearX();       // m01
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   203
            double B = at.getShearY();       // m10
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   204
            double D = at.getScaleY();       // m11
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   205
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   206
            /*
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   207
             * Given a 2 x 2 affine matrix [ A B ] such that
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   208
             *                             [ C D ]
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   209
             * v' = [x' y'] = [Ax + Cy, Bx + Dy], we want to
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   210
             * find the maximum magnitude (norm) of the vector v'
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   211
             * with the constraint (x^2 + y^2 = 1).
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   212
             * The equation to maximize is
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   213
             *     |v'| = sqrt((Ax+Cy)^2+(Bx+Dy)^2)
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   214
             * or  |v'| = sqrt((AA+BB)x^2 + 2(AC+BD)xy + (CC+DD)y^2).
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   215
             * Since sqrt is monotonic we can maximize |v'|^2
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   216
             * instead and plug in the substitution y = sqrt(1 - x^2).
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   217
             * Trigonometric equalities can then be used to get
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   218
             * rid of most of the sqrt terms.
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   219
             */
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   220
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   221
            double EA = A*A + B*B;          // x^2 coefficient
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   222
            double EB = 2*(A*C + B*D);      // xy coefficient
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   223
            double EC = C*C + D*D;          // y^2 coefficient
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   224
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   225
            /*
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   226
             * There is a lot of calculus omitted here.
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   227
             *
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   228
             * Conceptually, in the interests of understanding the
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   229
             * terms that the calculus produced we can consider
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   230
             * that EA and EC end up providing the lengths along
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   231
             * the major axes and the hypot term ends up being an
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   232
             * adjustment for the additional length along the off-axis
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   233
             * angle of rotated or sheared ellipses as well as an
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   234
             * adjustment for the fact that the equation below
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   235
             * averages the two major axis lengths.  (Notice that
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   236
             * the hypot term contains a part which resolves to the
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   237
             * difference of these two axis lengths in the absence
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   238
             * of rotation.)
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   239
             *
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   240
             * In the calculus, the ratio of the EB and (EA-EC) terms
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   241
             * ends up being the tangent of 2*theta where theta is
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   242
             * the angle that the long axis of the ellipse makes
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   243
             * with the horizontal axis.  Thus, this equation is
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   244
             * calculating the length of the hypotenuse of a triangle
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   245
             * along that axis.
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   246
             */
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   247
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   248
            double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC));
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   249
            /* sqrt omitted, compare to squared limits below. */
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   250
            double widthsquared = ((EA + EC + hypot)/2.0);
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   251
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   252
            widthScale = Math.sqrt(widthsquared);
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   253
        }
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   254
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   255
        return (float) (lw / widthScale);
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   256
    }
d717df90e151 6829673: ThinLineTest: A line < 1 pixel disappears.
jgodinez
parents: 2391
diff changeset
   257
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    void strokeTo(Shape src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                  AffineTransform at,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                  float width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                  int caps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                  int join,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                  float miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                  float dashes[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                  float dashphase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                  LineSink lsink)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        Transform4 t4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        if (at == null || at.isIdentity()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            t4 = IdentT4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            t4 = new Transform4(FloatToS15_16((float) at.getScaleX()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                                FloatToS15_16((float) at.getShearX()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                                FloatToS15_16((float) at.getShearY()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                                FloatToS15_16((float) at.getScaleY()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        lsink = new Stroker(lsink,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                            FloatToS15_16(width),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                            caps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                            join,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                            FloatToS15_16(miterlimit),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                            t4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        if (dashes != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            int fdashes[] = new int[dashes.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            for (int i = 0; i < dashes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                fdashes[i] = FloatToS15_16(dashes[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            lsink = new Dasher(lsink,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
                               fdashes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                               FloatToS15_16(dashphase),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                               t4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        PathIterator pi = src.getPathIterator(at, defaultFlat);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        pathTo(pi, lsink);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    void pathTo(PathIterator pi, LineSink lsink) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        float coords[] = new float[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        while (!pi.isDone()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            switch (pi.currentSegment(coords)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            case PathIterator.SEG_MOVETO:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                lsink.moveTo(FloatToS15_16(coords[0]),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                             FloatToS15_16(coords[1]));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            case PathIterator.SEG_LINETO:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                lsink.lineJoin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                lsink.lineTo(FloatToS15_16(coords[0]),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                             FloatToS15_16(coords[1]));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            case PathIterator.SEG_CLOSE:
2391
3397fe90e591 6812600: The miter line join decoration isn't rendered properly
jgodinez
parents: 2
diff changeset
   314
                lsink.lineJoin();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                lsink.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                throw new InternalError("unknown flattened segment type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            pi.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        lsink.end();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * Construct an antialiased tile generator for the given shape with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * the given rendering attributes and store the bounds of the tile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * iteration in the bbox parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * The {@code at} parameter specifies a transform that should affect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * both the shape and the {@code BasicStroke} attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * The {@code clip} parameter specifies the current clip in effect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * in device coordinates and can be used to prune the data for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * operation, but the renderer is not required to perform any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * clipping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * If the {@code BasicStroke} parameter is null then the shape
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * should be filled as is, otherwise the attributes of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * {@code BasicStroke} should be used to specify a draw operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * The {@code thin} parameter indicates whether or not the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * transformed {@code BasicStroke} represents coordinates smaller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * than the minimum resolution of the antialiasing rasterizer as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * specified by the {@code getMinimumAAPenWidth()} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * Upon returning, this method will fill the {@code bbox} parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * with 4 values indicating the bounds of the iteration of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * tile generator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * The iteration order of the tiles will be as specified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * pseudo-code:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     *     for (y = bbox[1]; y < bbox[3]; y += tileheight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     *         for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * If there is no output to be rendered, this method may return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @param s the shape to be rendered (fill or draw)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @param at the transform to be applied to the shape and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     *           stroke attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @param clip the current clip in effect in device coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @param bs if non-null, a {@code BasicStroke} whose attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *           should be applied to this operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @param thin true if the transformed stroke attributes are smaller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     *             than the minimum dropout pen width
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @param normalize true if the {@code VALUE_STROKE_NORMALIZE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     *                  {@code RenderingHint} is in effect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * @param bbox returns the bounds of the iteration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * @return the {@code AATileGenerator} instance to be consulted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *         for tile coverages, or null if there is no output to render
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    public AATileGenerator getAATileGenerator(Shape s,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                                              AffineTransform at,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                                              Region clip,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                                              BasicStroke bs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                                              boolean thin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                                              boolean normalize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                                              int bbox[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        PiscesCache pc = PiscesCache.createInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        Renderer r = new Renderer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        r.setCache(pc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        r.setAntialiasing(3, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        r.beginRendering(clip.getLoX(), clip.getLoY(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                         clip.getWidth(), clip.getHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        if (bs == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            PathIterator pi = s.getPathIterator(at, defaultFlat);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            r.setWindingRule(pi.getWindingRule());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            pathTo(pi, r);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
            r.setWindingRule(PathIterator.WIND_NON_ZERO);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            strokeTo(s, at, bs, thin, normalize, true, r);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        r.endRendering();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        PiscesTileGenerator ptg = new PiscesTileGenerator(pc, r.MAX_AA_ALPHA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        ptg.getBbox(bbox);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        return ptg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * Returns the minimum pen width that the antialiasing rasterizer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * can represent without dropouts occuring.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    public float getMinimumAAPenSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        return 0.5f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        if (PathIterator.WIND_NON_ZERO != Renderer.WIND_NON_ZERO ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            PathIterator.WIND_EVEN_ODD != Renderer.WIND_EVEN_ODD ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            BasicStroke.JOIN_MITER != Stroker.JOIN_MITER ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            BasicStroke.JOIN_ROUND != Stroker.JOIN_ROUND ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            BasicStroke.JOIN_BEVEL != Stroker.JOIN_BEVEL ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            BasicStroke.CAP_BUTT != Stroker.CAP_BUTT ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            BasicStroke.CAP_ROUND != Stroker.CAP_ROUND ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            BasicStroke.CAP_SQUARE != Stroker.CAP_SQUARE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            throw new InternalError("mismatched renderer constants");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
}