sun.font.GlyphList Java Examples
The following examples show how to use
sun.font.GlyphList.
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: GlyphListPipe.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector gv, float x, float y) { FontRenderContext frc = gv.getFontRenderContext(); FontInfo info = sg2d.getGVFontInfo(gv.getFont(), frc); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawGlyphVector(sg2d, gv, x, y); return; } if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x, y}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; y = (float) origin[1]; } else { x += sg2d.transX; // don't use the glyph info origin, already in gv. y += sg2d.transY; } GlyphList gl = GlyphList.getInstance(); gl.setFromGlyphVector(info, gv, x, y); drawGlyphList(sg2d, gl, info.aaHint); gl.dispose(); }
Example #2
Source File: GlyphListPipe.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector gv, float x, float y) { FontRenderContext frc = gv.getFontRenderContext(); FontInfo info = sg2d.getGVFontInfo(gv.getFont(), frc); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawGlyphVector(sg2d, gv, x, y); return; } if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x, y}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; y = (float) origin[1]; } else { x += sg2d.transX; // don't use the glyph info origin, already in gv. y += sg2d.transY; } GlyphList gl = GlyphList.getInstance(); gl.setFromGlyphVector(info, gv, x, y); drawGlyphList(sg2d, gl, info.aaHint); gl.dispose(); }
Example #3
Source File: GlyphListLoopPipe.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl, int aaHint) { int prevBorder = 0; boolean isColor = false; int len = gl.getNumGlyphs(); gl.startGlyphIteration(); if (SunFontManager.getInstance().areColorGlyphsSupported()) { for (int i = 0; i < len; i++) { boolean newIsColor = gl.isColorGlyph(i); if (newIsColor != isColor) { drawGlyphListSegment(sg2d, gl, prevBorder, i, aaHint, isColor); prevBorder = i; isColor = newIsColor; } } } drawGlyphListSegment(sg2d, gl, prevBorder, len, aaHint, isColor); }
Example #4
Source File: GlyphListPipe.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector gv, float x, float y) { FontRenderContext frc = gv.getFontRenderContext(); FontInfo info = sg2d.getGVFontInfo(gv.getFont(), frc); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawGlyphVector(sg2d, gv, x, y); return; } if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x, y}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; y = (float) origin[1]; } else { x += sg2d.transX; // don't use the glyph info origin, already in gv. y += sg2d.transY; } GlyphList gl = GlyphList.getInstance(); gl.setFromGlyphVector(info, gv, x, y); drawGlyphList(sg2d, gl, info.aaHint); gl.dispose(); }
Example #5
Source File: GlyphListPipe.java From Bytecoder with Apache License 2.0 | 5 votes |
public void drawString(SunGraphics2D sg2d, String s, double x, double y) { FontInfo info = sg2d.getFontInfo(); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawString(sg2d, s, x, y); return; } float devx, devy; if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double[] origin = {x + info.originX, y + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); devx = (float)origin[0]; devy = (float)origin[1]; } else { devx = (float)(x + info.originX + sg2d.transX); devy = (float)(y + info.originY + sg2d.transY); } /* setFromString returns false if shaping is needed, and we then back * off to a TextLayout. Such text may benefit slightly from a lower * overhead in this approach over the approach in previous releases. */ GlyphList gl = GlyphList.getInstance(); if (gl.setFromString(info, s, devx, devy)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(s, sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, (float)x, (float)y); } }
Example #6
Source File: BufferedTextPipe.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) { /* * The native drawGlyphList() only works with two composite types: * - CompositeType.SrcOver (with any extra alpha), or * - CompositeType.Xor */ Composite comp = sg2d.composite; if (comp == AlphaComposite.Src) { /* * In addition to the composite types listed above, the logic * in OGL/D3DSurfaceData.validatePipe() allows for * CompositeType.SrcNoEa, but only in the presence of an opaque * color. If we reach this case, we know the color is opaque, * and therefore SrcNoEa is the same as SrcOverNoEa, so we * override the composite here. */ comp = AlphaComposite.SrcOver; } rq.lock(); try { validateContext(sg2d, comp); enqueueGlyphList(sg2d, gl); } finally { rq.unlock(); } }
Example #7
Source File: BufferedTextPipe.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Packs the given parameters into a single int value in order to save * space on the rendering queue. Note that most of these parameters * are only used for rendering LCD-optimized text, but conditionalizing * this work wouldn't make any impact on performance, so we will pack * those parameters even in the non-LCD case. */ private static int createPackedParams(SunGraphics2D sg2d, GlyphList gl) { return (((gl.usePositions() ? 1 : 0) << OFFSET_POSITIONS) | ((gl.isSubPixPos() ? 1 : 0) << OFFSET_SUBPIXPOS) | ((gl.isRGBOrder() ? 1 : 0) << OFFSET_RGBORDER ) | ((sg2d.lcdTextContrast & 0xff) << OFFSET_CONTRAST )); }
Example #8
Source File: GlyphListPipe.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void drawChars(SunGraphics2D sg2d, char data[], int offset, int length, int ix, int iy) { FontInfo info = sg2d.getFontInfo(); float x, y; if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawChars( sg2d, data, offset, length, ix, iy); return; } if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {ix + info.originX, iy + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; y = (float) origin[1]; } else { x = ix + info.originX + sg2d.transX; y = iy + info.originY + sg2d.transY; } GlyphList gl = GlyphList.getInstance(); if (gl.setFromChars(info, data, offset, length, x, y)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(new String(data, offset, length), sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, ix, iy); } }
Example #9
Source File: GlyphListPipe.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void drawString(SunGraphics2D sg2d, String s, double x, double y) { FontInfo info = sg2d.getFontInfo(); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawString(sg2d, s, x, y); return; } float devx, devy; if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x + info.originX, y + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); devx = (float)origin[0]; devy = (float)origin[1]; } else { devx = (float)(x + info.originX + sg2d.transX); devy = (float)(y + info.originY + sg2d.transY); } /* setFromString returns false if shaping is needed, and we then back * off to a TextLayout. Such text may benefit slightly from a lower * overhead in this approach over the approach in previous releases. */ GlyphList gl = GlyphList.getInstance(); if (gl.setFromString(info, s, devx, devy)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(s, sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, (float)x, (float)y); } }
Example #10
Source File: DrawGlyphList.java From hottub with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl) { int strbounds[] = gl.getBounds(); // Don't delete, bug 4895493 int num = gl.getNumGlyphs(); Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = 0; i < num; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #11
Source File: DrawGlyphList.java From Bytecoder with Apache License 2.0 | 5 votes |
public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl) { int[] strbounds = gl.getBounds(); // Don't delete, bug 4895493 int num = gl.getNumGlyphs(); Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = 0; i < num; i++) { gl.setGlyphIndex(i); int[] metrics = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte[] alpha = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #12
Source File: GlyphListPipe.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void drawChars(SunGraphics2D sg2d, char data[], int offset, int length, int ix, int iy) { FontInfo info = sg2d.getFontInfo(); float x, y; if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawChars( sg2d, data, offset, length, ix, iy); return; } if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {ix + info.originX, iy + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; y = (float) origin[1]; } else { x = ix + info.originX + sg2d.transX; y = iy + info.originY + sg2d.transY; } GlyphList gl = GlyphList.getInstance(); if (gl.setFromChars(info, data, offset, length, x, y)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(new String(data, offset, length), sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, ix, iy); } }
Example #13
Source File: DrawGlyphListAA.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl, int fromGlyph, int toGlyph) { Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = fromGlyph; i < toGlyph; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #14
Source File: DrawGlyphListAA.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl) { gl.getBounds(); // Don't delete, bug 4895493 int num = gl.getNumGlyphs(); Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = 0; i < num; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #15
Source File: GlyphListPipe.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void drawChars(SunGraphics2D sg2d, char data[], int offset, int length, int ix, int iy) { FontInfo info = sg2d.getFontInfo(); float x, y; if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawChars( sg2d, data, offset, length, ix, iy); return; } if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {ix + info.originX, iy + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; y = (float) origin[1]; } else { x = ix + info.originX + sg2d.transX; y = iy + info.originY + sg2d.transY; } GlyphList gl = GlyphList.getInstance(); if (gl.setFromChars(info, data, offset, length, x, y)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(new String(data, offset, length), sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, ix, iy); } }
Example #16
Source File: DrawGlyphListAA.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl) { gl.getBounds(); // Don't delete, bug 4895493 int num = gl.getNumGlyphs(); Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = 0; i < num; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #17
Source File: DrawGlyphList.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl) { int strbounds[] = gl.getBounds(); // Don't delete, bug 4895493 int num = gl.getNumGlyphs(); Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = 0; i < num; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #18
Source File: GlyphListPipe.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void drawString(SunGraphics2D sg2d, String s, double x, double y) { FontInfo info = sg2d.getFontInfo(); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawString(sg2d, s, x, y); return; } float devx, devy; if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x + info.originX, y + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); devx = (float)origin[0]; devy = (float)origin[1]; } else { devx = (float)(x + info.originX + sg2d.transX); devy = (float)(y + info.originY + sg2d.transY); } /* setFromString returns false if shaping is needed, and we then back * off to a TextLayout. Such text may benefit slightly from a lower * overhead in this approach over the approach in previous releases. */ GlyphList gl = GlyphList.getInstance(); if (gl.setFromString(info, s, devx, devy)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(s, sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, (float)x, (float)y); } }
Example #19
Source File: GlyphListPipe.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void drawString(SunGraphics2D sg2d, String s, double x, double y) { FontInfo info = sg2d.getFontInfo(); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawString(sg2d, s, x, y); return; } float devx, devy; if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x + info.originX, y + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); devx = (float)origin[0]; devy = (float)origin[1]; } else { devx = (float)(x + info.originX + sg2d.transX); devy = (float)(y + info.originY + sg2d.transY); } /* setFromString returns false if shaping is needed, and we then back * off to a TextLayout. Such text may benefit slightly from a lower * overhead in this approach over the approach in previous releases. */ GlyphList gl = GlyphList.getInstance(); if (gl.setFromString(info, s, devx, devy)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(s, sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, (float)x, (float)y); } }
Example #20
Source File: DrawGlyphList.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl) { int strbounds[] = gl.getBounds(); // Don't delete, bug 4895493 int num = gl.getNumGlyphs(); Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = 0; i < num; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #21
Source File: BufferedTextPipe.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Packs the given parameters into a single int value in order to save * space on the rendering queue. Note that most of these parameters * are only used for rendering LCD-optimized text, but conditionalizing * this work wouldn't make any impact on performance, so we will pack * those parameters even in the non-LCD case. */ private static int createPackedParams(SunGraphics2D sg2d, GlyphList gl) { return (((gl.usePositions() ? 1 : 0) << OFFSET_POSITIONS) | ((gl.isSubPixPos() ? 1 : 0) << OFFSET_SUBPIXPOS) | ((gl.isRGBOrder() ? 1 : 0) << OFFSET_RGBORDER ) | ((sg2d.lcdTextContrast & 0xff) << OFFSET_CONTRAST )); }
Example #22
Source File: BufferedTextPipe.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Packs the given parameters into a single int value in order to save * space on the rendering queue. Note that most of these parameters * are only used for rendering LCD-optimized text, but conditionalizing * this work wouldn't make any impact on performance, so we will pack * those parameters even in the non-LCD case. */ private static int createPackedParams(SunGraphics2D sg2d, GlyphList gl) { return (((gl.usePositions() ? 1 : 0) << OFFSET_POSITIONS) | ((gl.isSubPixPos() ? 1 : 0) << OFFSET_SUBPIXPOS) | ((gl.isRGBOrder() ? 1 : 0) << OFFSET_RGBORDER ) | ((sg2d.lcdTextContrast & 0xff) << OFFSET_CONTRAST )); }
Example #23
Source File: BufferedTextPipe.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) { /* * The native drawGlyphList() only works with two composite types: * - CompositeType.SrcOver (with any extra alpha), or * - CompositeType.Xor */ Composite comp = sg2d.composite; if (comp == AlphaComposite.Src) { /* * In addition to the composite types listed above, the logic * in OGL/D3DSurfaceData.validatePipe() allows for * CompositeType.SrcNoEa, but only in the presence of an opaque * color. If we reach this case, we know the color is opaque, * and therefore SrcNoEa is the same as SrcOverNoEa, so we * override the composite here. */ comp = AlphaComposite.SrcOver; } rq.lock(); try { validateContext(sg2d, comp); enqueueGlyphList(sg2d, gl); } finally { rq.unlock(); } }
Example #24
Source File: GlyphListPipe.java From hottub with GNU General Public License v2.0 | 5 votes |
public void drawString(SunGraphics2D sg2d, String s, double x, double y) { FontInfo info = sg2d.getFontInfo(); if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) { SurfaceData.outlineTextRenderer.drawString(sg2d, s, x, y); return; } float devx, devy; if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x + info.originX, y + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); devx = (float)origin[0]; devy = (float)origin[1]; } else { devx = (float)(x + info.originX + sg2d.transX); devy = (float)(y + info.originY + sg2d.transY); } /* setFromString returns false if shaping is needed, and we then back * off to a TextLayout. Such text may benefit slightly from a lower * overhead in this approach over the approach in previous releases. */ GlyphList gl = GlyphList.getInstance(); if (gl.setFromString(info, s, devx, devy)) { drawGlyphList(sg2d, gl); gl.dispose(); } else { gl.dispose(); // release this asap. TextLayout tl = new TextLayout(s, sg2d.getFont(), sg2d.getFontRenderContext()); tl.draw(sg2d, (float)x, (float)y); } }
Example #25
Source File: BufferedTextPipe.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Packs the given parameters into a single int value in order to save * space on the rendering queue. Note that most of these parameters * are only used for rendering LCD-optimized text, but conditionalizing * this work wouldn't make any impact on performance, so we will pack * those parameters even in the non-LCD case. */ private static int createPackedParams(SunGraphics2D sg2d, GlyphList gl) { return (((gl.usePositions() ? 1 : 0) << OFFSET_POSITIONS) | ((gl.isSubPixPos() ? 1 : 0) << OFFSET_SUBPIXPOS) | ((gl.isRGBOrder() ? 1 : 0) << OFFSET_RGBORDER ) | ((sg2d.lcdTextContrast & 0xff) << OFFSET_CONTRAST )); }
Example #26
Source File: BufferedTextPipe.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Packs the given parameters into a single int value in order to save * space on the rendering queue. Note that most of these parameters * are only used for rendering LCD-optimized text, but conditionalizing * this work wouldn't make any impact on performance, so we will pack * those parameters even in the non-LCD case. */ private static int createPackedParams(SunGraphics2D sg2d, GlyphList gl) { return (((gl.usePositions() ? 1 : 0) << OFFSET_POSITIONS) | ((gl.isSubPixPos() ? 1 : 0) << OFFSET_SUBPIXPOS) | ((gl.isRGBOrder() ? 1 : 0) << OFFSET_RGBORDER ) | ((sg2d.lcdTextContrast & 0xff) << OFFSET_CONTRAST )); }
Example #27
Source File: BufferedTextPipe.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Packs the given parameters into a single int value in order to save * space on the rendering queue. Note that most of these parameters * are only used for rendering LCD-optimized text, but conditionalizing * this work wouldn't make any impact on performance, so we will pack * those parameters even in the non-LCD case. */ private static int createPackedParams(SunGraphics2D sg2d, GlyphList gl) { return (((gl.usePositions() ? 1 : 0) << OFFSET_POSITIONS) | ((gl.isSubPixPos() ? 1 : 0) << OFFSET_SUBPIXPOS) | ((gl.isRGBOrder() ? 1 : 0) << OFFSET_RGBORDER ) | ((sg2d.lcdTextContrast & 0xff) << OFFSET_CONTRAST )); }
Example #28
Source File: BufferedTextPipe.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) { /* * The native drawGlyphList() only works with two composite types: * - CompositeType.SrcOver (with any extra alpha), or * - CompositeType.Xor */ Composite comp = sg2d.composite; if (comp == AlphaComposite.Src) { /* * In addition to the composite types listed above, the logic * in OGL/D3DSurfaceData.validatePipe() allows for * CompositeType.SrcNoEa, but only in the presence of an opaque * color. If we reach this case, we know the color is opaque, * and therefore SrcNoEa is the same as SrcOverNoEa, so we * override the composite here. */ comp = AlphaComposite.SrcOver; } rq.lock(); try { validateContext(sg2d, comp); enqueueGlyphList(sg2d, gl); } finally { rq.unlock(); } }
Example #29
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 #30
Source File: GeneralRenderer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData sData, GlyphList gl) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawGlyphList(sData, pw, gl, sg2d.getCompClip()); }