equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
29 import java.lang.ref.WeakReference; |
29 import java.lang.ref.WeakReference; |
30 import java.util.concurrent.atomic.AtomicInteger; |
30 import java.util.concurrent.atomic.AtomicInteger; |
31 import sun.java2d.ReentrantContext; |
31 import sun.java2d.ReentrantContext; |
32 import sun.java2d.marlin.ArrayCacheConst.CacheStats; |
32 import sun.java2d.marlin.ArrayCacheConst.CacheStats; |
33 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator; |
33 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator; |
|
34 import sun.java2d.marlin.TransformingPathConsumer2D.CurveBasicMonotonizer; |
|
35 import sun.java2d.marlin.TransformingPathConsumer2D.CurveClipSplitter; |
34 |
36 |
35 /** |
37 /** |
36 * This class is a renderer context dedicated to a single thread |
38 * This class is a renderer context dedicated to a single thread |
37 */ |
39 */ |
38 final class RendererContext extends ReentrantContext implements IRendererContext { |
40 final class RendererContext extends ReentrantContext implements IRendererContext { |
68 private WeakReference<Path2D.Float> refPath2D = null; |
70 private WeakReference<Path2D.Float> refPath2D = null; |
69 final Renderer renderer; |
71 final Renderer renderer; |
70 final Stroker stroker; |
72 final Stroker stroker; |
71 // Simplifies out collinear lines |
73 // Simplifies out collinear lines |
72 final CollinearSimplifier simplifier = new CollinearSimplifier(); |
74 final CollinearSimplifier simplifier = new CollinearSimplifier(); |
|
75 // Simplifies path |
|
76 final PathSimplifier pathSimplifier = new PathSimplifier(); |
73 final Dasher dasher; |
77 final Dasher dasher; |
74 final MarlinTileGenerator ptg; |
78 final MarlinTileGenerator ptg; |
75 final MarlinCache cache; |
79 final MarlinCache cache; |
76 // flag indicating the shape is stroked (1) or filled (0) |
80 // flag indicating the shape is stroked (1) or filled (0) |
77 int stroking = 0; |
81 int stroking = 0; |
79 boolean doClip = false; |
83 boolean doClip = false; |
80 // flag indicating if the path is closed or not (in advance) to handle properly caps |
84 // flag indicating if the path is closed or not (in advance) to handle properly caps |
81 boolean closedPath = false; |
85 boolean closedPath = false; |
82 // clip rectangle (ymin, ymax, xmin, xmax): |
86 // clip rectangle (ymin, ymax, xmin, xmax): |
83 final float[] clipRect = new float[4]; |
87 final float[] clipRect = new float[4]; |
|
88 // CurveBasicMonotonizer instance |
|
89 final CurveBasicMonotonizer monotonizer; |
|
90 // CurveClipSplitter instance |
|
91 final CurveClipSplitter curveClipSplitter; |
84 |
92 |
85 // Array caches: |
93 // Array caches: |
86 /* clean int[] cache (zero-filled) = 5 refs */ |
94 /* clean int[] cache (zero-filled) = 5 refs */ |
87 private final IntArrayCache cleanIntCache = new IntArrayCache(true, 5); |
95 private final IntArrayCache cleanIntCache = new IntArrayCache(true, 5); |
88 /* dirty int[] cache = 5 refs */ |
96 /* dirty int[] cache = 5 refs */ |
118 } |
126 } |
119 |
127 |
120 // NormalizingPathIterator instances: |
128 // NormalizingPathIterator instances: |
121 nPCPathIterator = new NormalizingPathIterator.NearestPixelCenter(float6); |
129 nPCPathIterator = new NormalizingPathIterator.NearestPixelCenter(float6); |
122 nPQPathIterator = new NormalizingPathIterator.NearestPixelQuarter(float6); |
130 nPQPathIterator = new NormalizingPathIterator.NearestPixelQuarter(float6); |
|
131 |
|
132 // curve monotonizer & clip subdivider (before transformerPC2D init) |
|
133 monotonizer = new CurveBasicMonotonizer(this); |
|
134 curveClipSplitter = new CurveClipSplitter(this); |
123 |
135 |
124 // MarlinRenderingEngine.TransformingPathConsumer2D |
136 // MarlinRenderingEngine.TransformingPathConsumer2D |
125 transformerPC2D = new TransformingPathConsumer2D(this); |
137 transformerPC2D = new TransformingPathConsumer2D(this); |
126 |
138 |
127 // Renderer: |
139 // Renderer: |