author | lbourges |
Mon, 11 Dec 2017 21:14:43 +0100 | |
changeset 48284 | fd7fbc929001 |
parent 47216 | 71c04702a3d5 |
child 49496 | 1ea202af7a97 |
permissions | -rw-r--r-- |
34417 | 1 |
/* |
47126 | 2 |
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. |
34417 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package sun.java2d.marlin; |
|
27 |
||
28 |
import static java.lang.Math.PI; |
|
48284
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
29 |
import java.util.Arrays; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
30 |
import sun.awt.geom.PathConsumer2D; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
31 |
import sun.java2d.marlin.stats.Histogram; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
32 |
import sun.java2d.marlin.stats.StatLong; |
34417 | 33 |
|
34 |
final class Helpers implements MarlinConst { |
|
35 |
||
36 |
private Helpers() { |
|
37 |
throw new Error("This is a non instantiable class"); |
|
38 |
} |
|
39 |
||
40 |
static boolean within(final float x, final float y, final float err) { |
|
41 |
final float d = y - x; |
|
42 |
return (d <= err && d >= -err); |
|
43 |
} |
|
44 |
||
45 |
static boolean within(final double x, final double y, final double err) { |
|
46 |
final double d = y - x; |
|
47 |
return (d <= err && d >= -err); |
|
48 |
} |
|
49 |
||
50 |
static int quadraticRoots(final float a, final float b, |
|
51 |
final float c, float[] zeroes, final int off) |
|
52 |
{ |
|
53 |
int ret = off; |
|
54 |
float t; |
|
47126 | 55 |
if (a != 0.0f) { |
34417 | 56 |
final float dis = b*b - 4*a*c; |
47126 | 57 |
if (dis > 0.0f) { |
58 |
final float sqrtDis = (float) Math.sqrt(dis); |
|
34417 | 59 |
// depending on the sign of b we use a slightly different |
60 |
// algorithm than the traditional one to find one of the roots |
|
61 |
// so we can avoid adding numbers of different signs (which |
|
62 |
// might result in loss of precision). |
|
47126 | 63 |
if (b >= 0.0f) { |
64 |
zeroes[ret++] = (2.0f * c) / (-b - sqrtDis); |
|
65 |
zeroes[ret++] = (-b - sqrtDis) / (2.0f * a); |
|
34417 | 66 |
} else { |
47126 | 67 |
zeroes[ret++] = (-b + sqrtDis) / (2.0f * a); |
68 |
zeroes[ret++] = (2.0f * c) / (-b + sqrtDis); |
|
34417 | 69 |
} |
47126 | 70 |
} else if (dis == 0.0f) { |
71 |
t = (-b) / (2.0f * a); |
|
34417 | 72 |
zeroes[ret++] = t; |
73 |
} |
|
74 |
} else { |
|
47126 | 75 |
if (b != 0.0f) { |
34417 | 76 |
t = (-c) / b; |
77 |
zeroes[ret++] = t; |
|
78 |
} |
|
79 |
} |
|
80 |
return ret - off; |
|
81 |
} |
|
82 |
||
83 |
// find the roots of g(t) = d*t^3 + a*t^2 + b*t + c in [A,B) |
|
84 |
static int cubicRootsInAB(float d, float a, float b, float c, |
|
85 |
float[] pts, final int off, |
|
86 |
final float A, final float B) |
|
87 |
{ |
|
47126 | 88 |
if (d == 0.0f) { |
34417 | 89 |
int num = quadraticRoots(a, b, c, pts, off); |
90 |
return filterOutNotInAB(pts, off, num, A, B) - off; |
|
91 |
} |
|
92 |
// From Graphics Gems: |
|
93 |
// http://tog.acm.org/resources/GraphicsGems/gems/Roots3And4.c |
|
94 |
// (also from awt.geom.CubicCurve2D. But here we don't need as |
|
95 |
// much accuracy and we don't want to create arrays so we use |
|
96 |
// our own customized version). |
|
97 |
||
98 |
// normal form: x^3 + ax^2 + bx + c = 0 |
|
99 |
a /= d; |
|
100 |
b /= d; |
|
101 |
c /= d; |
|
102 |
||
103 |
// substitute x = y - A/3 to eliminate quadratic term: |
|
104 |
// x^3 +Px + Q = 0 |
|
105 |
// |
|
106 |
// Since we actually need P/3 and Q/2 for all of the |
|
107 |
// calculations that follow, we will calculate |
|
108 |
// p = P/3 |
|
109 |
// q = Q/2 |
|
110 |
// instead and use those values for simplicity of the code. |
|
111 |
double sq_A = a * a; |
|
47126 | 112 |
double p = (1.0d/3.0d) * ((-1.0d/3.0d) * sq_A + b); |
113 |
double q = (1.0d/2.0d) * ((2.0d/27.0d) * a * sq_A - (1.0d/3.0d) * a * b + c); |
|
34417 | 114 |
|
115 |
// use Cardano's formula |
|
116 |
||
117 |
double cb_p = p * p * p; |
|
118 |
double D = q * q + cb_p; |
|
119 |
||
120 |
int num; |
|
47126 | 121 |
if (D < 0.0d) { |
34417 | 122 |
// see: http://en.wikipedia.org/wiki/Cubic_function#Trigonometric_.28and_hyperbolic.29_method |
48284
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
123 |
final double phi = (1.0d/3.0d) * Math.acos(-q / Math.sqrt(-cb_p)); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
124 |
final double t = 2.0d * Math.sqrt(-p); |
34417 | 125 |
|
48284
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
126 |
pts[ off+0 ] = (float) ( t * Math.cos(phi)); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
127 |
pts[ off+1 ] = (float) (-t * Math.cos(phi + (PI / 3.0d))); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
128 |
pts[ off+2 ] = (float) (-t * Math.cos(phi - (PI / 3.0d))); |
34417 | 129 |
num = 3; |
130 |
} else { |
|
48284
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
131 |
final double sqrt_D = Math.sqrt(D); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
132 |
final double u = Math.cbrt(sqrt_D - q); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
133 |
final double v = - Math.cbrt(sqrt_D + q); |
34417 | 134 |
|
47126 | 135 |
pts[ off ] = (float) (u + v); |
34417 | 136 |
num = 1; |
137 |
||
47126 | 138 |
if (within(D, 0.0d, 1e-8d)) { |
139 |
pts[off+1] = -(pts[off] / 2.0f); |
|
34417 | 140 |
num = 2; |
141 |
} |
|
142 |
} |
|
143 |
||
47126 | 144 |
final float sub = (1.0f/3.0f) * a; |
34417 | 145 |
|
146 |
for (int i = 0; i < num; ++i) { |
|
147 |
pts[ off+i ] -= sub; |
|
148 |
} |
|
149 |
||
150 |
return filterOutNotInAB(pts, off, num, A, B) - off; |
|
151 |
} |
|
152 |
||
153 |
static float evalCubic(final float a, final float b, |
|
154 |
final float c, final float d, |
|
155 |
final float t) |
|
156 |
{ |
|
157 |
return t * (t * (t * a + b) + c) + d; |
|
158 |
} |
|
159 |
||
160 |
static float evalQuad(final float a, final float b, |
|
161 |
final float c, final float t) |
|
162 |
{ |
|
163 |
return t * (t * a + b) + c; |
|
164 |
} |
|
165 |
||
166 |
// returns the index 1 past the last valid element remaining after filtering |
|
167 |
static int filterOutNotInAB(float[] nums, final int off, final int len, |
|
168 |
final float a, final float b) |
|
169 |
{ |
|
170 |
int ret = off; |
|
171 |
for (int i = off, end = off + len; i < end; i++) { |
|
172 |
if (nums[i] >= a && nums[i] < b) { |
|
173 |
nums[ret++] = nums[i]; |
|
174 |
} |
|
175 |
} |
|
176 |
return ret; |
|
177 |
} |
|
178 |
||
179 |
static float linelen(float x1, float y1, float x2, float y2) { |
|
180 |
final float dx = x2 - x1; |
|
181 |
final float dy = y2 - y1; |
|
47126 | 182 |
return (float) Math.sqrt(dx*dx + dy*dy); |
34417 | 183 |
} |
184 |
||
185 |
static void subdivide(float[] src, int srcoff, float[] left, int leftoff, |
|
186 |
float[] right, int rightoff, int type) |
|
187 |
{ |
|
188 |
switch(type) { |
|
189 |
case 6: |
|
190 |
Helpers.subdivideQuad(src, srcoff, left, leftoff, right, rightoff); |
|
191 |
return; |
|
192 |
case 8: |
|
193 |
Helpers.subdivideCubic(src, srcoff, left, leftoff, right, rightoff); |
|
194 |
return; |
|
195 |
default: |
|
196 |
throw new InternalError("Unsupported curve type"); |
|
197 |
} |
|
198 |
} |
|
199 |
||
200 |
static void isort(float[] a, int off, int len) { |
|
201 |
for (int i = off + 1, end = off + len; i < end; i++) { |
|
202 |
float ai = a[i]; |
|
203 |
int j = i - 1; |
|
204 |
for (; j >= off && a[j] > ai; j--) { |
|
205 |
a[j+1] = a[j]; |
|
206 |
} |
|
207 |
a[j+1] = ai; |
|
208 |
} |
|
209 |
} |
|
210 |
||
211 |
// Most of these are copied from classes in java.awt.geom because we need |
|
47126 | 212 |
// both single and double precision variants of these functions, and Line2D, |
213 |
// CubicCurve2D, QuadCurve2D don't provide them. |
|
34417 | 214 |
/** |
215 |
* Subdivides the cubic curve specified by the coordinates |
|
216 |
* stored in the <code>src</code> array at indices <code>srcoff</code> |
|
217 |
* through (<code>srcoff</code> + 7) and stores the |
|
218 |
* resulting two subdivided curves into the two result arrays at the |
|
219 |
* corresponding indices. |
|
220 |
* Either or both of the <code>left</code> and <code>right</code> |
|
221 |
* arrays may be <code>null</code> or a reference to the same array |
|
222 |
* as the <code>src</code> array. |
|
223 |
* Note that the last point in the first subdivided curve is the |
|
224 |
* same as the first point in the second subdivided curve. Thus, |
|
225 |
* it is possible to pass the same array for <code>left</code> |
|
226 |
* and <code>right</code> and to use offsets, such as <code>rightoff</code> |
|
227 |
* equals (<code>leftoff</code> + 6), in order |
|
228 |
* to avoid allocating extra storage for this common point. |
|
229 |
* @param src the array holding the coordinates for the source curve |
|
230 |
* @param srcoff the offset into the array of the beginning of the |
|
231 |
* the 6 source coordinates |
|
232 |
* @param left the array for storing the coordinates for the first |
|
233 |
* half of the subdivided curve |
|
234 |
* @param leftoff the offset into the array of the beginning of the |
|
235 |
* the 6 left coordinates |
|
236 |
* @param right the array for storing the coordinates for the second |
|
237 |
* half of the subdivided curve |
|
238 |
* @param rightoff the offset into the array of the beginning of the |
|
239 |
* the 6 right coordinates |
|
240 |
* @since 1.7 |
|
241 |
*/ |
|
39519
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
242 |
static void subdivideCubic(float[] src, int srcoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
243 |
float[] left, int leftoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
244 |
float[] right, int rightoff) |
34417 | 245 |
{ |
246 |
float x1 = src[srcoff + 0]; |
|
247 |
float y1 = src[srcoff + 1]; |
|
248 |
float ctrlx1 = src[srcoff + 2]; |
|
249 |
float ctrly1 = src[srcoff + 3]; |
|
250 |
float ctrlx2 = src[srcoff + 4]; |
|
251 |
float ctrly2 = src[srcoff + 5]; |
|
252 |
float x2 = src[srcoff + 6]; |
|
253 |
float y2 = src[srcoff + 7]; |
|
254 |
if (left != null) { |
|
255 |
left[leftoff + 0] = x1; |
|
256 |
left[leftoff + 1] = y1; |
|
257 |
} |
|
258 |
if (right != null) { |
|
259 |
right[rightoff + 6] = x2; |
|
260 |
right[rightoff + 7] = y2; |
|
261 |
} |
|
47126 | 262 |
x1 = (x1 + ctrlx1) / 2.0f; |
263 |
y1 = (y1 + ctrly1) / 2.0f; |
|
264 |
x2 = (x2 + ctrlx2) / 2.0f; |
|
265 |
y2 = (y2 + ctrly2) / 2.0f; |
|
266 |
float centerx = (ctrlx1 + ctrlx2) / 2.0f; |
|
267 |
float centery = (ctrly1 + ctrly2) / 2.0f; |
|
268 |
ctrlx1 = (x1 + centerx) / 2.0f; |
|
269 |
ctrly1 = (y1 + centery) / 2.0f; |
|
270 |
ctrlx2 = (x2 + centerx) / 2.0f; |
|
271 |
ctrly2 = (y2 + centery) / 2.0f; |
|
272 |
centerx = (ctrlx1 + ctrlx2) / 2.0f; |
|
273 |
centery = (ctrly1 + ctrly2) / 2.0f; |
|
34417 | 274 |
if (left != null) { |
275 |
left[leftoff + 2] = x1; |
|
276 |
left[leftoff + 3] = y1; |
|
277 |
left[leftoff + 4] = ctrlx1; |
|
278 |
left[leftoff + 5] = ctrly1; |
|
279 |
left[leftoff + 6] = centerx; |
|
280 |
left[leftoff + 7] = centery; |
|
281 |
} |
|
282 |
if (right != null) { |
|
283 |
right[rightoff + 0] = centerx; |
|
284 |
right[rightoff + 1] = centery; |
|
285 |
right[rightoff + 2] = ctrlx2; |
|
286 |
right[rightoff + 3] = ctrly2; |
|
287 |
right[rightoff + 4] = x2; |
|
288 |
right[rightoff + 5] = y2; |
|
289 |
} |
|
290 |
} |
|
291 |
||
292 |
||
39519
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
293 |
static void subdivideCubicAt(float t, float[] src, int srcoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
294 |
float[] left, int leftoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
295 |
float[] right, int rightoff) |
34417 | 296 |
{ |
297 |
float x1 = src[srcoff + 0]; |
|
298 |
float y1 = src[srcoff + 1]; |
|
299 |
float ctrlx1 = src[srcoff + 2]; |
|
300 |
float ctrly1 = src[srcoff + 3]; |
|
301 |
float ctrlx2 = src[srcoff + 4]; |
|
302 |
float ctrly2 = src[srcoff + 5]; |
|
303 |
float x2 = src[srcoff + 6]; |
|
304 |
float y2 = src[srcoff + 7]; |
|
305 |
if (left != null) { |
|
306 |
left[leftoff + 0] = x1; |
|
307 |
left[leftoff + 1] = y1; |
|
308 |
} |
|
309 |
if (right != null) { |
|
310 |
right[rightoff + 6] = x2; |
|
311 |
right[rightoff + 7] = y2; |
|
312 |
} |
|
313 |
x1 = x1 + t * (ctrlx1 - x1); |
|
314 |
y1 = y1 + t * (ctrly1 - y1); |
|
315 |
x2 = ctrlx2 + t * (x2 - ctrlx2); |
|
316 |
y2 = ctrly2 + t * (y2 - ctrly2); |
|
317 |
float centerx = ctrlx1 + t * (ctrlx2 - ctrlx1); |
|
318 |
float centery = ctrly1 + t * (ctrly2 - ctrly1); |
|
319 |
ctrlx1 = x1 + t * (centerx - x1); |
|
320 |
ctrly1 = y1 + t * (centery - y1); |
|
321 |
ctrlx2 = centerx + t * (x2 - centerx); |
|
322 |
ctrly2 = centery + t * (y2 - centery); |
|
323 |
centerx = ctrlx1 + t * (ctrlx2 - ctrlx1); |
|
324 |
centery = ctrly1 + t * (ctrly2 - ctrly1); |
|
325 |
if (left != null) { |
|
326 |
left[leftoff + 2] = x1; |
|
327 |
left[leftoff + 3] = y1; |
|
328 |
left[leftoff + 4] = ctrlx1; |
|
329 |
left[leftoff + 5] = ctrly1; |
|
330 |
left[leftoff + 6] = centerx; |
|
331 |
left[leftoff + 7] = centery; |
|
332 |
} |
|
333 |
if (right != null) { |
|
334 |
right[rightoff + 0] = centerx; |
|
335 |
right[rightoff + 1] = centery; |
|
336 |
right[rightoff + 2] = ctrlx2; |
|
337 |
right[rightoff + 3] = ctrly2; |
|
338 |
right[rightoff + 4] = x2; |
|
339 |
right[rightoff + 5] = y2; |
|
340 |
} |
|
341 |
} |
|
342 |
||
39519
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
343 |
static void subdivideQuad(float[] src, int srcoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
344 |
float[] left, int leftoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
345 |
float[] right, int rightoff) |
34417 | 346 |
{ |
347 |
float x1 = src[srcoff + 0]; |
|
348 |
float y1 = src[srcoff + 1]; |
|
349 |
float ctrlx = src[srcoff + 2]; |
|
350 |
float ctrly = src[srcoff + 3]; |
|
351 |
float x2 = src[srcoff + 4]; |
|
352 |
float y2 = src[srcoff + 5]; |
|
353 |
if (left != null) { |
|
354 |
left[leftoff + 0] = x1; |
|
355 |
left[leftoff + 1] = y1; |
|
356 |
} |
|
357 |
if (right != null) { |
|
358 |
right[rightoff + 4] = x2; |
|
359 |
right[rightoff + 5] = y2; |
|
360 |
} |
|
47126 | 361 |
x1 = (x1 + ctrlx) / 2.0f; |
362 |
y1 = (y1 + ctrly) / 2.0f; |
|
363 |
x2 = (x2 + ctrlx) / 2.0f; |
|
364 |
y2 = (y2 + ctrly) / 2.0f; |
|
365 |
ctrlx = (x1 + x2) / 2.0f; |
|
366 |
ctrly = (y1 + y2) / 2.0f; |
|
34417 | 367 |
if (left != null) { |
368 |
left[leftoff + 2] = x1; |
|
369 |
left[leftoff + 3] = y1; |
|
370 |
left[leftoff + 4] = ctrlx; |
|
371 |
left[leftoff + 5] = ctrly; |
|
372 |
} |
|
373 |
if (right != null) { |
|
374 |
right[rightoff + 0] = ctrlx; |
|
375 |
right[rightoff + 1] = ctrly; |
|
376 |
right[rightoff + 2] = x2; |
|
377 |
right[rightoff + 3] = y2; |
|
378 |
} |
|
379 |
} |
|
380 |
||
39519
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
381 |
static void subdivideQuadAt(float t, float[] src, int srcoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
382 |
float[] left, int leftoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
383 |
float[] right, int rightoff) |
34417 | 384 |
{ |
385 |
float x1 = src[srcoff + 0]; |
|
386 |
float y1 = src[srcoff + 1]; |
|
387 |
float ctrlx = src[srcoff + 2]; |
|
388 |
float ctrly = src[srcoff + 3]; |
|
389 |
float x2 = src[srcoff + 4]; |
|
390 |
float y2 = src[srcoff + 5]; |
|
391 |
if (left != null) { |
|
392 |
left[leftoff + 0] = x1; |
|
393 |
left[leftoff + 1] = y1; |
|
394 |
} |
|
395 |
if (right != null) { |
|
396 |
right[rightoff + 4] = x2; |
|
397 |
right[rightoff + 5] = y2; |
|
398 |
} |
|
399 |
x1 = x1 + t * (ctrlx - x1); |
|
400 |
y1 = y1 + t * (ctrly - y1); |
|
401 |
x2 = ctrlx + t * (x2 - ctrlx); |
|
402 |
y2 = ctrly + t * (y2 - ctrly); |
|
403 |
ctrlx = x1 + t * (x2 - x1); |
|
404 |
ctrly = y1 + t * (y2 - y1); |
|
405 |
if (left != null) { |
|
406 |
left[leftoff + 2] = x1; |
|
407 |
left[leftoff + 3] = y1; |
|
408 |
left[leftoff + 4] = ctrlx; |
|
409 |
left[leftoff + 5] = ctrly; |
|
410 |
} |
|
411 |
if (right != null) { |
|
412 |
right[rightoff + 0] = ctrlx; |
|
413 |
right[rightoff + 1] = ctrly; |
|
414 |
right[rightoff + 2] = x2; |
|
415 |
right[rightoff + 3] = y2; |
|
416 |
} |
|
417 |
} |
|
418 |
||
39519
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
419 |
static void subdivideAt(float t, float[] src, int srcoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
420 |
float[] left, int leftoff, |
21bfc4452441
8159093: Fix coding conventions in Marlin renderer
lbourges
parents:
34417
diff
changeset
|
421 |
float[] right, int rightoff, int size) |
34417 | 422 |
{ |
423 |
switch(size) { |
|
424 |
case 8: |
|
425 |
subdivideCubicAt(t, src, srcoff, left, leftoff, right, rightoff); |
|
426 |
return; |
|
427 |
case 6: |
|
428 |
subdivideQuadAt(t, src, srcoff, left, leftoff, right, rightoff); |
|
429 |
return; |
|
430 |
} |
|
431 |
} |
|
48284
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
432 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
433 |
// From sun.java2d.loops.GeneralRenderer: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
434 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
435 |
static int outcode(final float x, final float y, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
436 |
final float[] clipRect) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
437 |
{ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
438 |
int code; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
439 |
if (y < clipRect[0]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
440 |
code = OUTCODE_TOP; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
441 |
} else if (y >= clipRect[1]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
442 |
code = OUTCODE_BOTTOM; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
443 |
} else { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
444 |
code = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
445 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
446 |
if (x < clipRect[2]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
447 |
code |= OUTCODE_LEFT; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
448 |
} else if (x >= clipRect[3]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
449 |
code |= OUTCODE_RIGHT; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
450 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
451 |
return code; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
452 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
453 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
454 |
// a stack of polynomial curves where each curve shares endpoints with |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
455 |
// adjacent ones. |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
456 |
static final class PolyStack { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
457 |
private static final byte TYPE_LINETO = (byte) 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
458 |
private static final byte TYPE_QUADTO = (byte) 1; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
459 |
private static final byte TYPE_CUBICTO = (byte) 2; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
460 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
461 |
// curves capacity = edges count (8192) = edges x 2 (coords) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
462 |
private static final int INITIAL_CURVES_COUNT = INITIAL_EDGES_COUNT << 1; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
463 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
464 |
// types capacity = edges count (4096) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
465 |
private static final int INITIAL_TYPES_COUNT = INITIAL_EDGES_COUNT; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
466 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
467 |
float[] curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
468 |
int end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
469 |
byte[] curveTypes; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
470 |
int numCurves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
471 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
472 |
// curves ref (dirty) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
473 |
final FloatArrayCache.Reference curves_ref; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
474 |
// curveTypes ref (dirty) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
475 |
final ByteArrayCache.Reference curveTypes_ref; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
476 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
477 |
// used marks (stats only) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
478 |
int curveTypesUseMark; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
479 |
int curvesUseMark; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
480 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
481 |
private final StatLong stat_polystack_types; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
482 |
private final StatLong stat_polystack_curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
483 |
private final Histogram hist_polystack_curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
484 |
private final StatLong stat_array_polystack_curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
485 |
private final StatLong stat_array_polystack_curveTypes; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
486 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
487 |
PolyStack(final RendererContext rdrCtx) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
488 |
this(rdrCtx, null, null, null, null, null); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
489 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
490 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
491 |
PolyStack(final RendererContext rdrCtx, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
492 |
final StatLong stat_polystack_types, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
493 |
final StatLong stat_polystack_curves, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
494 |
final Histogram hist_polystack_curves, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
495 |
final StatLong stat_array_polystack_curves, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
496 |
final StatLong stat_array_polystack_curveTypes) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
497 |
{ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
498 |
curves_ref = rdrCtx.newDirtyFloatArrayRef(INITIAL_CURVES_COUNT); // 32K |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
499 |
curves = curves_ref.initial; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
500 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
501 |
curveTypes_ref = rdrCtx.newDirtyByteArrayRef(INITIAL_TYPES_COUNT); // 4K |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
502 |
curveTypes = curveTypes_ref.initial; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
503 |
numCurves = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
504 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
505 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
506 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
507 |
curveTypesUseMark = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
508 |
curvesUseMark = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
509 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
510 |
this.stat_polystack_types = stat_polystack_types; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
511 |
this.stat_polystack_curves = stat_polystack_curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
512 |
this.hist_polystack_curves = hist_polystack_curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
513 |
this.stat_array_polystack_curves = stat_array_polystack_curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
514 |
this.stat_array_polystack_curveTypes = stat_array_polystack_curveTypes; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
515 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
516 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
517 |
/** |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
518 |
* Disposes this PolyStack: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
519 |
* clean up before reusing this instance |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
520 |
*/ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
521 |
void dispose() { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
522 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
523 |
numCurves = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
524 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
525 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
526 |
stat_polystack_types.add(curveTypesUseMark); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
527 |
stat_polystack_curves.add(curvesUseMark); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
528 |
hist_polystack_curves.add(curvesUseMark); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
529 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
530 |
// reset marks |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
531 |
curveTypesUseMark = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
532 |
curvesUseMark = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
533 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
534 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
535 |
// Return arrays: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
536 |
// curves and curveTypes are kept dirty |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
537 |
curves = curves_ref.putArray(curves); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
538 |
curveTypes = curveTypes_ref.putArray(curveTypes); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
539 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
540 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
541 |
private void ensureSpace(final int n) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
542 |
// use substraction to avoid integer overflow: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
543 |
if (curves.length - end < n) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
544 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
545 |
stat_array_polystack_curves.add(end + n); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
546 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
547 |
curves = curves_ref.widenArray(curves, end, end + n); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
548 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
549 |
if (curveTypes.length <= numCurves) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
550 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
551 |
stat_array_polystack_curveTypes.add(numCurves + 1); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
552 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
553 |
curveTypes = curveTypes_ref.widenArray(curveTypes, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
554 |
numCurves, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
555 |
numCurves + 1); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
556 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
557 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
558 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
559 |
void pushCubic(float x0, float y0, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
560 |
float x1, float y1, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
561 |
float x2, float y2) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
562 |
{ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
563 |
ensureSpace(6); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
564 |
curveTypes[numCurves++] = TYPE_CUBICTO; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
565 |
// we reverse the coordinate order to make popping easier |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
566 |
final float[] _curves = curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
567 |
int e = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
568 |
_curves[e++] = x2; _curves[e++] = y2; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
569 |
_curves[e++] = x1; _curves[e++] = y1; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
570 |
_curves[e++] = x0; _curves[e++] = y0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
571 |
end = e; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
572 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
573 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
574 |
void pushQuad(float x0, float y0, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
575 |
float x1, float y1) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
576 |
{ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
577 |
ensureSpace(4); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
578 |
curveTypes[numCurves++] = TYPE_QUADTO; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
579 |
final float[] _curves = curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
580 |
int e = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
581 |
_curves[e++] = x1; _curves[e++] = y1; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
582 |
_curves[e++] = x0; _curves[e++] = y0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
583 |
end = e; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
584 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
585 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
586 |
void pushLine(float x, float y) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
587 |
ensureSpace(2); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
588 |
curveTypes[numCurves++] = TYPE_LINETO; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
589 |
curves[end++] = x; curves[end++] = y; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
590 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
591 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
592 |
void pullAll(final PathConsumer2D io) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
593 |
final int nc = numCurves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
594 |
if (nc == 0) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
595 |
return; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
596 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
597 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
598 |
// update used marks: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
599 |
if (numCurves > curveTypesUseMark) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
600 |
curveTypesUseMark = numCurves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
601 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
602 |
if (end > curvesUseMark) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
603 |
curvesUseMark = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
604 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
605 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
606 |
final byte[] _curveTypes = curveTypes; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
607 |
final float[] _curves = curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
608 |
int e = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
609 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
610 |
for (int i = 0; i < nc; i++) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
611 |
switch(_curveTypes[i]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
612 |
case TYPE_LINETO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
613 |
io.lineTo(_curves[e], _curves[e+1]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
614 |
e += 2; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
615 |
continue; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
616 |
case TYPE_QUADTO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
617 |
io.quadTo(_curves[e+0], _curves[e+1], |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
618 |
_curves[e+2], _curves[e+3]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
619 |
e += 4; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
620 |
continue; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
621 |
case TYPE_CUBICTO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
622 |
io.curveTo(_curves[e+0], _curves[e+1], |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
623 |
_curves[e+2], _curves[e+3], |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
624 |
_curves[e+4], _curves[e+5]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
625 |
e += 6; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
626 |
continue; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
627 |
default: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
628 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
629 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
630 |
numCurves = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
631 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
632 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
633 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
634 |
void popAll(final PathConsumer2D io) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
635 |
int nc = numCurves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
636 |
if (nc == 0) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
637 |
return; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
638 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
639 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
640 |
// update used marks: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
641 |
if (numCurves > curveTypesUseMark) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
642 |
curveTypesUseMark = numCurves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
643 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
644 |
if (end > curvesUseMark) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
645 |
curvesUseMark = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
646 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
647 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
648 |
final byte[] _curveTypes = curveTypes; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
649 |
final float[] _curves = curves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
650 |
int e = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
651 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
652 |
while (nc != 0) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
653 |
switch(_curveTypes[--nc]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
654 |
case TYPE_LINETO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
655 |
e -= 2; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
656 |
io.lineTo(_curves[e], _curves[e+1]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
657 |
continue; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
658 |
case TYPE_QUADTO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
659 |
e -= 4; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
660 |
io.quadTo(_curves[e+0], _curves[e+1], |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
661 |
_curves[e+2], _curves[e+3]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
662 |
continue; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
663 |
case TYPE_CUBICTO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
664 |
e -= 6; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
665 |
io.curveTo(_curves[e+0], _curves[e+1], |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
666 |
_curves[e+2], _curves[e+3], |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
667 |
_curves[e+4], _curves[e+5]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
668 |
continue; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
669 |
default: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
670 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
671 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
672 |
numCurves = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
673 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
674 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
675 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
676 |
@Override |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
677 |
public String toString() { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
678 |
String ret = ""; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
679 |
int nc = numCurves; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
680 |
int last = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
681 |
int len; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
682 |
while (nc != 0) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
683 |
switch(curveTypes[--nc]) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
684 |
case TYPE_LINETO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
685 |
len = 2; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
686 |
ret += "line: "; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
687 |
break; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
688 |
case TYPE_QUADTO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
689 |
len = 4; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
690 |
ret += "quad: "; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
691 |
break; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
692 |
case TYPE_CUBICTO: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
693 |
len = 6; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
694 |
ret += "cubic: "; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
695 |
break; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
696 |
default: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
697 |
len = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
698 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
699 |
last -= len; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
700 |
ret += Arrays.toString(Arrays.copyOfRange(curves, last, last+len)) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
701 |
+ "\n"; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
702 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
703 |
return ret; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
704 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
705 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
706 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
707 |
// a stack of integer indices |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
708 |
static final class IndexStack { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
709 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
710 |
// integer capacity = edges count / 4 ~ 1024 |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
711 |
private static final int INITIAL_COUNT = INITIAL_EDGES_COUNT >> 2; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
712 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
713 |
private int end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
714 |
private int[] indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
715 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
716 |
// indices ref (dirty) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
717 |
private final IntArrayCache.Reference indices_ref; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
718 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
719 |
// used marks (stats only) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
720 |
private int indicesUseMark; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
721 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
722 |
private final StatLong stat_idxstack_indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
723 |
private final Histogram hist_idxstack_indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
724 |
private final StatLong stat_array_idxstack_indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
725 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
726 |
IndexStack(final RendererContext rdrCtx) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
727 |
this(rdrCtx, null, null, null); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
728 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
729 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
730 |
IndexStack(final RendererContext rdrCtx, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
731 |
final StatLong stat_idxstack_indices, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
732 |
final Histogram hist_idxstack_indices, |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
733 |
final StatLong stat_array_idxstack_indices) |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
734 |
{ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
735 |
indices_ref = rdrCtx.newDirtyIntArrayRef(INITIAL_COUNT); // 4K |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
736 |
indices = indices_ref.initial; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
737 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
738 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
739 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
740 |
indicesUseMark = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
741 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
742 |
this.stat_idxstack_indices = stat_idxstack_indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
743 |
this.hist_idxstack_indices = hist_idxstack_indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
744 |
this.stat_array_idxstack_indices = stat_array_idxstack_indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
745 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
746 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
747 |
/** |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
748 |
* Disposes this PolyStack: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
749 |
* clean up before reusing this instance |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
750 |
*/ |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
751 |
void dispose() { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
752 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
753 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
754 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
755 |
stat_idxstack_indices.add(indicesUseMark); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
756 |
hist_idxstack_indices.add(indicesUseMark); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
757 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
758 |
// reset marks |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
759 |
indicesUseMark = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
760 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
761 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
762 |
// Return arrays: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
763 |
// values is kept dirty |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
764 |
indices = indices_ref.putArray(indices); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
765 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
766 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
767 |
boolean isEmpty() { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
768 |
return (end == 0); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
769 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
770 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
771 |
void reset() { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
772 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
773 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
774 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
775 |
void push(final int v) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
776 |
// remove redundant values (reverse order): |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
777 |
int[] _values = indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
778 |
final int nc = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
779 |
if (nc != 0) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
780 |
if (_values[nc - 1] == v) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
781 |
// remove both duplicated values: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
782 |
end--; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
783 |
return; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
784 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
785 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
786 |
if (_values.length <= nc) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
787 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
788 |
stat_array_idxstack_indices.add(nc + 1); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
789 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
790 |
indices = _values = indices_ref.widenArray(_values, nc, nc + 1); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
791 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
792 |
_values[end++] = v; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
793 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
794 |
if (DO_STATS) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
795 |
// update used marks: |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
796 |
if (end > indicesUseMark) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
797 |
indicesUseMark = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
798 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
799 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
800 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
801 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
802 |
void pullAll(final float[] points, final PathConsumer2D io) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
803 |
final int nc = end; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
804 |
if (nc == 0) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
805 |
return; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
806 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
807 |
final int[] _values = indices; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
808 |
|
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
809 |
for (int i = 0, j; i < nc; i++) { |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
810 |
j = _values[i] << 1; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
811 |
io.lineTo(points[j], points[j + 1]); |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
812 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
813 |
end = 0; |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
814 |
} |
fd7fbc929001
8191814: Marlin rasterizer spends time computing geometry for stroked segments that do not intersect the clip
lbourges
parents:
47216
diff
changeset
|
815 |
} |
34417 | 816 |
} |