Skip to content

Instantly share code, notes, and snippets.

@theoparis
Last active November 10, 2023 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theoparis/f7310bb3ff2159542a8fb5860fa98e24 to your computer and use it in GitHub Desktop.
Save theoparis/f7310bb3ff2159542a8fb5860fa98e24 to your computer and use it in GitHub Desktop.
jdk 21 with pure wayland patch (jdk-21-ga branch)
diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
index f8fbe14cc..88b0cedfd 100644
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -206,7 +206,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
clang)
DISABLE_WARNING_PREFIX="-Wno-"
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
- CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
+ CFLAGS_WARNINGS_ARE_ERRORS="-Wno-error"
# Additional warnings that are not activated by -Wall and -Wextra
WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare -Wreorder \
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index a1fc81564..1f1b2abda 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -32,7 +32,8 @@ m4_include([lib-fontconfig.m4])
m4_include([lib-freetype.m4])
m4_include([lib-hsdis.m4])
m4_include([lib-std.m4])
-m4_include([lib-x11.m4])
+m4_include([lib-fontconfig.m4])
+m4_include([lib-wayland.m4])
m4_include([lib-tests.m4])
@@ -41,14 +42,23 @@ m4_include([lib-tests.m4])
################################################################################
AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
[
- # Check if X11 is needed
+ # Check if X11, wayland and vulkan is needed
if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
- # No X11 support on windows or macosx
+ # No X11 and wayland support on windows or macosx
+ NEEDS_LIB_X11=false
+ NEEDS_LIB_WAYLAND=false
+ SUPPORTS_LIB_VULKAN=false
+ elif test "x$ENABLE_HEADLESS_ONLY" = xtrue; then
+ # No X11 support needed when building headless only
NEEDS_LIB_X11=false
+ NEEDS_LIB_WAYLAND=false
+ SUPPORTS_LIB_VULKAN=false
else
- # All other instances need X11, even if building headless only, libawt still
+ # All other instances need X11 and wayland, even if building headless only, libawt still
# needs X11 headers.
- NEEDS_LIB_X11=true
+ NEEDS_LIB_X11=false
+ NEEDS_LIB_WAYLAND=true
+ SUPPORTS_LIB_VULKAN=true
fi
# Check if fontconfig is needed
@@ -131,7 +141,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
LIB_SETUP_HSDIS
LIB_SETUP_LIBFFI
LIB_SETUP_MISC_LIBS
- LIB_SETUP_X11
+ LIB_SETUP_WAYLAND
LIB_TESTS_SETUP_GTEST
diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in
index 0f8591781..40c4cab03 100644
--- a/make/autoconf/spec.gmk.in
+++ b/make/autoconf/spec.gmk.in
@@ -465,6 +465,11 @@ UBSAN_LDFLAGS:=@UBSAN_LDFLAGS@
X_CFLAGS:=@X_CFLAGS@
X_LIBS:=@X_LIBS@
+WAYLAND_CFLAGS:=@WAYLAND_CFLAGS@
+WAYLAND_LIBS:=@WAYLAND_LIBS@
+VULKAN_FLAGS:=@VULKAN_FLAGS@
+VULKAN_ENABLED:=@VULKAN_ENABLED@
+
# The lowest required version of macosx
MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@
# The highest allowed version of macosx
diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
index ff7c90e57..7669d4b41 100644
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -267,13 +267,10 @@ define SetupJavaCompilationBody
$$(error Invalid value for COMPILER in SetupJavaCompilation for $1: '$$($1_COMPILER)')
endif
- # Allow overriding on the command line
- JAVA_WARNINGS_ARE_ERRORS ?= -Werror
-
# Tell javac to do exactly as told and no more
PARANOIA_FLAGS := -implicit:none -Xprefer:source -XDignore.symbol.file=true -encoding ascii
- $1_FLAGS += -g -Xlint:all $$($1_TARGET_RELEASE) $$(PARANOIA_FLAGS) $$(JAVA_WARNINGS_ARE_ERRORS)
+ $1_FLAGS += -g -Xlint:all $$($1_TARGET_RELEASE) $$(PARANOIA_FLAGS)
$1_FLAGS += $$($1_JAVAC_FLAGS)
ifneq ($$($1_DISABLED_WARNINGS), )
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index 62b4477b8..6f1015067 100644
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -189,7 +189,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
common/font \
#
- LIBAWT_XAWT_EXCLUDES := medialib debug
+ LIBAWT_XAWT_EXCLUDES := medialib debug wl vulkan
LIBPIPEWIRE_HEADER_DIRS := \
$(TOPDIR)/src/$(MODULE)/unix/native/libpipewire/include
@@ -268,6 +268,98 @@ endif
################################################################################
+
+ifeq ($(call isTargetOs, windows macosx), false)
+ ifeq ($(ENABLE_HEADLESS_ONLY), false)
+
+ LIBAWT_WLAWT_EXTRA_SRC := \
+ common/awt \
+ common/java2d \
+ common/font \
+ #
+
+ LIBAWT_WLAWT_EXCLUDES := medialib debug opengl x11
+ LIBAWT_WLAWT_EXCLUDE_FILES := common/awt/X11Color.c common/awt/awt_Font.c
+
+ # Substitute Vulkan with stubs if disabled.
+ ifeq ($(VULKAN_ENABLED), false)
+ LIBAWT_WLAWT_EXCLUDES += vulkan
+ LIBAWT_WLAWT_EXTRA_FILES += $(TOPDIR)/src/$(MODULE)/share/native/common/java2d/vulkan/VKStubs.c
+ endif
+
+ LIBAWT_WLAWT_EXTRA_HEADER_DIRS := \
+ $(LIBAWT_DEFAULT_HEADER_DIRS) \
+ libawt_wlawt/awt \
+ include \
+ common/awt/debug \
+ common/awt/systemscale \
+ common/font \
+ common/java2d/wl \
+ common/java2d/vulkan \
+ #
+
+ # Enable 'wakefield' extension for java.awt.Robot support
+ WAKEFIELD_ROBOT_CFLAGS=-DWAKEFIELD_ROBOT
+
+ LIBAWT_WLAWT_CFLAGS += -DWLAWT \
+ $(WAKEFIELD_ROBOT_CFLAGS) \
+ $(FONTCONFIG_CFLAGS) \
+ $(VULKAN_FLAGS) \
+ $(CUPS_CFLAGS)
+
+ LIBAWT_WLAWT_CXXFLAGS += $(VULKAN_FLAGS)
+
+ LIBAWT_WLAWT_LIBS := $(LIBM) -lawt $(WAYLAND_LIBS) $(LIBDL) -ljava -ljvm -lrt
+
+ ifeq ($(call isTargetOs, linux), true)
+ LIBAWT_WLAWT_LIBS += -lpthread
+ endif
+
+ ifeq ($(TOOLCHAIN_TYPE), gcc)
+ # Turn off all warnings for the following files since they contain warnings
+ # that cannot be turned of individually.
+ # redefining a macro
+ BUILD_LIBAWT_WLAWT_awt_Font.c_CFLAGS := -w
+ # initializing a declared 'extern'
+ BUILD_LIBAWT_WLAWT_debug_mem.c_CFLAGS := -w
+ endif
+
+ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_WLAWT, \
+ NAME := awt_wlawt, \
+ EXCLUDE_FILES := $(LIBAWT_WLAWT_EXCLUDE_FILES), \
+ EXTRA_FILES := $(LIBAWT_WLAWT_EXTRA_FILES), \
+ EXTRA_SRC := $(LIBAWT_WLAWT_EXTRA_SRC), \
+ EXTRA_HEADER_DIRS := $(LIBAWT_WLAWT_EXTRA_HEADER_DIRS), \
+ EXCLUDES := $(LIBAWT_WLAWT_EXCLUDES), \
+ OPTIMIZATION := LOW, \
+ TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_WLAWT_CFLAGS), \
+ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBAWT_WLAWT_CXXFLAGS), \
+ WARNINGS_AS_ERRORS_xlc := false, \
+ DISABLED_WARNINGS_C_gcc := type-limits pointer-to-int-cast \
+ unused-result maybe-uninitialized format \
+ format-security int-to-pointer-cast parentheses \
+ implicit-fallthrough undef unused-function, \
+ DISABLED_WARNINGS_CXX_gcc := undef, \
+ DISABLED_WARNINGS_clang := parentheses format undef \
+ logical-op-parentheses format-nonliteral int-conversion, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ -L$(INSTALL_LIBRARIES_HERE), \
+ LIBS := $(LIBAWT_WLAWT_LIBS), \
+ ))
+
+ $(BUILD_LIBAWT_WLAWT): $(call FindLib, java.base, java)
+
+ $(BUILD_LIBAWT_WLAWT): $(BUILD_LIBAWT)
+
+ TARGETS += $(BUILD_LIBAWT_WLAWT)
+
+ endif
+endif
+
+################################################################################
+
# The fast floor code loses precision.
LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR -DCMS_NO_HALF_SUPPORT
@@ -366,7 +458,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
#
- LIBAWT_HEADLESS_EXCLUDES := medialib
+ LIBAWT_HEADLESS_EXCLUDES := medialib wl vulkan
LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
$(LIBAWT_DEFAULT_HEADER_DIRS) \
@@ -562,6 +654,51 @@ TARGETS += $(BUILD_LIBFONTMANAGER)
################################################################################
+ifeq ($(call isTargetOs, windows macosx), false)
+ ifeq ($(ENABLE_HEADLESS_ONLY), false)
+
+ LIBFONTMANAGER_XAWT_EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES)
+ LIBFONTMANAGER_XAWT_CFLAGS := $(LIBFONTMANAGER_CFLAGS)
+ LIBFONTMANAGER_XAWT_OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION)
+ LIBFONTMANAGER_XAWT_EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS) \
+ libfontmanager
+ LIBFONTMANAGER_XAWT_EXTRA_SRC :=
+
+ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER_XAWT, \
+ NAME := fontmanager_xawt, \
+ EXCLUDE_FILES := $(LIBFONTMANAGER_XAWT_EXCLUDE_FILES) \
+ AccelGlyphCache.c, \
+ TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_XAWT_CFLAGS), \
+ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_XAWT_CFLAGS), \
+ OPTIMIZATION := $(LIBFONTMANAGER_XAWT_OPTIMIZATION), \
+ CFLAGS_windows = -DCC_NOEX, \
+ EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_XAWT_EXTRA_HEADER_DIRS), \
+ EXTRA_SRC := $(LIBFONTMANAGER_XAWT_EXTRA_SRC), \
+ WARNINGS_AS_ERRORS_xlc := false, \
+ DISABLED_WARNINGS_gcc := $(HARFBUZZ_DISABLED_WARNINGS_gcc), \
+ DISABLED_WARNINGS_CXX_gcc := $(HARFBUZZ_DISABLED_WARNINGS_CXX_gcc), \
+ DISABLED_WARNINGS_clang := $(HARFBUZZ_DISABLED_WARNINGS_clang), \
+ DISABLED_WARNINGS_microsoft := $(HARFBUZZ_DISABLED_WARNINGS_microsoft), \
+ LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
+ $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
+ LDFLAGS_aix := -Wl$(COMMA)-berok, \
+ LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
+ LIBS_unix := -lfontmanager -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
+ ))
+
+ $(BUILD_LIBFONTMANAGER_XAWT): $(BUILD_LIBFONTMANAGER)
+ $(BUILD_LIBFONTMANAGER_XAWT): $(BUILD_LIBAWT_XAWT)
+
+ TARGETS += $(BUILD_LIBFONTMANAGER_XAWT)
+
+ endif
+endif
+
+################################################################################
+
ifeq ($(call isTargetOs, windows), true)
LIBJAWT_CFLAGS := -EHsc -DUNICODE -D_UNICODE
diff --git a/src/java.desktop/share/classes/java/awt/Window.java b/src/java.desktop/share/classes/java/awt/Window.java
index c58b2a5e9..79726428d 100644
--- a/src/java.desktop/share/classes/java/awt/Window.java
+++ b/src/java.desktop/share/classes/java/awt/Window.java
@@ -4083,10 +4083,20 @@ public class Window extends Container implements Accessible {
static {
AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() {
+ private static final boolean isWLToolkit = Toolkit.getDefaultToolkit()
+ .getClass().getName().equals("sun.awt.wl.WLToolkit");
public void updateWindow(Window window) {
window.updateWindow();
}
+ public boolean needUpdateWindowAfterPaint(Window window) {
+ return window != null && isWLToolkit;
+ }
+
+ public boolean needUpdateWindow(Window window) {
+ return window != null && (isWLToolkit || !window.isOpaque());
+ }
+
public void setSecurityWarningSize(Window window, int width, int height)
{
window.securityWarningWidth = width;
diff --git a/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/src/java.desktop/share/classes/javax/swing/RepaintManager.java
index f6e6dbdf0..fbf35876c 100644
--- a/src/java.desktop/share/classes/javax/swing/RepaintManager.java
+++ b/src/java.desktop/share/classes/javax/swing/RepaintManager.java
@@ -803,8 +803,7 @@ public class RepaintManager
Window window = dirty instanceof Window ?
(Window)dirty :
SwingUtilities.getWindowAncestor(dirty);
- if (window != null &&
- !window.isOpaque())
+ if (AWTAccessor.getWindowAccessor().needUpdateWindow(window))
{
windows.add(window);
}
@@ -1338,6 +1337,12 @@ public class RepaintManager
g.setClip(x, y, w, h);
paintingComponent.paintToOffscreen(g, x, y, w, h, x + w, y + h);
}
+ final Window window = SwingUtilities.getWindowAncestor(paintingComponent);
+ if (AWTAccessor.getWindowAccessor().needUpdateWindowAfterPaint(window)) {
+ // TODO: maybe introduce a more general "commitWindow" call instead
+ // of mixing Windows-specific "updateWindow" with Wayland commits.
+ AWTAccessor.getWindowAccessor().updateWindow(window);
+ }
}
/**
diff --git a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java
index 1303ef7b2..10f28c2b1 100644
--- a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java
+++ b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java
@@ -305,6 +305,10 @@ public final class AWTAccessor {
*/
void updateWindow(Window window);
+ boolean needUpdateWindowAfterPaint(Window window);
+
+ boolean needUpdateWindow(Window window);
+
/**
* Set the size of the security warning.
*/
diff --git a/src/java.desktop/share/native/common/font/sunfontids.h b/src/java.desktop/share/native/common/font/sunfontids.h
index 2301f80b5..a0130f3e2 100644
--- a/src/java.desktop/share/native/common/font/sunfontids.h
+++ b/src/java.desktop/share/native/common/font/sunfontids.h
@@ -86,6 +86,7 @@ typedef struct FontManagerNativeIDs {
but we need access method to use it from separate rasterizer lib */
extern FontManagerNativeIDs sunFontIDs;
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv* env);
+JNIEXPORT const FontManagerNativeIDs* getSunFontIDsPtr(JNIEnv* env);
#ifdef __cplusplus
}
diff --git a/src/java.desktop/share/native/libfontmanager/DrawGlyphList.c b/src/java.desktop/share/native/libfontmanager/DrawGlyphList.c
index d32a72093..0a3e44727 100644
--- a/src/java.desktop/share/native/libfontmanager/DrawGlyphList.c
+++ b/src/java.desktop/share/native/libfontmanager/DrawGlyphList.c
@@ -50,7 +50,10 @@
#define FLOOR_ASSIGN(l, r)\
if ((r)<0) (l) = ((int)floor(r)); else (l) = ((int)(r))
-GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist,
+#define ADJUST_SUBPIXEL_GLYPH_POSITION(coord, res) \
+ if ((res) > 1) (coord) += 0.5f / ((float)(res)) - 0.5f;
+
+JNIEXPORT GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist,
jint fromGlyph, jint toGlyph) {
int g;
@@ -140,7 +143,7 @@ GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist,
return gbv;
}
-jint RefineBounds(GlyphBlitVector *gbv, SurfaceDataBounds *bounds) {
+JNIEXPORT jint RefineBounds(GlyphBlitVector *gbv, SurfaceDataBounds *bounds) {
int index;
jint dx1, dy1, dx2, dy2;
ImageRef glyphImage;
@@ -487,8 +490,8 @@ Java_sun_java2d_loops_DrawGlyphListLCD_DrawGlyphListLCD
* rendered fractional metrics, there's typically more space between the
* glyphs. Perhaps disabling X-axis grid-fitting will help with that.
*/
-GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist,
- jint fromGlyph, jint toGlyph) {
+JNIEXPORT GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist,
+ jint fromGlyph, jint toGlyph) {
int g;
size_t bytesNeeded;
diff --git a/src/java.desktop/share/native/libfontmanager/glyphblitting.h b/src/java.desktop/share/native/libfontmanager/glyphblitting.h
index 5ce07b0d5..5e15dba40 100644
--- a/src/java.desktop/share/native/libfontmanager/glyphblitting.h
+++ b/src/java.desktop/share/native/libfontmanager/glyphblitting.h
@@ -39,11 +39,11 @@ typedef struct {
ImageRef *glyphs;
} GlyphBlitVector;
-extern jint RefineBounds(GlyphBlitVector *gbv, SurfaceDataBounds *bounds);
-extern GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist,
- jint fromGlyph, jint toGlyph);
-extern GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist,
+JNIEXPORT jint RefineBounds(GlyphBlitVector *gbv, SurfaceDataBounds *bounds);
+JNIEXPORT GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist,
jint fromGlyph, jint toGlyph);
+JNIEXPORT GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist,
+ jint fromGlyph, jint toGlyph);
#ifdef __cplusplus
}
diff --git a/src/java.desktop/share/native/libfontmanager/sunFont.c b/src/java.desktop/share/native/libfontmanager/sunFont.c
index 661dccae0..f04894ca4 100644
--- a/src/java.desktop/share/native/libfontmanager/sunFont.c
+++ b/src/java.desktop/share/native/libfontmanager/sunFont.c
@@ -207,6 +207,12 @@ JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
return sunFontIDs;
}
+JNIEXPORT const FontManagerNativeIDs* getSunFontIDsPtr(JNIEnv* env) {
+
+ initFontIDs(env);
+ return &sunFontIDs;
+}
+
/*
* Class: sun_font_StrikeCache
* Method: freeIntPointer
diff --git a/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java b/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java
index 664004225..af5648c30 100644
--- a/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java
+++ b/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java
@@ -28,17 +28,51 @@ package sun.awt;
import java.io.File;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
+import java.lang.annotation.Native;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import sun.awt.wl.WLGraphicsEnvironment;
+import sun.security.action.GetPropertyAction;
+
public class PlatformGraphicsInfo {
+ @Native
+ public static final int TK_UNDEF = 0;
+ @Native
+ public static final int TK_X11 = 1;
+ @Native
+ public static final int TK_WAYLAND = 2;
+
+ private static int toolkitID = TK_UNDEF;
+
+ private static int getToolkitID() {
+ if (toolkitID == TK_UNDEF) {
+ @SuppressWarnings("removal")
+ String name = AccessController.doPrivileged(
+ new GetPropertyAction("awt.toolkit.name"));
+ if ("XToolkit".equals(name)) {
+ toolkitID = TK_X11;
+ } if ("WLToolkit".equals(name)) {
+ toolkitID = TK_WAYLAND;
+ } else {
+ toolkitID = TK_X11;
+ }
+ }
+ return toolkitID;
+ }
public static GraphicsEnvironment createGE() {
- return new X11GraphicsEnvironment();
+ return (getToolkitID() == TK_X11)?
+ new X11GraphicsEnvironment() :
+ WLGraphicsEnvironment.getSingleInstance();
}
public static Toolkit createToolkit() {
- return new sun.awt.X11.XToolkit();
+ return (getToolkitID() == TK_X11)?
+ new sun.awt.X11.XToolkit() :
+ new sun.awt.wl.WLToolkit();
}
/**
@@ -52,8 +86,26 @@ public class PlatformGraphicsInfo {
boolean noDisplay =
AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
- final String display = System.getenv("DISPLAY");
- return display == null || display.trim().isEmpty();
+ if (getToolkitID() == TK_X11) {
+ final String display = System.getenv("DISPLAY");
+ return display == null || display.trim().isEmpty();
+ } else {
+ // This code needs to be in sync with what wl_display_connect() does
+ // in WLToolkit.initIDs().
+ final String wl_display = System.getenv("WAYLAND_DISPLAY");
+ if (wl_display != null && !wl_display.trim().isEmpty()) {
+ return false; // not headless
+ }
+
+ // Check $XDG_RUNTIME_DIR/wayland-0.
+ final String socketDir = System.getenv("XDG_RUNTIME_DIR");
+ if (socketDir != null && !socketDir.trim().isEmpty()) {
+ final Path defaultSocketPath = Path.of(socketDir).resolve("wayland-0");
+ return !Files.isReadable(defaultSocketPath);
+ }
+
+ return true;
+ }
});
if (noDisplay) {
return true;
diff --git a/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java b/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java
index 5ab78ee39..03dcc592a 100644
--- a/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java
+++ b/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java
@@ -28,10 +28,12 @@ package sun.java2d;
import java.awt.GraphicsConfiguration;
+import sun.awt.X11GraphicsConfig;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.opengl.GLXGraphicsConfig;
import sun.java2d.opengl.GLXVolatileSurfaceManager;
+import sun.java2d.wl.WLVolatileSurfaceManager;
import sun.java2d.x11.X11VolatileSurfaceManager;
import sun.java2d.xr.*;
@@ -60,8 +62,10 @@ public class UnixSurfaceManagerFactory extends SurfaceManagerFactory {
return new GLXVolatileSurfaceManager(vImg, context);
} else if(gc instanceof XRGraphicsConfig) {
return new XRVolatileSurfaceManager(vImg, context);
- }else {
+ } else if (gc instanceof X11GraphicsConfig){
return new X11VolatileSurfaceManager(vImg, context);
+ } else {
+ return new WLVolatileSurfaceManager(vImg, context);
}
}
diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c
index e64a9b051..d10503160 100644
--- a/src/java.desktop/unix/native/common/awt/fontpath.c
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -96,7 +96,7 @@ typedef struct {
int num;
} fDirRecord, *fDirRecordPtr;
-#ifndef HEADLESS
+#ifdef XAWT
/*
* Returns True if display is local, False of it's remote.
@@ -194,7 +194,7 @@ static char **getX11FontPath ()
}
-#endif /* !HEADLESS */
+#endif /* XAWT */
#if defined(__linux__)
/* from awt_LoadLibrary.c */
@@ -334,7 +334,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1, jboolean is
* this code could throw an exception and the fontpath would fail to
* be initialised.
*/
-#ifndef HEADLESS
+#ifdef XAWT
if (isX11) { // The following only works in an x11 environment.
#if defined(__linux__)
/* There's no headless build on linux ... */
@@ -356,7 +356,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1, jboolean is
}
#endif
}
-#endif /* !HEADLESS */
+#endif /* XAWT */
path = mergePaths(fcdirs, x11dirs, knowndirs, noType1);
if (fcdirs != NULL) {
char **p = fcdirs;
diff --git a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c
index b2dedca35..7139ecc46 100644
--- a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c
+++ b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c
@@ -31,7 +31,7 @@
#include <jni_util.h>
#include <jvm.h>
#include "gdefs.h"
-
+#include "sun_awt_PlatformGraphicsInfo.h"
#include <sys/param.h>
#include <sys/utsname.h>
@@ -79,6 +79,34 @@ JNIEXPORT jboolean JNICALL AWTIsHeadless() {
return isHeadless;
}
+JNIEXPORT jint JNICALL AWTGetToolkitID() {
+ static JNIEnv *env = NULL;
+ static jint toolkitID;
+ jmethodID toolkitIDFn;
+ jclass platformGraphicsInfoClass;
+
+ if (env == NULL) {
+ env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ platformGraphicsInfoClass = (*env)->FindClass(env,
+ "sun/awt/PlatformGraphicsInfo");
+ if (platformGraphicsInfoClass == NULL) {
+ return 0;
+ }
+ toolkitIDFn = (*env)->GetStaticMethodID(env,
+ platformGraphicsInfoClass, "getToolkitID", "()I");
+ if (toolkitIDFn == NULL) {
+ return 0;
+ }
+ toolkitID = (*env)->CallStaticBooleanMethod(env, platformGraphicsInfoClass,
+ toolkitIDFn);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionClear(env);
+ return JNI_TRUE;
+ }
+ }
+ return toolkitID;
+}
+
#define CHECK_EXCEPTION_FATAL(env, message) \
if ((*env)->ExceptionCheck(env)) { \
(*env)->ExceptionClear(env); \
@@ -94,6 +122,7 @@ JNIEXPORT jboolean JNICALL AWTIsHeadless() {
#define DEFAULT_PATH LWAWT_PATH
#else
#define XAWT_PATH "/libawt_xawt.so"
+ #define WLAWT_PATH "/libawt_wlawt.so"
#define DEFAULT_PATH XAWT_PATH
#define HEADLESS_PATH "/libawt_headless.so"
#endif
@@ -109,6 +138,7 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
struct utsname name;
JNIEnv *env = (JNIEnv *)JNU_GetEnv(vm, JNI_VERSION_1_2);
void *v;
+ jint tkID = 0;
if (awtHandle != NULL) {
/* Avoid several loading attempts */
@@ -128,10 +158,16 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
* loading appropriate awt library, i.e. libawt_xawt or libawt_headless
*/
+ tkID = AWTGetToolkitID();
+
#ifdef MACOSX
tk = LWAWT_PATH;
#else
- tk = XAWT_PATH;
+ if (tkID == sun_awt_PlatformGraphicsInfo_TK_WAYLAND) {
+ tk = WLAWT_PATH;
+ } else {
+ tk = XAWT_PATH;
+ }
#endif
#ifndef MACOSX
diff --git a/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c b/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c
deleted file mode 100644
index e705321e0..000000000
--- a/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Important note : All AWTxxx functions are defined in font.h.
- * These were added to remove the dependency of this file on X11.
- * These functions are used to perform X11 operations and should
- * be "stubbed out" in environments that do not support X11.
- * The implementation of these functions has been moved from this file
- * into X11FontScaler_md.c, which is compiled into another library.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <sys/utsname.h>
-
-#include <jni.h>
-#include <jni_util.h>
-
-#include "sun_font_NativeFont.h"
-#include "sun_font_NativeStrike.h"
-#include "sun_font_NativeStrikeDisposer.h"
-#include "sunfontids.h"
-#include "fontscalerdefs.h"
-#include "X11FontScaler.h"
-
-JNIEXPORT void JNICALL
- Java_sun_font_NativeStrikeDisposer_freeNativeScalerContext
- (JNIEnv *env, jobject disposer, jlong pScalerContext) {
-
- NativeScalerContext *context = (NativeScalerContext*)(uintptr_t)(pScalerContext);
-
- if (context != NULL) {
- if (context->xFont != NULL) {
- AWTFreeFont(context->xFont);
- }
- free(context);
- }
-}
-
-JNIEXPORT jlong JNICALL
-Java_sun_font_NativeStrike_createNullScalerContext
- (JNIEnv *env, jobject strike) {
-
- NativeScalerContext *context =
- (NativeScalerContext*)malloc(sizeof(NativeScalerContext));
- if (context == NULL) {
- return (jlong)(uintptr_t)0L;
- }
- context->xFont = NULL;
- context->minGlyph = 0;
- context->maxGlyph = 0;
- context->numGlyphs = 0;
- context->defaultGlyph = 0;
- context->ptSize = NO_POINTSIZE;
- return (jlong)(uintptr_t)context;
-}
-
-JNIEXPORT jlong JNICALL
-Java_sun_font_NativeStrike_createScalerContext
- (JNIEnv *env, jobject strike, jbyteArray xlfdBytes,
- jint ptSize, jdouble scale) {
-
- NativeScalerContext *context;
- int len = (*env)->GetArrayLength(env, xlfdBytes);
-
- char* xlfd = (char*)malloc(len+1);
-
- if (xlfd == NULL) {
- return (jlong)(uintptr_t)0L;
- }
-
- (*env)->GetByteArrayRegion(env, xlfdBytes, 0, len, (jbyte*)xlfd);
- xlfd[len] = '\0';
- context = (NativeScalerContext*)malloc(sizeof(NativeScalerContext));
- if (context == NULL) {
- free(xlfd);
- return (jlong)(uintptr_t)0L;
- }
-
- AWTLoadFont (xlfd, &(context->xFont));
- free(xlfd);
-
- if (context->xFont == NULL) { /* NULL means couldn't find the font */
- free(context);
- context = NULL;
- } else {
- /* numGlyphs is an estimate : X11 doesn't provide a quick way to
- * discover which glyphs are valid: just the range that contains all
- * the valid glyphs, and this range may have holes.
- */
- context->minGlyph = (AWTFontMinByte1(context->xFont) << 8) +
- AWTFontMinCharOrByte2(context->xFont);
- context->maxGlyph = (AWTFontMaxByte1(context->xFont) << 8) +
- AWTFontMaxCharOrByte2(context->xFont);
- context->numGlyphs = context->maxGlyph - context->minGlyph + 1;
- context->defaultGlyph = AWTFontDefaultChar(context->xFont);
- /* Sometimes the default_char field of the XFontStruct isn't
- * initialized to anything, so it can be a large number. So,
- * check to see if its less than the largest possible value
- * and if so, then use it. Otherwise, just use the minGlyph.
- */
- if (context->defaultGlyph < context->minGlyph ||
- context->defaultGlyph > context->maxGlyph) {
- context->defaultGlyph = context->minGlyph;
- }
- context->ptSize = ptSize;
- context->scale = scale;
- }
-
- /*
- * REMIND: freeing of native resources? XID, XFontStruct etc??
- */
- return (jlong)(uintptr_t)context;
-}
-
-
-/* JNIEXPORT jint JNICALL */
-/* Java_sun_font_NativeFont_getItalicAngle */
-/* (JNIEnv *env, jobject font) { */
-
-/* UInt32 angle; */
-/* AWTGetFontItalicAngle(xFont, &angle); */
-/*X11 reports italic angle as 1/64ths of a degree, relative to 3 o'clock
- * with anti-clockwise being the +ve rotation direction.
- * We return
-XGetFontProperty(xFont,XA_ITALIC_ANGLE, &angle);
-*/
-
-/* return (jint)angle; */
-/* } */
-
-JNIEXPORT jboolean JNICALL
-Java_sun_font_NativeFont_fontExists
- (JNIEnv *env, jclass fontClass, jbyteArray xlfdBytes) {
-
- int count = 0;
- int len = (*env)->GetArrayLength(env, xlfdBytes);
- char* xlfd = (char*)malloc(len+1);
-
- if (xlfd == NULL) {
- return JNI_FALSE;
- }
-
- (*env)->GetByteArrayRegion(env, xlfdBytes, 0, len, (jbyte*)xlfd);
- xlfd[len] = '\0';
-
- count = AWTCountFonts(xlfd);
- free(xlfd);
- if (count > 0) {
- return JNI_TRUE;
- } else {
- return JNI_FALSE;
- }
-}
-
-JNIEXPORT jboolean JNICALL
-Java_sun_font_NativeFont_haveBitmapFonts
- (JNIEnv *env, jclass fontClass, jbyteArray xlfdBytes) {
-
- int count = 0;
- int len = (*env)->GetArrayLength(env, xlfdBytes);
- char* xlfd = (char*)malloc(len+1);
-
- if (xlfd == NULL) {
- return JNI_FALSE;
- }
-
- (*env)->GetByteArrayRegion(env, xlfdBytes, 0, len, (jbyte*)xlfd);
- xlfd[len] = '\0';
-
- count = AWTCountFonts(xlfd);
- free(xlfd);
- if (count > 2) {
- return JNI_TRUE;
- } else {
- return JNI_FALSE;
- }
-}
-
-// CountGlyphs doubles as way of getting a native font reference
-// and telling if its valid. So far as I can tell GenerateImage etc
-// just return if this "initialisation method" hasn't been called.
-// So clients of this class need to call CountGlyphs() right after
-// construction to be safe.
-JNIEXPORT jint JNICALL
-Java_sun_font_NativeFont_countGlyphs
- (JNIEnv *env, jobject font, jbyteArray xlfdBytes, jint ptSize) {
-
- NativeScalerContext *context = (NativeScalerContext*)
- (uintptr_t)(Java_sun_font_NativeStrike_createScalerContext
- (env, NULL, xlfdBytes, ptSize, 1));
-
- if (context == NULL) {
- return 0;
- } else {
- int numGlyphs = context->numGlyphs;
- AWTFreeFont(context->xFont);
- free(context);
- return numGlyphs;
- }
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_font_NativeStrike_getMaxGlyph
- (JNIEnv *env, jobject strike, jlong pScalerContext) {
-
- NativeScalerContext *context = (NativeScalerContext*)(uintptr_t)(pScalerContext);
- if (context == NULL) {
- return (jint)0;
- } else {
- return (jint)context->maxGlyph+1;
- }
-}
-
-JNIEXPORT jfloat JNICALL
-Java_sun_font_NativeFont_getGlyphAdvance
- (JNIEnv *env, jobject font2D, jlong pScalerContext, jint glyphCode) {
-
- AWTChar xcs = NULL;
- jfloat advance = 0.0f;
- AWTFont xFont;
- NativeScalerContext *context = (NativeScalerContext*)(uintptr_t)(pScalerContext);
- if (context == NULL) {
- return advance;
- } else {
- xFont = (AWTFont)context->xFont;
- }
-
- if (xFont == NULL || context->ptSize == NO_POINTSIZE) {
- return advance;
- }
-
- if (glyphCode < context->minGlyph || glyphCode > context->maxGlyph) {
- glyphCode = context->defaultGlyph;
- }
-
- /* If number of glyphs is 256 or less, the metrics are
- * stored correctly in the XFontStruct for each
- * character. If the # characters is more (double byte
- * case), then these metrics seem flaky and there's no
- * way to determine if they have been set or not.
- */
- if ((context->maxGlyph <= 256) && (AWTFontPerChar(xFont, 0) != NULL)) {
- xcs = AWTFontPerChar(xFont, glyphCode - context->minGlyph);
- advance = AWTCharAdvance(xcs);
- } else {
- int direction, ascent, descent;
- AWTChar2b xChar;
-
- xChar.byte1 = (unsigned char) (glyphCode >> 8);
- xChar.byte2 = (unsigned char) glyphCode;
- AWTFontTextExtents16(xFont, &xChar, &xcs);
- advance = AWTCharAdvance(xcs);
- AWTFreeChar(xcs);
- }
- return (jfloat)(advance/context->scale);
-}
-
-JNIEXPORT jlong JNICALL
-Java_sun_font_NativeFont_getGlyphImageNoDefault
- (JNIEnv *env, jobject font2D, jlong pScalerContext, jint glyphCode) {
-
- AWTChar2b xChar;
- AWTFont xFont;
- NativeScalerContext *context = (NativeScalerContext*)(uintptr_t)(pScalerContext);
- if (context == NULL) {
- return (jlong)0;
- } else {
- xFont = (AWTFont)context->xFont;
- }
-
- if (xFont == NULL || context->ptSize == NO_POINTSIZE) {
- return (jlong)0;
- }
-
- if (glyphCode < context->minGlyph || glyphCode > context->maxGlyph) {
- return (jlong)0;
- }
-
- xChar.byte1 = (unsigned char)(glyphCode >> 8);
- xChar.byte2 = (unsigned char)glyphCode;
- return AWTFontGenerateImage(xFont, &xChar);
-}
-
-JNIEXPORT jlong JNICALL
-Java_sun_font_NativeFont_getGlyphImage
- (JNIEnv *env, jobject font2D, jlong pScalerContext, jint glyphCode) {
-
- AWTChar2b xChar;
- AWTFont xFont;
- NativeScalerContext *context = (NativeScalerContext*)(uintptr_t)(pScalerContext);
- if (context == NULL) {
- return (jlong)0;
- } else {
- xFont = (AWTFont)context->xFont;
- }
-
- if (xFont == NULL || context->ptSize == NO_POINTSIZE) {
- return (jlong)0;
- }
-
- if (glyphCode < context->minGlyph || glyphCode > context->maxGlyph) {
- glyphCode = context->defaultGlyph;
- }
-
- xChar.byte1 = (unsigned char)(glyphCode >> 8);
- xChar.byte2 = (unsigned char)glyphCode;
- return AWTFontGenerateImage(xFont, &xChar);
-}
-
-JNIEXPORT jobject JNICALL
- Java_sun_font_NativeFont_getFontMetrics
- (JNIEnv *env, jobject font2D, jlong pScalerContext) {
-
- jfloat j0=0, j1=1, ay=j0, dy=j0, mx=j0;
- jobject metrics;
- AWTFont xFont;
- NativeScalerContext *context = (NativeScalerContext*)(uintptr_t)(pScalerContext);
- if (context == NULL) {
- return NULL;
- } else {
- xFont = (AWTFont)context->xFont;
- }
-
- if (xFont == NULL) {
- return NULL;
- }
-
- /* the commented out lines are the old 1.4.x behaviour which used max
- * bounds instead of the font's designed ascent/descent */
-/* ay = (jfloat)-AWTCharAscent(AWTFontMaxBounds(xFont)); */
-/* dy = (jfloat)AWTCharDescent(AWTFontMaxBounds(xFont)); */
-
- ay = (jfloat)-AWTFontAscent(xFont);
- dy = (jfloat)AWTFontDescent(xFont);
- mx = (jfloat)AWTCharAdvance(AWTFontMaxBounds(xFont));
-
- /* ascent : no need to set ascentX - it will be zero
- * descent : no need to set descentX - it will be zero
- * baseline : old releases "made up" a number and also seemed to
- * make it up for "X" and set "Y" to 0.
- * leadingX : no need to set leadingX - it will be zero.
- * leadingY : made-up number, but being compatible with what 1.4.x did
- * advance : no need to set yMaxLinearAdvanceWidth - it will be zero.
- */
- metrics = (*env)->NewObject(env, sunFontIDs.strikeMetricsClass,
- sunFontIDs.strikeMetricsCtr,
- j0, ay, j0, dy, j1, j0, j0, j1, mx, j0);
-/* printf("X11 asc=%f dsc=%f adv=%f scale=%f\n", */
-/* ay, dy, mx, (float)context->scale); */
- return metrics;
-}
diff --git a/src/java.desktop/unix/native/libfontmanager/X11TextRenderer.c b/src/java.desktop/unix/native/libfontmanager/X11TextRenderer.c
deleted file mode 100644
index e1f64c566..000000000
--- a/src/java.desktop/unix/native/libfontmanager/X11TextRenderer.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Important note : All AWTxxx functions are defined in font.h.
- * These were added to remove the dependency of this file on X11.
- * These functions are used to perform X11 operations and should
- * be "stubbed out" in environments that do not support X11.
- * The implementation of these functions has been moved from this file
- * into X11TextRenderer_md.c, which is compiled into another library.
- */
-
-#include "sun_font_X11TextRenderer.h"
-
-#include "Region.h"
-#include "SurfaceData.h"
-#include "GraphicsPrimitiveMgr.h"
-#include "glyphblitting.h"
-#include "sunfontids.h"
-#include <stdlib.h>
-
-
-JNIEXPORT void JNICALL AWTDrawGlyphList
-(JNIEnv *env, jobject xtr,
- jlong dstData, jlong gc,
- SurfaceDataBounds *bounds, ImageRef *glyphs, jint totalGlyphs);
-
-/*
- * Class: sun_font_X11TextRenderer
- * Method: doDrawGlyphList
- * Signature: (Lsun/java2d/SurfaceData;Ljava/awt/Rectangle;ILsun/font/GlyphList;J)V
- */
-JNIEXPORT void JNICALL Java_sun_font_X11TextRenderer_doDrawGlyphList
- (JNIEnv *env, jobject xtr,
- jlong dstData, jlong xgc, jobject clip,
- jobject glyphlist)
-{
- jint glyphCount;
- GlyphBlitVector* gbv;
- SurfaceDataBounds bounds;
- Region_GetBounds(env, clip, &bounds);
-
- glyphCount = (*env)->GetIntField(env, glyphlist, sunFontIDs.glyphListLen);
- if ((gbv = setupBlitVector(env, glyphlist, 0, glyphCount)) == NULL) {
- return;
- }
- if (!RefineBounds(gbv, &bounds)) {
- free(gbv);
- return;
- }
- AWTDrawGlyphList(env, xtr, dstData, xgc,
- &bounds, gbv->glyphs, gbv->numGlyphs);
- free(gbv);
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment