Java Code Examples for sun.font.GlyphList#getY()
The following examples show how to use
sun.font.GlyphList#getY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BufferedTextPipe.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 2
Source File: BufferedTextPipe.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 3
Source File: BufferedTextPipe.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 4
Source File: BufferedTextPipe.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 5
Source File: BufferedTextPipe.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 6
Source File: BufferedTextPipe.java From Bytecoder with Apache License 2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 7
Source File: BufferedTextPipe.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 8
Source File: BufferedTextPipe.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 9
Source File: BufferedTextPipe.java From hottub with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 10
Source File: BufferedTextPipe.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 11
Source File: BufferedTextPipe.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 12
Source File: BufferedTextPipe.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 13
Source File: BufferedTextPipe.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }
Example 14
Source File: BufferedTextPipe.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private void enqueueGlyphList(final SunGraphics2D sg2d, final GlyphList gl) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); final int totalGlyphs = gl.getNumGlyphs(); int glyphBytesRequired = totalGlyphs * BYTES_PER_GLYPH_IMAGE; int posBytesRequired = gl.usePositions() ? totalGlyphs * BYTES_PER_GLYPH_POSITION : 0; int totalBytesRequired = 24 + glyphBytesRequired + posBytesRequired; final long[] images = gl.getImages(); final float glyphListOrigX = gl.getX() + 0.5f; final float glyphListOrigY = gl.getY() + 0.5f; // make sure the RenderQueue keeps a hard reference to the FontStrike // so that the associated glyph images are not disposed while enqueued rq.addReference(gl.getStrike()); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the glyphs rq.flushNow(); } rq.ensureAlignment(20); buf.putInt(DRAW_GLYPH_LIST); // enqueue parameters buf.putInt(totalGlyphs); buf.putInt(createPackedParams(sg2d, gl)); buf.putFloat(glyphListOrigX); buf.putFloat(glyphListOrigY); // now enqueue glyph information buf.put(images, 0, totalGlyphs); if (gl.usePositions()) { float[] positions = gl.getPositions(); buf.put(positions, 0, 2*totalGlyphs); } } else { // queue is too small to accommodate glyphs; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { drawGlyphList(totalGlyphs, gl.usePositions(), gl.isSubPixPos(), gl.isRGBOrder(), sg2d.lcdTextContrast, glyphListOrigX, glyphListOrigY, images, gl.getPositions()); } }); } }