62 final DCurve curve = new DCurve();
63 // MarlinRenderingEngine.TransformingPathConsumer2D
64 public final DTransformingPathConsumer2D transformerPC2D;
65 // recycled Path2D instance (weak)
66 private WeakReference<Path2D> refPath2D = null;
67 public final DRenderer renderer;
68 public final DStroker stroker;
69 // Simplifies out collinear lines
70 public final DCollinearSimplifier simplifier = new DCollinearSimplifier();
71 // Simplifies path
72 public final DPathSimplifier pathSimplifier = new DPathSimplifier();
73 public final DDasher dasher;
74 // flag indicating the shape is stroked (1) or filled (0)
75 int stroking = 0;
76 // flag indicating to clip the shape
77 public boolean doClip = false;
78 // flag indicating if the path is closed or not (in advance) to handle properly caps
79 boolean closedPath = false;
80 // clip rectangle (ymin, ymax, xmin, xmax):
81 public final double[] clipRect = new double[4];
82 // CurveBasicMonotonizer instance
83 public final CurveBasicMonotonizer monotonizer;
84 // CurveClipSplitter instance
85 final CurveClipSplitter curveClipSplitter;
86
87 // MarlinFX specific:
88 // shared memory between renderer instances:
89 final DRendererSharedMemory rdrMem;
90 private DRendererNoAA rendererNoAA = null;
91 // dirty bbox rectangle
92 public final Rectangle clip = new Rectangle();
93 // dirty MaskMarlinAlphaConsumer
94 public MaskMarlinAlphaConsumer consumer = null;
95
96 // Array caches:
97 /* clean int[] cache (zero-filled) = 5 refs */
98 private final IntArrayCache cleanIntCache = new IntArrayCache(true, 5);
99 /* dirty int[] cache = 5 refs */
100 private final IntArrayCache dirtyIntCache = new IntArrayCache(false, 5);
101 /* dirty double[] cache = 4 refs (2 polystack) */
142 renderer = new DRenderer(this);
143
144 stroker = new DStroker(this);
145 dasher = new DDasher(this);
146 }
147
148 /**
149 * Disposes this renderer context:
150 * clean up before reusing this context
151 */
152 public void dispose() {
153 if (DO_STATS) {
154 if (stats.totalOffHeap > stats.totalOffHeapMax) {
155 stats.totalOffHeapMax = stats.totalOffHeap;
156 }
157 stats.totalOffHeap = 0L;
158 }
159 stroking = 0;
160 doClip = false;
161 closedPath = false;
162
163 // if context is maked as DIRTY:
164 if (dirty) {
165 // may happen if an exception if thrown in the pipeline processing:
166 // force cleanup of all possible pipelined blocks (except Renderer):
167
168 // Dasher:
169 this.dasher.dispose();
170 // Stroker:
171 this.stroker.dispose();
172
173 // mark context as CLEAN:
174 dirty = false;
175 }
176 }
177
178 public Path2D getPath2D() {
179 // resolve reference:
180 Path2D p2d = (refPath2D != null) ? refPath2D.get() : null;
181
|
62 final DCurve curve = new DCurve();
63 // MarlinRenderingEngine.TransformingPathConsumer2D
64 public final DTransformingPathConsumer2D transformerPC2D;
65 // recycled Path2D instance (weak)
66 private WeakReference<Path2D> refPath2D = null;
67 public final DRenderer renderer;
68 public final DStroker stroker;
69 // Simplifies out collinear lines
70 public final DCollinearSimplifier simplifier = new DCollinearSimplifier();
71 // Simplifies path
72 public final DPathSimplifier pathSimplifier = new DPathSimplifier();
73 public final DDasher dasher;
74 // flag indicating the shape is stroked (1) or filled (0)
75 int stroking = 0;
76 // flag indicating to clip the shape
77 public boolean doClip = false;
78 // flag indicating if the path is closed or not (in advance) to handle properly caps
79 boolean closedPath = false;
80 // clip rectangle (ymin, ymax, xmin, xmax):
81 public final double[] clipRect = new double[4];
82 // clip inverse scale (mean) to adjust length checks
83 public double clipInvScale = 0.0d;
84 // CurveBasicMonotonizer instance
85 public final CurveBasicMonotonizer monotonizer;
86 // CurveClipSplitter instance
87 final CurveClipSplitter curveClipSplitter;
88
89 // MarlinFX specific:
90 // shared memory between renderer instances:
91 final DRendererSharedMemory rdrMem;
92 private DRendererNoAA rendererNoAA = null;
93 // dirty bbox rectangle
94 public final Rectangle clip = new Rectangle();
95 // dirty MaskMarlinAlphaConsumer
96 public MaskMarlinAlphaConsumer consumer = null;
97
98 // Array caches:
99 /* clean int[] cache (zero-filled) = 5 refs */
100 private final IntArrayCache cleanIntCache = new IntArrayCache(true, 5);
101 /* dirty int[] cache = 5 refs */
102 private final IntArrayCache dirtyIntCache = new IntArrayCache(false, 5);
103 /* dirty double[] cache = 4 refs (2 polystack) */
144 renderer = new DRenderer(this);
145
146 stroker = new DStroker(this);
147 dasher = new DDasher(this);
148 }
149
150 /**
151 * Disposes this renderer context:
152 * clean up before reusing this context
153 */
154 public void dispose() {
155 if (DO_STATS) {
156 if (stats.totalOffHeap > stats.totalOffHeapMax) {
157 stats.totalOffHeapMax = stats.totalOffHeap;
158 }
159 stats.totalOffHeap = 0L;
160 }
161 stroking = 0;
162 doClip = false;
163 closedPath = false;
164 clipInvScale = 0.0d;
165
166 // if context is maked as DIRTY:
167 if (dirty) {
168 // may happen if an exception if thrown in the pipeline processing:
169 // force cleanup of all possible pipelined blocks (except Renderer):
170
171 // Dasher:
172 this.dasher.dispose();
173 // Stroker:
174 this.stroker.dispose();
175
176 // mark context as CLEAN:
177 dirty = false;
178 }
179 }
180
181 public Path2D getPath2D() {
182 // resolve reference:
183 Path2D p2d = (refPath2D != null) ? refPath2D.get() : null;
184
|