author | ohair |
Wed, 06 Apr 2011 22:06:11 -0700 | |
changeset 9035 | 1255eb81cc2f |
parent 8748 | 99ac71f8ef92 |
permissions | -rw-r--r-- |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
1 |
/* |
9035
1255eb81cc2f
7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents:
8748
diff
changeset
|
2 |
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
4 |
* |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
10 |
* |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
15 |
* accompanied this code). |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
16 |
* |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
20 |
* |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
23 |
* questions. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
24 |
*/ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
25 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
26 |
package sun.java2d.pisces; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
27 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
28 |
import java.util.Arrays; |
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
29 |
import static java.lang.Math.PI; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
30 |
import static java.lang.Math.cos; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
31 |
import static java.lang.Math.sqrt; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
32 |
import static java.lang.Math.cbrt; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
33 |
import static java.lang.Math.acos; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
34 |
|
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
35 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
36 |
final class Helpers { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
37 |
private Helpers() { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
38 |
throw new Error("This is a non instantiable class"); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
39 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
40 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
41 |
static boolean within(final float x, final float y, final float err) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
42 |
final float d = y - x; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
43 |
return (d <= err && d >= -err); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
44 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
45 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
46 |
static boolean within(final double x, final double y, final double err) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
47 |
final double d = y - x; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
48 |
return (d <= err && d >= -err); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
49 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
50 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
51 |
static int quadraticRoots(final float a, final float b, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
52 |
final float c, float[] zeroes, final int off) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
53 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
54 |
int ret = off; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
55 |
float t; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
56 |
if (a != 0f) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
57 |
final float dis = b*b - 4*a*c; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
58 |
if (dis > 0) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
59 |
final float sqrtDis = (float)Math.sqrt(dis); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
60 |
// depending on the sign of b we use a slightly different |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
61 |
// algorithm than the traditional one to find one of the roots |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
62 |
// so we can avoid adding numbers of different signs (which |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
63 |
// might result in loss of precision). |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
64 |
if (b >= 0) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
65 |
zeroes[ret++] = (2 * c) / (-b - sqrtDis); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
66 |
zeroes[ret++] = (-b - sqrtDis) / (2 * a); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
67 |
} else { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
68 |
zeroes[ret++] = (-b + sqrtDis) / (2 * a); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
69 |
zeroes[ret++] = (2 * c) / (-b + sqrtDis); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
70 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
71 |
} else if (dis == 0f) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
72 |
t = (-b) / (2 * a); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
73 |
zeroes[ret++] = t; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
74 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
75 |
} else { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
76 |
if (b != 0f) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
77 |
t = (-c) / b; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
78 |
zeroes[ret++] = t; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
79 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
80 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
81 |
return ret - off; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
82 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
83 |
|
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
84 |
// find the roots of g(t) = d*t^3 + a*t^2 + b*t + c in [A,B) |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
85 |
static int cubicRootsInAB(float d, float a, float b, float c, |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
86 |
float[] pts, final int off, |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
87 |
final float A, final float B) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
88 |
{ |
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
89 |
if (d == 0) { |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
90 |
int num = quadraticRoots(a, b, c, pts, off); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
91 |
return filterOutNotInAB(pts, off, num, A, B) - off; |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
92 |
} |
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
93 |
// From Graphics Gems: |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
94 |
// http://tog.acm.org/resources/GraphicsGems/gems/Roots3And4.c |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
95 |
// (also from awt.geom.CubicCurve2D. But here we don't need as |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
96 |
// much accuracy and we don't want to create arrays so we use |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
97 |
// our own customized version). |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
98 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
99 |
/* normal form: x^3 + ax^2 + bx + c = 0 */ |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
100 |
a /= d; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
101 |
b /= d; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
102 |
c /= d; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
103 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
104 |
// substitute x = y - A/3 to eliminate quadratic term: |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
105 |
// x^3 +Px + Q = 0 |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
106 |
// |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
107 |
// Since we actually need P/3 and Q/2 for all of the |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
108 |
// calculations that follow, we will calculate |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
109 |
// p = P/3 |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
110 |
// q = Q/2 |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
111 |
// instead and use those values for simplicity of the code. |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
112 |
double sq_A = a * a; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
113 |
double p = 1.0/3 * (-1.0/3 * sq_A + b); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
114 |
double q = 1.0/2 * (2.0/27 * a * sq_A - 1.0/3 * a * b + c); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
115 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
116 |
/* use Cardano's formula */ |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
117 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
118 |
double cb_p = p * p * p; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
119 |
double D = q * q + cb_p; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
120 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
121 |
int num; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
122 |
if (D < 0) { |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
123 |
// see: http://en.wikipedia.org/wiki/Cubic_function#Trigonometric_.28and_hyperbolic.29_method |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
124 |
final double phi = 1.0/3 * acos(-q / sqrt(-cb_p)); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
125 |
final double t = 2 * sqrt(-p); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
126 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
127 |
pts[ off+0 ] = (float)( t * cos(phi)); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
128 |
pts[ off+1 ] = (float)(-t * cos(phi + PI / 3)); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
129 |
pts[ off+2 ] = (float)(-t * cos(phi - PI / 3)); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
130 |
num = 3; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
131 |
} else { |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
132 |
final double sqrt_D = sqrt(D); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
133 |
final double u = cbrt(sqrt_D - q); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
134 |
final double v = - cbrt(sqrt_D + q); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
135 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
136 |
pts[ off ] = (float)(u + v); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
137 |
num = 1; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
138 |
|
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
139 |
if (within(D, 0, 1e-8)) { |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
140 |
pts[off+1] = -(pts[off] / 2); |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
141 |
num = 2; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
142 |
} |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
143 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
144 |
|
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
145 |
final float sub = 1.0f/3 * a; |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
146 |
|
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
147 |
for (int i = 0; i < num; ++i) { |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
148 |
pts[ off+i ] -= sub; |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
149 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
150 |
|
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
151 |
return filterOutNotInAB(pts, off, num, A, B) - off; |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
152 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
153 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
154 |
// These use a hardcoded factor of 2 for increasing sizes. Perhaps this |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
155 |
// should be provided as an argument. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
156 |
static float[] widenArray(float[] in, final int cursize, final int numToAdd) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
157 |
if (in.length >= cursize + numToAdd) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
158 |
return in; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
159 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
160 |
return Arrays.copyOf(in, 2 * (cursize + numToAdd)); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
161 |
} |
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
162 |
|
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
163 |
static int[] widenArray(int[] in, final int cursize, final int numToAdd) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
164 |
if (in.length >= cursize + numToAdd) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
165 |
return in; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
166 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
167 |
return Arrays.copyOf(in, 2 * (cursize + numToAdd)); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
168 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
169 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
170 |
static float evalCubic(final float a, final float b, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
171 |
final float c, final float d, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
172 |
final float t) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
173 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
174 |
return t * (t * (t * a + b) + c) + d; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
175 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
176 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
177 |
static float evalQuad(final float a, final float b, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
178 |
final float c, final float t) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
179 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
180 |
return t * (t * a + b) + c; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
181 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
182 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
183 |
// returns the index 1 past the last valid element remaining after filtering |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
184 |
static int filterOutNotInAB(float[] nums, final int off, final int len, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
185 |
final float a, final float b) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
186 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
187 |
int ret = off; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
188 |
for (int i = off; i < off + len; i++) { |
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
189 |
if (nums[i] >= a && nums[i] < b) { |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
190 |
nums[ret++] = nums[i]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
191 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
192 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
193 |
return ret; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
194 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
195 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
196 |
static float polyLineLength(float[] poly, final int off, final int nCoords) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
197 |
assert nCoords % 2 == 0 && poly.length >= off + nCoords : ""; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
198 |
float acc = 0; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
199 |
for (int i = off + 2; i < off + nCoords; i += 2) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
200 |
acc += linelen(poly[i], poly[i+1], poly[i-2], poly[i-1]); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
201 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
202 |
return acc; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
203 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
204 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
205 |
static float linelen(float x1, float y1, float x2, float y2) { |
8131
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
206 |
final float dx = x2 - x1; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
207 |
final float dy = y2 - y1; |
e2932d8114cb
7016856: dashing performance was reduced during latest changes to the OpenJDK rasterizer
dlila
parents:
7668
diff
changeset
|
208 |
return (float)Math.sqrt(dx*dx + dy*dy); |
6997
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
209 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
210 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
211 |
static void subdivide(float[] src, int srcoff, float[] left, int leftoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
212 |
float[] right, int rightoff, int type) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
213 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
214 |
switch(type) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
215 |
case 6: |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
216 |
Helpers.subdivideQuad(src, srcoff, left, leftoff, right, rightoff); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
217 |
break; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
218 |
case 8: |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
219 |
Helpers.subdivideCubic(src, srcoff, left, leftoff, right, rightoff); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
220 |
break; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
221 |
default: |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
222 |
throw new InternalError("Unsupported curve type"); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
223 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
224 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
225 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
226 |
static void isort(float[] a, int off, int len) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
227 |
for (int i = off + 1; i < off + len; i++) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
228 |
float ai = a[i]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
229 |
int j = i - 1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
230 |
for (; j >= off && a[j] > ai; j--) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
231 |
a[j+1] = a[j]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
232 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
233 |
a[j+1] = ai; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
234 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
235 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
236 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
237 |
// Most of these are copied from classes in java.awt.geom because we need |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
238 |
// float versions of these functions, and Line2D, CubicCurve2D, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
239 |
// QuadCurve2D don't provide them. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
240 |
/** |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
241 |
* Subdivides the cubic curve specified by the coordinates |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
242 |
* stored in the <code>src</code> array at indices <code>srcoff</code> |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
243 |
* through (<code>srcoff</code> + 7) and stores the |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
244 |
* resulting two subdivided curves into the two result arrays at the |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
245 |
* corresponding indices. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
246 |
* Either or both of the <code>left</code> and <code>right</code> |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
247 |
* arrays may be <code>null</code> or a reference to the same array |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
248 |
* as the <code>src</code> array. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
249 |
* Note that the last point in the first subdivided curve is the |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
250 |
* same as the first point in the second subdivided curve. Thus, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
251 |
* it is possible to pass the same array for <code>left</code> |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
252 |
* and <code>right</code> and to use offsets, such as <code>rightoff</code> |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
253 |
* equals (<code>leftoff</code> + 6), in order |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
254 |
* to avoid allocating extra storage for this common point. |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
255 |
* @param src the array holding the coordinates for the source curve |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
256 |
* @param srcoff the offset into the array of the beginning of the |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
257 |
* the 6 source coordinates |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
258 |
* @param left the array for storing the coordinates for the first |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
259 |
* half of the subdivided curve |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
260 |
* @param leftoff the offset into the array of the beginning of the |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
261 |
* the 6 left coordinates |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
262 |
* @param right the array for storing the coordinates for the second |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
263 |
* half of the subdivided curve |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
264 |
* @param rightoff the offset into the array of the beginning of the |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
265 |
* the 6 right coordinates |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
266 |
* @since 1.7 |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
267 |
*/ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
268 |
static void subdivideCubic(float src[], int srcoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
269 |
float left[], int leftoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
270 |
float right[], int rightoff) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
271 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
272 |
float x1 = src[srcoff + 0]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
273 |
float y1 = src[srcoff + 1]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
274 |
float ctrlx1 = src[srcoff + 2]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
275 |
float ctrly1 = src[srcoff + 3]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
276 |
float ctrlx2 = src[srcoff + 4]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
277 |
float ctrly2 = src[srcoff + 5]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
278 |
float x2 = src[srcoff + 6]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
279 |
float y2 = src[srcoff + 7]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
280 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
281 |
left[leftoff + 0] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
282 |
left[leftoff + 1] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
283 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
284 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
285 |
right[rightoff + 6] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
286 |
right[rightoff + 7] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
287 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
288 |
x1 = (x1 + ctrlx1) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
289 |
y1 = (y1 + ctrly1) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
290 |
x2 = (x2 + ctrlx2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
291 |
y2 = (y2 + ctrly2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
292 |
float centerx = (ctrlx1 + ctrlx2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
293 |
float centery = (ctrly1 + ctrly2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
294 |
ctrlx1 = (x1 + centerx) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
295 |
ctrly1 = (y1 + centery) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
296 |
ctrlx2 = (x2 + centerx) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
297 |
ctrly2 = (y2 + centery) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
298 |
centerx = (ctrlx1 + ctrlx2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
299 |
centery = (ctrly1 + ctrly2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
300 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
301 |
left[leftoff + 2] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
302 |
left[leftoff + 3] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
303 |
left[leftoff + 4] = ctrlx1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
304 |
left[leftoff + 5] = ctrly1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
305 |
left[leftoff + 6] = centerx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
306 |
left[leftoff + 7] = centery; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
307 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
308 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
309 |
right[rightoff + 0] = centerx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
310 |
right[rightoff + 1] = centery; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
311 |
right[rightoff + 2] = ctrlx2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
312 |
right[rightoff + 3] = ctrly2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
313 |
right[rightoff + 4] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
314 |
right[rightoff + 5] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
315 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
316 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
317 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
318 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
319 |
static void subdivideCubicAt(float t, float src[], int srcoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
320 |
float left[], int leftoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
321 |
float right[], int rightoff) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
322 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
323 |
float x1 = src[srcoff + 0]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
324 |
float y1 = src[srcoff + 1]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
325 |
float ctrlx1 = src[srcoff + 2]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
326 |
float ctrly1 = src[srcoff + 3]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
327 |
float ctrlx2 = src[srcoff + 4]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
328 |
float ctrly2 = src[srcoff + 5]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
329 |
float x2 = src[srcoff + 6]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
330 |
float y2 = src[srcoff + 7]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
331 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
332 |
left[leftoff + 0] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
333 |
left[leftoff + 1] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
334 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
335 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
336 |
right[rightoff + 6] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
337 |
right[rightoff + 7] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
338 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
339 |
x1 = x1 + t * (ctrlx1 - x1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
340 |
y1 = y1 + t * (ctrly1 - y1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
341 |
x2 = ctrlx2 + t * (x2 - ctrlx2); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
342 |
y2 = ctrly2 + t * (y2 - ctrly2); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
343 |
float centerx = ctrlx1 + t * (ctrlx2 - ctrlx1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
344 |
float centery = ctrly1 + t * (ctrly2 - ctrly1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
345 |
ctrlx1 = x1 + t * (centerx - x1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
346 |
ctrly1 = y1 + t * (centery - y1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
347 |
ctrlx2 = centerx + t * (x2 - centerx); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
348 |
ctrly2 = centery + t * (y2 - centery); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
349 |
centerx = ctrlx1 + t * (ctrlx2 - ctrlx1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
350 |
centery = ctrly1 + t * (ctrly2 - ctrly1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
351 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
352 |
left[leftoff + 2] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
353 |
left[leftoff + 3] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
354 |
left[leftoff + 4] = ctrlx1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
355 |
left[leftoff + 5] = ctrly1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
356 |
left[leftoff + 6] = centerx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
357 |
left[leftoff + 7] = centery; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
358 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
359 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
360 |
right[rightoff + 0] = centerx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
361 |
right[rightoff + 1] = centery; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
362 |
right[rightoff + 2] = ctrlx2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
363 |
right[rightoff + 3] = ctrly2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
364 |
right[rightoff + 4] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
365 |
right[rightoff + 5] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
366 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
367 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
368 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
369 |
static void subdivideQuad(float src[], int srcoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
370 |
float left[], int leftoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
371 |
float right[], int rightoff) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
372 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
373 |
float x1 = src[srcoff + 0]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
374 |
float y1 = src[srcoff + 1]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
375 |
float ctrlx = src[srcoff + 2]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
376 |
float ctrly = src[srcoff + 3]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
377 |
float x2 = src[srcoff + 4]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
378 |
float y2 = src[srcoff + 5]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
379 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
380 |
left[leftoff + 0] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
381 |
left[leftoff + 1] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
382 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
383 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
384 |
right[rightoff + 4] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
385 |
right[rightoff + 5] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
386 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
387 |
x1 = (x1 + ctrlx) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
388 |
y1 = (y1 + ctrly) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
389 |
x2 = (x2 + ctrlx) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
390 |
y2 = (y2 + ctrly) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
391 |
ctrlx = (x1 + x2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
392 |
ctrly = (y1 + y2) / 2.0f; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
393 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
394 |
left[leftoff + 2] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
395 |
left[leftoff + 3] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
396 |
left[leftoff + 4] = ctrlx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
397 |
left[leftoff + 5] = ctrly; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
398 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
399 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
400 |
right[rightoff + 0] = ctrlx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
401 |
right[rightoff + 1] = ctrly; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
402 |
right[rightoff + 2] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
403 |
right[rightoff + 3] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
404 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
405 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
406 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
407 |
static void subdivideQuadAt(float t, float src[], int srcoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
408 |
float left[], int leftoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
409 |
float right[], int rightoff) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
410 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
411 |
float x1 = src[srcoff + 0]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
412 |
float y1 = src[srcoff + 1]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
413 |
float ctrlx = src[srcoff + 2]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
414 |
float ctrly = src[srcoff + 3]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
415 |
float x2 = src[srcoff + 4]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
416 |
float y2 = src[srcoff + 5]; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
417 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
418 |
left[leftoff + 0] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
419 |
left[leftoff + 1] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
420 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
421 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
422 |
right[rightoff + 4] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
423 |
right[rightoff + 5] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
424 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
425 |
x1 = x1 + t * (ctrlx - x1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
426 |
y1 = y1 + t * (ctrly - y1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
427 |
x2 = ctrlx + t * (x2 - ctrlx); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
428 |
y2 = ctrly + t * (y2 - ctrly); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
429 |
ctrlx = x1 + t * (x2 - x1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
430 |
ctrly = y1 + t * (y2 - y1); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
431 |
if (left != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
432 |
left[leftoff + 2] = x1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
433 |
left[leftoff + 3] = y1; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
434 |
left[leftoff + 4] = ctrlx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
435 |
left[leftoff + 5] = ctrly; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
436 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
437 |
if (right != null) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
438 |
right[rightoff + 0] = ctrlx; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
439 |
right[rightoff + 1] = ctrly; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
440 |
right[rightoff + 2] = x2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
441 |
right[rightoff + 3] = y2; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
442 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
443 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
444 |
|
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
445 |
static void subdivideAt(float t, float src[], int srcoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
446 |
float left[], int leftoff, |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
447 |
float right[], int rightoff, int size) |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
448 |
{ |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
449 |
switch(size) { |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
450 |
case 8: |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
451 |
subdivideCubicAt(t, src, srcoff, left, leftoff, right, rightoff); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
452 |
break; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
453 |
case 6: |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
454 |
subdivideQuadAt(t, src, srcoff, left, leftoff, right, rightoff); |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
455 |
break; |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
456 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
457 |
} |
3642614e2282
6967434: Round joins/caps of scaled up lines have poor quality.
dlila
parents:
diff
changeset
|
458 |
} |