Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/classes/sun/font/X11TextRenderer.java
32287 views
1
/*
2
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.font;
27
28
import java.awt.Rectangle;
29
import java.awt.font.FontRenderContext;
30
import java.awt.font.GlyphVector;
31
import sun.awt.SunHints;
32
import sun.awt.SunToolkit;
33
import sun.java2d.SunGraphics2D;
34
import sun.java2d.SurfaceData;
35
import sun.java2d.pipe.GlyphListPipe;
36
import sun.java2d.pipe.Region;
37
import sun.java2d.loops.FontInfo;
38
import sun.java2d.loops.GraphicsPrimitive;
39
import sun.java2d.x11.X11SurfaceData;
40
41
/**
42
* A delegate pipe of SG2D for drawing text with
43
* a solid source colour to an X11 drawable destination.
44
*/
45
public class X11TextRenderer extends GlyphListPipe {
46
/*
47
* Override super class method to call the AA pipe if
48
* AA is specified in the GlyphVector's FontRenderContext
49
*/
50
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g,
51
float x, float y)
52
{
53
FontRenderContext frc = g.getFontRenderContext();
54
FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc);
55
switch (info.aaHint) {
56
case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
57
super.drawGlyphVector(sg2d, g, x, y);
58
return;
59
case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
60
sg2d.surfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y);
61
return;
62
case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
63
case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
64
sg2d.surfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y);
65
return;
66
default:
67
}
68
}
69
70
native void doDrawGlyphList(long dstData, long xgc,
71
Region clip, GlyphList gl);
72
73
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
74
SunToolkit.awtLock();
75
try {
76
X11SurfaceData x11sd = (X11SurfaceData)sg2d.surfaceData;
77
Region clip = sg2d.getCompClip();
78
long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
79
null, sg2d.pixel);
80
doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
81
} finally {
82
SunToolkit.awtUnlock();
83
}
84
}
85
86
public X11TextRenderer traceWrap() {
87
return new Tracer();
88
}
89
90
public static class Tracer extends X11TextRenderer {
91
void doDrawGlyphList(long dstData, long xgc,
92
Region clip, GlyphList gl)
93
{
94
GraphicsPrimitive.tracePrimitive("X11DrawGlyphs");
95
super.doDrawGlyphList(dstData, xgc, clip, gl);
96
}
97
}
98
}
99
100