Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5eb82201
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5eb82201
编写于
12月 16, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
788f0fdd
19d27bc8
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
1210 addition
and
678 deletion
+1210
-678
.hgtags
.hgtags
+2
-0
makefiles/CompileDemos.gmk
makefiles/CompileDemos.gmk
+0
-9
makefiles/CompileJavaClasses.gmk
makefiles/CompileJavaClasses.gmk
+10
-42
makefiles/CompileNativeLibraries.gmk
makefiles/CompileNativeLibraries.gmk
+4
-4
makefiles/CreateJars.gmk
makefiles/CreateJars.gmk
+111
-67
makefiles/Images.gmk
makefiles/Images.gmk
+3
-2
makefiles/Import.gmk
makefiles/Import.gmk
+0
-16
src/macosx/classes/com/apple/laf/AquaLookAndFeel.java
src/macosx/classes/com/apple/laf/AquaLookAndFeel.java
+2
-1
src/macosx/classes/sun/awt/CGraphicsConfig.java
src/macosx/classes/sun/awt/CGraphicsConfig.java
+8
-73
src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
+58
-122
src/macosx/classes/sun/lwawt/LWCanvasPeer.java
src/macosx/classes/sun/lwawt/LWCanvasPeer.java
+1
-29
src/macosx/classes/sun/lwawt/LWComponentPeer.java
src/macosx/classes/sun/lwawt/LWComponentPeer.java
+53
-25
src/macosx/classes/sun/lwawt/LWGraphicsConfig.java
src/macosx/classes/sun/lwawt/LWGraphicsConfig.java
+97
-0
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+16
-126
src/macosx/classes/sun/lwawt/PlatformWindow.java
src/macosx/classes/sun/lwawt/PlatformWindow.java
+0
-11
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
...cosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
+0
-19
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+0
-21
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+6
-25
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+8
-3
src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
...e/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
+36
-20
src/share/classes/java/awt/color/ICC_Profile.java
src/share/classes/java/awt/color/ICC_Profile.java
+9
-1
src/share/classes/java/awt/image/ColorConvertOp.java
src/share/classes/java/awt/image/ColorConvertOp.java
+10
-4
src/share/classes/java/lang/invoke/BoundMethodHandle.java
src/share/classes/java/lang/invoke/BoundMethodHandle.java
+4
-4
src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
...re/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+1
-1
src/share/classes/javax/imageio/metadata/doc-files/gif_metadata.html
...lasses/javax/imageio/metadata/doc-files/gif_metadata.html
+1
-1
src/share/classes/javax/swing/JColorChooser.java
src/share/classes/javax/swing/JColorChooser.java
+4
-0
src/share/classes/javax/swing/colorchooser/ColorChooserPanel.java
...e/classes/javax/swing/colorchooser/ColorChooserPanel.java
+1
-0
src/share/classes/javax/swing/colorchooser/ColorPanel.java
src/share/classes/javax/swing/colorchooser/ColorPanel.java
+12
-2
src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java
...e/classes/javax/swing/plaf/basic/BasicColorChooserUI.java
+1
-0
src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
+35
-21
src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
+52
-0
src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java
src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java
+2
-1
src/share/classes/sun/print/PathGraphics.java
src/share/classes/sun/print/PathGraphics.java
+2
-1
src/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java
...hare/classes/sun/swing/plaf/synth/SynthFileChooserUI.java
+1
-0
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XToolkit.java
+9
-0
src/solaris/native/sun/xawt/XlibWrapper.c
src/solaris/native/sun/xawt/XlibWrapper.c
+7
-5
test/java/awt/Frame/FrameSetSizeStressTest/FrameSetSizeStressTest.java
.../Frame/FrameSetSizeStressTest/FrameSetSizeStressTest.java
+20
-17
test/javax/swing/JTree/8003830/bug8003830.java
test/javax/swing/JTree/8003830/bug8003830.java
+66
-0
test/javax/swing/dnd/7171812/JListWithScroll.java
test/javax/swing/dnd/7171812/JListWithScroll.java
+81
-0
test/javax/swing/dnd/7171812/bug7171812.java
test/javax/swing/dnd/7171812/bug7171812.java
+123
-0
test/javax/swing/text/CSSBorder/6796710/bug6796710.java
test/javax/swing/text/CSSBorder/6796710/bug6796710.java
+11
-5
test/sun/java2d/OpenGL/CustomCompositeTest.java
test/sun/java2d/OpenGL/CustomCompositeTest.java
+266
-0
test/sun/java2d/cmm/ColorConvertOp/InvalidRenderIntentTest.java
...un/java2d/cmm/ColorConvertOp/InvalidRenderIntentTest.java
+77
-0
未找到文件。
.hgtags
浏览文件 @
5eb82201
...
...
@@ -188,3 +188,5 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63
26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64
130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65
4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66
ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67
53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68
makefiles/CompileDemos.gmk
浏览文件 @
5eb82201
...
...
@@ -194,15 +194,6 @@ endif
##################################################################################################
# Why do we install a demo jar into the main jre/lib/ext????????????????
$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
$(MKDIR) -p $(@D)
$(CP) $< $@
BUILD_DEMOS += $(JDK_OUTPUTDIR)/lib/ext/zipfs.jar
##################################################################################################
# In the old makefiles, j2dbench was not compiled.
#$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench))
...
...
makefiles/CompileJavaClasses.gmk
浏览文件 @
5eb82201
...
...
@@ -221,24 +221,10 @@ endif
EXFILES+=-linux-arm.java \
-linux-ppc.java
# TODO: Is this necessary?
ifeq ($(OPENJDK_TARGET_OS), windows)
EXFILES+=sun/nio/ch/AbstractPollSelectorImpl.java \
sun/nio/ch/DevPollArrayWrapper.java \
sun/nio/ch/DevPollSelectorImpl.java \
sun/nio/ch/DevPollSelectorProvider.java \
sun/nio/ch/InheritedChannel.java \
sun/nio/ch/PollSelectorProvider.java \
sun/nio/ch/PollSelectorImpl.java \
sun/nio/ch/Port.java \
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
sun/nio/ch/SolarisAsynchronousChannelProvider.java \
sun/nio/ch/SolarisEventPort.java \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
EXFILES+=sun/net/sdp/SdpProvider.java
else
EXFILES+=sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
endif
# Exclude nimbus files from rt.jar
...
...
@@ -339,29 +325,14 @@ $(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers: $(JDK_BASE_HEADER_JAVA_FI
##########################################################################################
#
# This is an empty jar (only contains manifest) and fits poorly into framework...
# create simple rule instead
#
MANAGEMENT_AGENT_JAR_DEPS := $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
$(JDK_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
$(JAR) cfm $@ $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
JARS += $(JDK_OUTPUTDIR)/lib/management-agent.jar
##########################################################################################
ifndef OPENJDK
$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES_JAR
,\
$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES
,\
SETUP:=GENERATE_JDKBYTECODE,\
SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \
BIN:=$(JDK_OUTPUTDIR)/altclasses_classes,\
JAR:=$(JDK_OUTPUTDIR)/lib/alt-rt.jar))
BIN:=$(JDK_OUTPUTDIR)/altclasses_classes))
$(BUILD_ALTCLASSES_JAR): $(BUILD_JDK)
JARS += $(JDK_OUTPUTDIR)/lib/alt-rt.jar
$(BUILD_ALTCLASSES): $(BUILD_JDK)
endif
...
...
@@ -384,7 +355,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE,\
SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
$(eval $(call SetupJavaCompilation,BUILD_JOBJC
_JAR
,\
$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\
SETUP:=GENERATE_15BYTECODE,\
DISABLE_SJAVAC:=true,\
SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
...
...
@@ -396,11 +367,9 @@ $(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\
JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \
JARINDEX := true))
$(BUILD_JOBJC
_JAR
) : $(BUILD_JDK)
$(BUILD_JOBJC) : $(BUILD_JDK)
JARS += $(JDK_OUTPUTDIR)/lib/JObjC.jar
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\
SETUP:=GENERATE_JDKBYTECODE,\
SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
$(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
...
...
@@ -410,16 +379,15 @@ $(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\
BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\
HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc))
$(BUILD_JOBJC_HEADERS_JAR) : $(BUILD_JDK)
JARS += $(BUILD_JOBJC_HEADERS_JAR)
$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK)
endif
##########################################################################################
# copy with -a to preserve timestamps so dependencies down the line aren't messed up
all: $(BUILD_JDK) $(JARS) $(COPY_EXTRA) $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers
.PHONY: all
makefiles/CompileNativeLibraries.gmk
浏览文件 @
5eb82201
...
...
@@ -125,7 +125,7 @@ endif
LIBVERIFY_OPTIMIZATION:=HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS),
yes
)
ifeq ($(ENABLE_DEBUG_SYMBOLS),
true
)
LIBVERIFY_OPTIMIZATION:=LOW
endif
endif
...
...
@@ -1645,7 +1645,7 @@ endif
LIBMANAGEMENT_OPTIMIZATION:=HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS),
yes
)
ifeq ($(ENABLE_DEBUG_SYMBOLS),
true
)
LIBMANAGEMENT_OPTIMIZATION:=LOW
endif
endif
...
...
@@ -1688,7 +1688,7 @@ BUILD_LIBHPROF_LDFLAGS:=
LIBHPROF_OPTIMIZATION:=HIGHEST
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS),
yes
)
ifeq ($(ENABLE_DEBUG_SYMBOLS),
true
)
LIBHPROF_OPTIMIZATION:=LOW
endif
endif
...
...
@@ -2236,7 +2236,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS,\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
LDFLAGS_SUFFIX
:=-lm $(LDFLAGS_JDKLIB_SUFFIX)
,\
LDFLAGS_SUFFIX
_posix:=-lm -ljava -ljvm
,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
RC_FLAGS:=$(RC_FLAGS)\
...
...
makefiles/CreateJars.gmk
浏览文件 @
5eb82201
...
...
@@ -446,9 +446,7 @@ ifndef OPENJDK
$(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
...
...
@@ -476,9 +474,7 @@ ifndef OPENJDK
$(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
...
...
@@ -518,9 +514,8 @@ ifndef OPENJDK
$(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
$(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
...
...
@@ -545,9 +540,7 @@ ifndef OPENJDK
$(JCE_JAR_DST) : $(JCE_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
...
...
@@ -567,76 +560,86 @@ JARS += $(JCE_JAR_DST)
##########################################################################################
ifdef OPENJDK
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
# NOTE: We currently do not place restrictions on our limited export
# policy. This was not a typo.
#
US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
ifndef OPENJDK
$(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
else
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
# NOTE: We currently do not place restrictions on our limited export
# policy. This was not a typo.
#
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(install-file)
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES:= .policy,\
JAR:=$(US_EXPORT_POLICY_JAR_DST), \
EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
SKIP_METAINF := true))
JARS += $(US_EXPORT_POLICY_JAR_DST)
endif
JARS += $(US_EXPORT_POLICY_JAR_DST)
##########################################################################################
LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
ifdef OPENJDK
if
n
def OPENJDK
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
$(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
ifeq ($(UNLIMITED_CRYPTO), true)
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
else
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
$(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
endif
$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
ifeq ($(UNLIMITED_CRYPTO), true)
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
else
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
$(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
endif
$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
$(install-file)
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
SRCS:=$(LOCAL_POLICY_JAR_TMP),\
SUFFIXES:= .policy,\
JAR:=$(LOCAL_POLICY_JAR_DST), \
EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
SKIP_METAINF := true))
JARS += $(LOCAL_POLICY_JAR_DST)
endif
JARS += $(LOCAL_POLICY_JAR_DST)
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS),windows)
...
...
@@ -648,9 +651,7 @@ SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
$(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
...
...
@@ -676,9 +677,7 @@ UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
$(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
JARS += $(UCRYPTO_JAR_DST)
...
...
@@ -897,14 +896,10 @@ LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%,$(IMAGES_OUTPUTDIR)
$(LAUNCHER_SRC_FILES)))
$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
$(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
...
...
@@ -922,6 +917,55 @@ JARS+=$(IMAGES_OUTPUTDIR)/src.zip
##########################################################################################
#
# This is an empty jar (only contains manifest) and fits poorly into framework...
# create simple rule instead
#
$(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
$(JAR) cfm $@ $<
JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar
##########################################################################################
$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
$(install-file)
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS),macosx)
$(eval $(call SetupArchive,BUILD_JOBJC_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\
JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \
JARINDEX:=true))
JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
endif
##########################################################################################
ifndef OPENJDK
$(eval $(call SetupArchive,BUILD_ALT_RT_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\
JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar))
JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar
endif
##########################################################################################
# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
# all jars can be found in one place when creating images in Images.gmk. It needs to be
# done here so that clean targets can be simple and accurate.
$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar
$(install-file)
JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
##########################################################################################
-include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
##########################################################################################
...
...
makefiles/Images.gmk
浏览文件 @
5eb82201
...
...
@@ -211,10 +211,11 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
endif
# Find all files to copy from $(JDK_OUTPUTDIR)/lib
# Jar files are not expected to be here
ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
\( -name "_the*" -o -name "javac_state " \) )
\( -name "_the*" -o -name "javac_state "
-o -name "*.jar"
\) )
# Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
# This might not exist if building overlay-images
# This
is were the jar files are and
might not exist if building overlay-images
ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
\( -name "_the*" -o -name "javac_state " \) )
...
...
makefiles/Import.gmk
浏览文件 @
5eb82201
...
...
@@ -231,22 +231,6 @@ define install-file
endef
endif
ifndef OPENJDK
IMPORT_TARGET_FILES += \
$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \
$(JDK_OUTPUTDIR)/lib/security/local_policy.jar
$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
endif # OPENJDK
#######
all: $(IMPORT_TARGET_FILES)
src/macosx/classes/com/apple/laf/AquaLookAndFeel.java
浏览文件 @
5eb82201
...
...
@@ -714,7 +714,8 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"PopupMenu.font"
,
menuFont
,
"PopupMenu.background"
,
menuBackgroundColor
,
"PopupMenu.translucentBackground"
,
translucentWhite
,
// Fix for 7154516: make popups opaque
"PopupMenu.translucentBackground"
,
white
,
"PopupMenu.foreground"
,
menuForegroundColor
,
"PopupMenu.selectionBackground"
,
menuSelectedBackgroundColor
,
"PopupMenu.selectionForeground"
,
menuSelectedForegroundColor
,
...
...
src/macosx/classes/sun/awt/CGraphicsConfig.java
浏览文件 @
5eb82201
...
...
@@ -31,13 +31,16 @@ import java.awt.image.*;
import
sun.java2d.SurfaceData
;
import
sun.java2d.opengl.CGLLayer
;
import
sun.lwawt.LWGraphicsConfig
;
import
sun.lwawt.macosx.CPlatformView
;
public
class
CGraphicsConfig
extends
GraphicsConfiguration
{
public
abstract
class
CGraphicsConfig
extends
GraphicsConfiguration
implements
LWGraphicsConfig
{
private
final
CGraphicsDevice
device
;
private
ColorModel
colorModel
;
p
ublic
CGraphicsConfig
(
CGraphicsDevice
device
)
{
p
rotected
CGraphicsConfig
(
CGraphicsDevice
device
)
{
this
.
device
=
device
;
}
...
...
@@ -84,88 +87,20 @@ public class CGraphicsConfig extends GraphicsConfiguration {
return
new
AffineTransform
(
xscale
,
0.0
,
0.0
,
yscale
,
0.0
,
0.0
);
}
/**
* The following methods are invoked from CToolkit.java and
* LWWindowPeer.java rather than having the native
* implementations hardcoded in those classes. This way the appropriate
* actions are taken based on the peer's GraphicsConfig, whether it is
* an CGLGraphicsConfig or something else.
*/
/**
* Creates a new SurfaceData that will be associated with the given
* LWWindowPeer.
*/
public
SurfaceData
createSurfaceData
(
CPlatformView
pView
)
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
public
abstract
SurfaceData
createSurfaceData
(
CPlatformView
pView
);
/**
* Creates a new SurfaceData that will be associated with the given
* CGLLayer.
*/
public
SurfaceData
createSurfaceData
(
CGLLayer
layer
)
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
/**
* Creates a new hidden-acceleration image of the given width and height
* that is associated with the target Component.
*/
public
Image
createAcceleratedImage
(
Component
target
,
int
width
,
int
height
)
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
/**
* The following methods correspond to the multibuffering methods in
* LWWindowPeer.java...
*/
/**
* Attempts to create a native backbuffer for the given peer. If
* the requested configuration is not natively supported, an AWTException
* is thrown. Otherwise, if the backbuffer creation is successful, a
* handle to the native backbuffer is returned.
*/
public
long
createBackBuffer
(
CPlatformView
pView
,
int
numBuffers
,
BufferCapabilities
caps
)
throws
AWTException
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
public
void
destroyBackBuffer
(
long
backBuffer
)
throws
AWTException
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
/**
* Creates a VolatileImage that essentially wraps the target Component's
* backbuffer, using the provided backbuffer handle.
*/
public
VolatileImage
createBackBufferImage
(
Component
target
,
long
backBuffer
)
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
/**
* Performs the native flip operation for the given target Component.
*/
public
void
flip
(
CPlatformView
delegate
,
Component
target
,
VolatileImage
xBackBuffer
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
)
{
throw
new
UnsupportedOperationException
(
"not implemented"
);
}
public
abstract
SurfaceData
createSurfaceData
(
CGLLayer
layer
);
@Override
public
boolean
isTranslucencyCapable
()
{
public
final
boolean
isTranslucencyCapable
()
{
//we know for sure we have capable config :)
return
true
;
}
...
...
src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
浏览文件 @
5eb82201
...
...
@@ -27,7 +27,6 @@ package sun.java2d.opengl;
import
java.awt.AWTException
;
import
java.awt.BufferCapabilities
;
import
java.awt.Color
;
import
java.awt.Component
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
...
...
@@ -48,13 +47,10 @@ import java.awt.image.WritableRaster;
import
sun.awt.CGraphicsConfig
;
import
sun.awt.CGraphicsDevice
;
import
sun.awt.TextureSizeConstraining
;
import
sun.awt.image.OffScreenImage
;
import
sun.awt.image.SunVolatileImage
;
import
sun.awt.image.SurfaceManager
;
import
sun.java2d.Disposer
;
import
sun.java2d.DisposerRecord
;
import
sun.java2d.SunGraphics2D
;
import
sun.java2d.Surface
;
import
sun.java2d.SurfaceData
;
import
sun.java2d.opengl.OGLContext.OGLContextCaps
;
...
...
@@ -63,18 +59,19 @@ import sun.java2d.pipe.hw.AccelTypedVolatileImage;
import
sun.java2d.pipe.hw.ContextCapabilities
;
import
static
sun
.
java2d
.
opengl
.
OGLSurfaceData
.*;
import
static
sun
.
java2d
.
opengl
.
OGLContext
.
OGLContextCaps
.*;
import
sun.java2d.opengl.CGLSurfaceData.CGLVSyncOffScreenSurfaceData
;
import
sun.java2d.pipe.hw.AccelDeviceEventListener
;
import
sun.java2d.pipe.hw.AccelDeviceEventNotifier
;
import
sun.lwawt.LWComponentPeer
;
import
sun.lwawt.macosx.CPlatformView
;
public
class
CGLGraphicsConfig
extends
CGraphicsConfig
implements
OGLGraphicsConfig
,
TextureSizeConstraining
public
final
class
CGLGraphicsConfig
extends
CGraphicsConfig
implements
OGLGraphicsConfig
{
//private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
//private static final int kOpenGLSwapInterval =
// RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
private
static
final
int
kOpenGLSwapInterval
=
0
;
// TODO
pr
otected
static
boolean
cglAvailable
;
pr
ivate
static
boolean
cglAvailable
;
private
static
ImageCapabilities
imageCaps
=
new
CGLImageCaps
();
private
int
pixfmt
;
...
...
@@ -82,7 +79,7 @@ public class CGLGraphicsConfig extends CGraphicsConfig
private
long
pConfigInfo
;
private
ContextCapabilities
oglCaps
;
private
OGLContext
context
;
private
Object
disposerReferent
=
new
Object
();
private
final
Object
disposerReferent
=
new
Object
();
public
static
native
int
getDefaultPixFmt
(
int
screennum
);
private
static
native
boolean
initCGL
();
...
...
@@ -94,7 +91,7 @@ public class CGLGraphicsConfig extends CGraphicsConfig
cglAvailable
=
initCGL
();
}
pr
otected
CGLGraphicsConfig
(
CGraphicsDevice
device
,
int
pixfmt
,
pr
ivate
CGLGraphicsConfig
(
CGraphicsDevice
device
,
int
pixfmt
,
long
configInfo
,
ContextCapabilities
oglCaps
)
{
super
(
device
);
...
...
@@ -170,11 +167,13 @@ public class CGLGraphicsConfig extends CGraphicsConfig
* Returns true if the provided capability bit is present for this config.
* See OGLContext.java for a list of supported capabilities.
*/
public
final
boolean
isCapPresent
(
int
cap
)
{
@Override
public
boolean
isCapPresent
(
int
cap
)
{
return
((
oglCaps
.
getCaps
()
&
cap
)
!=
0
);
}
public
final
long
getNativeConfigInfo
()
{
@Override
public
long
getNativeConfigInfo
()
{
return
pConfigInfo
;
}
...
...
@@ -183,7 +182,8 @@ public class CGLGraphicsConfig extends CGraphicsConfig
*
* @see sun.java2d.pipe.hw.BufferedContextProvider#getContext
*/
public
final
OGLContext
getContext
()
{
@Override
public
OGLContext
getContext
()
{
return
context
;
}
...
...
@@ -257,145 +257,83 @@ public class CGLGraphicsConfig extends CGraphicsConfig
return
(
"CGLGraphicsConfig[dev="
+
screen
+
",pixfmt="
+
pixfmt
+
"]"
);
}
/**
* The following methods are invoked from ComponentModel.java rather
* than having the Mac OS X-dependent implementations hardcoded in that
* class. This way the appropriate actions are taken based on the peer's
* GraphicsConfig, whether it is a CGraphicsConfig or a
* CGLGraphicsConfig.
*/
/**
* Creates a new SurfaceData that will be associated with the given
* LWWindowPeer.
*/
@Override
public
SurfaceData
createSurfaceData
(
CPlatformView
pView
)
{
return
CGLSurfaceData
.
createData
(
pView
);
}
/**
* Creates a new SurfaceData that will be associated with the given
* CGLLayer.
*/
@Override
public
SurfaceData
createSurfaceData
(
CGLLayer
layer
)
{
return
CGLSurfaceData
.
createData
(
layer
);
}
/**
* Creates a new hidden-acceleration image of the given width and height
* that is associated with the target Component.
*/
@Override
public
Image
createAcceleratedImage
(
Component
target
,
int
width
,
int
height
)
{
ColorModel
model
=
getColorModel
(
Transparency
.
OPAQUE
);
WritableRaster
wr
=
model
.
createCompatibleWritableRaster
(
width
,
height
);
WritableRaster
wr
=
model
.
createCompatibleWritableRaster
(
width
,
height
);
return
new
OffScreenImage
(
target
,
model
,
wr
,
model
.
isAlphaPremultiplied
());
}
/**
* The following methods correspond to the multibuffering methods in
* CWindowPeer.java...
*/
/**
* Attempts to create a OGL-based backbuffer for the given peer. If
* the requested configuration is not natively supported, an AWTException
* is thrown. Otherwise, if the backbuffer creation is successful, a
* value of 1 is returned.
*/
@Override
public
long
createBackBuffer
(
CPlatformView
pView
,
int
numBuffers
,
BufferCapabilities
caps
)
throws
AWTException
{
if
(
numBuffers
>
2
)
{
throw
new
AWTException
(
"Only double or single buffering is supported"
);
public
void
assertOperationSupported
(
final
int
numBuffers
,
final
BufferCapabilities
caps
)
throws
AWTException
{
// Assume this method is never called with numBuffers != 2, as 0 is
// unsupported, and 1 corresponds to a SingleBufferStrategy which
// doesn't depend on the peer. Screen is considered as a separate
// "buffer".
if
(
numBuffers
!=
2
)
{
throw
new
AWTException
(
"Only double buffering is supported"
);
}
BufferCapabilities
configCaps
=
getBufferCapabilities
();
final
BufferCapabilities
configCaps
=
getBufferCapabilities
();
if
(!
configCaps
.
isPageFlipping
())
{
throw
new
AWTException
(
"Page flipping is not supported"
);
}
if
(
caps
.
getFlipContents
()
==
BufferCapabilities
.
FlipContents
.
PRIOR
)
{
throw
new
AWTException
(
"FlipContents.PRIOR is not supported"
);
}
// non-zero return value means backbuffer creation was successful
// (checked in CPlatformWindow.flip(), etc.)
return
1
;
}
/**
* Destroys the backbuffer object represented by the given handle value.
*/
@Override
public
void
destroyBackBuffer
(
long
backBuffer
)
{
public
Image
createBackBuffer
(
final
LWComponentPeer
<?,
?>
peer
)
{
final
Rectangle
r
=
peer
.
getBounds
();
// It is possible for the component to have size 0x0, adjust it to
// be at least 1x1 to avoid IAE
final
int
w
=
Math
.
max
(
1
,
r
.
width
);
final
int
h
=
Math
.
max
(
1
,
r
.
height
);
final
int
transparency
=
peer
.
isTranslucent
()
?
Transparency
.
TRANSLUCENT
:
Transparency
.
OPAQUE
;
return
new
SunVolatileImage
(
this
,
w
,
h
,
transparency
,
null
);
}
/**
* Creates a VolatileImage that essentially wraps the target Component's
* backbuffer (the provided backbuffer handle is essentially ignored).
*/
@Override
public
VolatileImage
createBackBufferImage
(
Component
target
,
long
backBuffer
)
{
return
new
SunVolatileImage
(
target
,
target
.
getWidth
(),
target
.
getHeight
(),
Boolean
.
TRUE
);
public
void
destroyBackBuffer
(
final
Image
backBuffer
)
{
if
(
backBuffer
!=
null
)
{
backBuffer
.
flush
();
}
}
/**
* Performs the native OGL flip operation for the given target Component.
*/
@Override
public
void
flip
(
CPlatformView
pView
,
Component
target
,
VolatileImage
xBackBuffer
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
)
{
if
(
flipAction
==
BufferCapabilities
.
FlipContents
.
COPIED
)
{
SurfaceManager
vsm
=
SurfaceManager
.
getManager
(
xBackBuffer
);
SurfaceData
sd
=
vsm
.
getPrimarySurfaceData
();
if
(
sd
instanceof
CGLVSyncOffScreenSurfaceData
)
{
CGLVSyncOffScreenSurfaceData
vsd
=
(
CGLVSyncOffScreenSurfaceData
)
sd
;
SurfaceData
bbsd
=
vsd
.
getFlipSurface
();
Graphics2D
bbg
=
new
SunGraphics2D
(
bbsd
,
Color
.
black
,
Color
.
white
,
null
);
try
{
bbg
.
drawImage
(
xBackBuffer
,
0
,
0
,
null
);
}
finally
{
bbg
.
dispose
();
}
}
else
{
pView
.
drawImageOnPeer
(
xBackBuffer
,
x1
,
y1
,
x2
,
y2
);
return
;
}
}
else
if
(
flipAction
==
BufferCapabilities
.
FlipContents
.
PRIOR
)
{
// not supported by CGL...
return
;
public
void
flip
(
final
LWComponentPeer
<?,
?>
peer
,
final
Image
backBuffer
,
final
int
x1
,
final
int
y1
,
final
int
x2
,
final
int
y2
,
final
BufferCapabilities
.
FlipContents
flipAction
)
{
final
Graphics
g
=
peer
.
getGraphics
();
try
{
g
.
drawImage
(
backBuffer
,
x1
,
y1
,
x2
,
y2
,
x1
,
y1
,
x2
,
y2
,
null
);
}
finally
{
g
.
dispose
();
}
OGLSurfaceData
.
swapBuffers
(
pView
.
getAWTView
());
if
(
flipAction
==
BufferCapabilities
.
FlipContents
.
BACKGROUND
)
{
Graphics
g
=
xB
ackBuffer
.
getGraphics
();
final
Graphics2D
bg
=
(
Graphics2D
)
b
ackBuffer
.
getGraphics
();
try
{
g
.
setColor
(
target
.
getBackground
());
g
.
fillRect
(
0
,
0
,
xBackBuffer
.
getWidth
(),
xBackBuffer
.
getHeight
());
bg
.
setBackground
(
peer
.
getBackground
());
bg
.
clearRect
(
0
,
0
,
backBuffer
.
getWidth
(
null
),
backBuffer
.
getHeight
(
null
));
}
finally
{
g
.
dispose
();
b
g
.
dispose
();
}
}
}
...
...
@@ -429,15 +367,10 @@ public class CGLGraphicsConfig extends CGraphicsConfig
return
imageCaps
;
}
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
*/
public
VolatileImage
createCompatibleVolatileImage
(
int
width
,
int
height
,
int
transparency
,
int
type
)
{
@Override
public
VolatileImage
createCompatibleVolatileImage
(
int
width
,
int
height
,
int
transparency
,
int
type
)
{
if
(
type
==
FLIP_BACKBUFFER
||
type
==
WINDOW
||
type
==
UNDEFINED
||
transparency
==
Transparency
.
BITMASK
)
{
...
...
@@ -473,15 +406,18 @@ public class CGLGraphicsConfig extends CGraphicsConfig
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
*/
@Override
public
ContextCapabilities
getContextCapabilities
()
{
return
oglCaps
;
}
@Override
public
void
addDeviceEventListener
(
AccelDeviceEventListener
l
)
{
int
screen
=
getDevice
().
getCoreGraphicsScreen
();
AccelDeviceEventNotifier
.
addListener
(
l
,
screen
);
}
@Override
public
void
removeDeviceEventListener
(
AccelDeviceEventListener
l
)
{
AccelDeviceEventNotifier
.
removeListener
(
l
);
}
...
...
src/macosx/classes/sun/lwawt/LWCanvasPeer.java
浏览文件 @
5eb82201
...
...
@@ -26,12 +26,9 @@
package
sun.lwawt
;
import
java.awt.AWTException
;
import
java.awt.BufferCapabilities
;
import
java.awt.Component
;
import
java.awt.Dimension
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.Image
;
import
java.awt.peer.CanvasPeer
;
import
javax.swing.JComponent
;
...
...
@@ -42,35 +39,10 @@ class LWCanvasPeer<T extends Component, D extends JComponent>
LWCanvasPeer
(
final
T
target
,
final
PlatformComponent
platformComponent
)
{
super
(
target
,
platformComponent
);
}
// ---- PEER METHODS ---- //
@Override
public
void
createBuffers
(
int
numBuffers
,
BufferCapabilities
caps
)
throws
AWTException
{
// TODO
}
@Override
public
Image
getBackBuffer
()
{
// TODO
return
null
;
}
@Override
public
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
)
{
// TODO
}
@Override
public
void
destroyBuffers
()
{
// TODO
}
@Override
public
final
GraphicsConfiguration
getAppropriateGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
final
GraphicsConfiguration
gc
)
{
// TODO
return
gc
;
}
...
...
src/macosx/classes/sun/lwawt/LWComponentPeer.java
浏览文件 @
5eb82201
...
...
@@ -138,6 +138,11 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
*/
static
final
char
WIDE_CHAR
=
'0'
;
/**
* The back buffer provide user with a BufferStrategy.
*/
private
Image
backBuffer
;
private
final
class
DelegateContainer
extends
Container
{
{
enableEvents
(
0xFFFFFFFF
);
...
...
@@ -389,6 +394,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
protected
void
disposeImpl
()
{
destroyBuffers
();
LWContainerPeer
cp
=
getContainerPeer
();
if
(
cp
!=
null
)
{
cp
.
removeChildPeer
(
this
);
...
...
@@ -415,6 +421,12 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
return
getWindowPeer
().
getGraphicsConfiguration
();
}
// Just a helper method
public
final
LWGraphicsConfig
getLWGC
()
{
return
(
LWGraphicsConfig
)
getGraphicsConfiguration
();
}
/*
* Overridden in LWWindowPeer to replace its surface
* data and back buffer.
...
...
@@ -506,31 +518,45 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
return
getGraphicsConfiguration
().
getColorModel
();
}
public
boolean
isTranslucent
()
{
// Translucent windows of the top level are supported only
return
false
;
}
@Override
public
void
createBuffers
(
int
numBuffers
,
BufferCapabilities
caps
)
public
final
void
createBuffers
(
int
numBuffers
,
BufferCapabilities
caps
)
throws
AWTException
{
throw
new
AWTException
(
"Back buffers are only supported for "
+
"Window or Canvas components."
);
getLWGC
().
assertOperationSupported
(
numBuffers
,
caps
);
final
Image
buffer
=
getLWGC
().
createBackBuffer
(
this
);
synchronized
(
getStateLock
())
{
backBuffer
=
buffer
;
}
}
/*
* To be overridden in LWWindowPeer and LWCanvasPeer.
*/
@Override
public
Image
getBackBuffer
()
{
// Return null or throw AWTException?
return
null
;
public
final
Image
getBackBuffer
()
{
synchronized
(
getStateLock
())
{
if
(
backBuffer
!=
null
)
{
return
backBuffer
;
}
}
throw
new
IllegalStateException
(
"Buffers have not been created"
);
}
@Override
public
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
public
final
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
)
{
// Skip silently or throw AWTException?
getLWGC
().
flip
(
this
,
getBackBuffer
(),
x1
,
y1
,
x2
,
y2
,
flipAction
);
}
@Override
public
void
destroyBuffers
()
{
// Do nothing
public
final
void
destroyBuffers
()
{
final
Image
oldBB
;
synchronized
(
getStateLock
())
{
oldBB
=
backBuffer
;
backBuffer
=
null
;
}
getLWGC
().
destroyBackBuffer
(
oldBB
);
}
// Helper method
...
...
@@ -642,7 +668,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
}
p
rotected
final
Color
getBackground
()
{
p
ublic
final
Color
getBackground
()
{
synchronized
(
getStateLock
())
{
return
background
;
}
...
...
@@ -982,19 +1008,17 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
@Override
public
Image
createImage
(
ImageProducer
producer
)
{
public
final
Image
createImage
(
final
ImageProducer
producer
)
{
return
new
ToolkitImage
(
producer
);
}
@Override
public
Image
createImage
(
int
w
,
int
h
)
{
CGraphicsConfig
gc
=
(
CGraphicsConfig
)
getGraphicsConfiguration
();
return
gc
.
createAcceleratedImage
(
getTarget
(),
w
,
h
);
public
final
Image
createImage
(
final
int
width
,
final
int
height
)
{
return
getLWGC
().
createAcceleratedImage
(
getTarget
(),
width
,
height
);
}
@Override
public
VolatileImage
createVolatileImage
(
int
w
,
int
h
)
{
// TODO: is it a right/complete implementation?
public
final
VolatileImage
createVolatileImage
(
final
int
w
,
final
int
h
)
{
return
new
SunVolatileImage
(
getTarget
(),
w
,
h
);
}
...
...
@@ -1105,8 +1129,6 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* of target.setLocation() or as a result of user actions (window is
* dragged with mouse).
*
* To be overridden in LWWindowPeer to update its GraphicsConfig.
*
* This method could be called on the toolkit thread.
*/
protected
final
void
handleMove
(
final
int
x
,
final
int
y
,
...
...
@@ -1122,13 +1144,19 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* Called when this peer's size has been changed either as a result of
* target.setSize() or as a result of user actions (window is resized).
*
* To be overridden in LWWindowPeer to update its SurfaceData and
* GraphicsConfig.
*
* This method could be called on the toolkit thread.
*/
protected
final
void
handleResize
(
final
int
w
,
final
int
h
,
final
boolean
updateTarget
)
{
Image
oldBB
=
null
;
synchronized
(
getStateLock
())
{
if
(
backBuffer
!=
null
)
{
oldBB
=
backBuffer
;
backBuffer
=
getLWGC
().
createBackBuffer
(
this
);
}
}
getLWGC
().
destroyBackBuffer
(
oldBB
);
if
(
updateTarget
)
{
AWTAccessor
.
getComponentAccessor
().
setSize
(
getTarget
(),
w
,
h
);
}
...
...
src/macosx/classes/sun/lwawt/LWGraphicsConfig.java
0 → 100644
浏览文件 @
5eb82201
/*
* Copyright (c) 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.
*/
package
sun.lwawt
;
import
java.awt.AWTException
;
import
java.awt.BufferCapabilities
;
import
java.awt.Component
;
import
java.awt.Image
;
/**
* As lwawt can be used on different platforms with different graphic
* configurations, the general set of methods is necessary. This interface
* collects the methods that should be provided by GraphicsConfiguration,
* simplifying use by the LWAWT.
*
* @author Sergey Bylokhov
*/
public
interface
LWGraphicsConfig
{
/*
* A GraphicsConfiguration must implements following methods to indicate
* that it imposes certain limitations on the maximum size of supported
* textures.
*/
/**
* Returns the maximum width of any texture image. By default return {@code
* Integer.MAX_VALUE}.
*/
int
getMaxTextureWidth
();
/**
* Returns the maximum height of any texture image. By default return {@code
* Integer.MAX_VALUE}.
*/
int
getMaxTextureHeight
();
/*
* The following methods correspond to the multi-buffering methods in
* LWComponentPeer.java.
*/
/**
* Checks that the requested configuration is natively supported; if not, an
* AWTException is thrown.
*/
void
assertOperationSupported
(
int
numBuffers
,
BufferCapabilities
caps
)
throws
AWTException
;
/**
* Creates a back buffer for the given peer and returns the image wrapper.
*/
Image
createBackBuffer
(
LWComponentPeer
<?,
?>
peer
);
/**
* Destroys the back buffer object.
*/
void
destroyBackBuffer
(
Image
backBuffer
);
/**
* Performs the native flip operation for the given target Component. Our
* flip is implemented through normal drawImage() to the graphic object,
* because of our components uses a graphic object of the container(in this
* case we also apply necessary constrains)
*/
void
flip
(
LWComponentPeer
<?,
?>
peer
,
Image
backBuffer
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
);
/**
* Creates a new hidden-acceleration image of the given width and height
* that is associated with the target Component.
*/
Image
createAcceleratedImage
(
Component
target
,
int
width
,
int
height
);
}
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
5eb82201
...
...
@@ -27,7 +27,6 @@ package sun.lwawt;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.image.BufferedImage
;
import
java.awt.peer.*
;
import
java.util.List
;
...
...
@@ -75,17 +74,6 @@ public class LWWindowPeer
private
SurfaceData
surfaceData
;
private
final
Object
surfaceDataLock
=
new
Object
();
private
int
backBufferCount
;
private
BufferCapabilities
backBufferCaps
;
// The back buffer is used for two purposes:
// 1. To render all the lightweight peers
// 2. To provide user with a BufferStrategy
// Need to check if a single back buffer can be used for both
// TODO: VolatileImage
// private VolatileImage backBuffer;
private
volatile
BufferedImage
backBuffer
;
private
volatile
int
windowState
=
Frame
.
NORMAL
;
// check that the mouse is over the window
...
...
@@ -227,7 +215,6 @@ public class LWWindowPeer
if
(
isGrabbing
())
{
ungrab
();
}
destroyBuffers
();
platformWindow
.
dispose
();
super
.
disposeImpl
();
}
...
...
@@ -258,8 +245,10 @@ public class LWWindowPeer
}
@Override
public
GraphicsConfiguration
getGraphicsConfiguration
()
{
return
graphicsConfig
;
public
final
GraphicsConfiguration
getGraphicsConfiguration
()
{
synchronized
(
getStateLock
())
{
return
graphicsConfig
;
}
}
@Override
...
...
@@ -284,48 +273,6 @@ public class LWWindowPeer
return
platformWindow
.
transformGraphics
(
new
SunGraphics2D
(
getSurfaceData
(),
fg
,
bg
,
f
));
}
@Override
public
void
createBuffers
(
int
numBuffers
,
BufferCapabilities
caps
)
throws
AWTException
{
try
{
// Assume this method is never called with numBuffers <= 1, as 0 is
// unsupported, and 1 corresponds to a SingleBufferStrategy which
// doesn't depend on the peer. Screen is considered as a separate
// "buffer", that's why numBuffers - 1
assert
numBuffers
>
1
;
replaceSurfaceData
(
numBuffers
-
1
,
caps
,
false
);
}
catch
(
InvalidPipeException
z
)
{
throw
new
AWTException
(
z
.
toString
());
}
}
@Override
public
final
Image
getBackBuffer
()
{
synchronized
(
getStateLock
())
{
return
backBuffer
;
}
}
@Override
public
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
)
{
platformWindow
.
flip
(
x1
,
y1
,
x2
,
y2
,
flipAction
);
}
@Override
public
final
void
destroyBuffers
()
{
final
Image
oldBB
=
getBackBuffer
();
synchronized
(
getStateLock
())
{
backBuffer
=
null
;
}
if
(
oldBB
!=
null
)
{
oldBB
.
flush
();
}
}
@Override
public
void
setBounds
(
int
x
,
int
y
,
int
w
,
int
h
,
int
op
)
{
if
((
op
&
SET_CLIENT_SIZE
)
!=
0
)
{
...
...
@@ -343,16 +290,14 @@ public class LWWindowPeer
h
=
MINIMUM_HEIGHT
;
}
if
(
graphicsConfig
instanceof
TextureSizeConstraining
)
{
final
int
maxW
=
((
TextureSizeConstraining
)
graphicsConfig
).
getMaxTextureWidth
();
final
int
maxH
=
((
TextureSizeConstraining
)
graphicsConfig
).
getMaxTextureHeight
();
final
int
maxW
=
getLWGC
().
getMaxTextureWidth
();
final
int
maxH
=
getLWGC
().
getMaxTextureHeight
();
if
(
w
>
maxW
)
{
w
=
maxW
;
}
if
(
h
>
maxH
)
{
h
=
maxH
;
}
if
(
w
>
maxW
)
{
w
=
maxW
;
}
if
(
h
>
maxH
)
{
h
=
maxH
;
}
// Don't post ComponentMoved/Resized and Paint events
...
...
@@ -431,21 +376,14 @@ public class LWWindowPeer
min
=
new
Dimension
(
MINIMUM_WIDTH
,
MINIMUM_HEIGHT
);
}
final
int
maxW
,
maxH
;
if
(
graphicsConfig
instanceof
TextureSizeConstraining
)
{
maxW
=
((
TextureSizeConstraining
)
graphicsConfig
).
getMaxTextureWidth
();
maxH
=
((
TextureSizeConstraining
)
graphicsConfig
).
getMaxTextureHeight
();
}
else
{
maxW
=
maxH
=
Integer
.
MAX_VALUE
;
}
final
Dimension
max
;
if
(
getTarget
().
isMaximumSizeSet
())
{
max
=
getTarget
().
getMaximumSize
();
max
.
width
=
Math
.
min
(
max
.
width
,
maxW
);
max
.
height
=
Math
.
min
(
max
.
height
,
maxH
);
max
.
width
=
Math
.
min
(
max
.
width
,
getLWGC
().
getMaxTextureWidth
()
);
max
.
height
=
Math
.
min
(
max
.
height
,
getLWGC
().
getMaxTextureHeight
()
);
}
else
{
max
=
new
Dimension
(
maxW
,
maxH
);
max
=
new
Dimension
(
getLWGC
().
getMaxTextureWidth
(),
getLWGC
().
getMaxTextureHeight
());
}
platformWindow
.
setSizeConstraints
(
min
.
width
,
min
.
height
,
max
.
width
,
max
.
height
);
...
...
@@ -1014,21 +952,10 @@ public class LWWindowPeer
replaceSurfaceData
(
true
);
}
private
void
replaceSurfaceData
(
boolean
blit
)
{
replaceSurfaceData
(
backBufferCount
,
backBufferCaps
,
blit
);
}
private
void
replaceSurfaceData
(
int
newBackBufferCount
,
BufferCapabilities
newBackBufferCaps
,
boolean
blit
)
{
private
void
replaceSurfaceData
(
final
boolean
blit
)
{
synchronized
(
surfaceDataLock
)
{
final
SurfaceData
oldData
=
getSurfaceData
();
surfaceData
=
platformWindow
.
replaceSurfaceData
();
// TODO: volatile image
// VolatileImage oldBB = backBuffer;
BufferedImage
oldBB
=
backBuffer
;
backBufferCount
=
newBackBufferCount
;
backBufferCaps
=
newBackBufferCaps
;
final
Rectangle
size
=
getSize
();
if
(
getSurfaceData
()
!=
null
&&
oldData
!=
getSurfaceData
())
{
clearBackground
(
size
.
width
,
size
.
height
);
...
...
@@ -1043,35 +970,6 @@ public class LWWindowPeer
// This can only happen when this peer is being created
oldData
.
flush
();
}
// TODO: volatile image
// backBuffer = (VolatileImage)delegate.createBackBuffer();
backBuffer
=
(
BufferedImage
)
platformWindow
.
createBackBuffer
();
if
(
backBuffer
!=
null
)
{
Graphics
g
=
backBuffer
.
getGraphics
();
try
{
Rectangle
r
=
getBounds
();
if
(
g
instanceof
Graphics2D
)
{
((
Graphics2D
)
g
).
setComposite
(
AlphaComposite
.
Src
);
}
g
.
setColor
(
nonOpaqueBackground
);
g
.
fillRect
(
0
,
0
,
r
.
width
,
r
.
height
);
if
(
g
instanceof
SunGraphics2D
)
{
SG2DConstraint
((
SunGraphics2D
)
g
,
getRegion
());
}
if
(!
isTextured
())
{
g
.
setColor
(
getBackground
());
g
.
fillRect
(
0
,
0
,
r
.
width
,
r
.
height
);
}
if
(
oldBB
!=
null
)
{
// Draw the old back buffer to the new one
g
.
drawImage
(
oldBB
,
0
,
0
,
null
);
oldBB
.
flush
();
}
}
finally
{
g
.
dispose
();
}
}
}
}
...
...
@@ -1092,14 +990,6 @@ public class LWWindowPeer
}
}
public
int
getBackBufferCount
()
{
return
backBufferCount
;
}
public
BufferCapabilities
getBackBufferCaps
()
{
return
backBufferCaps
;
}
/*
* Request the window insets from the delegate and compares it
* with the current one. This method is mostly called by the
...
...
src/macosx/classes/sun/lwawt/PlatformWindow.java
浏览文件 @
5eb82201
...
...
@@ -97,17 +97,6 @@ public interface PlatformWindow {
*/
public
SurfaceData
replaceSurfaceData
();
/*
* Creates a new image to serve as a back buffer.
*/
public
Image
createBackBuffer
();
/*
* Move the given part of the back buffer to the front buffer.
*/
public
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
BufferCapabilities
.
FlipContents
flipAction
);
public
void
setModalBlocked
(
boolean
blocked
);
public
void
toFront
();
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
浏览文件 @
5eb82201
...
...
@@ -31,12 +31,9 @@ import sun.lwawt.LWWindowPeer;
import
sun.java2d.opengl.CGLLayer
;
import
sun.java2d.SurfaceData
;
import
sun.awt.CGraphicsConfig
;
import
sun.awt.CGraphicsDevice
;
import
sun.awt.CausedFocusEvent
;
import
java.awt.*
;
import
java.awt.BufferCapabilities.FlipContents
;
import
sun.util.logging.PlatformLogger
;
...
...
@@ -112,22 +109,6 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
return
windowLayer
.
replaceSurfaceData
();
}
@Override
public
Image
createBackBuffer
()
{
Rectangle
r
=
peer
.
getBounds
();
Image
im
=
null
;
if
(!
r
.
isEmpty
())
{
int
transparency
=
peer
.
isTranslucent
()
?
Transparency
.
TRANSLUCENT
:
Transparency
.
OPAQUE
;
im
=
peer
.
getGraphicsConfiguration
().
createCompatibleImage
(
r
.
width
,
r
.
height
,
transparency
);
}
return
im
;
}
@Override
public
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
FlipContents
flipAction
)
{
throw
new
RuntimeException
(
"Not implemented"
);
}
@Override
public
void
setVisible
(
boolean
visible
)
{}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
浏览文件 @
5eb82201
...
...
@@ -26,7 +26,6 @@
package
sun.lwawt.macosx
;
import
java.awt.*
;
import
java.awt.image.VolatileImage
;
import
sun.awt.CGraphicsConfig
;
import
sun.lwawt.LWWindowPeer
;
...
...
@@ -115,26 +114,6 @@ public class CPlatformView extends CFRetainedResource {
// ----------------------------------------------------------------------
// PAINTING METHODS
// ----------------------------------------------------------------------
public
void
drawImageOnPeer
(
VolatileImage
xBackBuffer
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
Graphics
g
=
peer
.
getGraphics
();
try
{
g
.
drawImage
(
xBackBuffer
,
x1
,
y1
,
x2
,
y2
,
x1
,
y1
,
x2
,
y2
,
null
);
}
finally
{
g
.
dispose
();
}
}
public
Image
createBackBuffer
()
{
Rectangle
r
=
peer
.
getBounds
();
Image
im
=
null
;
if
(!
r
.
isEmpty
())
{
int
transparency
=
(
isOpaque
()
?
Transparency
.
OPAQUE
:
Transparency
.
TRANSLUCENT
);
im
=
peer
.
getGraphicsConfiguration
().
createCompatibleImage
(
r
.
width
,
r
.
height
,
transparency
);
}
return
im
;
}
public
SurfaceData
replaceSurfaceData
()
{
if
(!
LWCToolkit
.
getSunAwtDisableCALayers
())
{
surfaceData
=
windowLayer
.
replaceSurfaceData
();
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
5eb82201
...
...
@@ -25,7 +25,6 @@
package
sun.lwawt.macosx
;
import
java.awt.BufferCapabilities.FlipContents
;
import
java.awt.*
;
import
java.awt.Dialog.ModalityType
;
import
java.awt.event.*
;
...
...
@@ -258,7 +257,7 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
validateSurface
();
}
pr
otected
int
getInitialStyleBits
()
{
pr
ivate
int
getInitialStyleBits
()
{
// defaults style bits
int
styleBits
=
DECORATED
|
HAS_SHADOW
|
CLOSEABLE
|
MINIMIZABLE
|
ZOOMABLE
|
RESIZABLE
;
...
...
@@ -285,7 +284,6 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
final
boolean
resizable
=
isFrame
?
((
Frame
)
target
).
isResizable
()
:
(
isDialog
?
((
Dialog
)
target
).
isResizable
()
:
false
);
styleBits
=
SET
(
styleBits
,
RESIZABLE
,
resizable
);
if
(!
resizable
)
{
styleBits
=
SET
(
styleBits
,
RESIZABLE
,
false
);
styleBits
=
SET
(
styleBits
,
ZOOMABLE
,
false
);
}
}
...
...
@@ -380,7 +378,7 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
}
// this is the counter-point to -[CWindow _nativeSetStyleBit:]
pr
otected
void
setStyleBits
(
final
int
mask
,
final
boolean
value
)
{
pr
ivate
void
setStyleBits
(
final
int
mask
,
final
boolean
value
)
{
nativeSetNSWindowStyleBits
(
getNSWindowPtr
(),
mask
,
value
?
mask
:
0
);
}
...
...
@@ -401,11 +399,6 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
}
}
@Override
// PlatformWindow
public
Image
createBackBuffer
()
{
return
contentView
.
createBackBuffer
();
}
@Override
// PlatformWindow
public
void
dispose
()
{
if
(
owner
!=
null
)
{
...
...
@@ -416,12 +409,6 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
CPlatformWindow
.
super
.
dispose
();
}
@Override
// PlatformWindow
public
void
flip
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
FlipContents
flipAction
)
{
// TODO: not implemented
(
new
RuntimeException
(
"unimplemented"
)).
printStackTrace
();
}
@Override
// PlatformWindow
public
FontMetrics
getFontMetrics
(
Font
f
)
{
// TODO: not implemented
...
...
@@ -668,15 +655,8 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
}
@Override
public
void
setResizable
(
boolean
resizable
)
{
public
void
setResizable
(
final
boolean
resizable
)
{
setStyleBits
(
RESIZABLE
,
resizable
);
// Re-apply the size constraints and the size to ensure the space
// occupied by the grow box is counted properly
peer
.
updateMinimumSize
();
Rectangle
bounds
=
peer
.
getBounds
();
setBounds
(
bounds
.
x
,
bounds
.
y
,
bounds
.
width
,
bounds
.
height
);
}
@Override
...
...
@@ -889,7 +869,8 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
responder
.
handleWindowFocusEvent
(
gained
,
oppositePeer
);
}
private
void
deliverMoveResizeEvent
(
int
x
,
int
y
,
int
width
,
int
height
)
{
private
void
deliverMoveResizeEvent
(
int
x
,
int
y
,
int
width
,
int
height
,
boolean
byUser
)
{
// when the content view enters the full-screen mode, the native
// move/resize notifications contain a bounds smaller than
// the whole screen and therefore we ignore the native notifications
...
...
@@ -901,7 +882,7 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
final
Rectangle
oldB
=
nativeBounds
;
nativeBounds
=
new
Rectangle
(
x
,
y
,
width
,
height
);
peer
.
notifyReshape
(
x
,
y
,
width
,
height
);
if
(
!
oldB
.
getSize
().
equals
(
nativeBounds
.
getSize
())
)
{
if
(
byUser
&&
!
oldB
.
getSize
().
equals
(
nativeBounds
.
getSize
())
)
{
flushBuffers
();
}
//TODO validateSurface already called from notifyReshape
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
5eb82201
...
...
@@ -160,6 +160,10 @@ AWT_NS_WINDOW_IMPLEMENTATION
BOOL
resizable
=
IS
(
bits
,
RESIZABLE
);
[
self
updateMinMaxSize
:
resizable
];
[
self
.
nsWindow
setShowsResizeIndicator
:
resizable
];
// Zoom button should be disabled, if the window is not resizable,
// otherwise button should be restored to initial state.
BOOL
zoom
=
resizable
&&
IS
(
bits
,
ZOOMABLE
);
[[
self
.
nsWindow
standardWindowButton
:
NSWindowZoomButton
]
setEnabled
:
zoom
];
}
if
(
IS
(
mask
,
HAS_SHADOW
))
{
...
...
@@ -445,12 +449,13 @@ AWT_ASSERT_APPKIT_THREAD;
NSRect
frame
=
ConvertNSScreenRect
(
env
,
[
self
.
nsWindow
frame
]);
static
JNF_MEMBER_CACHE
(
jm_deliverMoveResizeEvent
,
jc_CPlatformWindow
,
"deliverMoveResizeEvent"
,
"(IIII)V"
);
static
JNF_MEMBER_CACHE
(
jm_deliverMoveResizeEvent
,
jc_CPlatformWindow
,
"deliverMoveResizeEvent"
,
"(IIII
Z
)V"
);
JNFCallVoidMethod
(
env
,
platformWindow
,
jm_deliverMoveResizeEvent
,
(
jint
)
frame
.
origin
.
x
,
(
jint
)
frame
.
origin
.
y
,
(
jint
)
frame
.
size
.
width
,
(
jint
)
frame
.
size
.
height
);
(
jint
)
frame
.
size
.
height
,
(
jboolean
)[
self
.
nsWindow
inLiveResize
]);
(
*
env
)
->
DeleteLocalRef
(
env
,
platformWindow
);
}
...
...
@@ -784,7 +789,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD;
// calls methods on NSWindow to change other properties, based on the mask
if
(
mask
&
MASK
(
_METHOD_PROP_BITMASK
))
{
[
window
setPropertiesForStyleBits
:
b
its
mask
:
mask
];
[
window
setPropertiesForStyleBits
:
newB
its
mask
:
mask
];
}
window
.
styleBits
=
newBits
;
...
...
src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
浏览文件 @
5eb82201
...
...
@@ -30,14 +30,10 @@ import java.awt.Rectangle;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.WritableRaster
;
import
java.io.BufferedInputStream
;
import
java.io.DataInputStream
;
import
java.io.EOFException
;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.nio.ByteOrder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Iterator
;
import
java.util.List
;
import
javax.imageio.IIOException
;
...
...
@@ -48,6 +44,11 @@ import javax.imageio.metadata.IIOMetadata;
import
javax.imageio.spi.ImageReaderSpi
;
import
javax.imageio.stream.ImageInputStream
;
import
com.sun.imageio.plugins.common.ReaderUtil
;
import
java.awt.image.ColorModel
;
import
java.awt.image.IndexColorModel
;
import
java.awt.image.MultiPixelPackedSampleModel
;
import
java.awt.image.PixelInterleavedSampleModel
;
import
java.awt.image.SampleModel
;
public
class
GIFImageReader
extends
ImageReader
{
...
...
@@ -194,6 +195,36 @@ public class GIFImageReader extends ImageReader {
return
imageMetadata
.
imageHeight
;
}
// We don't check all parameters as ImageTypeSpecifier.createIndexed do
// since this method is private and we pass consistent data here
private
ImageTypeSpecifier
createIndexed
(
byte
[]
r
,
byte
[]
g
,
byte
[]
b
,
int
bits
)
{
ColorModel
colorModel
;
if
(
imageMetadata
.
transparentColorFlag
)
{
// Some files erroneously have a transparent color index
// of 255 even though there are fewer than 256 colors.
int
idx
=
Math
.
min
(
imageMetadata
.
transparentColorIndex
,
r
.
length
-
1
);
colorModel
=
new
IndexColorModel
(
bits
,
r
.
length
,
r
,
g
,
b
,
idx
);
}
else
{
colorModel
=
new
IndexColorModel
(
bits
,
r
.
length
,
r
,
g
,
b
);
}
SampleModel
sampleModel
;
if
(
bits
==
8
)
{
int
[]
bandOffsets
=
{
0
};
sampleModel
=
new
PixelInterleavedSampleModel
(
DataBuffer
.
TYPE_BYTE
,
1
,
1
,
1
,
1
,
bandOffsets
);
}
else
{
sampleModel
=
new
MultiPixelPackedSampleModel
(
DataBuffer
.
TYPE_BYTE
,
1
,
1
,
bits
);
}
return
new
ImageTypeSpecifier
(
colorModel
,
sampleModel
);
}
public
Iterator
getImageTypes
(
int
imageIndex
)
throws
IIOException
{
checkIndex
(
imageIndex
);
...
...
@@ -239,22 +270,7 @@ public class GIFImageReader extends ImageReader {
b
[
i
]
=
colorTable
[
rgbIndex
++];
}
byte
[]
a
=
null
;
if
(
imageMetadata
.
transparentColorFlag
)
{
a
=
new
byte
[
lutLength
];
Arrays
.
fill
(
a
,
(
byte
)
255
);
// Some files erroneously have a transparent color index
// of 255 even though there are fewer than 256 colors.
int
idx
=
Math
.
min
(
imageMetadata
.
transparentColorIndex
,
lutLength
-
1
);
a
[
idx
]
=
(
byte
)
0
;
}
int
[]
bitsPerSample
=
new
int
[
1
];
bitsPerSample
[
0
]
=
bits
;
l
.
add
(
ImageTypeSpecifier
.
createIndexed
(
r
,
g
,
b
,
a
,
bits
,
DataBuffer
.
TYPE_BYTE
));
l
.
add
(
createIndexed
(
r
,
g
,
b
,
bits
));
return
l
.
iterator
();
}
...
...
src/share/classes/java/awt/color/ICC_Profile.java
浏览文件 @
5eb82201
...
...
@@ -1435,7 +1435,15 @@ public class ICC_Profile implements Serializable {
int
renderingIntent
=
intFromBigEndian
(
theHeader
,
icHdrRenderingIntent
);
/* set the rendering intent */
return
renderingIntent
;
/* According to ICC spec, only the least-significant 16 bits shall be
* used to encode the rendering intent. The most significant 16 bits
* shall be set to zero. Thus, we are ignoring two most significant
* bytes here.
*
* See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15.
*/
return
(
0xffff
&
renderingIntent
);
}
...
...
src/share/classes/java/awt/image/ColorConvertOp.java
浏览文件 @
5eb82201
...
...
@@ -732,10 +732,16 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp {
private
int
getRenderingIntent
(
ICC_Profile
profile
)
{
byte
[]
header
=
profile
.
getData
(
ICC_Profile
.
icSigHead
);
int
index
=
ICC_Profile
.
icHdrRenderingIntent
;
return
(((
header
[
index
]
&
0xff
)
<<
24
)
|
((
header
[
index
+
1
]
&
0xff
)
<<
16
)
|
((
header
[
index
+
2
]
&
0xff
)
<<
8
)
|
(
header
[
index
+
3
]
&
0xff
));
/* According to ICC spec, only the least-significant 16 bits shall be
* used to encode the rendering intent. The most significant 16 bits
* shall be set to zero. Thus, we are ignoring two most significant
* bytes here.
*
* See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15.
*/
return
((
header
[
index
+
2
]
&
0xff
)
<<
8
)
|
(
header
[
index
+
3
]
&
0xff
);
}
/**
...
...
src/share/classes/java/lang/invoke/BoundMethodHandle.java
浏览文件 @
5eb82201
...
...
@@ -25,7 +25,7 @@
package
java.lang.invoke
;
import
static
com
.
sun
.
xml
.
internal
.
ws
.
org
.
objectweb
.
asm
.
Opcodes
.*;
import
static
jdk
.
internal
.
org
.
objectweb
.
asm
.
Opcodes
.*;
import
static
java
.
lang
.
invoke
.
LambdaForm
.
basicTypes
;
import
static
java
.
lang
.
invoke
.
MethodHandleNatives
.
Constants
.
REF_invokeStatic
;
import
static
java
.
lang
.
invoke
.
MethodHandleStatics
.*;
...
...
@@ -40,9 +40,9 @@ import java.util.HashMap;
import
sun.invoke.util.ValueConversions
;
import
sun.invoke.util.Wrapper
;
import
com.sun.xml.internal.ws
.org.objectweb.asm.ClassWriter
;
import
com.sun.xml.internal.ws
.org.objectweb.asm.MethodVisitor
;
import
com.sun.xml.internal.ws
.org.objectweb.asm.Type
;
import
jdk.internal
.org.objectweb.asm.ClassWriter
;
import
jdk.internal
.org.objectweb.asm.MethodVisitor
;
import
jdk.internal
.org.objectweb.asm.Type
;
/**
* The flavor of method handle which emulates an invoke instruction
...
...
src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
浏览文件 @
5eb82201
...
...
@@ -34,7 +34,7 @@ import sun.invoke.util.Wrapper;
import
java.io.*
;
import
java.util.*
;
import
com.sun.xml.internal.ws
.org.objectweb.asm.*
;
import
jdk.internal
.org.objectweb.asm.*
;
import
java.lang.reflect.*
;
import
static
java
.
lang
.
invoke
.
MethodHandleStatics
.*;
...
...
src/share/classes/javax/imageio/metadata/doc-files/gif_metadata.html
浏览文件 @
5eb82201
...
...
@@ -90,7 +90,7 @@ images that do not have their own local color table.
<
!-- Max value: 8 (inclusive) --
>
<
!ATTLIST "LogicalScreenDescriptor" "pixelAspectRatio" #CDATA
#REQUIRED
>
<
!-- If 0, indicates square pixels, else W/H = (value + 1
6
)/64 --
>
<
!-- If 0, indicates square pixels, else W/H = (value + 1
5
)/64 --
>
<
!-- Data type: Integer --
>
<
!-- Min value: 0 (inclusive) --
>
<
!-- Max value: 255 (inclusive) --
>
...
...
src/share/classes/javax/swing/JColorChooser.java
浏览文件 @
5eb82201
...
...
@@ -182,6 +182,7 @@ public class JColorChooser extends JComponent implements Accessible {
dialog
=
new
ColorChooserDialog
((
Dialog
)
window
,
title
,
modal
,
c
,
chooserPane
,
okListener
,
cancelListener
);
}
dialog
.
getAccessibleContext
().
setAccessibleDescription
(
title
);
return
dialog
;
}
...
...
@@ -647,6 +648,7 @@ class ColorChooserDialog extends JDialog {
buttonPane
.
setLayout
(
new
FlowLayout
(
FlowLayout
.
CENTER
));
JButton
okButton
=
new
JButton
(
okString
);
getRootPane
().
setDefaultButton
(
okButton
);
okButton
.
getAccessibleContext
().
setAccessibleDescription
(
okString
);
okButton
.
setActionCommand
(
"OK"
);
okButton
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
...
...
@@ -659,6 +661,7 @@ class ColorChooserDialog extends JDialog {
buttonPane
.
add
(
okButton
);
cancelButton
=
new
JButton
(
cancelString
);
cancelButton
.
getAccessibleContext
().
setAccessibleDescription
(
cancelString
);
// The following few lines are used to register esc to close the dialog
Action
cancelKeyAction
=
new
AbstractAction
()
{
...
...
@@ -688,6 +691,7 @@ class ColorChooserDialog extends JDialog {
buttonPane
.
add
(
cancelButton
);
JButton
resetButton
=
new
JButton
(
resetString
);
resetButton
.
getAccessibleContext
().
setAccessibleDescription
(
resetString
);
resetButton
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
reset
();
...
...
src/share/classes/javax/swing/colorchooser/ColorChooserPanel.java
浏览文件 @
5eb82201
...
...
@@ -135,6 +135,7 @@ final class ColorChooserPanel extends AbstractColorChooserPanel implements Prope
String
label
=
this
.
model
.
getText
(
this
,
"HexCode"
);
// NON-NLS: suffix
boolean
visible
=
label
!=
null
;
this
.
text
.
setVisible
(
visible
);
this
.
text
.
getAccessibleContext
().
setAccessibleDescription
(
label
);
this
.
label
.
setVisible
(
visible
);
if
(
visible
)
{
this
.
label
.
setText
(
label
);
...
...
src/share/classes/javax/swing/colorchooser/ColorPanel.java
浏览文件 @
5eb82201
...
...
@@ -37,6 +37,7 @@ import javax.swing.JLabel;
import
javax.swing.JPanel
;
import
javax.swing.JRadioButton
;
import
javax.swing.border.EmptyBorder
;
import
javax.swing.JSpinner.DefaultEditor
;
final
class
ColorPanel
extends
JPanel
implements
ActionListener
{
...
...
@@ -119,17 +120,26 @@ final class ColorPanel extends JPanel implements ActionListener {
int
count
=
this
.
model
.
getCount
();
this
.
spinners
[
4
].
setVisible
(
count
>
4
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
String
text
=
this
.
model
.
getLabel
(
this
,
i
);
Object
object
=
this
.
spinners
[
i
].
getLabel
();
if
(
object
instanceof
JRadioButton
)
{
JRadioButton
button
=
(
JRadioButton
)
object
;
button
.
setText
(
this
.
model
.
getLabel
(
this
,
i
));
button
.
setText
(
text
);
button
.
getAccessibleContext
().
setAccessibleDescription
(
text
);
}
else
if
(
object
instanceof
JLabel
)
{
JLabel
label
=
(
JLabel
)
object
;
label
.
setText
(
t
his
.
model
.
getLabel
(
this
,
i
)
);
label
.
setText
(
t
ext
);
}
this
.
spinners
[
i
].
setRange
(
this
.
model
.
getMinimum
(
i
),
this
.
model
.
getMaximum
(
i
));
this
.
spinners
[
i
].
setValue
(
this
.
values
[
i
]);
this
.
spinners
[
i
].
getSlider
().
getAccessibleContext
().
setAccessibleName
(
text
);
this
.
spinners
[
i
].
getSpinner
().
getAccessibleContext
().
setAccessibleName
(
text
);
DefaultEditor
editor
=
(
DefaultEditor
)
this
.
spinners
[
i
].
getSpinner
().
getEditor
();
editor
.
getTextField
().
getAccessibleContext
().
setAccessibleName
(
text
);
this
.
spinners
[
i
].
getSlider
().
getAccessibleContext
().
setAccessibleDescription
(
text
);
this
.
spinners
[
i
].
getSpinner
().
getAccessibleContext
().
setAccessibleDescription
(
text
);
editor
.
getTextField
().
getAccessibleContext
().
setAccessibleDescription
(
text
);
}
}
...
...
src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java
浏览文件 @
5eb82201
...
...
@@ -94,6 +94,7 @@ public class BasicColorChooserUI extends ColorChooserUI
tabbedPane
=
new
JTabbedPane
();
tabbedPane
.
setName
(
"ColorChooser.tabPane"
);
tabbedPane
.
setInheritsPopupMenu
(
true
);
tabbedPane
.
getAccessibleContext
().
setAccessibleDescription
(
tabbedPane
.
getName
());
singlePanel
=
new
JPanel
(
new
CenterLayout
());
singlePanel
.
setName
(
"ColorChooser.panel"
);
singlePanel
.
setInheritsPopupMenu
(
true
);
...
...
src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
浏览文件 @
5eb82201
...
...
@@ -1941,6 +1941,9 @@ public class BasicTreeUI extends TreeUI
for
(
int
counter
=
beginRow
+
1
;
counter
<=
endRow
;
counter
++)
{
testRect
=
getPathBounds
(
tree
,
getPathForRow
(
tree
,
counter
));
if
(
testRect
==
null
)
{
return
;
}
if
((
testRect
.
y
+
testRect
.
height
)
>
maxY
)
counter
=
endRow
;
}
...
...
@@ -2069,7 +2072,7 @@ public class BasicTreeUI extends TreeUI
treeState
.
invalidatePathBounds
(
oldPath
);
updateSize
();
}
else
{
else
if
(
editingBounds
!=
null
)
{
editingBounds
.
x
=
0
;
editingBounds
.
width
=
tree
.
getSize
().
width
;
tree
.
repaint
(
editingBounds
);
...
...
@@ -2114,6 +2117,9 @@ public class BasicTreeUI extends TreeUI
tree
.
isPathSelected
(
path
),
tree
.
isExpanded
(
path
),
treeModel
.
isLeaf
(
path
.
getLastPathComponent
()),
row
);
Rectangle
nodeBounds
=
getPathBounds
(
tree
,
path
);
if
(
nodeBounds
==
null
)
{
return
false
;
}
editingRow
=
row
;
...
...
@@ -2134,6 +2140,9 @@ public class BasicTreeUI extends TreeUI
// To make sure x/y are updated correctly, fetch
// the bounds again.
nodeBounds
=
getPathBounds
(
tree
,
path
);
if
(
nodeBounds
==
null
)
{
return
false
;
}
}
else
editorHasDifferentSize
=
false
;
...
...
@@ -3570,7 +3579,7 @@ public class BasicTreeUI extends TreeUI
if
(
pressedPath
!=
null
)
{
Rectangle
bounds
=
getPathBounds
(
tree
,
pressedPath
);
if
(
e
.
getY
()
>=
(
bounds
.
y
+
bounds
.
height
))
{
if
(
bounds
==
null
||
e
.
getY
()
>=
(
bounds
.
y
+
bounds
.
height
))
{
return
;
}
...
...
@@ -3832,6 +3841,10 @@ public class BasicTreeUI extends TreeUI
// And repaint
Rectangle
newMinBounds
=
getPathBounds
(
tree
,
minPath
);
if
(
minBounds
==
null
||
newMinBounds
==
null
)
{
return
;
}
if
(
indices
.
length
==
1
&&
newMinBounds
.
height
==
minBounds
.
height
)
{
tree
.
repaint
(
0
,
minBounds
.
y
,
tree
.
getWidth
(),
...
...
@@ -4466,27 +4479,28 @@ public class BasicTreeUI extends TreeUI
}
}
Rectangle
newRect
=
ui
.
getPathBounds
(
tree
,
newPath
);
if
(
newRect
!=
null
)
{
newRect
.
x
=
visRect
.
x
;
newRect
.
width
=
visRect
.
width
;
if
(
direction
==
-
1
)
{
newRect
.
height
=
visRect
.
height
;
}
else
{
newRect
.
y
-=
(
visRect
.
height
-
newRect
.
height
);
newRect
.
height
=
visRect
.
height
;
}
newRect
.
x
=
visRect
.
x
;
newRect
.
width
=
visRect
.
width
;
if
(
direction
==
-
1
)
{
newRect
.
height
=
visRect
.
height
;
}
else
{
newRect
.
y
-=
(
visRect
.
height
-
newRect
.
height
);
newRect
.
height
=
visRect
.
height
;
}
if
(
addToSelection
)
{
ui
.
extendSelection
(
newPath
);
}
else
if
(
changeSelection
)
{
tree
.
setSelectionPath
(
newPath
);
}
else
{
ui
.
setLeadSelectionPath
(
newPath
,
true
);
if
(
addToSelection
)
{
ui
.
extendSelection
(
newPath
);
}
else
if
(
changeSelection
)
{
tree
.
setSelectionPath
(
newPath
);
}
else
{
ui
.
setLeadSelectionPath
(
newPath
,
true
);
}
tree
.
scrollRectToVisible
(
newRect
);
}
tree
.
scrollRectToVisible
(
newRect
);
}
}
...
...
src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
浏览文件 @
5eb82201
...
...
@@ -25,6 +25,7 @@
package
sun.java2d.opengl
;
import
java.awt.AlphaComposite
;
import
java.awt.Composite
;
import
java.awt.Transparency
;
import
java.awt.geom.AffineTransform
;
...
...
@@ -99,6 +100,8 @@ class OGLBlitLoops {
CompositeType
.
AnyAlpha
,
blitIntArgbPreToSurface
),
new
OGLAnyCompositeBlit
(
OGLSurfaceData
.
OpenGLSurface
),
new
OGLSwToSurfaceScale
(
SurfaceType
.
IntRgb
,
OGLSurfaceData
.
PF_INT_RGB
),
new
OGLSwToSurfaceScale
(
SurfaceType
.
IntRgbx
,
...
...
@@ -175,6 +178,9 @@ class OGLBlitLoops {
new
OGLGeneralBlit
(
OGLSurfaceData
.
OpenGLTexture
,
CompositeType
.
SrcNoEa
,
blitIntArgbPreToTexture
),
new
OGLAnyCompositeBlit
(
OGLSurfaceData
.
OpenGLTexture
),
};
GraphicsPrimitiveMgr
.
register
(
primitives
);
}
...
...
@@ -763,3 +769,49 @@ class OGLGeneralBlit extends Blit {
}
}
}
class
OGLAnyCompositeBlit
extends
Blit
{
private
WeakReference
<
SurfaceData
>
dstTmp
;
public
OGLAnyCompositeBlit
(
SurfaceType
dstType
)
{
super
(
SurfaceType
.
Any
,
CompositeType
.
Any
,
dstType
);
}
public
synchronized
void
Blit
(
SurfaceData
src
,
SurfaceData
dst
,
Composite
comp
,
Region
clip
,
int
sx
,
int
sy
,
int
dx
,
int
dy
,
int
w
,
int
h
)
{
Blit
convertdst
=
Blit
.
getFromCache
(
dst
.
getSurfaceType
(),
CompositeType
.
SrcNoEa
,
SurfaceType
.
IntArgbPre
);
SurfaceData
cachedDst
=
null
;
if
(
dstTmp
!=
null
)
{
// use cached intermediate surface, if available
cachedDst
=
dstTmp
.
get
();
}
// convert source to IntArgbPre
SurfaceData
dstBuffer
=
convertFrom
(
convertdst
,
dst
,
dx
,
dy
,
w
,
h
,
cachedDst
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
Blit
performop
=
Blit
.
getFromCache
(
src
.
getSurfaceType
(),
CompositeType
.
Any
,
dstBuffer
.
getSurfaceType
());
performop
.
Blit
(
src
,
dstBuffer
,
comp
,
clip
,
sx
,
sy
,
0
,
0
,
w
,
h
);
if
(
dstBuffer
!=
cachedDst
)
{
// cache the intermediate surface
dstTmp
=
new
WeakReference
(
dstBuffer
);
}
// now blit the buffer back to the destination
convertdst
=
Blit
.
getFromCache
(
dstBuffer
.
getSurfaceType
(),
CompositeType
.
SrcNoEa
,
dst
.
getSurfaceType
());
convertdst
.
Blit
(
dstBuffer
,
dst
,
AlphaComposite
.
Src
,
clip
,
0
,
0
,
dx
,
dy
,
w
,
h
);
}
}
src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java
浏览文件 @
5eb82201
...
...
@@ -76,6 +76,7 @@ public class OGLSurfaceDataProxy extends SurfaceDataProxy {
CompositeType
comp
,
Color
bgColor
)
{
return
(
bgColor
==
null
||
transparency
==
Transparency
.
OPAQUE
);
return
comp
.
isDerivedFrom
(
CompositeType
.
AnyAlpha
)
&&
(
bgColor
==
null
||
transparency
==
Transparency
.
OPAQUE
);
}
}
src/share/classes/sun/print/PathGraphics.java
浏览文件 @
5eb82201
...
...
@@ -1025,7 +1025,8 @@ public abstract class PathGraphics extends ProxyGraphics2D {
continue
;
}
glyph
=
font2D
.
charToGlyph
(
c
);
if
(
glyph
!=
missingGlyph
&&
glyph
<
numGlyphs
&&
if
(
glyph
!=
missingGlyph
&&
glyph
>=
0
&&
glyph
<
numGlyphs
&&
(
glyphToCharMap
[
glyph
]
==
CharToGlyphMapper
.
INVISIBLE_GLYPH_ID
))
{
glyphToCharMap
[
glyph
]
=
c
;
...
...
src/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java
浏览文件 @
5eb82201
...
...
@@ -256,6 +256,7 @@ public abstract class SynthFileChooserUI extends BasicFileChooserUI implements
if
(
getFileChooser
().
getControlButtonsAreShown
())
{
approveButton
.
setText
(
getApproveButtonText
(
getFileChooser
()));
approveButton
.
setToolTipText
(
getApproveButtonToolTipText
(
getFileChooser
()));
approveButton
.
setMnemonic
(
getApproveButtonMnemonic
(
getFileChooser
()));
}
}
...
...
src/solaris/classes/sun/awt/X11/XToolkit.java
浏览文件 @
5eb82201
...
...
@@ -1332,6 +1332,15 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
return
new
XInputMethodDescriptor
();
}
/**
* Returns whether enableInputMethods should be set to true for peered
* TextComponent instances on this platform. True by default.
*/
@Override
public
boolean
enableInputMethodsForTextComponent
()
{
return
true
;
}
static
int
getMultiClickTime
()
{
if
(
awt_multiclick_time
==
0
)
{
initializeMultiClickTime
();
...
...
src/solaris/native/sun/xawt/XlibWrapper.c
浏览文件 @
5eb82201
...
...
@@ -1260,13 +1260,15 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
JavaVM
*
jvm
=
NULL
;
static
int
ToolkitErrorHandler
(
Display
*
dpy
,
XErrorEvent
*
event
)
{
JNIEnv
*
env
;
if
(
jvm
!=
NULL
)
{
JNIEnv
*
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
return
JNU_CallStaticMethodByName
(
env
,
NULL
,
"sun/awt/X11/XToolkit"
,
"globalErrorHandler"
,
"(JJ)I"
,
ptr_to_jlong
(
dpy
),
ptr_to_jlong
(
event
)).
i
;
}
else
{
return
0
;
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
if
(
env
)
{
return
JNU_CallStaticMethodByName
(
env
,
NULL
,
"sun/awt/X11/XToolkit"
,
"globalErrorHandler"
,
"(JJ)I"
,
ptr_to_jlong
(
dpy
),
ptr_to_jlong
(
event
)).
i
;
}
}
return
0
;
}
/*
...
...
src/share/classes/sun/awt/TextureSizeConstraining
.java
→
test/java/awt/Frame/FrameSetSizeStressTest/FrameSetSizeStressTest
.java
浏览文件 @
5eb82201
...
...
@@ -23,23 +23,26 @@
* questions.
*/
package
sun.awt
;
import
java.awt.Frame
;
/**
* A GraphicsConfiguration implements the TextureSizeConstraining
* interface to indicate that it imposes certain limitations on the
* maximum size of supported textures.
*/
public
interface
TextureSizeConstraining
{
/**
* Returns the maximum width of any texture image.
*/
public
int
getMaxTextureWidth
();
/**
* Returns the maximum height of any texture image.
*/
public
int
getMaxTextureHeight
();
/*
@test
@bug 7177173
@summary setBounds can cause StackOverflow in case of the considerable loading
@author Sergey Bylokhov
*/
public
final
class
FrameSetSizeStressTest
{
public
static
void
main
(
final
String
[]
args
)
{
final
Frame
frame
=
new
Frame
();
frame
.
setSize
(
200
,
200
);
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
for
(
int
i
=
0
;
i
<
1000
;
++
i
)
{
frame
.
setSize
(
100
,
100
);
frame
.
setSize
(
200
,
200
);
frame
.
setSize
(
300
,
300
);
}
frame
.
dispose
();
}
}
test/javax/swing/JTree/8003830/bug8003830.java
0 → 100644
浏览文件 @
5eb82201
/*
* Copyright (c) 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.
*
* 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.
*/
import
java.awt.EventQueue
;
import
java.awt.Rectangle
;
import
java.awt.event.ActionEvent
;
import
javax.swing.JTree
;
import
javax.swing.plaf.basic.BasicTreeUI
;
import
javax.swing.tree.TreePath
;
/* Originally reported as NetBeans bug 222081.
*
* @test
* @bug 8003830
* @summary NullPointerException in BasicTreeUI.Actions when getPathBounds returns null
* @author Jaroslav Tulach
* @run main bug8003830
*/
public
class
bug8003830
implements
Runnable
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
EventQueue
.
invokeAndWait
(
new
bug8003830
());
}
@Override
public
void
run
()
{
testNPEAtActionsPage
();
}
public
void
testNPEAtActionsPage
()
{
JTree
tree
=
new
JTree
();
BasicTreeUI
ui
=
new
NullReturningTreeUI
();
tree
.
setUI
(
ui
);
BasicTreeUI
.
TreePageAction
tpa
=
ui
.
new
TreePageAction
(
0
,
"down"
);
tpa
.
actionPerformed
(
new
ActionEvent
(
tree
,
0
,
""
));
}
private
static
final
class
NullReturningTreeUI
extends
BasicTreeUI
{
@Override
public
Rectangle
getPathBounds
(
JTree
tree
,
TreePath
path
)
{
// the method can return null and callers have to be ready for
// that. Simulate the case by returning null for unknown reason.
return
null
;
}
}
}
test/javax/swing/dnd/7171812/JListWithScroll.java
0 → 100644
浏览文件 @
5eb82201
/*
* Copyright (c) 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.
*
* 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.
*/
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.dnd.Autoscroll
;
public
class
JListWithScroll
<
E
>
extends
JList
<
E
>
implements
Autoscroll
{
private
Insets
scrollInsets
;
public
JListWithScroll
(
E
[]
listData
)
{
super
(
listData
);
scrollInsets
=
new
Insets
(
50
,
50
,
50
,
50
);
}
@Override
public
Insets
getAutoscrollInsets
()
{
return
scrollInsets
;
}
@Override
public
void
autoscroll
(
Point
cursorLoc
)
{
JViewport
viewport
=
getViewport
();
if
(
viewport
==
null
)
{
return
;
}
Point
viewPos
=
viewport
.
getViewPosition
();
int
viewHeight
=
viewport
.
getExtentSize
().
height
;
int
viewWidth
=
viewport
.
getExtentSize
().
width
;
if
((
cursorLoc
.
y
-
viewPos
.
y
)
<
scrollInsets
.
top
)
{
viewport
.
setViewPosition
(
new
Point
(
viewPos
.
x
,
Math
.
max
(
viewPos
.
y
-
scrollInsets
.
top
,
0
)));
}
else
if
(((
viewPos
.
y
+
viewHeight
)
-
cursorLoc
.
y
)
<
scrollInsets
.
bottom
)
{
viewport
.
setViewPosition
(
new
Point
(
viewPos
.
x
,
Math
.
min
(
viewPos
.
y
+
scrollInsets
.
bottom
,
this
.
getHeight
()
-
viewHeight
))
);
}
else
if
((
cursorLoc
.
x
-
viewPos
.
x
)
<
scrollInsets
.
left
)
{
viewport
.
setViewPosition
(
new
Point
(
Math
.
max
(
viewPos
.
x
-
scrollInsets
.
left
,
0
),
viewPos
.
y
));
}
else
if
(((
viewPos
.
x
+
viewWidth
)
-
cursorLoc
.
x
)
<
scrollInsets
.
right
)
{
viewport
.
setViewPosition
(
new
Point
(
Math
.
min
(
viewPos
.
x
+
scrollInsets
.
right
,
this
.
getWidth
()
-
viewWidth
),
viewPos
.
y
)
);
}
}
public
JViewport
getViewport
()
{
Component
curComp
=
this
;
while
(!(
curComp
instanceof
JViewport
)
&&
(
curComp
!=
null
))
{
curComp
=
curComp
.
getParent
();
}
if
(
curComp
instanceof
JViewport
)
{
return
(
JViewport
)
curComp
;
}
else
{
return
null
;
}
}
}
test/javax/swing/dnd/7171812/bug7171812.java
0 → 100644
浏览文件 @
5eb82201
/*
* Copyright (c) 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.
*
* 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.
*/
/* @test
@bug 7171812
@summary [macosx] Views keep scrolling back to the drag position after DnD
@author Alexander Zuev
@run main bug7171812
*/
import
sun.awt.SunToolkit
;
import
java.awt.*
;
import
java.awt.dnd.*
;
import
java.awt.event.InputEvent
;
import
javax.swing.*
;
public
class
bug7171812
{
static
JFrame
mainFrame
;
static
String
listData
[];
static
JListWithScroll
<
String
>
list
;
static
JScrollPane
scrollPane
;
/**
* @param args the command line arguments
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
setupGUI
();
}
});
toolkit
.
realSync
();
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
10
);
robot
.
mouseMove
(
scrollPane
.
getLocationOnScreen
().
x
+
5
,
scrollPane
.
getLocationOnScreen
().
y
+
5
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
for
(
int
offset
=
5
;
offset
<
scrollPane
.
getHeight
()-
20
;
offset
++)
{
robot
.
mouseMove
(
scrollPane
.
getLocationOnScreen
().
x
+
5
,
scrollPane
.
getLocationOnScreen
().
y
+
offset
);
}
for
(
int
offset
=
5
;
offset
<
195
;
offset
++)
{
robot
.
mouseMove
(
scrollPane
.
getLocationOnScreen
().
x
+
offset
,
scrollPane
.
getLocationOnScreen
().
y
+
scrollPane
.
getHeight
()-
20
);
}
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
try
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
scrollPane
.
getViewport
().
getViewPosition
().
getY
()
<
30
)
{
throw
new
RuntimeException
(
"Incorrect view position."
);
};
}
});
}
catch
(
java
.
lang
.
reflect
.
InvocationTargetException
ite
)
{
throw
new
RuntimeException
(
"Test failed, scroll on drag doesn't work!"
);
}
}
public
static
void
setupGUI
()
{
listData
=
new
String
[
100
];
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
listData
[
i
]
=
"Long Line With Item "
+
i
;
}
mainFrame
=
new
JFrame
(
"Rest frame"
);
mainFrame
.
setSize
(
300
,
500
);
mainFrame
.
setLayout
(
new
BorderLayout
());
list
=
new
JListWithScroll
(
listData
);
list
.
setDragEnabled
(
true
);
list
.
setAutoscrolls
(
true
);
final
DropTarget
dropTarget
=
new
DropTarget
(
list
,
DnDConstants
.
ACTION_MOVE
,
new
DropTargetListener
()
{
@Override
public
void
dragEnter
(
DropTargetDragEvent
dtde
)
{
dragOver
(
dtde
);
}
@Override
public
void
dragOver
(
DropTargetDragEvent
dtde
)
{
dtde
.
acceptDrag
(
DnDConstants
.
ACTION_MOVE
);
}
@Override
public
void
dropActionChanged
(
DropTargetDragEvent
dtde
)
{
}
@Override
public
void
dragExit
(
DropTargetEvent
dte
)
{
}
@Override
public
void
drop
(
DropTargetDropEvent
dtde
)
{
}
},
true
);
scrollPane
=
new
JScrollPane
(
list
);
mainFrame
.
add
(
scrollPane
,
BorderLayout
.
CENTER
);
mainFrame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
mainFrame
.
setLocation
(
100
,
100
);
mainFrame
.
setVisible
(
true
);
}
}
test/javax/swing/text/CSSBorder/6796710/bug6796710.java
浏览文件 @
5eb82201
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 6796710
* @bug 6796710
7124242
* @summary Html content in JEditorPane is overlapping on swing components while resizing the application.
* @library ../../../regtesthelpers
* @build Util
...
...
@@ -31,11 +31,10 @@
@run main bug6796710
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
javax.swing.*
;
import
sun.awt.SunToolkit
;
public
class
bug6796710
{
// The page is inlined because we want to be sure that the JEditorPane filled synchronously
...
...
@@ -68,9 +67,12 @@ public class bug6796710 {
robot
=
new
Robot
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
frame
=
new
JFrame
();
frame
.
setUndecorated
(
true
);
pnBottom
=
new
JPanel
();
pnBottom
.
add
(
new
JLabel
(
"Some label"
));
pnBottom
.
add
(
new
JButton
(
"A button"
));
...
...
@@ -95,9 +97,13 @@ public class bug6796710 {
((
SunToolkit
)
SunToolkit
.
getDefaultToolkit
()).
realSync
();
// This delay should be added for MacOSX, realSync is not enough
Thread
.
sleep
(
1000
);
BufferedImage
bufferedImage
=
getPnBottomImage
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
frame
.
setSize
(
400
,
150
);
}
...
...
test/sun/java2d/OpenGL/CustomCompositeTest.java
0 → 100644
浏览文件 @
5eb82201
/*
* Copyright (c) 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.
*
* 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.
*/
/*
* @test
* @bug 7124347
* @summary Verifies that rendering with XOR composite, and arbitraty
* custom composite doesn not cause internal errors.
*
* @run main/othervm -Dsun.java2d.opengl=True CustomCompositeTest
*/
import
java.awt.AWTException
;
import
java.awt.Color
;
import
java.awt.Composite
;
import
java.awt.CompositeContext
;
import
java.awt.Dimension
;
import
java.awt.GradientPaint
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.ImageCapabilities
;
import
java.awt.RenderingHints
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.ColorModel
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.Raster
;
import
java.awt.image.SinglePixelPackedSampleModel
;
import
java.awt.image.VolatileImage
;
import
java.awt.image.WritableRaster
;
import
java.util.concurrent.CountDownLatch
;
import
javax.swing.JComponent
;
import
javax.swing.JFrame
;
import
javax.swing.SwingUtilities
;
public
class
CustomCompositeTest
{
private
static
JFrame
frame
;
private
static
CountDownLatch
paintLatch
;
private
static
Throwable
paintError
;
public
static
void
main
(
String
[]
args
)
{
paintLatch
=
new
CountDownLatch
(
1
);
paintError
=
null
;
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
initGUI
();
}
});
try
{
paintLatch
.
await
();
}
catch
(
InterruptedException
e
)
{
};
System
.
out
.
println
(
"Paint is done!"
);
if
(
paintError
!=
null
)
{
frame
.
dispose
();
throw
new
RuntimeException
(
"Test FAILED."
,
paintError
);
}
System
.
out
.
println
(
"Phase 1: PASSED."
);
// now resise the frame in order to cause re-paint with accelerated
// source images.
paintError
=
null
;
paintLatch
=
new
CountDownLatch
(
1
);
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
Dimension
size
=
frame
.
getSize
();
size
.
width
+=
50
;
size
.
height
+=
50
;
frame
.
setSize
(
size
);
}
});
try
{
paintLatch
.
await
();
}
catch
(
InterruptedException
e
)
{
};
if
(
paintError
!=
null
)
{
frame
.
dispose
();
throw
new
RuntimeException
(
"Resize test FAILED."
,
paintError
);
}
frame
.
dispose
();
System
.
out
.
println
(
"Phase 2: PASSED."
);
GraphicsEnvironment
env
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsConfiguration
cfg
=
env
.
getDefaultScreenDevice
().
getDefaultConfiguration
();
// test rendering to accelerated volatile image
testVolatileImage
(
cfg
,
true
);
System
.
out
.
println
(
"Phase 3: PASSED."
);
// test rendering to unaccelerated volatile image
testVolatileImage
(
cfg
,
false
);
System
.
out
.
println
(
"Phase 4: PASSED."
);
}
private
static
void
testVolatileImage
(
GraphicsConfiguration
cfg
,
boolean
accelerated
)
{
VolatileImage
dst
=
null
;
try
{
dst
=
cfg
.
createCompatibleVolatileImage
(
640
,
480
,
new
ImageCapabilities
(
accelerated
));
}
catch
(
AWTException
e
)
{
System
.
out
.
println
(
"Unable to create volatile image, skip the test."
);
return
;
}
renderToVolatileImage
(
dst
);
}
private
static
void
renderToVolatileImage
(
VolatileImage
dst
)
{
Graphics2D
g
=
dst
.
createGraphics
();
do
{
System
.
out
.
println
(
"Render to volatile image.."
);
try
{
MyComp
.
renderTest
(
g
,
dst
.
getHeight
(),
dst
.
getHeight
());
}
catch
(
Throwable
e
)
{
throw
new
RuntimeException
(
"Test FAILED."
,
e
);
}
}
while
(
dst
.
contentsLost
());
System
.
out
.
println
(
"Done."
);
}
private
static
void
initGUI
()
{
frame
=
new
JFrame
(
"Silly composite"
);
frame
.
getContentPane
().
add
(
new
MyComp
());
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
pack
();
frame
.
setVisible
(
true
);
}
private
static
class
MyComp
extends
JComponent
{
private
static
BufferedImage
theImage
;
public
MyComp
()
{
}
private
static
BufferedImage
getTestImage
()
{
if
(
theImage
==
null
)
{
theImage
=
new
BufferedImage
(
256
,
256
,
BufferedImage
.
TYPE_INT_ARGB
);
Graphics2D
g2d
=
theImage
.
createGraphics
();
g2d
.
setColor
(
Color
.
red
);
g2d
.
fillRect
(
0
,
0
,
256
,
256
);
g2d
.
setPaint
(
new
GradientPaint
(
0
,
0
,
Color
.
red
,
256
,
256
,
Color
.
blue
));
g2d
.
fillRect
(
0
,
100
,
256
,
256
);
g2d
.
dispose
();
}
return
theImage
;
}
public
Dimension
getPreferredSize
()
{
return
new
Dimension
(
640
,
375
);
}
public
void
paintComponent
(
Graphics
g
)
{
Graphics2D
g2d
=
(
Graphics2D
)
g
;
try
{
renderTest
(
g2d
,
getWidth
(),
getHeight
());
}
catch
(
Throwable
e
)
{
paintError
=
e
;
}
if
(
paintLatch
!=
null
)
{
paintLatch
.
countDown
();
}
}
public
static
void
renderTest
(
Graphics2D
g2d
,
int
w
,
int
h
)
{
g2d
.
setColor
(
Color
.
yellow
);
g2d
.
fillRect
(
0
,
0
,
w
,
h
);
BufferedImage
image
=
getTestImage
();
// draw original image
g2d
.
drawRenderedImage
(
image
,
null
);
// draw image with custom composite
g2d
.
translate
(
175
,
25
);
Composite
currentComposite
=
g2d
.
getComposite
();
g2d
.
setComposite
(
new
TestComposite
());
g2d
.
drawRenderedImage
(
image
,
null
);
g2d
.
setComposite
(
currentComposite
);
// draw image with XOR
g2d
.
translate
(
175
,
25
);
g2d
.
setXORMode
(
Color
.
red
);
g2d
.
drawRenderedImage
(
image
,
null
);
System
.
out
.
println
(
"Painting is done..."
);
}
}
// A silly custom Composite to demonstrate the problem - just inverts the RGB
private
static
class
TestComposite
implements
Composite
{
public
CompositeContext
createContext
(
ColorModel
srcColorModel
,
ColorModel
dstColorModel
,
RenderingHints
hints
)
{
return
new
TestCompositeContext
();
}
}
private
static
class
TestCompositeContext
implements
CompositeContext
{
public
void
dispose
()
{
}
public
void
compose
(
Raster
src
,
Raster
dstIn
,
WritableRaster
dstOut
)
{
int
w
=
src
.
getWidth
();
int
h
=
src
.
getHeight
();
DataBufferInt
srcDB
=
(
DataBufferInt
)
src
.
getDataBuffer
();
DataBufferInt
dstOutDB
=
(
DataBufferInt
)
dstOut
.
getDataBuffer
();
int
srcRGB
[]
=
srcDB
.
getBankData
()[
0
];
int
dstOutRGB
[]
=
dstOutDB
.
getBankData
()[
0
];
int
srcOffset
=
srcDB
.
getOffset
();
int
dstOutOffset
=
dstOutDB
.
getOffset
();
int
srcScanStride
=
((
SinglePixelPackedSampleModel
)
src
.
getSampleModel
()).
getScanlineStride
();
int
dstOutScanStride
=
((
SinglePixelPackedSampleModel
)
dstOut
.
getSampleModel
()).
getScanlineStride
();
int
srcAdjust
=
srcScanStride
-
w
;
int
dstOutAdjust
=
dstOutScanStride
-
w
;
int
si
=
srcOffset
;
int
doi
=
dstOutOffset
;
for
(
int
i
=
0
;
i
<
h
;
i
++)
{
for
(
int
j
=
0
;
j
<
w
;
j
++)
{
dstOutRGB
[
doi
]
=
srcRGB
[
si
]
^
0x00ffffff
;
si
++;
doi
++;
}
si
+=
srcAdjust
;
doi
+=
dstOutAdjust
;
}
}
}
}
test/sun/java2d/cmm/ColorConvertOp/InvalidRenderIntentTest.java
0 → 100644
浏览文件 @
5eb82201
/*
* Copyright (c) 2011, 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.
*
* 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.
*/
/**
* @test
* @bug 7064516
* @summary Test verifies that incorrect profile rendering intent
* does not cause an failure of color conversion op.
* @run main InvalidRenderIntentTest
*/
import
java.awt.color.CMMException
;
import
java.awt.color.ColorSpace
;
import
java.awt.color.ICC_ColorSpace
;
import
java.awt.color.ICC_Profile
;
import
java.awt.image.ColorConvertOp
;
import
java.awt.image.BufferedImage
;
import
static
java
.
awt
.
color
.
ColorSpace
.
CS_sRGB
;
import
static
java
.
awt
.
image
.
BufferedImage
.
TYPE_3BYTE_BGR
;
public
class
InvalidRenderIntentTest
{
public
static
void
main
(
String
[]
args
)
{
ICC_Profile
pSRGB
=
ICC_Profile
.
getInstance
(
CS_sRGB
);
byte
[]
raw_data
=
pSRGB
.
getData
();
setRenderingIntent
(
0x1000000
,
raw_data
);
ICC_Profile
p
=
ICC_Profile
.
getInstance
(
raw_data
);
ICC_ColorSpace
cs
=
new
ICC_ColorSpace
(
p
);
// perfrom test color conversion
ColorConvertOp
op
=
new
ColorConvertOp
(
cs
,
ColorSpace
.
getInstance
(
CS_sRGB
),
null
);
BufferedImage
src
=
new
BufferedImage
(
1
,
1
,
TYPE_3BYTE_BGR
);
BufferedImage
dst
=
new
BufferedImage
(
1
,
1
,
TYPE_3BYTE_BGR
);
try
{
op
.
filter
(
src
.
getRaster
(),
dst
.
getRaster
());
}
catch
(
CMMException
e
)
{
throw
new
RuntimeException
(
"Test failed."
,
e
);
}
System
.
out
.
println
(
"Test passed."
);
}
private
static
void
setRenderingIntent
(
int
intent
,
byte
[]
data
)
{
final
int
pos
=
ICC_Profile
.
icHdrRenderingIntent
;
data
[
pos
+
0
]
=
(
byte
)
(
0xff
&
(
intent
>>
24
));
data
[
pos
+
1
]
=
(
byte
)
(
0xff
&
(
intent
>>
16
));
data
[
pos
+
2
]
=
(
byte
)
(
0xff
&
(
intent
>>
8
));
data
[
pos
+
3
]
=
(
byte
)
(
0xff
&
(
intent
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录