equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2017, 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 |
33 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator; |
33 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator; |
34 |
34 |
35 /** |
35 /** |
36 * This class is a renderer context dedicated to a single thread |
36 * This class is a renderer context dedicated to a single thread |
37 */ |
37 */ |
38 final class RendererContext extends ReentrantContext implements MarlinConst { |
38 final class RendererContext extends ReentrantContext implements IRendererContext { |
39 |
39 |
40 // RendererContext creation counter |
40 // RendererContext creation counter |
41 private static final AtomicInteger CTX_COUNT = new AtomicInteger(1); |
41 private static final AtomicInteger CTX_COUNT = new AtomicInteger(1); |
42 |
42 |
43 /** |
43 /** |
119 transformerPC2D = new TransformingPathConsumer2D(); |
119 transformerPC2D = new TransformingPathConsumer2D(); |
120 |
120 |
121 // Renderer: |
121 // Renderer: |
122 cache = new MarlinCache(this); |
122 cache = new MarlinCache(this); |
123 renderer = new Renderer(this); // needs MarlinCache from rdrCtx.cache |
123 renderer = new Renderer(this); // needs MarlinCache from rdrCtx.cache |
124 ptg = new MarlinTileGenerator(renderer); |
124 ptg = new MarlinTileGenerator(stats, renderer, cache); |
125 |
125 |
126 stroker = new Stroker(this); |
126 stroker = new Stroker(this); |
127 dasher = new Dasher(this); |
127 dasher = new Dasher(this); |
128 } |
128 } |
129 |
129 |
172 // reset the path anyway: |
172 // reset the path anyway: |
173 p2d.reset(); |
173 p2d.reset(); |
174 return p2d; |
174 return p2d; |
175 } |
175 } |
176 |
176 |
177 OffHeapArray newOffHeapArray(final long initialSize) { |
177 @Override |
|
178 public RendererStats stats() { |
|
179 return stats; |
|
180 } |
|
181 |
|
182 @Override |
|
183 public OffHeapArray newOffHeapArray(final long initialSize) { |
178 if (DO_STATS) { |
184 if (DO_STATS) { |
179 stats.totalOffHeapInitial += initialSize; |
185 stats.totalOffHeapInitial += initialSize; |
180 } |
186 } |
181 return new OffHeapArray(cleanerObj, initialSize); |
187 return new OffHeapArray(cleanerObj, initialSize); |
182 } |
188 } |
183 |
189 |
184 IntArrayCache.Reference newCleanIntArrayRef(final int initialSize) { |
190 @Override |
|
191 public IntArrayCache.Reference newCleanIntArrayRef(final int initialSize) { |
185 return cleanIntCache.createRef(initialSize); |
192 return cleanIntCache.createRef(initialSize); |
186 } |
193 } |
187 |
194 |
188 IntArrayCache.Reference newDirtyIntArrayRef(final int initialSize) { |
195 IntArrayCache.Reference newDirtyIntArrayRef(final int initialSize) { |
189 return dirtyIntCache.createRef(initialSize); |
196 return dirtyIntCache.createRef(initialSize); |