This commit is contained in:
Kelly O'Hair 2008-08-14 20:59:51 -07:00
commit f3e3c0e552
398 changed files with 40101 additions and 18524 deletions

View File

@ -6,3 +6,4 @@ bf2517e15f0c0f950e5b3143c4ca11e2df73dcc1 jdk7-b25
bfe4572fd301a6fcd120373cdb2eff5d2da0c72c jdk7-b29
bee4731164a06ddece1297ae58db24aca6a1c626 jdk7-b30
cd8b8f500face60d1566d850857a7fccadbd383a jdk7-b31
a9f1805e3ba9ca520cad199d522c84af5433e85a jdk7-b32

View File

@ -6,3 +6,4 @@ cbc8ad9dd0e085a607427ea35411990982f19a36 jdk7-b25
31e08f70e88d77c2053f91c21b49a04296bdc59a jdk7-b29
2dab2f712e1832c92acfa63ec0337048b9422c20 jdk7-b30
3300a35a0bd56d695b92fe0b34f03ebbfc939064 jdk7-b31
64da805be725721bf2004e7409a0d7a16fc8ddbc jdk7-b32

373
Makefile
View File

@ -49,27 +49,17 @@ ifndef JDK_MAKE_SHARED_DIR
JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
endif
# For start and finish echo lines
TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE)
DAYE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
START_ECHO = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)"
FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)"
default: all
include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
include ./make/Defs-internal.gmk
all::
@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`
$(MKDIR) -p $(OUTPUTDIR)
# Rules for sanity checks
include ./make/sanity-rules.gmk
dev : dev-build
dev-build:
$(MAKE) DEV_ONLY=true all
dev-sanity:
$(MAKE) DEV_ONLY=true sanity
dev-clobber:
$(MAKE) DEV_ONLY=true clobber
# Rules for various components
include ./make/hotspot-rules.gmk
include ./make/langtools-rules.gmk
include ./make/corba-rules.gmk
@ -80,11 +70,203 @@ include ./make/install-rules.gmk
include ./make/sponsors-rules.gmk
include ./make/deploy-rules.gmk
all:: setup build
# What "all" means
all::
@$(START_ECHO)
setup: openjdk_check
all:: openjdk_check sanity all_product_build
ifeq ($(SKIP_FASTDEBUG_BUILD), false)
all:: fastdebug_build
endif
ifeq ($(SKIP_DEBUG_BUILD), false)
all:: debug_build
endif
ifneq ($(SKIP_OPENJDK_BUILD), true)
all:: openjdk_build
endif
all::
@$(FINISH_ECHO)
# Everything for a full product build
all_product_build::
@$(START_ECHO)
ifeq ($(SKIP_PRODUCT_BUILD), false)
all_product_build:: product_build
ifeq ($(BUILD_INSTALL), true)
all_product_build:: $(INSTALL)
clobber:: install-clobber
endif
ifeq ($(BUILD_SPONSORS), true)
all_product_build:: $(SPONSORS)
clobber:: sponsors-clobber
endif
ifneq ($(SKIP_COMPARE_IMAGES), true)
all_product_build:: compare-image
endif
endif
all_product_build::
@$(FINISH_ECHO)
# Generis build of basic repo series
generic_build_repo_series::
$(MKDIR) -p $(OUTPUTDIR)
$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
ifeq ($(BUILD_LANGTOOLS), true)
generic_build_repo_series:: langtools
clobber:: langtools-clobber
endif
ifeq ($(BUILD_CORBA), true)
generic_build_repo_series:: corba
clobber:: corba-clobber
endif
ifeq ($(BUILD_JAXP), true)
generic_build_repo_series:: jaxp
clobber:: jaxp-clobber
endif
ifeq ($(BUILD_JAXWS), true)
generic_build_repo_series:: jaxws
clobber:: jaxws-clobber
endif
ifeq ($(BUILD_HOTSPOT), true)
generic_build_repo_series:: $(HOTSPOT)
clobber:: hotspot-clobber
endif
ifeq ($(BUILD_JDK), true)
generic_build_repo_series:: $(JDK_JAVA_EXE)
clobber:: jdk-clobber
endif
ifeq ($(BUILD_DEPLOY), true)
generic_build_repo_series:: $(DEPLOY)
clobber:: deploy-clobber
endif
ifeq ($(BUILD_JDK), true)
ifeq ($(BUNDLE_RULES_AVAILABLE), true)
generic_build_repo_series:: openjdk-binary-plugs-bundles
endif
endif
# The debug build, fastdebug or debug. Needs special handling.
# Note that debug builds do NOT do INSTALL steps, but must be done
# after the product build and before the INSTALL step of the product build.
#
# DEBUG_NAME is fastdebug or debug
# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
# The resulting j2sdk-image is used by the install makefiles to create a
# debug install bundle jdk-*-debug-** bundle (tar or zip)
# which will install in the debug or fastdebug subdirectory of the
# normal product install area.
# The install process needs to know what the DEBUG_NAME is, so
# look for INSTALL_DEBUG_NAME in the install rules.
#
# Location of fresh bootdir output
ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME)/j2sdk-image
create_fresh_product_bootdir: FRC
@$(START_ECHO)
$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
NO_DOCS=true \
BOOT_CYCLE_SETTINGS= \
build_product_image
@$(FINISH_ECHO)
create_fresh_debug_bootdir: FRC
@$(START_ECHO)
$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
NO_DOCS=true \
BOOT_CYCLE_DEBUG_SETTINGS= \
build_debug_image
@$(FINISH_ECHO)
create_fresh_fastdebug_bootdir: FRC
@$(START_ECHO)
$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
NO_DOCS=true \
BOOT_CYCLE_DEBUG_SETTINGS= \
build_fastdebug_image
@$(FINISH_ECHO)
# Create boot image?
ifeq ($(SKIP_BOOT_CYCLE),false)
ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
DO_BOOT_CYCLE=true
endif
endif
ifeq ($(DO_BOOT_CYCLE),true)
# Create the bootdir to use in the build
product_build:: create_fresh_product_bootdir
debug_build:: create_fresh_debug_bootdir
fastdebug_build:: create_fresh_fastdebug_bootdir
# Define variables to be used now for the boot jdk
BOOT_CYCLE_SETTINGS= \
ALT_BOOTDIR=$(FRESH_BOOTDIR) \
ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR)
BOOT_CYCLE_DEBUG_SETTINGS= \
ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \
ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)
else
# Use the supplied ALT_BOOTDIR as the boot
BOOT_CYCLE_SETTINGS=
BOOT_CYCLE_DEBUG_SETTINGS=
endif
build_product_image:
@$(START_ECHO)
$(MAKE) \
SKIP_FASTDEBUG_BUILD=true \
SKIP_DEBUG_BUILD=true \
$(BOOT_CYCLE_SETTINGS) \
generic_build_repo_series
@$(FINISH_ECHO)
generic_debug_build:
@$(START_ECHO)
$(MAKE) \
ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
DEBUG_NAME=$(DEBUG_NAME) \
NO_DOCS=true \
$(BOOT_CYCLE_DEBUG_SETTINGS) \
generic_build_repo_series
@$(FINISH_ECHO)
build_debug_image:
$(MAKE) DEBUG_NAME=debug generic_debug_build
build_fastdebug_image:
$(MAKE) DEBUG_NAME=fastdebug generic_debug_build
# Build final image
product_build:: build_product_image
debug_build:: build_debug_image
fastdebug_build:: build_fastdebug_image
# Check on whether we really can build the openjdk, need source etc.
openjdk_check: FRC
ifneq ($(SKIP_OPENJDK_BUILD), true)
@ -101,113 +283,6 @@ ifneq ($(SKIP_OPENJDK_BUILD), true)
@$(ECHO) " "
endif
build:: sanity
clobber::
ifeq ($(BUILD_LANGTOOLS), true)
build:: langtools
clobber:: langtools-clobber
endif
ifeq ($(BUILD_CORBA), true)
build:: corba
clobber:: corba-clobber
endif
ifeq ($(BUILD_JAXP), true)
build:: jaxp
clobber:: jaxp-clobber
endif
ifeq ($(BUILD_JAXWS), true)
build:: jaxws
clobber:: jaxws-clobber
endif
ifeq ($(BUILD_HOTSPOT), true)
build:: $(HOTSPOT)
clobber:: hotspot-clobber
endif
ifeq ($(BUILD_JDK), true)
build:: $(JDK_JAVA_EXE)
clobber:: jdk-clobber
endif
ifeq ($(BUILD_DEPLOY), true)
build:: $(DEPLOY)
clobber:: deploy-clobber
endif
#
# Generic debug build, fastdebug or debug. Needs special handling.
# Note that debug builds do NOT do INSTALL steps, but must be done
# after the product build and before the INSTALL step of the product build.
#
# DEBUG_NAME is fastdebug or debug
# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix
# The resulting j2sdk-image is used by the install makefiles to create a
# debug install bundle jdk-*-debug-** bundle (tar or zip)
# which will install in the debug or fastdebug subdirectory of the
# normal product install area.
# The install process needs to know what the DEBUG_NAME is, so
# look for INSTALL_DEBUG_NAME in the install rules.
#
COMMON_DEBUG_FLAGS= \
DEBUG_NAME=$(DEBUG_NAME) \
ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
NO_DOCS=true
product_build: setup
@$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
$(MAKE) SKIP_FASTDEBUG_BUILD=true SKIP_DEBUG_BUILD=true all
@$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
generic_debug_build:
@$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
$(MAKE) $(COMMON_DEBUG_FLAGS) setup build
@$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
debug_build: setup
$(MAKE) DEBUG_NAME=debug generic_debug_build
fastdebug_build: setup
$(MAKE) DEBUG_NAME=fastdebug generic_debug_build
ifeq ($(SKIP_FASTDEBUG_BUILD), false)
all:: fastdebug_build
endif
ifeq ($(SKIP_DEBUG_BUILD), false)
all:: debug_build
endif
ifeq ($(BUILD_JDK), true)
ifeq ($(BUNDLE_RULES_AVAILABLE), true)
all:: openjdk-binary-plugs-bundles
endif
endif
ifeq ($(BUILD_INSTALL), true)
all :: $(INSTALL)
clobber:: install-clobber
endif
ifeq ($(BUILD_SPONSORS), true)
all :: $(SPONSORS)
clobber:: sponsors-clobber
endif
ifneq ($(SKIP_COMPARE_IMAGES), true)
all :: compare-image
endif
ifneq ($(SKIP_OPENJDK_BUILD), true)
all :: openjdk_build
endif
# If we have bundle rules, we have a chance here to do a complete cycle
# build, of production and open build.
# FIXUP: We should create the openjdk source bundle and build that?
@ -235,6 +310,7 @@ else
endif
openjdk_build:
@$(START_ECHO)
@$(ECHO) " "
@$(ECHO) "================================================="
@$(ECHO) "Starting openjdk build"
@ -245,6 +321,7 @@ openjdk_build:
$(MKDIR) -p $(OPENJDK_OUTPUTDIR)
($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
OPENJDK=true \
NO_DOCS=true \
ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
@ -261,6 +338,7 @@ openjdk_build:
@$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)"
@$(ECHO) "================================================="
@$(ECHO) " "
@$(FINISH_ECHO)
endif
endif
@ -274,8 +352,18 @@ clobber::
clean: clobber
all::
@$(ECHO) Control build finished: `$(DATE) '+%y-%m-%d %H:%M'`
#
# Dev builds
#
dev : dev-build
dev-build:
$(MAKE) DEV_ONLY=true all
dev-sanity:
$(MAKE) DEV_ONLY=true sanity
dev-clobber:
$(MAKE) DEV_ONLY=true clobber
#
# Quick jdk verification build
@ -460,16 +548,6 @@ ifeq ($(BUNDLE_RULES_AVAILABLE), true)
include $(BUNDLE_RULES)
endif
################################################################
# Cycle build. Build the jdk, use it to build the jdk again.
################################################################
ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
boot_cycle:
$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build
$(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build
################################################################
# JPRT rule to build
################################################################
@ -480,9 +558,20 @@ include ./make/jprt.gmk
# PHONY
################################################################
.PHONY: all build what clobber insane \
fastdebug_build debug_build product_build setup \
dev dev-build dev-sanity dev-clobber
.PHONY: all \
generic_build_repo_series \
what clobber insane \
dev dev-build dev-sanity dev-clobber \
product_build \
fastdebug_build \
debug_build \
build_product_image \
build_debug_image \
build_fastdebug_image \
create_fresh_product_bootdir \
create_fresh_debug_bootdir \
create_fresh_fastdebug_bootdir \
generic_debug_build
# Force target
FRC:

View File

@ -132,7 +132,7 @@
See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
SunSolve</a> for patch downloads.
</td>
<td>Sun Studio 11 </td>
<td>Sun Studio 12</td>
</tr>
<tr>
<td>Solaris SPARCV9 (64bit)</td>
@ -141,7 +141,7 @@
See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
SunSolve</a> for patch downloads.
</td>
<td>Sun Studio 11</td>
<td>Sun Studio 12</td>
</tr>
<tr>
<td>Solaris X86 (32bit)</td>
@ -150,7 +150,7 @@
See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
SunSolve</a> for patch downloads.
</td>
<td>Sun Studio 11</td>
<td>Sun Studio 12</td>
</tr>
<tr>
<td>Solaris X64 (64bit)</td>
@ -159,7 +159,7 @@
See <a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/JavaSE" target="_blank">
SunSolve</a> for patch downloads.
</td>
<td>Sun Studio 11</td>
<td>Sun Studio 12</td>
</tr>
<tr>
<td>Windows X86 (32bit)</td>
@ -831,8 +831,8 @@
<blockquote>
At a minimum, the
<a href="http://developers.sun.com/sunstudio/index.jsp" target="_blank">
Sun Studio 11 Compilers</a>
(containing version 5.8 of the C and C++ compilers) is required,
Sun Studio 12 Compilers</a>
(containing version 5.9 of the C and C++ compilers) is required,
with patches from the
<a href="http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/patch-access" target="_blank">
SunSolve web site</a>.

View File

@ -6,3 +6,4 @@ e84e9018bebbf3e5bafc5706e7882a15cb1c7d99 jdk7-b27
8b71960f79ce0a6fb8ddfeec03f03d400a361747 jdk7-b29
c0252adbb2abbfdd6c35595429ac6fbdd98e20ac jdk7-b30
ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31
80a0f46a6203e727012bd579fe38a609b83decce jdk7-b32

View File

@ -41,4 +41,7 @@ com_sun_corba_se_impl_dynamicany_java = \
com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java \
com/sun/corba/se/impl/dynamicany/DynStructImpl.java \
com/sun/corba/se/impl/dynamicany/DynUnionImpl.java \
com/sun/corba/se/impl/dynamicany/DynValueImpl.java
com/sun/corba/se/impl/dynamicany/DynValueImpl.java \
com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java \
com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java

View File

@ -52,6 +52,8 @@ com_sun_corba_se_impl_encoding_java = \
com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java \
com/sun/corba/se/impl/encoding/EncapsInputStream.java \
com/sun/corba/se/impl/encoding/EncapsOutputStream.java \
com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java \
com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java \
com/sun/corba/se/impl/encoding/MarkAndResetHandler.java \
com/sun/corba/se/impl/encoding/MarshalInputStream.java \
com/sun/corba/se/impl/encoding/MarshalOutputStream.java \

View File

@ -63,6 +63,7 @@ com_sun_corba_se_impl_ior_java = \
com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java \
com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java \
com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java \
com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java \
com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java \
com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java \
com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java

View File

@ -27,6 +27,7 @@ com_sun_corba_se_impl_orbutil_java = \
com/sun/corba/se/impl/orbutil/CacheTable.java \
com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java \
com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java \
com/sun/corba/se/impl/orbutil/GetPropertyAction.java \
com/sun/corba/se/impl/orbutil/HexOutputStream.java \
com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3.java \
com/sun/corba/se/impl/orbutil/IIOPInputStream_1_3_1.java \
@ -76,6 +77,7 @@ com_sun_corba_se_impl_orbutil_java = \
com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java \
com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java \
com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java \
com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java \
com/sun/corba/se/impl/orbutil/graph/Node.java \
com/sun/corba/se/impl/orbutil/graph/NodeData.java \
com/sun/corba/se/impl/orbutil/graph/Graph.java \

View File

@ -63,6 +63,7 @@ com_sun_corba_se_impl_protocol_java = \
com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java \
com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java \
com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java \
com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java \
com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java \
com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java \
com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java \

View File

@ -29,6 +29,7 @@
com_sun_corba_se_spi_legacy_interceptor_java = \
com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java \
com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java \
com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java \
com/sun/corba/se/spi/legacy/interceptor/UnknownType.java

View File

@ -35,5 +35,6 @@ FILES_java = \
com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java \
com/sun/corba/se/spi/monitoring/MonitoredAttribute.java \
com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java \
com/sun/corba/se/spi/monitoring/MonitoringConstants.java \
com/sun/corba/se/spi/monitoring/MonitoringManager.java \
com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java

View File

@ -27,6 +27,7 @@ com_sun_corba_se_spi_presentation_rmi_java = \
com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java \
com/sun/corba/se/spi/presentation/rmi/DynamicStub.java \
com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java \
com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java \
com/sun/corba/se/spi/presentation/rmi/PresentationManager.java \
com/sun/corba/se/spi/presentation/rmi/StubAdapter.java

View File

@ -26,6 +26,7 @@
com_sun_corba_se_spi_transport_java = \
com/sun/corba/se/spi/transport/CorbaAcceptor.java \
com/sun/corba/se/spi/transport/CorbaConnection.java \
com/sun/corba/se/spi/transport/CorbaConnectionCache.java \
com/sun/corba/se/spi/transport/CorbaContactInfo.java \
com/sun/corba/se/spi/transport/CorbaContactInfoList.java \
com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java \

View File

@ -47,6 +47,7 @@ NS_GENERATED_java = \
org/omg/CosNaming/NamingContext.java \
org/omg/CosNaming/NamingContextHelper.java \
org/omg/CosNaming/NamingContextHolder.java \
org/omg/CosNaming/NamingContextOperations.java \
org/omg/CosNaming/_NamingContextStub.java \
org/omg/CosNaming/NamingContextPackage/AlreadyBound.java \
org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java \

View File

@ -47,6 +47,10 @@ DYNANY_GENERATED_java = \
org/omg/DynamicAny/DynUnionOperations.java \
org/omg/DynamicAny/DynValue.java \
org/omg/DynamicAny/DynValueOperations.java \
org/omg/DynamicAny/DynValueBox.java \
org/omg/DynamicAny/DynValueBoxOperations.java \
org/omg/DynamicAny/DynValueCommon.java \
org/omg/DynamicAny/DynValueCommonOperations.java \
org/omg/DynamicAny/NameDynAnyPair.java \
org/omg/DynamicAny/NameValuePair.java \
org/omg/DynamicAny/DynAnyPackage/InvalidValue.java \
@ -70,8 +74,16 @@ DYNANY_GENERATED_java = \
org/omg/DynamicAny/DynSequenceHelper.java \
org/omg/DynamicAny/NameDynAnyPairSeqHelper.java \
org/omg/DynamicAny/NameValuePairHelper.java \
org/omg/DynamicAny/NameValuePairSeqHelper.java
org/omg/DynamicAny/NameValuePairSeqHelper.java \
org/omg/DynamicAny/_DynAnyFactoryStub.java \
org/omg/DynamicAny/_DynAnyStub.java \
org/omg/DynamicAny/_DynArrayStub.java \
org/omg/DynamicAny/_DynEnumStub.java \
org/omg/DynamicAny/_DynFixedStub.java \
org/omg/DynamicAny/_DynSequenceStub.java \
org/omg/DynamicAny/_DynStructStub.java \
org/omg/DynamicAny/_DynUnionStub.java \
org/omg/DynamicAny/_DynValueStub.java
DYNANY_HELP_HOLD_java = \
org/omg/DynamicAny/AnySeqHolder.java \

View File

@ -106,6 +106,7 @@ PI_GENERATED_java = \
org/omg/IOP/CodecPackage/TypeMismatchHelper.java \
org/omg/IOP/ENCODING_CDR_ENCAPS.java \
org/omg/IOP/Encoding.java \
org/omg/IOP/ExceptionDetailMessage.java \
org/omg/Dynamic/Parameter.java
# Helper and Holder files to be removed:

View File

@ -46,6 +46,8 @@ CORBA_JMK_DIRECTORY=$(TOPDIR)/make/com/sun/corba/minclude/
include $(CORBA_JMK_DIRECTORY)com_sun_corba_se_PortableActivationIDL.jmk
include $(CORBA_JMK_DIRECTORY)com_sun_corba_se_impl_logging.jmk
FILES_java += com/sun/corba/se/org/omg/CORBA/ORB.java
#
# Dirs
#

View File

@ -31,11 +31,8 @@ COMPILER_NAME=Sun Studio
# Sun Studio Compiler settings specific to Solaris
ifeq ($(PLATFORM), solaris)
# FIXUP: Change to SS12 when validated
#COMPILER_VERSION=SS12
#REQUIRED_CC_VER=5.9
COMPILER_VERSION=SS11
REQUIRED_CC_VER=5.8
COMPILER_VERSION=SS12
REQUIRED_CC_VER=5.9
CC = $(COMPILER_PATH)cc
CPP = $(COMPILER_PATH)cc -E
CXX = $(COMPILER_PATH)CC

View File

@ -35,7 +35,7 @@ include $(BUILDDIR)/common/Defs.gmk
#
# Files to compile
#
AUTO_FILES_JAVA_DIRS = javax/transaction/xa
AUTO_FILES_JAVA_DIRS = javax/transaction
#
# Rules

View File

@ -127,9 +127,7 @@ if [ "${osname}" = SunOS ] ; then
if [ "${JPRT_SOLARIS_COMPILER_NAME}" != "" ] ; then
compiler_name=${JPRT_SOLARIS_COMPILER_NAME}
else
# FIXUP: Change to SS12 when validated
#compiler_name=SS12
compiler_name=SS11
compiler_name=SS12
fi
compiler_path=${jdk_devtools}/${solaris_arch}/SUNWspro/${compiler_name}/bin
ALT_COMPILER_PATH="${compiler_path}"

View File

@ -47,8 +47,8 @@ else
endif
FILES_java = \
$(ORG_OMG_SENDINGCONTEXT_java) \
$(ORG_OMG_CORBA_2_3_java) \
$(org_omg_SendingContext_java) \
$(org_omg_CORBA_2_3_java) \
$(ORG_OMG_CORBA_java)
#

View File

@ -6,3 +6,4 @@ c14dab40ed9bf45ad21150bd70c9c80cdf655415 jdk7-b28
4f91c08b3e4498213a9c5a24898f7d9c38cf86fb jdk7-b29
d1605aabd0a15ecf93787c47de63073c33fba52d jdk7-b30
9c2ecc2ffb125f14fab3857fe7689598956348a0 jdk7-b31
b727c32788a906c04839516ae7443a085185a300 jdk7-b32

View File

@ -6,3 +6,4 @@ b996318955c0ad8e9fa0ffb56c74f626786e863f jdk7-b28
617ee8607cfd5fd81f233f3c0b690f85084687a0 jdk7-b29
2d94a238a1641d074e6032dcdceed461d6f85d6a jdk7-b30
255d64ee287e926e8629dd80bc67690e65eeba30 jdk7-b31
400a5ee432cc2db9031e06852ddde9264a192b48 jdk7-b32

View File

@ -6,3 +6,4 @@ eefcd5204500a11d6aa802dca9f961cf10ab64c2 jdk7-b28
836c55713abab186e4de0c6eabd06ff008c7b8d0 jdk7-b29
7f2466f8cc7009702e548d1a763254f546024d7e jdk7-b30
f978623825364a2ad9c6f51d02fc9424a8b0bc86 jdk7-b31
e6daca2eced9d84b01255cabcfcc49164c26405e jdk7-b32

View File

@ -6,3 +6,4 @@ fb57027902e04ecafceae31a605e69b436c23d57 jdk7-b26
e21f4266466cd1306b176aaa08b2cd8337a9be3d jdk7-b29
b6d6877c1155621a175dccd12dc14c54f938fb8b jdk7-b30
b7474b739d13bacd9972f88ac91f6350b7b0be12 jdk7-b31
c51121419e30eac5f0fbbce45ff1711c4ce0de28 jdk7-b32

View File

@ -370,7 +370,7 @@ ifeq ($(PLATFORM), windows)
# ISHIELD_TEMP_MIN is the difference of an empty C:\TEMP vs. one after a
# bundles build on windows.
ISHIELD_TEMP_MIN=250000
REQUIRED_DXSDK_VER = 0x0700
REQUIRED_DXSDK_VER = 0x0900
OS_VENDOR = Microsoft
# How much RAM does this machine have:
ifeq ($(JDK_HAS_MEM_INFO),)

View File

@ -92,7 +92,7 @@ ifeq ($(PLATFORM), windows)
_WINDOWS_VERSION := Windows 2000 or Unknown (no systeminfo utility)
endif
WINDOWS_VERSION := $(strip $(_WINDOWS_VERSION))
DXSDK_VER := $(shell $(EGREP) DIRECTDRAW_VERSION $(DXSDK_INCLUDE_PATH)/ddraw.h 2>&1 | \
DXSDK_VER := $(shell $(EGREP) DIRECT3D_VERSION $(DXSDK_INCLUDE_PATH)/d3d9.h 2>&1 | \
$(EGREP) "\#define" | $(NAWK) '{print $$3}')
endif
@ -1258,7 +1258,7 @@ sane-unzip_version:
######################################################
sane-dxsdk:
ifeq ($(PLATFORM), windows)
@if [ ! -r $(DXSDK_INCLUDE_PATH)/ddraw.h ]; then \
@if [ ! -r $(DXSDK_INCLUDE_PATH)/d3d9.h ]; then \
$(ECHO) "ERROR: You do not have access to a valid DirectX SDK Include dir.\n" \
" The value of DXSDK_INCLUDE_PATH must point a valid DX SDK dir.\n" \
" Please check your access to \n" \
@ -1287,7 +1287,7 @@ ifeq ($(PLATFORM), windows)
" This may result in a build failure.\n" \
" The DirectX SDK Include dir was obtained from the following location:\n" \
" $(DXSDK_INCLUDE_PATH) \n" \
" Please change your DirectX SDK to version 7 or 9 (Summer 2004 Update or newer).\n" \
" Please change your DirectX SDK to version 9 (Summer 2004 Update or newer).\n" \
" Microsoft DirectX 9 SDK can be downloaded from the following location:\n" \
" http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp\n" \
" Or http://www.microsoft.com/directx\n" \

View File

@ -165,8 +165,8 @@ include $(BUILDDIR)/common/Library.gmk
# Generate source files
#
SPP = spp.sh
SPP_CMD = $(SH) $(SPP)
SPP_JARFILE = $(BUILDTOOLJARDIR)/spp.jar
SPP_CMD = $(BOOT_JAVA_CMD) -jar $(SPP_JARFILE)
FILES_genout = $(FILES_gen:%.java=$(GENSRCDIR)/%.java)
@ -182,7 +182,7 @@ CS_GEN=$(NIO_GEN)/charset
SCH_GEN=$(SNIO_GEN)/ch
SCS_GEN=$(SNIO_GEN)/cs
sources: $(SPP) $(FILES_genout)
sources: $(SPP_JARFILE) $(FILES_genout)
#
# Generated buffer classes

View File

@ -53,8 +53,8 @@ if [ x$what = xdecoder ]; then
-Dcoding='decoding' \
-DOtherCoder='Encoder' \
-DreplTypeName='string' \
-DdefaultRepl='"\\\\uFFFD"' \
-DdefaultReplName='<tt>"\\\&#92;uFFFD"<\/tt>' \
-DdefaultRepl='"\\uFFFD"' \
-DdefaultReplName='<tt>"\&#92;uFFFD"<\/tt>' \
-DreplType='String' \
-DreplFQType='java.lang.String' \
-DreplLength='length()' \
@ -84,7 +84,7 @@ elif [ x$what = xencoder ]; then
-DOtherCoder='Decoder' \
-DreplTypeName='byte array' \
-DdefaultRepl='new byte[] { (byte)'"'"\\?"'"' }' \
-DdefaultReplName='<tt>{<\/tt>\\\&nbsp;<tt>(byte)'"'"\\?"'"'<\/tt>\\\&nbsp;<tt>}<\/tt>' \
-DdefaultReplName='<tt>{<\/tt>\&nbsp;<tt>(byte)'"'"\\?"'"'<\/tt>\&nbsp;<tt>}<\/tt>' \
-DreplType='byte[]' \
-DreplFQType='byte[]' \
-DreplLength='length' \

View File

@ -1,165 +0,0 @@
#! /bin/sh
#
# Copyright 2000-2001 Sun Microsystems, Inc. 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. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# SPP: A simple/sed-based/stream preprocessor
# Mark Reinhold / mr@sun.com
#
# Usage: spp [-be] [-Kkey] -Dvar=value ... <in >out
#
# Source-file constructs
#
# Meaningful only at beginning of line, works with any number of keys:
#
# #if[key] Includes text between #if/#end if -Kkey specified,
# #else[key] otherwise changes text to blank lines; key test
# #end[key] may be negated by prefixing !, e.g., #if[!key]
#
# #begin If -be is specified then lines up to and including
# #end #begin, and from #end to EOF, are deleted
#
# #warn Changed into warning that file is generated
#
# // ## Changed into blank line
#
# Meaningful anywhere in line, works only for first two keys:
#
# {#if[key]?yes} Expands to yes if -Kkey specified
# {#if[key]?yes:no} Expands to yes if -Kkey, otherwise no
# {#if[!key]?yes} Expands to yes if -Kother
# {#if[!key]?yes:no} Expands to yes if -Kother, otherwise no
# $var$ Expands to value if -Dvar=value given
#
# yes, no must not contain whitespace
#
# If the environment variable SED is defined, uses that instead of sed
# If the environment variable NAWK is defined, uses that instead of awk
#
SED=${SED:-sed}
NAWK=${NAWK:-awk}
# Map a string of the form -Dvar=value into an appropriate sed command
#
subst() {
# The first two lines are to avoid the direct use of echo,
# which does not treat backslashes consistently across platforms
echo '' \
| $SED -e "s.*$*" \
| $SED -e 's-D\([a-zA-Z_][-a-zA-Z_]*\)=\(.*\)'"s\\\\\$\\1\\\\\$\2gg" \
-e 's-D\([a-zA-Z_][-a-zA-Z_]*\)'"s\\\\\$\\1\\\\\$1gg" \
-e 's/ //g'
}
es=
be=
keys=
key1=_1_
key2=_2_
while [ $# -gt 0 ]; do
case "$1" in
-be)
be='-e 1,/^#begin$/d -e /^#end$/,$d'
;;
-D*)
es="$es -e `subst $1`"
;;
-K*)
nk=`echo $1 | $SED -e 's/-K//'`
if [ "x$keys" = x ]; then keys="$nk"; else keys="$keys $nk"; fi
if [ "x$key1" = x_1_ ]; then key1="$nk";
elif [ "x$key2" = x_2_ ]; then key2="$nk"; fi
;;
*)
echo "Usage: $0 [-be] [-Kkey] -Dvar=value ... <in >out"
exit 1
;;
esac
shift
done
text='[-a-zA-Z0-9&;,.<>/#() ]'
$SED $es \
-e 's// /g' \
-e "s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@" \
-e 's-// ##.*$--' $be \
-e "s/{#if\[$key1\]?\($text*\):\($text*\)}/\1/g" \
-e "s/{#if\[!$key1\]?\($text*\):\($text*\)}/\2/g" \
-e "s/{#if\[$key1\]?\($text*\)}/\1/g" \
-e "s/{#if\[!$key1\]?\($text*\)}//g" \
-e "s/{#if\[$key2\]?\($text*\):\($text*\)}/\1/g" \
-e "s/{#if\[!$key2\]?\($text*\):\($text*\)}/\2/g" \
-e "s/{#if\[$key2\]?\($text*\)}/\1/g" \
-e "s/{#if\[!$key2\]?\($text*\)}//g" \
-e "s/{#if\[[a-z]*\]?\($text*\):\($text*\)}/\2/g" \
-e "s/{#if\[![a-z]*\]?\($text*\):\($text*\)}/\1/g" \
-e "s/{#if\[[a-z]*\]?\($text*\)}//g" \
-e "s/{#if\[![a-z]*\]?\($text*\)}/\1/g" \
| $NAWK \
'function key(s) {
i = match(s, "[a-zA-Z][a-zA-Z]*\\]");
if (i > 0) return substr(s, i, RLENGTH - 1);
return "XYZZY"; }
function neg(s) { return match(s, "!") > 0; }
BEGIN {
KEYS = "'"$keys"'"
n = split(KEYS, ks, " *");
for (i = 1; i <= n; i++) keys[ks[i]] = 1;
top = 1; copy[top] = 1 }
/^#if\[!?[a-zA-Z][a-zA-Z]*\]/ \
{ k = key($0);
n = neg($0);
stack[++top] = k;
if ((k in keys) == !n) {
copy[top] = copy[top - 1];
} else {
copy[top] = 0;
}
print ""; next }
/^#else\[!?[a-zA-Z][a-zA-Z]*\]/ \
{ k = key($0);
if (stack[top] == k) {
copy[top] = copy[top - 1] && !copy[top];
} else {
printf "%d: Mismatched #else key\n", NR | "cat 1>&2";
exit 11
}
print ""; next }
/^#end\[!?[a-zA-Z][a-zA-Z]*\]/ \
{ k = key($0);
if (stack[top] == k) {
top--;
} else {
printf "%d: Mismatched #end key\n", NR | "cat 1>&2"
exit 11
}
print ""; next }
/^#/ {
printf "%d: Malformed #directive\n", NR | "cat 1>&2"
exit 11
}
{ if (copy[top]) print; else print "" }'

View File

@ -1,5 +1,5 @@
#
# Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1997-2008 Sun Microsystems, Inc. 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
@ -112,29 +112,11 @@ FILES_cpp = \
GDIHashtable.cpp \
Devices.cpp \
ObjectList.cpp \
DDBlitLoops.cpp \
DDRenderer.cpp \
GDIBlitLoops.cpp \
GDIRenderer.cpp \
Win32OffScreenSurfaceData.cpp \
Win32SurfaceData.cpp \
WinBackBufferSurfaceData.cpp \
GDIWindowSurfaceData.cpp \
WindowsFlags.cpp \
WBufferStrategy.cpp \
WPrinterJob.cpp \
ddrawUtils.cpp \
dxCapabilities.cpp \
dxInit.cpp \
RegistryKey.cpp \
D3DBlitLoops.cpp \
D3DContext.cpp \
D3DMaskFill.cpp \
D3DRenderer.cpp \
D3DRuntimeTest.cpp \
D3DSurfaceData.cpp \
D3DTextRenderer_md.cpp \
D3DUtils.cpp \
ddrawObject.cpp \
awt_AWTEvent.cpp \
awt_BitmapUtil.cpp \
awt_Brush.cpp \
@ -199,6 +181,23 @@ FILES_cpp = \
awt_Mlib.cpp \
awt_new.cpp \
awt_TrayIcon.cpp \
ShaderList.cpp \
D3DBlitLoops.cpp \
D3DBufImgOps.cpp \
D3DContext.cpp \
D3DGlyphCache.cpp \
D3DGraphicsDevice.cpp \
D3DMaskBlit.cpp \
D3DMaskCache.cpp \
D3DMaskFill.cpp \
D3DPipelineManager.cpp \
D3DPaints.cpp \
D3DRenderer.cpp \
D3DRenderQueue.cpp \
D3DResourceManager.cpp \
D3DSurfaceData.cpp \
D3DTextRenderer.cpp \
D3DVertexCacher.cpp \
ShellFolder2.cpp \
ThemeReader.cpp \
ComCtl32Util.cpp \

View File

@ -1,5 +1,5 @@
#
# Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2000-2008 Sun Microsystems, Inc. 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
@ -49,6 +49,9 @@ FILES_export = \
sun/java2d/loops/TransformHelper.java \
sun/java2d/loops/GraphicsPrimitiveMgr.java \
sun/java2d/loops/GraphicsPrimitive.java \
sun/java2d/pipe/hw/AccelSurface.java \
sun/java2d/pipe/hw/AccelDeviceEventNotifier.java \
sun/java2d/pipe/hw/ContextCapabilities.java \
sun/awt/image/ImagingLib.java \
sun/java2d/SurfaceData.java \
sun/java2d/SunGraphics2D.java \
@ -107,6 +110,7 @@ FILES_export = \
sun/java2d/pipe/BufferedContext.java \
sun/java2d/pipe/BufferedMaskBlit.java \
sun/java2d/pipe/BufferedOpCodes.java \
sun/java2d/pipe/BufferedMaskBlit.java \
sun/java2d/pipe/BufferedPaints.java \
sun/java2d/pipe/BufferedRenderPipe.java \
sun/java2d/pipe/BufferedTextPipe.java \

View File

@ -1,5 +1,5 @@
#
# Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2000-2008 Sun Microsystems, Inc. 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
@ -125,14 +125,9 @@ FILES_export2 = \
sun/awt/image/BufImgSurfaceData.java \
sun/awt/image/DataBufferNative.java \
sun/awt/shell/Win32ShellFolder2.java \
sun/java2d/windows/DDBlitLoops.java \
sun/java2d/windows/DDRenderer.java \
sun/java2d/windows/DDScaleLoops.java \
sun/java2d/windows/GDIBlitLoops.java \
sun/java2d/windows/GDIRenderer.java \
sun/java2d/windows/Win32OffScreenSurfaceData.java \
sun/java2d/windows/Win32SurfaceData.java \
sun/java2d/windows/WinBackBufferSurfaceData.java \
sun/java2d/windows/GDIWindowSurfaceData.java \
sun/java2d/windows/WindowsFlags.java \
sun/java2d/loops/Blit.java \
sun/java2d/loops/BlitBg.java \
@ -219,6 +214,9 @@ FILES_export3 = \
sun/awt/windows/WBufferStrategy.java \
sun/awt/windows/WTrayIconPeer.java \
sun/awt/image/ImagingLib.java \
sun/java2d/pipe/hw/AccelSurface.java \
sun/java2d/pipe/hw/AccelDeviceEventNotifier.java \
sun/java2d/pipe/hw/ContextCapabilities.java \
sun/java2d/pipe/BufferedContext.java \
sun/java2d/pipe/BufferedMaskBlit.java \
sun/java2d/pipe/BufferedOpCodes.java \
@ -229,13 +227,6 @@ FILES_export3 = \
sun/java2d/pipe/ShapeSpanIterator.java \
sun/java2d/pipe/SpanClipRenderer.java \
sun/java2d/pipe/RegionIterator.java \
sun/java2d/d3d/D3DBlitLoops.java \
sun/java2d/d3d/D3DMaskFill.java \
sun/java2d/d3d/D3DRenderer.java \
sun/java2d/d3d/D3DContext.java \
sun/java2d/d3d/D3DSurfaceData.java \
sun/java2d/d3d/D3DBackBufferSurfaceData.java \
sun/java2d/d3d/D3DTextRenderer.java \
sun/java2d/opengl/OGLBlitLoops.java \
sun/java2d/opengl/OGLContext.java \
sun/java2d/opengl/OGLMaskFill.java \
@ -245,4 +236,13 @@ FILES_export3 = \
sun/java2d/opengl/OGLSurfaceData.java \
sun/java2d/opengl/OGLTextRenderer.java \
sun/java2d/opengl/WGLGraphicsConfig.java \
sun/java2d/opengl/WGLSurfaceData.java
sun/java2d/opengl/WGLSurfaceData.java \
sun/java2d/d3d/D3DBlitLoops.java \
sun/java2d/d3d/D3DGraphicsDevice.java \
sun/java2d/d3d/D3DSurfaceData.java \
sun/java2d/d3d/D3DMaskFill.java \
sun/java2d/d3d/D3DPaints.java \
sun/java2d/d3d/D3DRenderQueue.java \
sun/java2d/d3d/D3DRenderer.java \
sun/java2d/d3d/D3DTextRenderer.java \
sun/java2d/d3d/D3DContext.java

View File

@ -1,5 +1,5 @@
#
# Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1995-2008 Sun Microsystems, Inc. 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
@ -65,7 +65,6 @@ include FILES_export_windows.gmk
#
AUTO_JAVA_PRUNE += RemoteOffScreenImage.java
OTHER_CXXFLAGS += -DD3D_OVERLOADS
OTHER_CFLAGS += $(GX_OPTION) -DMLIB_NO_LIBSUNMATH -DUNICODE -D_UNICODE
OTHER_CXXFLAGS += $(GX_OPTION) -DUNICODE -D_UNICODE
@ -444,7 +443,7 @@ OTHER_INCLUDES += -I$(CLASSHDRDIR)/../../java/jvm \
-I$(SHARE_SRC)/native/sun/dc/path \
-I$(SHARE_SRC)/native/sun/dc/doe \
-I$(SHARE_SRC)/native/sun/awt/debug \
-I$(PLATFORM_SRC)/native/sun/awt \
-I$(PLATFORM_SRC)/native/sun/awt
# -I$(WINAWT_COMMON_native)
# this is only required for compiling )/native/sun/awt/medialib/*.c files

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
#
# Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2001-2008 Sun Microsystems, Inc. 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
@ -417,12 +417,14 @@ SUNWprivate_1.1 {
Java_sun_java2d_x11_X11SurfaceData_XSetForeground;
Java_sun_java2d_x11_X11SurfaceData_XSetGraphicsExposures;
Java_sun_java2d_opengl_OGLContext_getOGLIdString;
Java_sun_java2d_opengl_OGLMaskFill_maskFill;
Java_sun_java2d_opengl_OGLRenderer_drawPoly;
Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer;
Java_sun_java2d_opengl_OGLSurfaceData_initTexture;
Java_sun_java2d_opengl_OGLSurfaceData_initFBObject;
Java_sun_java2d_opengl_OGLSurfaceData_initFlipBackbuffer;
Java_sun_java2d_opengl_OGLSurfaceData_getTextureID;
Java_sun_java2d_opengl_OGLSurfaceData_getTextureTarget;
Java_sun_java2d_opengl_OGLTextRenderer_drawGlyphList;
Java_sun_java2d_opengl_GLXGraphicsConfig_getGLXConfigInfo;
@ -511,6 +513,7 @@ SUNWprivate_1.1 {
AWTCharAscent;
AWTCharDescent;
AWTDrawGlyphList;
AccelGlyphCache_RemoveAllCellInfos;
local:
*;

View File

@ -1,5 +1,5 @@
#
# Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1997-2008 Sun Microsystems, Inc. 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
@ -137,7 +137,6 @@ SUNWprivate_1.1 {
RegionToYXBandedRectangles;
GrPrim_CompGetXorInfo;
GrPrim_CompGetAlphaInfo;
GrPrim_ColorGetRGB;
J2dTraceImpl;
J2dTraceInit;
img_makePalette;

View File

@ -1,5 +1,5 @@
#
# Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2002-2008 Sun Microsystems, Inc. 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
@ -568,6 +568,7 @@ SUNWprivate_1.1 {
AWTCharAscent;
AWTCharDescent;
AWTDrawGlyphList;
AccelGlyphCache_RemoveAllCellInfos;
local:
*;

View File

@ -116,7 +116,7 @@ ifeq ($(PLATFORM),windows)
FILES_c_platform = fontpath.c \
lcdglyph.c
FILES_cpp_platform = D3DTextRenderer.cpp
FILES_cpp_platform =
else
FILES_c_platform = X11FontScaler.c \
X11TextRenderer.c

View File

@ -80,8 +80,6 @@ ifeq ($(PLATFORM), windows)
OTHER_CFLAGS += -DCC_NOEX
OTHER_CXXFLAGS += -DCC_NOEX
FILES_export += sun/java2d/d3d/D3DTextRenderer.java
else # PLATFORM unix
FILES_export += \
@ -166,7 +164,6 @@ endif
ifeq ($(PLATFORM), windows)
vpath %.cpp $(PLATFORM_SRC)/native/sun/windows
vpath %.cpp $(PLATFORM_SRC)/native/sun/java2d/d3d
else # PLATFORM
#
@ -201,7 +198,6 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR) \
-I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders
ifeq ($(PLATFORM), windows)
CPPFLAGS += -I$(PLATFORM_SRC)/native/sun/windows \
-I$(PLATFORM_SRC)/native/sun/java2d/d3d
CPPFLAGS += -I$(PLATFORM_SRC)/native/sun/windows
endif

View File

@ -1,5 +1,5 @@
#
# Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2001-2008 Sun Microsystems, Inc. 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
@ -60,6 +60,7 @@ SUNWprivate_1.1 {
X11SurfaceData_GetOps;
Java_java_awt_Font_initIDs;
Java_sun_font_FontManager_getFontConfig;
Java_sun_font_FontManager_getFontConfigVersion;
Java_sun_font_FontManager_getFontConfigAASettings;
Java_sun_font_FontManager_getFontPath;
Java_sun_font_FontManager_setNativeFontPath;
@ -98,6 +99,7 @@ SUNWprivate_1.1 {
AWTCharAscent;
AWTCharDescent;
AWTDrawGlyphList;
AccelGlyphCache_RemoveAllCellInfos;
local:

View File

@ -1 +1 @@
$(OBJDIR)/jawt.obj:: $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_AlphaComposite.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_AWTEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Component.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Dimension.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Event.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Font.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_PlatformFont.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jawt_md.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/ddrawObject.h ../../../src/windows/native/sun/java2d/windows/dxCapabilities.h ../../../src/windows/native/sun/java2d/windows/RegistryKey.h ../../../src/windows/native/sun/java2d/windows/Win32SurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_DrawingSurface.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
$(OBJDIR)/jawt.obj:: $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_AWTEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Component.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Dimension.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Event.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_Font.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_PlatformFont.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/../../awt/CClassHeaders/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jawt_md.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/UnicowsLoader.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_DrawingSurface.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/stdhdrs.h

View File

@ -1,5 +1,5 @@
#
# Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2002-2008 Sun Microsystems, Inc. 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
@ -177,6 +177,7 @@ SUNWprivate_1.1 {
Java_java_awt_TextField_initIDs;
Java_java_awt_TrayIcon_initIDs;
Java_sun_font_FontManager_getFontConfig;
Java_sun_font_FontManager_getFontConfigVersion;
Java_sun_font_FontManager_getFontConfigAASettings;
Java_sun_font_FontManager_getFontPath;
Java_sun_font_FontManager_setNativeFontPath;
@ -241,6 +242,7 @@ SUNWprivate_1.1 {
AWTCharAscent;
AWTCharDescent;
AWTDrawGlyphList;
AccelGlyphCache_RemoveAllCellInfos;
Java_sun_awt_X11_XToolkit_waitForEvents;
Java_java_awt_Event_initIDs;

View File

@ -51,6 +51,7 @@ SUBDIRS = \
jdwpgen \
makeclasslist \
strip_properties \
spp \
CharsetMapping
all build clean clobber::

View File

@ -0,0 +1,45 @@
#
# Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
# Makefile for build spp tool
#
BUILDDIR = ../..
PACKAGE = build.tools.spp
PRODUCT = tools
PROGRAM = spp
include $(BUILDDIR)/common/Defs.gmk
BUILDTOOL_SOURCE_ROOT = $(BUILDDIR)/tools/src
BUILDTOOL_MAIN = $(PKGDIR)/Spp.java
#
# Build tool jar rules.
#
include $(BUILDDIR)/common/BuildToolJar.gmk

View File

@ -0,0 +1,189 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.spp;
import java.util.*;
import java.util.regex.*;
/*
* Spp: A simple regex-based stream preprocessor based on Mark Reinhold's
* sed-based spp.sh
*
* Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out
*
* Source-file constructs
*
* Meaningful only at beginning of line, works with any number of keys:
*
* #if[key] Includes text between #if/#end if -Kkey specified,
* #else[key] otherwise changes text to blank lines; key test
* #end[key] may be negated by prefixing !, e.g., #if[!key]
*
* #begin If -be is specified then lines up to and including
* #end #begin, and from #end to EOF, are deleted
*
* #warn Changed into warning that file is generated
*
* // ## Changed into blank line
*
* Meaningful anywhere in line
*
* {#if[key]?yes} Expands to yes if -Kkey specified
* {#if[key]?yes:no} Expands to yes if -Kkey, otherwise no
* {#if[!key]?yes} Expands to yes if -Kother
* {#if[!key]?yes:no} Expands to yes if -Kother, otherwise no
* $var$ Expands to value if -Dvar=value given
*
* yes, no must not contain whitespace
*
* @author Xueming Shen
*/
public class Spp {
public static void main(String args[]) throws Exception {
Map<String, String> vars = new HashMap<String, String>();
Set<String> keys = new HashSet<String>();
boolean be = false;
for (String arg:args) {
if (arg.startsWith("-D")) {
int i = arg.indexOf('=');
vars.put(arg.substring(2, i),arg.substring(i+1));
} else if (arg.startsWith("-K")) {
keys.add(arg.substring(2));
} else if ("-be".equals(arg)) {
be = true;
} else {
System.err.println("Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out");
System.exit(-1);
}
}
StringBuffer out = new StringBuffer();
new Spp().spp(new Scanner(System.in),
out, "",
keys, vars, be,
false);
System.out.print(out.toString());
}
static final String LNSEP = System.getProperty("line.separator");
static final String KEY = "([a-zA-Z0-9]+)";
static final String VAR = "([a-zA-Z0-9_\\-]+)";
static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\$]+)"; // $ -- hack embedded $var$
static final int GN_NOT = 1;
static final int GN_KEY = 2;
static final int GN_YES = 3;
static final int GN_NO = 5;
static final int GN_VAR = 6;
Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
Matcher vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
void append(StringBuffer buf, String ln,
Set<String> keys, Map<String, String> vars) {
vardef.reset(ln);
while (vardef.find()) {
String repl = "";
if (vardef.group(GN_VAR) != null)
repl = vars.get(vardef.group(GN_VAR));
else {
boolean test = keys.contains(vardef.group(GN_KEY));
if (vardef.group(GN_NOT) != null)
test = !test;
repl = test?vardef.group(GN_YES):vardef.group(GN_NO);
if (repl == null)
repl = "";
else { // embedded $var$
while (vardef2.reset(repl).find()) {
repl = vardef2.replaceFirst(vars.get(vardef2.group(1)));
}
}
}
vardef.appendReplacement(buf, repl);
}
vardef.appendTail(buf);
}
// return true if #end[key], #end or EOF reached
boolean spp(Scanner in, StringBuffer buf, String key,
Set<String> keys, Map<String, String> vars,
boolean be, boolean skip) {
while (in.hasNextLine()) {
String ln = in.nextLine();
if (be) {
if (ln.startsWith("#begin")) {
buf.setLength(0); //clean up to this line
continue;
}
if (ln.equals("#end")) {
while (in.hasNextLine())
in.nextLine();
return true; //discard the rest to EOF
}
}
if (ifkey.reset(ln).find()) {
String k = ifkey.group(GN_KEY);
boolean test = keys.contains(k);
if (ifkey.group(GN_NOT) != null)
test = !test;
buf.append(LNSEP);
if (!spp(in, buf, k, keys, vars, be, skip || !test)) {
spp(in, buf, k, keys, vars, be, skip || test);
}
continue;
}
if (elsekey.reset(ln).find()) {
if (!key.equals(elsekey.group(GN_KEY))) {
throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
}
buf.append(LNSEP);
return false;
}
if (endkey.reset(ln).find()) {
if (!key.equals(endkey.group(GN_KEY))) {
throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
}
buf.append(LNSEP);
return true;
}
if (ln.startsWith("#warn")) {
ln = "// -- This file was mechanically generated: Do not edit! -- //";
} else if (ln.trim().startsWith("// ##")) {
ln = "";
}
if (!skip) {
append(buf, ln, keys, vars);
}
buf.append(LNSEP);
}
return true;
}
}

View File

@ -540,7 +540,6 @@ ownedMonitorsWithStackDepth(PacketInputStream *in, PacketOutputStream *out)
jvmtiError error = JVMTI_ERROR_NONE;
jint count = 0;
jint depth;
jvmtiMonitorStackDepthInfo *monitors=NULL;
error = JVMTI_FUNC_PTR(gdata->jvmti,GetOwnedMonitorStackDepthInfo)

View File

@ -473,7 +473,7 @@ transport_startTransport(jboolean isServer, char *name, char *address,
/*
* Record listener address in a system property
*/
len = strlen(name) + strlen(retAddress) + 2; /* ':' and '\0' */
len = (int)strlen(name) + (int)strlen(retAddress) + 2; /* ':' and '\0' */
prop_value = (char*)jvmtiAllocate(len);
strcpy(prop_value, name);
strcat(prop_value, ":");

View File

@ -26,6 +26,7 @@
package com.sun.jmx.mbeanserver;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@ -113,4 +114,32 @@ public class Util {
public static <T> T cast(Object x) {
return (T) x;
}
/**
* Computes a descriptor hashcode from its names and values.
* @param names the sorted array of descriptor names.
* @param values the array of descriptor values.
* @return a hash code value, as described in {@link #hashCode(Descriptor)}
*/
public static int hashCode(String[] names, Object[] values) {
int hash = 0;
for (int i = 0; i < names.length; i++) {
Object v = values[i];
int h;
if (v == null) {
h = 0;
} else if (v instanceof Object[]) {
h = Arrays.deepHashCode((Object[]) v);
} else if (v.getClass().isArray()) {
h = Arrays.deepHashCode(new Object[]{v}) - 31;
// hashcode of a list containing just v is
// v.hashCode() + 31, see List.hashCode()
} else {
h = v.hashCode();
}
hash += names[i].toLowerCase().hashCode() ^ h;
}
return hash;
}
}

View File

@ -74,7 +74,11 @@ import sun.awt.dnd.SunDropTargetEvent;
import sun.awt.im.CompositionArea;
import sun.java2d.SunGraphics2D;
import sun.java2d.pipe.Region;
import sun.awt.image.VSyncedBSManager;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
import sun.awt.RequestFocusController;
import sun.java2d.SunGraphicsEnvironment;
/**
* A <em>component</em> is an object having a graphical representation
@ -3522,6 +3526,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (numBuffers == 1) {
bufferStrategy = new SingleBufferStrategy(caps);
} else {
SunGraphicsEnvironment sge = (SunGraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (!caps.isPageFlipping() && sge.isFlipStrategyPreferred(peer)) {
caps = new ProxyCapabilities(caps);
}
// assert numBuffers > 1;
if (caps.isPageFlipping()) {
bufferStrategy = new FlipSubRegionBufferStrategy(numBuffers, caps);
@ -3531,6 +3540,25 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/**
* This is a proxy capabilities class used when a FlipBufferStrategy
* is created instead of the requested Blit strategy.
*
* @see sun.awt.SunGraphicsEnvironment#isFlipStrategyPreferred(ComponentPeer)
*/
private class ProxyCapabilities extends ExtendedBufferCapabilities {
private BufferCapabilities orig;
private ProxyCapabilities(BufferCapabilities orig) {
super(orig.getFrontBufferCapabilities(),
orig.getBackBufferCapabilities(),
orig.getFlipContents() ==
BufferCapabilities.FlipContents.BACKGROUND ?
BufferCapabilities.FlipContents.BACKGROUND :
BufferCapabilities.FlipContents.COPIED);
this.orig = orig;
}
}
/**
* @return the buffer strategy used by this component
* @see Window#createBufferStrategy
@ -3660,16 +3688,30 @@ public abstract class Component implements ImageObserver, MenuContainer,
width = getWidth();
height = getHeight();
if (drawBuffer == null) {
peer.createBuffers(numBuffers, caps);
} else {
if (drawBuffer != null) {
// dispose the existing backbuffers
drawBuffer = null;
drawVBuffer = null;
destroyBuffers();
// ... then recreate the backbuffers
peer.createBuffers(numBuffers, caps);
}
if (caps instanceof ExtendedBufferCapabilities) {
ExtendedBufferCapabilities ebc =
(ExtendedBufferCapabilities)caps;
if (ebc.getVSync() == VSYNC_ON) {
// if this buffer strategy is not allowed to be v-synced,
// change the caps that we pass to the peer but keep on
// trying to create v-synced buffers;
// do not throw IAE here in case it is disallowed, see
// ExtendedBufferCapabilities for more info
if (!VSyncedBSManager.vsyncAllowed(this)) {
caps = ebc.derive(VSYNC_DEFAULT);
}
}
}
peer.createBuffers(numBuffers, caps);
updateInternalBuffers();
}
@ -3714,7 +3756,23 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/
protected void flip(BufferCapabilities.FlipContents flipAction) {
if (peer != null) {
peer.flip(flipAction);
Image backBuffer = getBackBuffer();
if (backBuffer != null) {
peer.flip(0, 0,
backBuffer.getWidth(null),
backBuffer.getHeight(null), flipAction);
}
} else {
throw new IllegalStateException(
"Component must have a valid peer");
}
}
void flipSubRegion(int x1, int y1, int x2, int y2,
BufferCapabilities.FlipContents flipAction)
{
if (peer != null) {
peer.flip(x1, y1, x2, y2, flipAction);
} else {
throw new IllegalStateException(
"Component must have a valid peer");
@ -3725,6 +3783,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Destroys the buffers created through this object
*/
protected void destroyBuffers() {
VSyncedBSManager.releaseVsync(this);
if (peer != null) {
peer.destroyBuffers();
} else {
@ -3737,8 +3796,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @return the buffering capabilities of this strategy
*/
public BufferCapabilities getCapabilities() {
if (caps instanceof ProxyCapabilities) {
return ((ProxyCapabilities)caps).orig;
} else {
return caps;
}
}
/**
* @return the graphics on the drawing buffer. This method may not
@ -3824,6 +3887,14 @@ public abstract class Component implements ImageObserver, MenuContainer,
flip(caps.getFlipContents());
}
/**
* Makes specified region of the the next available buffer visible
* by either blitting or flipping.
*/
void showSubRegion(int x1, int y1, int x2, int y2) {
flipSubRegion(x1, y1, x2, y2, caps.getFlipContents());
}
/**
* {@inheritDoc}
* @since 1.6
@ -4094,8 +4165,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Private class to perform sub-region flipping.
* REMIND: this subclass currently punts on subregions and
* flips the entire buffer.
*/
private class FlipSubRegionBufferStrategy extends FlipBufferStrategy
implements SubRegionShowable
@ -4109,14 +4178,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
public void show(int x1, int y1, int x2, int y2) {
show();
showSubRegion(x1, y1, x2, y2);
}
// This is invoked by Swing on the toolkit thread.
public boolean validateAndShow(int x1, int y1, int x2, int y2) {
revalidate(false);
if (!contentsRestored() && !contentsLost()) {
show();
public boolean showIfNotLost(int x1, int y1, int x2, int y2) {
if (!contentsLost()) {
showSubRegion(x1, y1, x2, y2);
return !contentsLost();
}
return false;
@ -4144,9 +4212,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
// This method is called by Swing on the toolkit thread.
public boolean validateAndShow(int x1, int y1, int x2, int y2) {
revalidate(false);
if (!contentsRestored() && !contentsLost()) {
public boolean showIfNotLost(int x1, int y1, int x2, int y2) {
if (!contentsLost()) {
showSubRegion(x1, y1, x2, y2);
return !contentsLost();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. 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
@ -236,6 +236,10 @@ public abstract class GraphicsDevice {
*/
public void setFullScreenWindow(Window w) {
if (fullScreenWindow != null && windowedModeBounds != null) {
// if the window went into fs mode before it was realized it may
// have (0,0) dimensions
if (windowedModeBounds.width == 0) windowedModeBounds.width = 1;
if (windowedModeBounds.height == 0) windowedModeBounds.height = 1;
fullScreenWindow.setBounds(windowedModeBounds);
}
// Set the full screen window

View File

@ -1,5 +1,5 @@
/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1999-2008 Sun Microsystems, Inc. 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
@ -25,12 +25,18 @@
package java.awt;
import java.awt.peer.*;
import java.awt.image.*;
import java.awt.event.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.DirectColorModel;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.awt.peer.RobotPeer;
import java.lang.reflect.InvocationTargetException;
import sun.awt.ComponentFactory;
import sun.awt.SunToolkit;
import sun.awt.image.SunWritableRaster;
import sun.security.util.SecurityConstants;
/**
@ -335,6 +341,10 @@ public class Robot {
/* blue mask */ 0x000000FF);
}
// need to sync the toolkit prior to grabbing the pixels since in some
// cases rendering to the screen may be delayed
Toolkit.getDefaultToolkit().sync();
int pixels[];
int[] bandmasks = new int[3];
@ -346,6 +356,7 @@ public class Robot {
bandmasks[2] = screenCapCM.getBlueMask();
raster = Raster.createPackedRaster(buffer, translatedRect.width, translatedRect.height, translatedRect.width, bandmasks, null);
SunWritableRaster.makeTrackable(buffer);
image = new BufferedImage(screenCapCM, raster, false, null);

View File

@ -530,6 +530,12 @@ public abstract class DataBuffer {
public StateTrackableDelegate getTrackable(DataBuffer db) {
return db.theTrackable;
}
public void setTrackable(DataBuffer db,
StateTrackableDelegate trackable)
{
db.theTrackable = trackable;
}
});
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1995-2008 Sun Microsystems, Inc. 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
@ -88,7 +88,7 @@ public interface ComponentPeer {
boolean handlesWheelScrolling();
void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException;
Image getBackBuffer();
void flip(BufferCapabilities.FlipContents flipAction);
void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction);
void destroyBuffers();
/**

View File

@ -25,12 +25,9 @@
package java.net;
import java.security.AccessController;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.InvalidObjectException;
import sun.security.action.*;
import java.util.Enumeration;
/**
@ -358,13 +355,13 @@ class Inet6Address extends InetAddress {
}
private int deriveNumericScope (NetworkInterface ifc) throws UnknownHostException {
Enumeration addresses = ifc.getInetAddresses();
Enumeration<InetAddress> addresses = ifc.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress address = (InetAddress)addresses.nextElement();
if (!(address instanceof Inet6Address)) {
InetAddress addr = addresses.nextElement();
if (!(addr instanceof Inet6Address)) {
continue;
}
Inet6Address ia6_addr = (Inet6Address)address;
Inet6Address ia6_addr = (Inet6Address)addr;
/* check if site or link local prefixes match */
if (!differentLocalAddressTypes(ia6_addr)){
/* type not the same, so carry on searching */
@ -377,22 +374,22 @@ class Inet6Address extends InetAddress {
}
private int deriveNumericScope (String ifname) throws UnknownHostException {
Enumeration en;
Enumeration<NetworkInterface> en;
try {
en = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
throw new UnknownHostException ("could not enumerate local network interfaces");
}
while (en.hasMoreElements()) {
NetworkInterface ifc = (NetworkInterface)en.nextElement();
NetworkInterface ifc = en.nextElement();
if (ifc.getName().equals (ifname)) {
Enumeration addresses = ifc.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress address = (InetAddress)addresses.nextElement();
if (!(address instanceof Inet6Address)) {
InetAddress addr = (InetAddress)addresses.nextElement();
if (!(addr instanceof Inet6Address)) {
continue;
}
Inet6Address ia6_addr = (Inet6Address)address;
Inet6Address ia6_addr = (Inet6Address)addr;
/* check if site or link local prefixes match */
if (!differentLocalAddressTypes(ia6_addr)){
/* type not the same, so carry on searching */
@ -420,22 +417,23 @@ class Inet6Address extends InetAddress {
if (ifname != null && !"".equals (ifname)) {
try {
scope_ifname = NetworkInterface.getByName(ifname);
try {
scope_id = deriveNumericScope (scope_ifname);
} catch (UnknownHostException e) {
// should not happen
assert false;
}
} catch (SocketException e) {}
if (scope_ifname == null) {
/* the interface does not exist on this system, so we clear
* the scope information completely */
scope_id_set = false;
scope_ifname_set = false;
scope_id = 0;
} else {
try {
scope_id = deriveNumericScope (scope_ifname);
} catch (UnknownHostException e) {
// should not happen
assert false;
}
}
} catch (SocketException e) {}
}
/* if ifname was not supplied, then the numeric info is used */
ipaddress = ipaddress.clone();
@ -460,6 +458,7 @@ class Inet6Address extends InetAddress {
* an IP multicast address
* @since JDK1.1
*/
@Override
public boolean isMulticastAddress() {
return ((ipaddress[0] & 0xff) == 0xff);
}
@ -470,6 +469,7 @@ class Inet6Address extends InetAddress {
* a wildcard address.
* @since 1.4
*/
@Override
public boolean isAnyLocalAddress() {
byte test = 0x00;
for (int i = 0; i < INADDRSZ; i++) {
@ -485,6 +485,7 @@ class Inet6Address extends InetAddress {
* a loopback address; or false otherwise.
* @since 1.4
*/
@Override
public boolean isLoopbackAddress() {
byte test = 0x00;
for (int i = 0; i < 15; i++) {
@ -500,6 +501,7 @@ class Inet6Address extends InetAddress {
* a link local address; or false if address is not a link local unicast address.
* @since 1.4
*/
@Override
public boolean isLinkLocalAddress() {
return ((ipaddress[0] & 0xff) == 0xfe
&& (ipaddress[1] & 0xc0) == 0x80);
@ -512,6 +514,7 @@ class Inet6Address extends InetAddress {
* a site local address; or false if address is not a site local unicast address.
* @since 1.4
*/
@Override
public boolean isSiteLocalAddress() {
return ((ipaddress[0] & 0xff) == 0xfe
&& (ipaddress[1] & 0xc0) == 0xc0);
@ -525,6 +528,7 @@ class Inet6Address extends InetAddress {
* of global scope or it is not a multicast address
* @since 1.4
*/
@Override
public boolean isMCGlobal() {
return ((ipaddress[0] & 0xff) == 0xff
&& (ipaddress[1] & 0x0f) == 0x0e);
@ -538,6 +542,7 @@ class Inet6Address extends InetAddress {
* of node-local scope or it is not a multicast address
* @since 1.4
*/
@Override
public boolean isMCNodeLocal() {
return ((ipaddress[0] & 0xff) == 0xff
&& (ipaddress[1] & 0x0f) == 0x01);
@ -551,6 +556,7 @@ class Inet6Address extends InetAddress {
* of link-local scope or it is not a multicast address
* @since 1.4
*/
@Override
public boolean isMCLinkLocal() {
return ((ipaddress[0] & 0xff) == 0xff
&& (ipaddress[1] & 0x0f) == 0x02);
@ -564,6 +570,7 @@ class Inet6Address extends InetAddress {
* of site-local scope or it is not a multicast address
* @since 1.4
*/
@Override
public boolean isMCSiteLocal() {
return ((ipaddress[0] & 0xff) == 0xff
&& (ipaddress[1] & 0x0f) == 0x05);
@ -578,6 +585,7 @@ class Inet6Address extends InetAddress {
* or it is not a multicast address
* @since 1.4
*/
@Override
public boolean isMCOrgLocal() {
return ((ipaddress[0] & 0xff) == 0xff
&& (ipaddress[1] & 0x0f) == 0x08);
@ -590,6 +598,7 @@ class Inet6Address extends InetAddress {
*
* @return the raw IP address of this object.
*/
@Override
public byte[] getAddress() {
return ipaddress.clone();
}
@ -624,6 +633,7 @@ class Inet6Address extends InetAddress {
*
* @return the raw IP address in a string format.
*/
@Override
public String getHostAddress() {
String s = numericToTextFormat(ipaddress);
if (scope_ifname_set) { /* must check this first */
@ -639,6 +649,7 @@ class Inet6Address extends InetAddress {
*
* @return a hash code value for this IP address.
*/
@Override
public int hashCode() {
if (ipaddress != null) {
@ -677,6 +688,7 @@ class Inet6Address extends InetAddress {
* <code>false</code> otherwise.
* @see java.net.InetAddress#getAddress()
*/
@Override
public boolean equals(Object obj) {
if (obj == null ||
!(obj instanceof Inet6Address))

View File

@ -82,7 +82,7 @@ public abstract class AbstractSelector
this.provider = provider;
}
private final Set cancelledKeys = new HashSet();
private final Set<SelectionKey> cancelledKeys = new HashSet<SelectionKey>();
void cancel(SelectionKey k) { // package-private
synchronized (cancelledKeys) {

View File

@ -303,7 +303,7 @@ public abstract class Charset$Coder$ {
#if[encoder]
private WeakReference cachedDecoder = null;
private WeakReference<CharsetDecoder> cachedDecoder = null;
/**
* Tells whether or not the given byte array is a legal replacement value
@ -322,13 +322,13 @@ public abstract class Charset$Coder$ {
* is a legal replacement value for this encoder
*/
public boolean isLegalReplacement(byte[] repl) {
WeakReference wr = cachedDecoder;
WeakReference<CharsetDecoder> wr = cachedDecoder;
CharsetDecoder dec = null;
if ((wr == null) || ((dec = (CharsetDecoder)wr.get()) == null)) {
if ((wr == null) || ((dec = wr.get()) == null)) {
dec = charset().newDecoder();
dec.onMalformedInput(CodingErrorAction.REPORT);
dec.onUnmappableCharacter(CodingErrorAction.REPORT);
cachedDecoder = new WeakReference(dec);
cachedDecoder = new WeakReference<CharsetDecoder>(dec);
} else {
dec.reset();
}

View File

@ -379,7 +379,7 @@ public abstract class Charset
}
// Thread-local gate to prevent recursive provider lookups
private static ThreadLocal gate = new ThreadLocal();
private static ThreadLocal<ThreadLocal> gate = new ThreadLocal<ThreadLocal>();
private static Charset lookupViaProviders(final String charsetName) {
@ -539,9 +539,9 @@ public abstract class Charset
// Fold charsets from the given iterator into the given map, ignoring
// charsets whose names already have entries in the map.
//
private static void put(Iterator i, Map m) {
private static void put(Iterator<Charset> i, Map<String,Charset> m) {
while (i.hasNext()) {
Charset cs = (Charset)i.next();
Charset cs = i.next();
if (!m.containsKey(cs.name()))
m.put(cs.name(), cs);
}
@ -623,7 +623,7 @@ public abstract class Charset
private final String name; // tickles a bug in oldjavac
private final String[] aliases; // tickles a bug in oldjavac
private Set aliasSet = null;
private Set<String> aliasSet = null;
/**
* Initializes a new charset with the given canonical name and alias
@ -665,7 +665,7 @@ public abstract class Charset
if (aliasSet != null)
return aliasSet;
int n = aliases.length;
HashSet hs = new HashSet(n);
HashSet<String> hs = new HashSet<String>(n);
for (int i = 0; i < n; i++)
hs.add(aliases[i]);
aliasSet = Collections.unmodifiableSet(hs);

View File

@ -194,7 +194,7 @@ public class CoderResult {
private static abstract class Cache {
private Map cache = null;
private Map<Integer,WeakReference<CoderResult>> cache = null;
protected abstract CoderResult create(int len);
@ -202,16 +202,16 @@ public class CoderResult {
if (len <= 0)
throw new IllegalArgumentException("Non-positive length");
Integer k = new Integer(len);
WeakReference w;
WeakReference<CoderResult> w;
CoderResult e = null;
if (cache == null) {
cache = new HashMap();
} else if ((w = (WeakReference)cache.get(k)) != null) {
e = (CoderResult)w.get();
cache = new HashMap<Integer,WeakReference<CoderResult>>();
} else if ((w = cache.get(k)) != null) {
e = w.get();
}
if (e == null) {
e = create(len);
cache.put(k, new WeakReference(e));
cache.put(k, new WeakReference<CoderResult>(e));
}
return e;
}

View File

@ -29,7 +29,7 @@ formatVersion=1
# It is a serial number that accompanies with each amendment, such as
# 'MAxxx.doc'
dataVersion=139
dataVersion=140
# List of all valid ISO 4217 currency codes.
# To ensure compatibility, do not remove codes.
@ -187,7 +187,7 @@ HR=HRK
# CUBA
CU=CUP
# CYPRUS
CY=CYP
CY=EUR
# CZECH REPUBLIC
CZ=CZK
# DENMARK
@ -346,7 +346,7 @@ MV=MVR
# MALI
ML=XOF
# MALTA
MT=MTL
MT=EUR
# MARSHALL ISLANDS
MH=USD
# MARTINIQUE

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2004-2008 Sun Microsystems, Inc. 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
@ -25,6 +25,7 @@
package javax.management;
import com.sun.jmx.mbeanserver.Util;
import java.io.InvalidObjectException;
import java.lang.reflect.Array;
import java.util.Arrays;
@ -362,6 +363,7 @@ public class ImmutableDescriptor implements Descriptor {
*/
// Note: this Javadoc is copied from javax.management.Descriptor
// due to 6369229.
@Override
public boolean equals(Object o) {
if (o == this)
return true;
@ -410,29 +412,15 @@ public class ImmutableDescriptor implements Descriptor {
*/
// Note: this Javadoc is copied from javax.management.Descriptor
// due to 6369229.
@Override
public int hashCode() {
if (hashCode == -1) {
int hash = 0;
for (int i = 0; i < names.length; i++) {
Object v = values[i];
int h;
if (v == null)
h = 0;
else if (v instanceof Object[])
h = Arrays.deepHashCode((Object[]) v);
else if (v.getClass().isArray()) {
h = Arrays.deepHashCode(new Object[] {v}) - 31;
// hashcode of a list containing just v is
// v.hashCode() + 31, see List.hashCode()
} else
h = v.hashCode();
hash += names[i].toLowerCase().hashCode() ^ h;
}
hashCode = hash;
hashCode = Util.hashCode(names, values);
}
return hashCode;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
for (int i = 0; i < names.length; i++) {
@ -479,6 +467,7 @@ public class ImmutableDescriptor implements Descriptor {
* If the descriptor construction fails for any reason, this exception will
* be thrown.
*/
@Override
public Descriptor clone() {
return this;
}

View File

@ -33,6 +33,7 @@ package javax.management.modelmbean;
import static com.sun.jmx.defaults.JmxProperties.MODELMBEAN_LOGGER;
import static com.sun.jmx.mbeanserver.Util.cast;
import com.sun.jmx.mbeanserver.GetPropertyAction;
import com.sun.jmx.mbeanserver.Util;
import java.io.IOException;
import java.io.ObjectInputStream;
@ -774,6 +775,7 @@ public class DescriptorSupport
* fails for any reason, this exception will be thrown.
*/
@Override
public synchronized Object clone() throws RuntimeOperationsException {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
MODELMBEAN_LOGGER.logp(Level.FINEST,
@ -814,13 +816,16 @@ public class DescriptorSupport
* otherwise.
*
*/
// XXXX TODO: This is not very efficient!
// Note: this Javadoc is copied from javax.management.Descriptor
// due to 6369229.
@Override
public synchronized boolean equals(Object o) {
if (o == this)
return true;
if (! (o instanceof Descriptor))
return false;
if (o instanceof ImmutableDescriptor)
return o.equals(this);
return new ImmutableDescriptor(descriptorMap).equals(o);
}
@ -844,11 +849,16 @@ public class DescriptorSupport
* @return A hash code value for this object.
*
*/
// XXXX TODO: This is not very efficient!
// Note: this Javadoc is copied from javax.management.Descriptor
// due to 6369229.
@Override
public synchronized int hashCode() {
return new ImmutableDescriptor(descriptorMap).hashCode();
final int size = descriptorMap.size();
// descriptorMap is sorted with a comparator that ignores cases.
//
return Util.hashCode(
descriptorMap.keySet().toArray(new String[size]),
descriptorMap.values().toArray(new Object[size]));
}
/**
@ -1278,6 +1288,7 @@ public class DescriptorSupport
* field Names or field Values. If the descriptor string fails
* for any reason, this exception will be thrown.
*/
@Override
public synchronized String toString() {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
MODELMBEAN_LOGGER.logp(Level.FINEST,

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2008 Sun Microsystems, Inc. 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
@ -263,7 +263,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
(SubRegionShowable)bufferStrategy;
boolean paintAllOnExpose = info.getPaintAllOnExpose();
info.setPaintAllOnExpose(false);
if (bsSubRegion.validateAndShow(x, y, (x + w), (y + h))) {
if (bsSubRegion.showIfNotLost(x, y, (x + w), (y + h))) {
return !paintAllOnExpose;
}
// Mark the buffer as needing to be repainted. We don't

View File

@ -72,6 +72,11 @@ public abstract class FontConfiguration {
protected boolean preferLocaleFonts;
protected boolean preferPropFonts;
private File fontConfigFile;
private boolean foundOsSpecificFile;
private boolean inited;
private String javaLib;
/* A default FontConfiguration must be created before an alternate
* one to ensure proper static initialisation takes place.
*/
@ -80,14 +85,25 @@ public abstract class FontConfiguration {
logger = Logger.getLogger("sun.awt.FontConfiguration");
}
this.environment = environment;
this.preferLocaleFonts = false;
this.preferPropFonts = false;
setOsNameAndVersion(); /* static initialization */
setEncoding(); /* static initialization */
fontConfig = this; /* static initialization */
/* Separating out the file location from the rest of the
* initialisation, so the caller has the option of doing
* something else if a suitable file isn't found.
*/
findFontConfigFile();
}
readFontConfigFile();
public synchronized boolean init() {
if (!inited) {
this.preferLocaleFonts = false;
this.preferPropFonts = false;
fontConfig = this; /* static initialization */
readFontConfigFile(fontConfigFile);
initFontConfig();
inited = true;
}
return true;
}
public FontConfiguration(SunGraphicsEnvironment environment,
@ -121,21 +137,51 @@ public abstract class FontConfiguration {
/////////////////////////////////////////////////////////////////////
// methods for loading the FontConfig file //
/////////////////////////////////////////////////////////////////////
private void readFontConfigFile() {
// Find fontconfig file
File f = null;
public boolean foundOsSpecificFile() {
return foundOsSpecificFile;
}
/* Smoke test to see if we can trust this configuration by testing if
* the first slot of a composite font maps to an installed file.
*/
public boolean fontFilesArePresent() {
init();
short fontNameID = compFontNameIDs[0][0][0];
short fileNameID = getComponentFileID(fontNameID);
final String fileName = mapFileName(getComponentFileName(fileNameID));
Boolean exists = (Boolean)java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
try {
File f = new File(fileName);
return Boolean.valueOf(f.exists());
}
catch (Exception e) {
return false;
}
}
});
return exists.booleanValue();
}
private void findFontConfigFile() {
foundOsSpecificFile = true; // default assumption.
String javaHome = System.getProperty("java.home");
if (javaHome == null) {
throw new Error("java.home property not set");
}
String javaLib = javaHome + File.separator + "lib";
javaLib = javaHome + File.separator + "lib";
String userConfigFile = System.getProperty("sun.awt.fontconfig");
if (userConfigFile != null) {
f = new File(userConfigFile);
fontConfigFile = new File(userConfigFile);
} else {
f = findFontConfigFile(javaLib);
fontConfigFile = findFontConfigFile(javaLib);
}
}
private void readFontConfigFile(File f) {
/* This is invoked here as readFontConfigFile is only invoked
* once per VM, and always in a privileged context, thus the
* directory containing installed fall back fonts is accessed
@ -167,7 +213,7 @@ public abstract class FontConfiguration {
}
}
private void getInstalledFallbackFonts(String javaLib) {
protected void getInstalledFallbackFonts(String javaLib) {
String fallbackDirName = javaLib + File.separator +
"fonts" + File.separator + "fallback";
@ -229,6 +275,8 @@ public abstract class FontConfiguration {
return configFile;
}
}
foundOsSpecificFile = false;
configFile = findImpl(baseName);
if (configFile != null) {
return configFile;
@ -506,12 +554,12 @@ public abstract class FontConfiguration {
/////////////////////////////////////////////////////////////////////
protected static final int NUM_FONTS = 5;
protected static final int NUM_STYLES = 4;
private static final String[] fontNames
protected static final String[] fontNames
= {"serif", "sansserif", "monospaced", "dialog", "dialoginput"};
private static final String[] publicFontNames
protected static final String[] publicFontNames
= {Font.SERIF, Font.SANS_SERIF, Font.MONOSPACED, Font.DIALOG,
Font.DIALOG_INPUT};
private static final String[] styleNames
protected static final String[] styleNames
= {"plain", "bold", "italic", "bolditalic"};
/**
@ -656,7 +704,7 @@ public abstract class FontConfiguration {
return null;
}
private static String[] installedFallbackFontFiles = null;
protected static String[] installedFallbackFontFiles = null;
/**
* Maps a file name given in the font configuration file

View File

@ -1,5 +1,5 @@
/*
* Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-2008 Sun Microsystems, Inc. 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
@ -255,7 +255,9 @@ public class NullComponentPeer implements LightweightPeer,
throw new IllegalStateException(
"Page-flipping is not allowed on a lightweight component");
}
public void flip(BufferCapabilities.FlipContents flipAction) {
public void flip(int x1, int y1, int x2, int y2,
BufferCapabilities.FlipContents flipAction)
{
throw new IllegalStateException(
"Page-flipping is not allowed on a lightweight component");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2008 Sun Microsystems, Inc. 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
@ -39,10 +39,11 @@ public interface SubRegionShowable {
public void show(int x1, int y1, int x2, int y2);
/**
* Validates the buffer and if successful shows the specified region.
* Shows the specified region if the buffer is not lost and the dimensions
* of the back-buffer match those of the component.
*
* @return true if successful
*/
// NOTE: this is invoked by swing on the toolkit thread!
public boolean validateAndShow(int x1, int y1, int x2, int y2);
public boolean showIfNotLost(int x1, int y1, int x2, int y2);
}

View File

@ -29,19 +29,18 @@ import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.ImageCapabilities;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.java2d.SurfaceManagerFactory;
import sun.java2d.DestSurfaceProvider;
import sun.java2d.Surface;
import static sun.java2d.pipe.hw.AccelSurface.*;
/**
* This class is the base implementation of the VolatileImage
@ -52,23 +51,28 @@ import sun.java2d.SurfaceManagerFactory;
* appropriate VolatileSurfaceManager for the GraphicsConfiguration
* under which this SunVolatileImage was created.
*/
public class SunVolatileImage extends VolatileImage {
public class SunVolatileImage extends VolatileImage
implements DestSurfaceProvider
{
protected VolatileSurfaceManager volSurfaceManager;
protected Component comp;
private GraphicsConfiguration graphicsConfig;
private Font defaultFont;
private int width, height;
private int forcedAccelSurfaceType;
private SunVolatileImage(Component comp,
protected SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
int transparency, ImageCapabilities caps)
int transparency, ImageCapabilities caps,
int accType)
{
this.comp = comp;
this.graphicsConfig = graphicsConfig;
this.width = width;
this.height = height;
this.forcedAccelSurfaceType = accType;
if (!(transparency == Transparency.OPAQUE ||
transparency == Transparency.BITMASK ||
transparency == Transparency.TRANSLUCENT))
@ -92,7 +96,7 @@ public class SunVolatileImage extends VolatileImage {
ImageCapabilities caps)
{
this(comp, graphicsConfig,
width, height, context, Transparency.OPAQUE, caps);
width, height, context, Transparency.OPAQUE, caps, UNDEFINED);
}
public SunVolatileImage(Component comp, int width, int height) {
@ -110,7 +114,8 @@ public class SunVolatileImage extends VolatileImage {
int width, int height, int transparency,
ImageCapabilities caps)
{
this(null, graphicsConfig, width, height, null, transparency, caps);
this(null, graphicsConfig, width, height, null, transparency,
caps, UNDEFINED);
}
public int getWidth() {
@ -144,6 +149,10 @@ public class SunVolatileImage extends VolatileImage {
return comp;
}
public int getForcedAccelSurfaceType() {
return forcedAccelSurfaceType;
}
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
@ -248,4 +257,14 @@ public class SunVolatileImage extends VolatileImage {
public ImageCapabilities getCapabilities() {
return volSurfaceManager.getCapabilities(graphicsConfig);
}
/**
* {@inheritDoc}
*
* @see sun.java2d.DestSurfaceProvider#getDestSurface
*/
@Override
public Surface getDestSurface() {
return volSurfaceManager.getPrimarySurfaceData();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. 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
@ -35,6 +35,7 @@ import java.awt.image.DataBufferInt;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import sun.java2d.StateTrackable.State;
import sun.java2d.SurfaceData;
import sun.java2d.StateTrackableDelegate;
@ -54,6 +55,7 @@ public class SunWritableRaster extends WritableRaster {
public short[] getData(DataBufferUShort dbus, int bank);
public int[] getData(DataBufferInt dbi, int bank);
public StateTrackableDelegate getTrackable(DataBuffer db);
public void setTrackable(DataBuffer db, StateTrackableDelegate trackable);
}
public static void setDataStealer(DataStealer ds) {
@ -79,6 +81,14 @@ public class SunWritableRaster extends WritableRaster {
return stealer.getTrackable(db);
}
public static void setTrackable(DataBuffer db, StateTrackableDelegate trackable) {
stealer.setTrackable(db, trackable);
}
public static void makeTrackable(DataBuffer db) {
stealer.setTrackable(db, StateTrackableDelegate.createInstance(State.STABLE));
}
public static void markDirty(DataBuffer db) {
stealer.getTrackable(db).markDirty();
}

View File

@ -0,0 +1,121 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.awt.image;
import java.awt.image.BufferStrategy;
import java.lang.ref.WeakReference;
/**
* Manages v-synced buffer strategies.
*/
public abstract class VSyncedBSManager {
private static VSyncedBSManager theInstance;
private static final boolean vSyncLimit =
Boolean.valueOf((String)java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction(
"sun.java2d.vsynclimit", "true")));
private static VSyncedBSManager getInstance(boolean create) {
if (theInstance == null && create) {
theInstance =
vSyncLimit ? new SingleVSyncedBSMgr() : new NoLimitVSyncBSMgr();
}
return theInstance;
}
abstract boolean checkAllowed(BufferStrategy bs);
abstract void relinquishVsync(BufferStrategy bs);
/**
* Returns true if the buffer strategy is allowed to be created
* v-synced.
*
* @return true if the bs is allowed to be v-synced, false otherwise
*/
public static boolean vsyncAllowed(BufferStrategy bs) {
VSyncedBSManager bsm = getInstance(true);
return bsm.checkAllowed(bs);
}
/**
* Lets the manager know that this buffer strategy is no longer interested
* in being v-synced.
*/
public static synchronized void releaseVsync(BufferStrategy bs) {
VSyncedBSManager bsm = getInstance(false);
if (bsm != null) {
bsm.relinquishVsync(bs);
}
}
/**
* An instance of the manager which allows any buffer strategy to be
* v-synced.
*/
private static final class NoLimitVSyncBSMgr extends VSyncedBSManager {
@Override
boolean checkAllowed(BufferStrategy bs) {
return true;
}
@Override
void relinquishVsync(BufferStrategy bs) {
}
}
/**
* An instance of the manager which allows only one buffer strategy to
* be v-synced at any give moment in the vm.
*/
private static final class SingleVSyncedBSMgr extends VSyncedBSManager {
private WeakReference<BufferStrategy> strategy;
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
if (strategy != null) {
BufferStrategy current = strategy.get();
if (current != null) {
return (current == bs);
}
}
strategy = new WeakReference<BufferStrategy>(bs);
return true;
}
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
if (strategy != null) {
BufferStrategy b = strategy.get();
if (b == bs) {
strategy.clear();
strategy = null;
}
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. 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
@ -37,6 +37,7 @@ import sun.awt.image.SunVolatileImage;
import sun.java2d.SunGraphicsEnvironment;
import sun.java2d.SurfaceData;
import sun.java2d.loops.CompositeType;
import static sun.java2d.pipe.hw.AccelSurface.*;
/**
* This SurfaceManager variant manages an accelerated volatile surface, if it
@ -117,7 +118,11 @@ public abstract class VolatileSurfaceManager
sdCurrent = sdAccel;
}
}
if (sdCurrent == null) {
// only initialize the backup surface for images with unforced
// acceleration type
if (sdCurrent == null &&
vImg.getForcedAccelSurfaceType() == UNDEFINED)
{
sdCurrent = getBackupSurface();
}
}
@ -270,10 +275,14 @@ public abstract class VolatileSurfaceManager
* the background).
*/
public void initContents() {
// images with forced acceleration type may have a null sdCurrent
// because we do not create a backup surface for them
if (sdCurrent != null) {
Graphics g = vImg.createGraphics();
g.clearRect(0, 0, vImg.getWidth(), vImg.getHeight());
g.dispose();
}
}
/**
* Called from a SurfaceData object, indicating that our

View File

@ -148,6 +148,7 @@ public final class FontManager {
static HashSet<String> jreLucidaFontFiles;
static String[] jreOtherFontFiles;
static boolean noOtherJREFontFiles = false; // initial assumption.
static boolean fontConfigFailed = false;
/* Used to indicate required return type from toArray(..); */
private static String[] STR_ARRAY = new String[0];
@ -3100,19 +3101,30 @@ public final class FontManager {
"monospace:bold:italic",
};
/* This class is just a data structure.
/* These next three classes are just data structures.
*/
private static class FontConfigInfo {
static class FontConfigFont {
String familyName; // eg Bitstream Vera Sans
String styleStr; // eg Bold
String fullName; // eg Bitstream Vera Sans Bold
String fontFile; // eg /usr/X11/lib/fonts/foo.ttf
}
static class FcCompFont {
String fcName; // eg sans
String fcFamily; // eg sans
String jdkName; // eg sansserif
int style; // eg 0=PLAIN
String familyName; // eg Bitstream Vera Sans
String fontFile; // eg /usr/X11/lib/fonts/foo.ttf
FontConfigFont firstFont;
FontConfigFont[] allFonts;
//boolean preferBitmaps; // if embedded bitmaps preferred over AA
CompositeFont compFont; // null if not yet created/known.
}
static class FontConfigInfo {
int fcVersion;
String[] cacheDirs = new String[4];
}
private static String getFCLocaleStr() {
Locale l = SunToolkit.getStartupLocale();
@ -3124,6 +3136,12 @@ public final class FontManager {
return localeStr;
}
/* This does cause the native libfontconfig to be loaded and unloaded,
* but it does not incur the overhead of initialisation of its
* data structures, so shouldn't have a measurable impact.
*/
public static native int getFontConfigVersion();
private static native int
getFontConfigAASettings(String locale, String fcFamily);
@ -3157,17 +3175,35 @@ public final class FontManager {
return getFontConfigAAHint("sans");
}
/* This is populated by native */
private static final FontConfigInfo fcInfo = new FontConfigInfo();
/* This array has the array elements created in Java code and is
* passed down to native to be filled in.
*/
private static FontConfigInfo[] fontConfigFonts;
private static FcCompFont[] fontConfigFonts;
/* Return an array of FontConfigInfo structs describing the primary
/* Return an array of FcCompFont structs describing the primary
* font located for each of fontconfig/GTK/Pango's logical font names.
*/
private static native void getFontConfig(String locale,
FontConfigInfo[] fonts);
FontConfigInfo fcInfo,
FcCompFont[] fonts,
boolean includeFallbacks);
static void populateFontConfig(FcCompFont[] fcInfo) {
fontConfigFonts = fcInfo;
}
static FcCompFont[] loadFontConfig() {
initFontConfigFonts(true);
return fontConfigFonts;
}
static FontConfigInfo getFontConfigInfo() {
initFontConfigFonts(true);
return fcInfo;
}
/* This can be made public if it's needed to force a re-read
* rather than using the cached values. The re-read would be needed
@ -3175,54 +3211,80 @@ public final class FontManager {
* In that event this method would need to return directly the array
* to be used by the caller in case it subsequently changed.
*/
private static void initFontConfigFonts() {
private static synchronized void
initFontConfigFonts(boolean includeFallbacks) {
if (fontConfigFonts != null) {
if (!includeFallbacks || (fontConfigFonts[0].allFonts != null)) {
return;
}
}
if (isWindows) {
if (isWindows || fontConfigFailed) {
return;
}
long t0 = 0;
if (logging) {
t0 = System.currentTimeMillis();
t0 = System.nanoTime();
}
FontConfigInfo[] fontArr = new FontConfigInfo[fontConfigNames.length];
FcCompFont[] fontArr = new FcCompFont[fontConfigNames.length];
for (int i = 0; i< fontArr.length; i++) {
fontArr[i] = new FontConfigInfo();
fontArr[i] = new FcCompFont();
fontArr[i].fcName = fontConfigNames[i];
int colonPos = fontArr[i].fcName.indexOf(':');
fontArr[i].fcFamily = fontArr[i].fcName.substring(0, colonPos);
fontArr[i].jdkName = mapFcName(fontArr[i].fcFamily);
fontArr[i].style = i % 4; // depends on array order.
}
getFontConfig(getFCLocaleStr(), fontArr);
getFontConfig(getFCLocaleStr(), fcInfo, fontArr, includeFallbacks);
/* If don't find anything (eg no libfontconfig), then just return */
for (int i = 0; i< fontArr.length; i++) {
FcCompFont fci = fontArr[i];
if (fci.firstFont == null) {
if (logging) {
logger.info("Fontconfig returned no fonts.");
}
fontConfigFailed = true;
return;
}
}
fontConfigFonts = fontArr;
if (logging) {
long t1 = System.currentTimeMillis();
logger.info("Time spent accessing fontconfig="+(t1-t0)+"ms.");
long t1 = System.nanoTime();
logger.info("Time spent accessing fontconfig="+
(t1-t0)/1000000+"ms.");
for (int i = 0; i< fontConfigFonts.length; i++) {
FontConfigInfo fci = fontConfigFonts[i];
FcCompFont fci = fontConfigFonts[i];
logger.info("FC font " + fci.fcName+" maps to family " +
fci.familyName + " in file " + fci.fontFile);
fci.firstFont.familyName +
" in file " + fci.firstFont.fontFile);
if (fci.allFonts != null) {
for (int f=0;f<fci.allFonts.length;f++) {
FontConfigFont fcf = fci.allFonts[f];
logger.info("Family=" + fcf.familyName +
" Style="+ fcf.styleStr +
" Fullname="+fcf.fullName +
" File="+fcf.fontFile);
}
}
}
}
}
private static PhysicalFont registerFromFcInfo(FontConfigInfo fcInfo) {
private static PhysicalFont registerFromFcInfo(FcCompFont fcInfo) {
/* If it's a TTC file we need to know that as we will need to
* make sure we return the right font */
int offset = fcInfo.fontFile.length()-4;
String fontFile = fcInfo.firstFont.fontFile;
int offset = fontFile.length()-4;
if (offset <= 0) {
return null;
}
String ext = fcInfo.fontFile.substring(offset).toLowerCase();
String ext = fontFile.substring(offset).toLowerCase();
boolean isTTC = ext.equals(".ttc");
/* If this file is already registered, can just return its font.
@ -3230,10 +3292,10 @@ public final class FontManager {
* a specific font, so rather than directly returning it, let
* findFont2D resolve that.
*/
PhysicalFont physFont = registeredFontFiles.get(fcInfo.fontFile);
PhysicalFont physFont = registeredFontFiles.get(fontFile);
if (physFont != null) {
if (isTTC) {
Font2D f2d = findFont2D(fcInfo.familyName,
Font2D f2d = findFont2D(fcInfo.firstFont.familyName,
fcInfo.style, NO_FALLBACK);
if (f2d instanceof PhysicalFont) { /* paranoia */
return (PhysicalFont)f2d;
@ -3249,18 +3311,20 @@ public final class FontManager {
* Lucida Sans), we want to use the JRE version, so make it
* point to the JRE font.
*/
physFont = findJREDeferredFont(fcInfo.familyName, fcInfo.style);
physFont = findJREDeferredFont(fcInfo.firstFont.familyName,
fcInfo.style);
/* It is also possible the font file is on the "deferred" list,
* in which case we can just initialise it now.
*/
if (physFont == null &&
deferredFontFiles.get(fcInfo.fontFile) != null) {
physFont = initialiseDeferredFont(fcInfo.fontFile);
deferredFontFiles.get(fontFile) != null)
{
physFont = initialiseDeferredFont(fcInfo.firstFont.fontFile);
/* use findFont2D to get the right font from TTC's */
if (physFont != null) {
if (isTTC) {
Font2D f2d = findFont2D(fcInfo.familyName,
Font2D f2d = findFont2D(fcInfo.firstFont.familyName,
fcInfo.style, NO_FALLBACK);
if (f2d instanceof PhysicalFont) { /* paranoia */
return (PhysicalFont)f2d;
@ -3287,7 +3351,7 @@ public final class FontManager {
fontFormat = FONTFORMAT_TYPE1;
fontRank = Font2D.TYPE1_RANK;
}
physFont = registerFontFile(fcInfo.fontFile, null,
physFont = registerFontFile(fcInfo.firstFont.fontFile, null,
fontFormat, true, fontRank);
}
return physFont;
@ -3345,12 +3409,12 @@ public final class FontManager {
}
info[1] = info[1] + File.separator + "arial.ttf";
} else {
initFontConfigFonts();
initFontConfigFonts(false);
for (int i=0; i<fontConfigFonts.length; i++) {
if ("sans".equals(fontConfigFonts[i].fcFamily) &&
0 == fontConfigFonts[i].style) {
info[0] = fontConfigFonts[i].familyName;
info[1] = fontConfigFonts[i].fontFile;
info[0] = fontConfigFonts[i].firstFont.familyName;
info[1] = fontConfigFonts[i].firstFont.fontFile;
break;
}
}
@ -3360,9 +3424,9 @@ public final class FontManager {
*/
if (info[0] == null) {
if (fontConfigFonts.length > 0 &&
fontConfigFonts[0].fontFile != null) {
info[0] = fontConfigFonts[0].familyName;
info[1] = fontConfigFonts[0].fontFile;
fontConfigFonts[0].firstFont.fontFile != null) {
info[0] = fontConfigFonts[0].firstFont.familyName;
info[1] = fontConfigFonts[0].firstFont.fontFile;
} else {
info[0] = "Dialog";
info[1] = "/dialog.ttf";
@ -3373,8 +3437,8 @@ public final class FontManager {
return defaultPlatformFont;
}
private FontConfigInfo getFontConfigInfo() {
initFontConfigFonts();
private FcCompFont getFcCompFont() {
initFontConfigFonts(false);
for (int i=0; i<fontConfigFonts.length; i++) {
if ("sans".equals(fontConfigFonts[i].fcFamily) &&
0 == fontConfigFonts[i].style) {
@ -3391,9 +3455,9 @@ public final class FontManager {
name = name.toLowerCase();
initFontConfigFonts();
initFontConfigFonts(false);
FontConfigInfo fcInfo = null;
FcCompFont fcInfo = null;
for (int i=0; i<fontConfigFonts.length; i++) {
if (name.equals(fontConfigFonts[i].fcFamily) &&
style == fontConfigFonts[i].style) {
@ -3407,7 +3471,8 @@ public final class FontManager {
if (logging) {
logger.info("FC name=" + name + " style=" + style + " uses " +
fcInfo.familyName + " in file: " + fcInfo.fontFile);
fcInfo.firstFont.familyName +
" in file: " + fcInfo.firstFont.fontFile);
}
if (fcInfo.compFont != null) {
@ -3420,7 +3485,8 @@ public final class FontManager {
CompositeFont jdkFont = (CompositeFont)
findFont2D(fcInfo.jdkName, style, LOGICAL_FALLBACK);
if (fcInfo.familyName == null || fcInfo.fontFile == null) {
if (fcInfo.firstFont.familyName == null ||
fcInfo.firstFont.fontFile == null) {
return (fcInfo.compFont = jdkFont);
}
@ -3432,7 +3498,7 @@ public final class FontManager {
* will fall through this code, but the regisration code will
* find that file already registered and return its font.
*/
FontFamily family = FontFamily.getFamily(fcInfo.familyName);
FontFamily family = FontFamily.getFamily(fcInfo.firstFont.familyName);
PhysicalFont physFont = null;
if (family != null) {
Font2D f2D = family.getFontWithExactStyleMatch(fcInfo.style);
@ -3441,7 +3507,8 @@ public final class FontManager {
}
}
if (physFont == null || !fcInfo.fontFile.equals(physFont.platName)) {
if (physFont == null ||
!fcInfo.firstFont.fontFile.equals(physFont.platName)) {
physFont = registerFromFcInfo(fcInfo);
if (physFont == null) {
return (fcInfo.compFont = jdkFont);
@ -3459,10 +3526,10 @@ public final class FontManager {
* together to prevent synthetic styling.
*/
for (int i=0; i<fontConfigFonts.length; i++) {
FontConfigInfo fc = fontConfigFonts[i];
FcCompFont fc = fontConfigFonts[i];
if (fc != fcInfo &&
physFont.getFamilyName(null).equals(fc.familyName) &&
!fc.fontFile.equals(physFont.platName) &&
physFont.getFamilyName(null).equals(fc.firstFont.familyName) &&
!fc.firstFont.fontFile.equals(physFont.platName) &&
family.getFontWithExactStyleMatch(fc.style) == null) {
registerFromFcInfo(fontConfigFonts[i]);

View File

@ -76,7 +76,7 @@ class NullFontScaler extends FontScaler {
}
int getNumGlyphs() throws FontScalerException {
return 0;
return 1;
}
int getMissingGlyphCode() throws FontScalerException {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. 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
@ -25,16 +25,17 @@
package sun.font;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.awt.Font;
import java.awt.FontFormatException;
import java.util.logging.Level;
import java.util.logging.Logger;
import sun.java2d.Disposer;
import sun.java2d.pipe.BufferedContext;
import sun.java2d.pipe.RenderQueue;
import sun.java2d.pipe.hw.AccelGraphicsConfig;
import sun.misc.Unsafe;
/**
@ -192,7 +193,7 @@ public final class StrikeCache {
recentStrikeIndex = index;
}
static void disposeStrike(FontStrikeDisposer disposer) {
private static final void doDispose(FontStrikeDisposer disposer) {
if (disposer.intGlyphImages != null) {
freeIntMemory(disposer.intGlyphImages,
disposer.pScalerContext);
@ -234,6 +235,44 @@ public final class StrikeCache {
}
}
static void disposeStrike(final FontStrikeDisposer disposer) {
// we need to execute the strike disposal on the rendering thread
// because they may be accessed on that thread at the time of the
// disposal (for example, when the accel. cache is invalidated)
// REMIND: this look a bit heavyweight, but should be ok
// because strike disposal is a relatively infrequent operation,
// more worrisome is the necessity of getting a GC here.
RenderQueue rq = null;
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (!ge.isHeadless()) {
GraphicsConfiguration gc =
ge.getDefaultScreenDevice().getDefaultConfiguration();
if (gc instanceof AccelGraphicsConfig) {
AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
BufferedContext bc = agc.getContext();
if (bc != null) {
rq = bc.getRenderQueue();
}
}
}
if (rq != null) {
rq.lock();
try {
rq.flushAndInvokeNow(new Runnable() {
public void run() {
doDispose(disposer);
}
});
} finally {
rq.unlock();
}
} else {
doDispose(disposer);
}
}
static native void freeIntPointer(int ptr);
static native void freeLongPointer(long ptr);
private static native void freeIntMemory(int[] glyphPtrs, long pContext);

View File

@ -0,0 +1,41 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d;
import sun.java2d.pipe.hw.*;
/**
* Classes implementing this interface provide access to their
* destination surfaces.
*/
public interface DestSurfaceProvider {
/**
* Returns a surface currently used as a destination surface for rendering.
*
* @return destination surface
*/
public Surface getDestSurface();
}

View File

@ -41,24 +41,17 @@ import java.awt.image.renderable.RenderableImage;
import java.awt.image.renderable.RenderContext;
import java.awt.image.AffineTransformOp;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import java.awt.Image;
import java.awt.Composite;
import java.awt.Color;
import java.awt.color.ColorSpace;
import java.awt.image.DataBuffer;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import java.awt.image.DirectColorModel;
import java.awt.GraphicsConfiguration;
import java.awt.Paint;
import java.awt.GradientPaint;
import java.awt.LinearGradientPaint;
import java.awt.RadialGradientPaint;
import java.awt.TexturePaint;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.PathIterator;
import java.awt.geom.GeneralPath;
@ -69,19 +62,16 @@ import java.awt.Rectangle;
import java.text.AttributedCharacterIterator;
import java.awt.Font;
import java.awt.image.ImageObserver;
import java.awt.image.ColorConvertOp;
import java.awt.Transparency;
import java.awt.font.GlyphVector;
import java.awt.font.TextLayout;
import sun.font.FontDesignMetrics;
import sun.font.StandardGlyphVector;
import sun.java2d.pipe.PixelDrawPipe;
import sun.java2d.pipe.PixelFillPipe;
import sun.java2d.pipe.ShapeDrawPipe;
import sun.java2d.pipe.ValidatePipe;
import sun.java2d.pipe.ShapeSpanIterator;
import sun.java2d.pipe.Region;
import sun.java2d.pipe.RegionIterator;
import sun.java2d.pipe.TextPipe;
import sun.java2d.pipe.DrawImagePipe;
import sun.java2d.pipe.LoopPipe;
@ -90,7 +80,6 @@ import sun.java2d.loops.RenderLoops;
import sun.java2d.loops.CompositeType;
import sun.java2d.loops.SurfaceType;
import sun.java2d.loops.Blit;
import sun.java2d.loops.BlitBg;
import sun.java2d.loops.MaskFill;
import sun.font.FontManager;
import java.awt.font.FontRenderContext;
@ -99,7 +88,7 @@ import sun.awt.ConstrainableGraphics;
import sun.awt.SunHints;
import java.util.Map;
import java.util.Iterator;
import sun.awt.image.OffScreenImage;
import sun.java2d.DestSurfaceProvider;
import sun.misc.PerformanceLogger;
/**
@ -113,7 +102,7 @@ import sun.misc.PerformanceLogger;
*/
public final class SunGraphics2D
extends Graphics2D
implements ConstrainableGraphics, Cloneable
implements ConstrainableGraphics, Cloneable, DestSurfaceProvider
{
/*
* Attribute States
@ -3306,4 +3295,14 @@ public final class SunGraphics2D
public Object getDestination() {
return surfaceData.getDestination();
}
/**
* {@inheritDoc}
*
* @see sun.java2d.DestSurfaceProvider#getDestSurface
*/
@Override
public Surface getDestSurface() {
return surfaceData;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. 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
@ -36,6 +36,7 @@ import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.font.TextAttribute;
import java.awt.image.BufferedImage;
import java.awt.peer.ComponentPeer;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@ -78,6 +79,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
public static boolean isLinux;
public static boolean isSolaris;
public static boolean isOpenSolaris;
public static boolean isWindows;
public static boolean noType1Font;
private static Font defaultFont;
@ -167,6 +169,23 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
isLinux = true;
} else if ("SunOS".equals(osName)) {
isSolaris = true;
String version = System.getProperty("os.version", "0.0");
try {
float ver = Float.parseFloat(version);
if (ver > 5.10f) {
File f = new File("/etc/release");
FileInputStream fis = new FileInputStream(f);
InputStreamReader isr
= new InputStreamReader(fis, "ISO-8859-1");
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
if (line.indexOf("OpenSolaris") >= 0) {
isOpenSolaris = true;
}
fis.close();
}
} catch (Exception e) {
}
} else if ("Windows".equals(osName)) {
isWindows = true;
}
@ -174,11 +193,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
noType1Font = "true".
equals(System.getProperty("sun.java2d.noType1Font"));
if (isOpenJDK()) {
String[] fontInfo = FontManager.getDefaultPlatformFont();
defaultFontName = fontInfo[0];
defaultFontFileName = fontInfo[1];
} else {
if (!isOpenJDK()) {
defaultFontName = lucidaFontName;
if (useAbsoluteFontFileNames()) {
defaultFontFileName =
@ -244,6 +259,11 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
* that might be specified.
*/
fontConfig = createFontConfiguration();
if (isOpenJDK()) {
String[] fontInfo = FontManager.getDefaultPlatformFont();
defaultFontName = fontInfo[0];
defaultFontFileName = fontInfo[1];
}
getPlatformFontPathFromFontConfig();
String extraFontPath = fontConfig.getExtraFontPath();
@ -1069,7 +1089,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
String fontFileName =
getFileNameFromPlatformName(platformFontName);
String[] nativeNames = null;
if (fontFileName == null) {
if (fontFileName == null || fontFileName.equals(platformFontName)){
/* No file located, so register using the platform name,
* i.e. as a native font.
*/
@ -1294,4 +1314,18 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
/*
* ----END DISPLAY CHANGE SUPPORT----
*/
/**
* Returns true if FlipBufferStrategy with COPIED buffer contents
* is preferred for this peer's GraphicsConfiguration over
* BlitBufferStrategy, false otherwise.
*
* The reason FlipBS could be preferred is that in some configurations
* an accelerated copy to the screen is supported (like Direct3D 9)
*
* @return true if flip strategy should be used, false otherwise
*/
public boolean isFlipStrategyPreferred(ComponentPeer peer) {
return false;
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d;
/**
* This is a tag interface for a surface.
* @see sun.java2d.SurfaceData
* @see sun.java2d.pipe.hw.AccelSurface
*/
public interface Surface {
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1999-2008 Sun Microsystems, Inc. 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
@ -93,7 +93,7 @@ import sun.awt.image.SurfaceManager;
* retrieved the tracker.
*/
public abstract class SurfaceData
implements Transparency, DisposerTarget, StateTrackable
implements Transparency, DisposerTarget, StateTrackable, Surface
{
private long pData;
private boolean valid;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007-2008 Sun Microsystems, Inc. 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
@ -521,7 +521,7 @@ public abstract class SurfaceDataProxy
CompositeType.SrcNoEa,
dstType);
blitbg.BlitBg(srcData, dstData,
AlphaComposite.Src, null, bgColor,
AlphaComposite.Src, null, bgColor.getRGB(),
0, 0, 0, 0, w, h);
dstData.markDirty();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1999-2008 Sun Microsystems, Inc. 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
@ -109,7 +109,7 @@ public class BlitBg extends GraphicsPrimitive
*/
public native void BlitBg(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
Color bgColor,
int bgColor,
int srcx, int srcy,
int dstx, int dsty,
int width, int height);
@ -142,19 +142,19 @@ public class BlitBg extends GraphicsPrimitive
compositeType = comptype;
}
@Override
public void BlitBg(SurfaceData srcData,
SurfaceData dstData,
Composite comp,
Region clip,
Color bgColor,
int bgArgb,
int srcx, int srcy,
int dstx, int dsty,
int width, int height)
{
ColorModel dstModel = dstData.getColorModel();
if (!dstModel.hasAlpha() &&
bgColor.getTransparency() != Transparency.OPAQUE)
{
boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
if (!dstModel.hasAlpha() && bgHasAlpha) {
dstModel = ColorModel.getRGBdefault();
}
WritableRaster wr =
@ -163,6 +163,7 @@ public class BlitBg extends GraphicsPrimitive
BufferedImage bimg =
new BufferedImage(dstModel, wr, isPremult, null);
SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
Color bgColor = new Color(bgArgb, bgHasAlpha);
SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
defaultFont);
FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
@ -201,9 +202,10 @@ public class BlitBg extends GraphicsPrimitive
return this;
}
@Override
public void BlitBg(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
Color bgColor,
int bgColor,
int srcx, int srcy, int dstx, int dsty,
int width, int height)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. 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
@ -159,6 +159,10 @@ public final class GeneralRenderer {
{
int mx, my, x1, y1;
int[] tmp = null;
if (nPoints <= 0) {
return;
}
mx = x1 = xPoints[off] + transx;
my = y1 = yPoints[off] + transy;
while (--nPoints > 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007-2008 Sun Microsystems, Inc. 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
@ -35,6 +35,7 @@ import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.java2d.loops.CompositeType;
import sun.java2d.pipe.BufferedBufImgOps;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
class OGLBufImgOps extends BufferedBufImgOps {
@ -94,7 +95,7 @@ class OGLBufImgOps extends BufferedBufImgOps {
OGLSurfaceData oglSrc = (OGLSurfaceData)srcData;
OGLGraphicsConfig gc = oglSrc.getOGLGraphicsConfig();
if (oglSrc.getType() != OGLSurfaceData.TEXTURE ||
!gc.isCapPresent(OGLContext.CAPS_EXT_BIOP_SHADER))
!gc.isCapPresent(CAPS_EXT_BIOP_SHADER))
{
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2004-2008 Sun Microsystems, Inc. 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
@ -25,91 +25,24 @@
package sun.java2d.opengl;
import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.Paint;
import java.awt.geom.AffineTransform;
import sun.java2d.SunGraphics2D;
import sun.java2d.pipe.BufferedContext;
import sun.java2d.pipe.Region;
import sun.java2d.pipe.RenderBuffer;
import sun.java2d.pipe.RenderQueue;
import sun.java2d.pipe.hw.ContextCapabilities;
import static sun.java2d.pipe.BufferedOpCodes.*;
import static sun.java2d.pipe.hw.ContextCapabilities.*;
/**
* Note that the RenderQueue lock must be acquired before calling any of
* the methods in this class.
*/
class OGLContext extends BufferedContext {
public class OGLContext extends BufferedContext {
/** Indicates that the context has no capabilities. */
static final int CAPS_EMPTY = (0 << 0);
/** Indicates that the context is doublebuffered. */
static final int CAPS_DOUBLEBUFFERED = (1 << 0);
/** Indicates that the context supports a stored alpha channel. */
static final int CAPS_STORED_ALPHA = (1 << 1);
/** Indicates the presence of the GL_ARB_multitexture extension. */
static final int CAPS_EXT_MULTITEXTURE = (1 << 2);
/** Indicates the presence of the GL_ARB_texture_non_power_of_two ext. */
static final int CAPS_EXT_TEXNONPOW2 = (1 << 3);
/**
* Indicates the presence of the GL_EXT_framebuffer_object extension.
* This cap will only be set if the fbobject system property has been
* enabled and we are able to create an FBO with depth buffer.
*/
static final int CAPS_EXT_FBOBJECT = (1 << 4);
/**
* Indicates the presence of the GL_ARB_fragment_shader extension.
* This cap will only be set if the lcdshader system property has been
* enabled and the hardware supports the minimum number of texture units.
*/
static final int CAPS_EXT_LCD_SHADER = (1 << 5);
/** Indicates the presence of the GL_ARB_texture_rectangle extension. */
static final int CAPS_EXT_TEXRECT = (1 << 6);
/**
* Indicates the presence of the GL_ARB_fragment_shader extension.
* This cap will only be set if the biopshader system property has been
* enabled and the hardware meets our minimum requirements.
*/
static final int CAPS_EXT_BIOP_SHADER = (1 << 7);
/**
* Indicates the presence of the GL_ARB_fragment_shader extension.
* This cap will only be set if the gradshader system property has been
* enabled and the hardware meets our minimum requirements.
*/
static final int CAPS_EXT_GRAD_SHADER = (1 << 8);
private final OGLGraphicsConfig config;
OGLContext(RenderQueue rq) {
OGLContext(RenderQueue rq, OGLGraphicsConfig config) {
super(rq);
}
/**
* Fetches the OGLContext associated with the current GraphicsConfig
* and validates the context using the given parameters. Most rendering
* operations will call this method first in order to set the necessary
* state before issuing rendering commands.
*/
static void validateContext(OGLSurfaceData srcData,
OGLSurfaceData dstData,
Region clip, Composite comp,
AffineTransform xform,
Paint paint, SunGraphics2D sg2d,
int flags)
{
// assert rq.lock.isHeldByCurrentThread();
OGLContext oglc = dstData.getContext();
oglc.validate(srcData, dstData,
clip, comp, xform, paint, sg2d, flags);
}
/**
* Simplified version of validateContext() that disables all context
* state settings.
*/
static void validateContext(OGLSurfaceData dstData) {
// assert rq.lock.isHeldByCurrentThread();
validateContext(dstData, dstData,
null, null, null, null, null, NO_CONTEXT_FLAGS);
this.config = config;
}
/**
@ -160,19 +93,128 @@ class OGLContext extends BufferedContext {
static void invalidateCurrentContext() {
// assert OGLRenderQueue.getInstance().lock.isHeldByCurrentThread();
// first invalidate the context reference at the native level, and
// invalidate the current Java-level context so that we
// revalidate everything the next time around
if (currentContext != null) {
currentContext.invalidateContext();
currentContext = null;
}
// invalidate the context reference at the native level, and
// then flush the queue so that we have no pending operations
// dependent on the current context
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.ensureCapacity(4);
rq.getBuffer().putInt(INVALIDATE_CONTEXT);
rq.flushNow();
}
// then invalidate the current Java-level context so that we
// revalidate everything the next time around
if (currentContext != null) {
currentContext.invalidateSurfaces();
currentContext = null;
public RenderQueue getRenderQueue() {
return OGLRenderQueue.getInstance();
}
/**
* Returns a string representing adapter id (vendor, renderer, version).
* Must be called on the rendering thread.
*
* @return an id string for the adapter
*/
static final native String getOGLIdString();
@Override
public void saveState() {
// assert rq.lock.isHeldByCurrentThread();
// reset all attributes of this and current contexts
invalidateContext();
invalidateCurrentContext();
setScratchSurface(config);
// save the state on the native level
rq.ensureCapacity(4);
buf.putInt(SAVE_STATE);
rq.flushNow();
}
@Override
public void restoreState() {
// assert rq.lock.isHeldByCurrentThread();
// reset all attributes of this and current contexts
invalidateContext();
invalidateCurrentContext();
setScratchSurface(config);
// restore the state on the native level
rq.ensureCapacity(4);
buf.putInt(RESTORE_STATE);
rq.flushNow();
}
static class OGLContextCaps extends ContextCapabilities {
/**
* Indicates the presence of the GL_EXT_framebuffer_object extension.
* This cap will only be set if the fbobject system property has been
* enabled and we are able to create an FBO with depth buffer.
*/
static final int CAPS_EXT_FBOBJECT =
(CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);
/** Indicates that the context supports a stored alpha channel. */
static final int CAPS_STORED_ALPHA = CAPS_RT_PLAIN_ALPHA;
/** Indicates that the context is doublebuffered. */
static final int CAPS_DOUBLEBUFFERED = (FIRST_PRIVATE_CAP << 0);
/**
* Indicates the presence of the GL_ARB_fragment_shader extension.
* This cap will only be set if the lcdshader system property has been
* enabled and the hardware supports the minimum number of texture units
*/
static final int CAPS_EXT_LCD_SHADER = (FIRST_PRIVATE_CAP << 1);
/**
* Indicates the presence of the GL_ARB_fragment_shader extension.
* This cap will only be set if the biopshader system property has been
* enabled and the hardware meets our minimum requirements.
*/
static final int CAPS_EXT_BIOP_SHADER = (FIRST_PRIVATE_CAP << 2);
/**
* Indicates the presence of the GL_ARB_fragment_shader extension.
* This cap will only be set if the gradshader system property has been
* enabled and the hardware meets our minimum requirements.
*/
static final int CAPS_EXT_GRAD_SHADER = (FIRST_PRIVATE_CAP << 3);
/** Indicates the presence of the GL_ARB_texture_rectangle extension. */
static final int CAPS_EXT_TEXRECT = (FIRST_PRIVATE_CAP << 4);
OGLContextCaps(int caps, String adapterId) {
super(caps, adapterId);
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer(super.toString());
if ((caps & CAPS_EXT_FBOBJECT) != 0) {
buf.append("CAPS_EXT_FBOBJECT|");
}
if ((caps & CAPS_STORED_ALPHA) != 0) {
buf.append("CAPS_STORED_ALPHA|");
}
if ((caps & CAPS_DOUBLEBUFFERED) != 0) {
buf.append("CAPS_DOUBLEBUFFERED|");
}
if ((caps & CAPS_EXT_LCD_SHADER) != 0) {
buf.append("CAPS_EXT_LCD_SHADER|");
}
if ((caps & CAPS_EXT_BIOP_SHADER) != 0) {
buf.append("CAPS_BIOP_SHADER|");
}
if ((caps & CAPS_EXT_GRAD_SHADER) != 0) {
buf.append("CAPS_EXT_GRAD_SHADER|");
}
if ((caps & CAPS_EXT_TEXRECT) != 0) {
buf.append("CAPS_EXT_TEXRECT|");
}
return buf.toString();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2008 Sun Microsystems, Inc. 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
@ -27,13 +27,16 @@ package sun.java2d.opengl;
import sun.java2d.SurfaceData;
import sun.awt.image.SurfaceManager;
import sun.java2d.pipe.hw.AccelGraphicsConfig;
/**
* This interface collects the methods that are provided by both
* GLXGraphicsConfig and WGLGraphicsConfig, making it easier to invoke these
* methods directly from OGLSurfaceData.
*/
interface OGLGraphicsConfig extends SurfaceManager.ProxiedGraphicsConfig {
interface OGLGraphicsConfig extends
AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig
{
OGLContext getContext();
long getNativeConfigInfo();
boolean isCapPresent(int cap);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007-2008 Sun Microsystems, Inc. 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
@ -39,6 +39,7 @@ import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.java2d.loops.CompositeType;
import static sun.java2d.pipe.BufferedPaints.*;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
abstract class OGLPaints {
@ -170,7 +171,7 @@ abstract class OGLPaints {
OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
OGLGraphicsConfig gc = dstData.getOGLGraphicsConfig();
if (!gc.isCapPresent(OGLContext.CAPS_EXT_GRAD_SHADER)) {
if (!gc.isCapPresent(CAPS_EXT_GRAD_SHADER)) {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. 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
@ -30,6 +30,7 @@ import java.awt.geom.Path2D;
import sun.java2d.SunGraphics2D;
import sun.java2d.loops.GraphicsPrimitive;
import sun.java2d.pipe.BufferedRenderPipe;
import sun.java2d.pipe.ParallelogramPipe;
import sun.java2d.pipe.RenderQueue;
import sun.java2d.pipe.SpanIterator;
import static sun.java2d.pipe.BufferedOpCodes.*;
@ -51,6 +52,15 @@ class OGLRenderer extends BufferedRenderPipe {
null, sg2d.paint, sg2d, ctxflags);
}
@Override
protected void validateContextAA(SunGraphics2D sg2d) {
int ctxflags = OGLContext.NO_CONTEXT_FLAGS;
OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite,
null, sg2d.paint, sg2d, ctxflags);
}
void copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{
@ -88,6 +98,31 @@ class OGLRenderer extends BufferedRenderPipe {
super(oglr.rq);
this.oglr = oglr;
}
public ParallelogramPipe getAAParallelogramPipe() {
final ParallelogramPipe realpipe = oglr.getAAParallelogramPipe();
return new ParallelogramPipe() {
public void fillParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
GraphicsPrimitive.tracePrimitive("OGLFillAAParallelogram");
realpipe.fillParallelogram(sg2d,
x, y, dx1, dy1, dx2, dy2);
}
public void drawParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
GraphicsPrimitive.tracePrimitive("OGLDrawAAParallelogram");
realpipe.drawParallelogram(sg2d,
x, y, dx1, dy1, dx2, dy2,
lw1, lw2);
}
};
}
protected void validateContext(SunGraphics2D sg2d) {
oglr.validateContext(sg2d);
}
@ -130,6 +165,23 @@ class OGLRenderer extends BufferedRenderPipe {
GraphicsPrimitive.tracePrimitive("OGLFillSpans");
oglr.fillSpans(sg2d, si, transx, transy);
}
public void fillParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
GraphicsPrimitive.tracePrimitive("OGLFillParallelogram");
oglr.fillParallelogram(sg2d, x, y, dx1, dy1, dx2, dy2);
}
public void drawParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
GraphicsPrimitive.tracePrimitive("OGLDrawParallelogram");
oglr.drawParallelogram(sg2d, x, y, dx1, dy1, dx2, dy2, lw1, lw2);
}
public void copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. 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
@ -27,23 +27,26 @@ package sun.java2d.opengl;
import java.awt.AlphaComposite;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.image.ColorModel;
import java.awt.image.Raster;
import sun.awt.SunHints;
import sun.awt.image.PixelConverter;
import sun.java2d.pipe.hw.AccelSurface;
import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.java2d.SurfaceDataProxy;
import sun.java2d.loops.CompositeType;
import sun.java2d.loops.GraphicsPrimitive;
import sun.java2d.loops.MaskFill;
import sun.java2d.loops.SurfaceType;
import sun.java2d.pipe.PixelToShapeConverter;
import sun.java2d.pipe.ParallelogramPipe;
import sun.java2d.pipe.PixelToParallelogramConverter;
import sun.java2d.pipe.RenderBuffer;
import sun.java2d.pipe.RenderQueue;
import sun.java2d.pipe.TextPipe;
import static sun.java2d.pipe.BufferedOpCodes.*;
import static sun.java2d.opengl.OGLContext.*;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
/**
* This class describes an OpenGL "surface", that is, a region of pixels
@ -92,17 +95,16 @@ import static sun.java2d.opengl.OGLContext.*;
* FLIP_BACKBUFFER OpenGLSurface
* FBOBJECT OpenGLSurfaceRTT
*/
public abstract class OGLSurfaceData extends SurfaceData {
public abstract class OGLSurfaceData extends SurfaceData
implements AccelSurface {
/**
* OGL-specific surface types
*
* @see sun.java2d.pipe.hw.AccelSurface
*/
public static final int UNDEFINED = 0;
public static final int WINDOW = 1;
public static final int PBUFFER = 2;
public static final int TEXTURE = 3;
public static final int FLIP_BACKBUFFER = 4;
public static final int FBOBJECT = 5;
public static final int PBUFFER = RT_PLAIN;
public static final int FBOBJECT = RT_TEXTURE;
/**
* Pixel formats
@ -148,11 +150,14 @@ public abstract class OGLSurfaceData extends SurfaceData {
private static boolean isGradShaderEnabled;
private OGLGraphicsConfig graphicsConfig;
private int textureTarget;
protected int type;
// these fields are set from the native code when the surface is
// initialized
private int nativeWidth, nativeHeight;
protected static OGLRenderer oglRenderPipe;
protected static PixelToShapeConverter oglTxRenderPipe;
protected static PixelToParallelogramConverter oglTxRenderPipe;
protected static ParallelogramPipe oglAAPgramPipe;
protected static OGLTextRenderer oglTextPipe;
protected static OGLDrawImage oglImagePipe;
@ -170,6 +175,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
int width, int height);
private native int getTextureTarget(long pData);
private native int getTextureID(long pData);
static {
if (!GraphicsEnvironment.isHeadless()) {
@ -203,9 +209,14 @@ public abstract class OGLSurfaceData extends SurfaceData {
oglRenderPipe = new OGLRenderer(rq);
if (GraphicsPrimitive.tracingEnabled()) {
oglTextPipe = oglTextPipe.traceWrap();
oglRenderPipe = oglRenderPipe.traceWrap();
//The wrapped oglRenderPipe will wrap the AA pipe as well...
//oglAAPgramPipe = oglRenderPipe.traceWrap();
}
oglTxRenderPipe = new PixelToShapeConverter(oglRenderPipe);
oglAAPgramPipe = oglRenderPipe.getAAParallelogramPipe();
oglTxRenderPipe =
new PixelToParallelogramConverter(oglRenderPipe,
oglRenderPipe,
1.0, 0.25, true);
OGLBlitLoops.register();
OGLMaskFill.register();
@ -282,9 +293,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
break;
}
if (success) {
textureTarget = getTextureTarget(getNativeOps());
} else {
if (!success) {
throw new OutOfMemoryError("can't create offscreen surface");
}
}
@ -323,7 +332,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
* Returns the OGLContext for the GraphicsConfig associated with this
* surface.
*/
final OGLContext getContext() {
public final OGLContext getContext() {
return graphicsConfig.getContext();
}
@ -337,7 +346,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
/**
* Returns one of the surface type constants defined above.
*/
final int getType() {
public final int getType() {
return type;
}
@ -346,8 +355,41 @@ public abstract class OGLSurfaceData extends SurfaceData {
* for that texture (either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB).
* Otherwise, this method will return zero.
*/
final int getTextureTarget() {
return textureTarget;
public final int getTextureTarget() {
return getTextureTarget(getNativeOps());
}
/**
* If this surface is backed by a texture object, returns the texture ID
* for that texture.
* Otherwise, this method will return zero.
*/
public final int getTextureID() {
return getTextureID(getNativeOps());
}
/**
* Returns native resource of specified {@code resType} associated with
* this surface.
*
* Specifically, for {@code OGLSurfaceData} this method returns the
* the following:
* <pre>
* TEXTURE - texture id
* </pre>
*
* Note: the resource returned by this method is only valid on the rendering
* thread.
*
* @return native resource of specified type or 0L if
* such resource doesn't exist or can not be retrieved.
* @see sun.java2d.pipe.hw.AccelSurface#getNativeResource
*/
public long getNativeResource(int resType) {
if (resType == TEXTURE) {
return getTextureID();
}
return 0L;
}
public Raster getRaster(int x, int y, int w, int h) {
@ -366,7 +408,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
*/
public boolean canRenderLCDText(SunGraphics2D sg2d) {
return
graphicsConfig.isCapPresent(OGLContext.CAPS_EXT_LCD_SHADER) &&
graphicsConfig.isCapPresent(CAPS_EXT_LCD_SHADER) &&
sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
}
@ -405,7 +447,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
validated = true;
}
PixelToShapeConverter txPipe = null;
PixelToParallelogramConverter txPipe = null;
OGLRenderer nonTxPipe = null;
if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
@ -422,13 +464,29 @@ public abstract class OGLSurfaceData extends SurfaceData {
// custom paints handled by super.validatePipe() below
}
} else {
if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
sg2d.compositeState == sg2d.COMP_XOR)
if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
if (graphicsConfig.isCapPresent(CAPS_PS30) &&
(sg2d.imageComp == CompositeType.SrcOverNoEa ||
sg2d.imageComp == CompositeType.SrcOver))
{
if (!validated) {
super.validatePipe(sg2d);
validated = true;
}
PixelToParallelogramConverter aaConverter =
new PixelToParallelogramConverter(sg2d.shapepipe,
oglAAPgramPipe,
1.0/8.0, 0.499,
false);
sg2d.drawpipe = aaConverter;
sg2d.fillpipe = aaConverter;
sg2d.shapepipe = aaConverter;
} else if (sg2d.compositeState == sg2d.COMP_XOR) {
// install the solid pipes when AA and XOR are both enabled
txPipe = oglTxRenderPipe;
nonTxPipe = oglRenderPipe;
}
}
// other cases handled by super.validatePipe() below
}
@ -443,7 +501,11 @@ public abstract class OGLSurfaceData extends SurfaceData {
sg2d.drawpipe = nonTxPipe;
sg2d.fillpipe = nonTxPipe;
}
sg2d.shapepipe = nonTxPipe;
// Note that we use the transforming pipe here because it
// will examine the shape and possibly perform an optimized
// operation if it can be simplified. The simplifications
// will be valid for all STROKE and TRANSFORM types.
sg2d.shapepipe = txPipe;
} else {
if (!validated) {
super.validatePipe(sg2d);
@ -472,7 +534,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
* validation code will choose a more general software-based loop.
*/
if (!OGLPaints.isValid(sg2d) ||
!graphicsConfig.isCapPresent(CAPS_EXT_MULTITEXTURE))
!graphicsConfig.isCapPresent(CAPS_MULTITEXTURE))
{
return null;
}
@ -564,7 +626,7 @@ public abstract class OGLSurfaceData extends SurfaceData {
* when using the basic GL_TEXTURE_2D target.
*/
boolean isTexNonPow2Available() {
return graphicsConfig.isCapPresent(OGLContext.CAPS_EXT_TEXNONPOW2);
return graphicsConfig.isCapPresent(CAPS_TEXNONPOW2);
}
/**
@ -573,6 +635,16 @@ public abstract class OGLSurfaceData extends SurfaceData {
* GL_ARB_texture_rectangle extension is present).
*/
boolean isTexRectAvailable() {
return graphicsConfig.isCapPresent(OGLContext.CAPS_EXT_TEXRECT);
return graphicsConfig.isCapPresent(CAPS_EXT_TEXRECT);
}
public Rectangle getNativeBounds() {
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.lock();
try {
return new Rectangle(nativeWidth, nativeHeight);
} finally {
rq.unlock();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2008 Sun Microsystems, Inc. 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
@ -26,12 +26,13 @@
package sun.java2d.pipe;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Paint;
import java.awt.geom.AffineTransform;
import sun.java2d.pipe.hw.AccelSurface;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.java2d.loops.XORComposite;
import static sun.java2d.pipe.BufferedOpCodes.*;
import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
@ -43,8 +44,10 @@ import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
* single thread. Note that the RenderQueue lock must be acquired before
* calling the validate() method (or any other method in this class). See
* the RenderQueue class comments for a sample usage scenario.
*
* @see RenderQueue
*/
public class BufferedContext {
public abstract class BufferedContext {
/*
* The following flags help the internals of validate() determine
@ -82,19 +85,66 @@ public class BufferedContext {
*/
protected static BufferedContext currentContext;
private SurfaceData validatedSrcData;
private SurfaceData validatedDstData;
private AccelSurface validatedSrcData;
private AccelSurface validatedDstData;
private Region validatedClip;
private Composite validatedComp;
private Paint validatedPaint;
private boolean isValidatedPaintAColor;
private int validatedRGB;
private int validatedFlags;
private boolean xformInUse;
private int transX;
private int transY;
protected BufferedContext(RenderQueue rq) {
this.rq = rq;
this.buf = rq.getBuffer();
}
/**
* Fetches the BufferedContextContext associated with the dst. surface
* and validates the context using the given parameters. Most rendering
* operations will call this method first in order to set the necessary
* state before issuing rendering commands.
*
* Note: must be called while the RenderQueue lock is held.
*
* @throws InvalidPipeException if either src or dest surface is not valid
* or lost
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
public static void validateContext(AccelSurface srcData,
AccelSurface dstData,
Region clip, Composite comp,
AffineTransform xform,
Paint paint, SunGraphics2D sg2d,
int flags)
{
// assert rq.lock.isHeldByCurrentThread();
BufferedContext d3dc = dstData.getContext();
d3dc.validate(srcData, dstData,
clip, comp, xform, paint, sg2d, flags);
}
/**
* Fetches the BufferedContextassociated with the surface
* and disables all context state settings.
*
* Note: must be called while the RenderQueue lock is held.
*
* @throws InvalidPipeException if the surface is not valid
* or lost
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
public static void validateContext(AccelSurface surface) {
// assert rt.lock.isHeldByCurrentThread();
validateContext(surface, surface,
null, null, null, null, null, NO_CONTEXT_FLAGS);
}
/**
* Validates the given parameters against the current state for this
* context. If this context is not current, it will be made current
@ -106,19 +156,47 @@ public class BufferedContext {
* Note that the SunGraphics2D parameter is only used for the purposes
* of validating a (non-null) Paint parameter. In all other cases it
* is safe to pass a null SunGraphics2D and it will be ignored.
*
* Note: must be called while the RenderQueue lock is held.
*
* @throws InvalidPipeException if either src or dest surface is not valid
* or lost
*/
public void validate(SurfaceData srcData, SurfaceData dstData,
public void validate(AccelSurface srcData, AccelSurface dstData,
Region clip, Composite comp,
AffineTransform xform,
Paint paint, SunGraphics2D sg2d, int flags)
{
// assert rq.lock.isHeldByCurrentThread();
boolean updateClip = (clip != validatedClip);
boolean updatePaint = (paint != validatedPaint);
boolean updateClip = false;
boolean updatePaint = false;
if (!dstData.isValid()) {
throw new InvalidPipeException("bounds changed");
if (!dstData.isValid() ||
dstData.isSurfaceLost() || srcData.isSurfaceLost())
{
invalidateContext();
throw new InvalidPipeException("bounds changed or surface lost");
}
if (paint instanceof Color) {
// REMIND: not 30-bit friendly
int newRGB = ((Color)paint).getRGB();
if (isValidatedPaintAColor) {
if (newRGB != validatedRGB) {
validatedRGB = newRGB;
updatePaint = true;
}
} else {
validatedRGB = newRGB;
updatePaint = true;
isValidatedPaintAColor = true;
}
} else if (validatedPaint != paint) {
updatePaint = true;
// this should be set when we are switching from paint to color
// in which case this condition will be true
isValidatedPaintAColor = false;
}
if ((currentContext != this) ||
@ -147,9 +225,18 @@ public class BufferedContext {
}
// validate clip
if (updateClip) {
if ((clip != validatedClip) || updateClip) {
if (clip != null) {
if (updateClip ||
validatedClip == null ||
!(validatedClip.isRectangular() && clip.isRectangular()) ||
((clip.getLoX() != validatedClip.getLoX() ||
clip.getLoY() != validatedClip.getLoY() ||
clip.getHiX() != validatedClip.getHiX() ||
clip.getHiY() != validatedClip.getHiY())))
{
setClip(clip);
}
} else {
resetClip();
}
@ -173,14 +260,29 @@ public class BufferedContext {
}
// validate transform
boolean txChanged = false;
if (xform == null) {
if (xformInUse) {
resetTransform();
xformInUse = false;
txChanged = true;
} else if (sg2d != null) {
if (transX != sg2d.transX || transY != sg2d.transY) {
txChanged = true;
}
}
if (sg2d != null) {
transX = sg2d.transX;
transY = sg2d.transY;
}
} else {
setTransform(xform);
xformInUse = true;
txChanged = true;
}
// non-Color paints may require paint revalidation
if (!isValidatedPaintAColor && txChanged) {
updatePaint = true;
}
// validate paint
@ -194,6 +296,7 @@ public class BufferedContext {
}
// mark dstData dirty
// REMIND: is this really needed now? we do it in SunGraphics2D..
dstData.markDirty();
}
@ -201,13 +304,20 @@ public class BufferedContext {
* Invalidates the surfaces associated with this context. This is
* useful when the context is no longer needed, and we want to break
* the chain caused by these surface references.
*
* Note: must be called while the RenderQueue lock is held.
*
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
public void invalidateSurfaces() {
validatedSrcData = null;
validatedDstData = null;
}
private void setSurfaces(SurfaceData srcData, SurfaceData dstData) {
private void setSurfaces(AccelSurface srcData,
AccelSurface dstData)
{
// assert rq.lock.isHeldByCurrentThread();
rq.ensureCapacityAndAlignment(20, 4);
buf.putInt(SET_SURFACES);
@ -304,4 +414,54 @@ public class BufferedContext {
buf.putDouble(xform.getTranslateX());
buf.putDouble(xform.getTranslateY());
}
/**
* Resets this context's surfaces and all attributes.
*
* Note: must be called while the RenderQueue lock is held.
*
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
public void invalidateContext() {
resetTransform();
resetComposite();
resetClip();
invalidateSurfaces();
validatedComp = null;
validatedClip = null;
validatedPaint = null;
xformInUse = false;
}
/**
* Returns a singleton {@code RenderQueue} object used by the rendering
* pipeline.
*
* @return a render queue
* @see RenderQueue
*/
public abstract RenderQueue getRenderQueue();
/**
* Saves the the state of this context.
* It may reset the current context.
*
* Note: must be called while the RenderQueue lock is held.
*
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
public abstract void saveState();
/**
* Restores the native state of this context.
* It may reset the current context.
*
* Note: must be called while the RenderQueue lock is held.
*
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
public abstract void restoreState();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2008 Sun Microsystems, Inc. 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
@ -32,10 +32,14 @@ public class BufferedOpCodes {
public static final int DRAW_POLY = 12;
public static final int DRAW_PIXEL = 13;
public static final int DRAW_SCANLINES = 14;
public static final int DRAW_PARALLELOGRAM = 15;
public static final int DRAW_AAPARALLELOGRAM = 16;
// fill ops
public static final int FILL_RECT = 20;
public static final int FILL_SPANS = 21;
public static final int FILL_PARALLELOGRAM = 22;
public static final int FILL_AAPARALLELOGRAM = 23;
// copy-related ops
public static final int COPY_AREA = 30;
@ -67,6 +71,9 @@ public class BufferedOpCodes {
public static final int DISPOSE_CONFIG = 74;
public static final int INVALIDATE_CONTEXT = 75;
public static final int SYNC = 76;
public static final int RESTORE_DEVICES = 77;
public static final int SAVE_STATE = 78;
public static final int RESTORE_STATE = 79;
// multibuffering ops
public static final int SWAP_BUFFERS = 80;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2008 Sun Microsystems, Inc. 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
@ -25,6 +25,7 @@
package sun.java2d.pipe;
import java.awt.BasicStroke;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
@ -33,6 +34,7 @@ import java.awt.geom.Ellipse2D;
import java.awt.geom.Path2D;
import java.awt.geom.IllegalPathStateException;
import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import sun.java2d.SunGraphics2D;
import sun.java2d.loops.ProcessPath;
@ -51,8 +53,10 @@ import static sun.java2d.pipe.BufferedOpCodes.*;
* simply delegate to draw(Shape) and fill(Shape), respectively.
*/
public abstract class BufferedRenderPipe
implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe
implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe, ParallelogramPipe
{
ParallelogramPipe aapgrampipe = new AAParallelogramPipe();
static final int BYTES_PER_POLY_POINT = 8;
static final int BYTES_PER_SCANLINE = 12;
static final int BYTES_PER_SPAN = 16;
@ -67,12 +71,17 @@ public abstract class BufferedRenderPipe
this.drawHandler = new BufferedDrawHandler();
}
public ParallelogramPipe getAAParallelogramPipe() {
return aapgrampipe;
}
/**
* Validates the state in the provided SunGraphics2D object and sets up
* any special resources for this operation (e.g. enabling gradient
* shading).
*/
protected abstract void validateContext(SunGraphics2D sg2d);
protected abstract void validateContextAA(SunGraphics2D sg2d);
public void drawLine(SunGraphics2D sg2d,
int x1, int y1, int x2, int y2)
@ -398,6 +407,98 @@ public abstract class BufferedRenderPipe
}
}
public void fillParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
rq.lock();
try {
validateContext(sg2d);
rq.ensureCapacity(28);
buf.putInt(FILL_PARALLELOGRAM);
buf.putFloat((float) x);
buf.putFloat((float) y);
buf.putFloat((float) dx1);
buf.putFloat((float) dy1);
buf.putFloat((float) dx2);
buf.putFloat((float) dy2);
} finally {
rq.unlock();
}
}
public void drawParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
rq.lock();
try {
validateContext(sg2d);
rq.ensureCapacity(36);
buf.putInt(DRAW_PARALLELOGRAM);
buf.putFloat((float) x);
buf.putFloat((float) y);
buf.putFloat((float) dx1);
buf.putFloat((float) dy1);
buf.putFloat((float) dx2);
buf.putFloat((float) dy2);
buf.putFloat((float) lw1);
buf.putFloat((float) lw2);
} finally {
rq.unlock();
}
}
private class AAParallelogramPipe implements ParallelogramPipe {
public void fillParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
rq.lock();
try {
validateContextAA(sg2d);
rq.ensureCapacity(28);
buf.putInt(FILL_AAPARALLELOGRAM);
buf.putFloat((float) x);
buf.putFloat((float) y);
buf.putFloat((float) dx1);
buf.putFloat((float) dy1);
buf.putFloat((float) dx2);
buf.putFloat((float) dy2);
} finally {
rq.unlock();
}
}
public void drawParallelogram(SunGraphics2D sg2d,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
rq.lock();
try {
validateContextAA(sg2d);
rq.ensureCapacity(36);
buf.putInt(DRAW_AAPARALLELOGRAM);
buf.putFloat((float) x);
buf.putFloat((float) y);
buf.putFloat((float) dx1);
buf.putFloat((float) dy1);
buf.putFloat((float) dx2);
buf.putFloat((float) dy2);
buf.putFloat((float) lw1);
buf.putFloat((float) lw2);
} finally {
rq.unlock();
}
}
}
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == sg2d.STROKE_THIN) {
if (s instanceof Polygon) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. 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
@ -955,7 +955,7 @@ public class DrawImage implements DrawImagePipe
} else {
BlitBg blit = BlitBg.getFromCache(srcType, comp, dstType);
blit.BlitBg(srcData, dstData, sg.composite, clipRegion,
bgColor, sx, sy, dx, dy, w, h);
bgColor.getRGB(), sx, sy, dx, dy, w, h);
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe;
import sun.java2d.SunGraphics2D;
/**
* This interface defines the set of calls that pipeline objects
* can use to pass on responsibility for drawing arbitrary
* parallelogram shapes.
* Six floating point numbers are provided and the parallelogram
* is defined as the quadrilateral with the following vertices:
* <pre>
* origin: (x, y)
* => (x+dx1, y+dy1)
* => (x+dx1+dx2, y+dy1+dy2)
* => (x+dx2, y+dy2)
* => origin
* </pre>
*/
public interface ParallelogramPipe {
public void fillParallelogram(SunGraphics2D sg,
double x, double y,
double dx1, double dy1,
double dx2, double dy2);
/**
* Draw a Parallelogram with the indicated line widths
* assuming a standard BasicStroke with MITER joins.
* lw1 specifies the width of the stroke along the dx1,dy1
* vector and lw2 specifies the width of the stroke along
* the dx2,dy2 vector.
* This is equivalent to outsetting the indicated
* parallelogram by lw/2 pixels, then insetting the
* same parallelogram by lw/2 pixels and filling the
* difference between the outer and inner parallelograms.
*/
public void drawParallelogram(SunGraphics2D sg,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2);
}

View File

@ -0,0 +1,417 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe;
import java.awt.Shape;
import java.awt.BasicStroke;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.AffineTransform;
import sun.java2d.SunGraphics2D;
import sun.awt.SunHints;
/**
* This class converts calls to the basic pixel rendering methods
* into calls to the methods on a ParallelogramPipe.
* Most calls are transformed into calls to the fill(Shape) method
* by the parent PixelToShapeConverter class, but some calls are
* transformed into calls to fill/drawParallelogram().
*/
public class PixelToParallelogramConverter extends PixelToShapeConverter
implements ShapeDrawPipe
{
ParallelogramPipe outrenderer;
double minPenSize;
double normPosition;
double normRoundingBias;
boolean adjustfill;
/**
* @param shapepipe pipeline to forward shape calls to
* @param pgrampipe pipeline to forward parallelogram calls to
* (and drawLine calls if possible)
* @param minPenSize minimum pen size for dropout control
* @param normPosition sub-pixel location to normalize endpoints
* for STROKE_NORMALIZE cases
* @param adjustFill boolean to control whethere normalization
* constants are also applied to fill operations
* (normally true for non-AA, false for AA)
*/
public PixelToParallelogramConverter(ShapeDrawPipe shapepipe,
ParallelogramPipe pgrampipe,
double minPenSize,
double normPosition,
boolean adjustfill)
{
super(shapepipe);
outrenderer = pgrampipe;
this.minPenSize = minPenSize;
this.normPosition = normPosition;
this.normRoundingBias = 0.5 - normPosition;
this.adjustfill = adjustfill;
}
public void drawLine(SunGraphics2D sg2d,
int x1, int y1, int x2, int y2)
{
if (!drawGeneralLine(sg2d, x1, y1, x2, y2)) {
super.drawLine(sg2d, x1, y1, x2, y2);
}
}
public void drawRect(SunGraphics2D sg2d,
int x, int y, int w, int h)
{
if (w >= 0 && h >= 0) {
if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
BasicStroke bs = ((BasicStroke) sg2d.stroke);
if (w > 0 && h > 0) {
if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
bs.getDashArray() == null)
{
double lw = bs.getLineWidth();
drawRectangle(sg2d, x, y, w, h, lw);
return;
}
} else {
// Note: This calls the integer version which
// will verify that the local drawLine optimizations
// work and call super.drawLine(), if not.
drawLine(sg2d, x, y, x+w, y+h);
return;
}
}
super.drawRect(sg2d, x, y, w, h);
}
}
public void fillRect(SunGraphics2D sg2d,
int x, int y, int w, int h)
{
if (w > 0 && h > 0) {
fillRectangle(sg2d, x, y, w, h);
}
}
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
BasicStroke bs = ((BasicStroke) sg2d.stroke);
if (s instanceof Rectangle2D) {
if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
bs.getDashArray() == null)
{
Rectangle2D r2d = (Rectangle2D) s;
double w = r2d.getWidth();
double h = r2d.getHeight();
double x = r2d.getX();
double y = r2d.getY();
if (w >= 0 && h >= 0) {
double lw = bs.getLineWidth();
drawRectangle(sg2d, x, y, w, h, lw);
}
return;
}
} else if (s instanceof Line2D) {
Line2D l2d = (Line2D) s;
if (drawGeneralLine(sg2d,
l2d.getX1(), l2d.getY1(),
l2d.getX2(), l2d.getY2()))
{
return;
}
}
}
outpipe.draw(sg2d, s);
}
public void fill(SunGraphics2D sg2d, Shape s) {
if (s instanceof Rectangle2D) {
Rectangle2D r2d = (Rectangle2D) s;
double w = r2d.getWidth();
double h = r2d.getHeight();
if (w > 0 && h > 0) {
double x = r2d.getX();
double y = r2d.getY();
fillRectangle(sg2d, x, y, w, h);
}
return;
}
outpipe.fill(sg2d, s);
}
static double len(double x, double y) {
return ((x == 0) ? Math.abs(y)
: ((y == 0) ? Math.abs(x)
: Math.sqrt(x * x + y * y)));
}
double normalize(double v) {
return Math.floor(v + normRoundingBias) + normPosition;
}
public boolean drawGeneralLine(SunGraphics2D sg2d,
double x1, double y1,
double x2, double y2)
{
if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM ||
sg2d.strokeState == SunGraphics2D.STROKE_THINDASHED)
{
return false;
}
BasicStroke bs = (BasicStroke) sg2d.stroke;
int cap = bs.getEndCap();
if (cap == BasicStroke.CAP_ROUND || bs.getDashArray() != null) {
// TODO: we could construct the GeneralPath directly
// for CAP_ROUND and save a lot of processing in that case...
// And again, we would need to deal with dropout control...
return false;
}
double lw = bs.getLineWidth();
// Save the original dx, dy in case we need it to transform
// the linewidth as a perpendicular vector below
double dx = x2 - x1;
double dy = y2 - y1;
switch (sg2d.transformState) {
case SunGraphics2D.TRANSFORM_GENERIC:
case SunGraphics2D.TRANSFORM_TRANSLATESCALE:
{
double coords[] = {x1, y1, x2, y2};
sg2d.transform.transform(coords, 0, coords, 0, 2);
x1 = coords[0];
y1 = coords[1];
x2 = coords[2];
y2 = coords[3];
}
break;
case SunGraphics2D.TRANSFORM_ANY_TRANSLATE:
case SunGraphics2D.TRANSFORM_INT_TRANSLATE:
{
double tx = sg2d.transform.getTranslateX();
double ty = sg2d.transform.getTranslateY();
x1 += tx;
y1 += ty;
x2 += tx;
y2 += ty;
}
break;
case SunGraphics2D.TRANSFORM_ISIDENT:
break;
default:
throw new InternalError("unknown TRANSFORM state...");
}
if (sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN &&
outrenderer instanceof PixelDrawPipe)
{
// PixelDrawPipes will add sg2d.transXY so we need to factor
// that out...
int ix1 = (int) Math.floor(x1 - sg2d.transX);
int iy1 = (int) Math.floor(y1 - sg2d.transY);
int ix2 = (int) Math.floor(x2 - sg2d.transX);
int iy2 = (int) Math.floor(y2 - sg2d.transY);
((PixelDrawPipe)outrenderer).drawLine(sg2d, ix1, iy1, ix2, iy2);
return true;
}
x1 = normalize(x1);
y1 = normalize(y1);
x2 = normalize(x2);
y2 = normalize(y2);
}
if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
// Transform the linewidth...
// calculate the scaling factor for a unit vector
// perpendicular to the original user space line.
double len = len(dx, dy);
if (len == 0) {
dx = len = 1;
// dy = 0; already
}
// delta transform the transposed (90 degree rotated) unit vector
double unitvector[] = {dy/len, -dx/len};
sg2d.transform.deltaTransform(unitvector, 0, unitvector, 0, 1);
lw *= len(unitvector[0], unitvector[1]);
}
lw = Math.max(lw, minPenSize);
dx = x2 - x1;
dy = y2 - y1;
double len = len(dx, dy);
double udx, udy;
if (len == 0) {
if (cap == BasicStroke.CAP_BUTT) {
return true;
}
udx = lw;
udy = 0;
} else {
udx = lw * dx / len;
udy = lw * dy / len;
}
double px = x1 + udy / 2.0;
double py = y1 - udx / 2.0;
if (cap == BasicStroke.CAP_SQUARE) {
px -= udx / 2.0;
py -= udy / 2.0;
dx += udx;
dy += udy;
}
outrenderer.fillParallelogram(sg2d, px, py, -udy, udx, dx, dy);
return true;
}
public void fillRectangle(SunGraphics2D sg2d,
double rx, double ry,
double rw, double rh)
{
double px, py;
double dx1, dy1, dx2, dy2;
AffineTransform txform = sg2d.transform;
dx1 = txform.getScaleX();
dy1 = txform.getShearY();
dx2 = txform.getShearX();
dy2 = txform.getScaleY();
px = rx * dx1 + ry * dx2 + txform.getTranslateX();
py = rx * dy1 + ry * dy2 + txform.getTranslateY();
dx1 *= rw;
dy1 *= rw;
dx2 *= rh;
dy2 *= rh;
if (adjustfill &&
sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
{
double newx = normalize(px);
double newy = normalize(py);
dx1 = normalize(px + dx1) - newx;
dy1 = normalize(py + dy1) - newy;
dx2 = normalize(px + dx2) - newx;
dy2 = normalize(py + dy2) - newy;
px = newx;
py = newy;
}
outrenderer.fillParallelogram(sg2d, px, py, dx1, dy1, dx2, dy2);
}
public void drawRectangle(SunGraphics2D sg2d,
double rx, double ry,
double rw, double rh,
double lw)
{
double px, py;
double dx1, dy1, dx2, dy2;
double lw1, lw2;
AffineTransform txform = sg2d.transform;
dx1 = txform.getScaleX();
dy1 = txform.getShearY();
dx2 = txform.getShearX();
dy2 = txform.getScaleY();
px = rx * dx1 + ry * dx2 + txform.getTranslateX();
py = rx * dy1 + ry * dy2 + txform.getTranslateY();
// lw along dx1,dy1 scale by transformed length of dx2,dy2 vectors
// and vice versa
lw1 = len(dx1, dy1) * lw;
lw2 = len(dx2, dy2) * lw;
dx1 *= rw;
dy1 *= rw;
dx2 *= rh;
dy2 *= rh;
if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
{
double newx = normalize(px);
double newy = normalize(py);
dx1 = normalize(px + dx1) - newx;
dy1 = normalize(py + dy1) - newy;
dx2 = normalize(px + dx2) - newx;
dy2 = normalize(py + dy2) - newy;
px = newx;
py = newy;
}
lw1 = Math.max(lw1, minPenSize);
lw2 = Math.max(lw2, minPenSize);
double len1 = len(dx1, dy1);
double len2 = len(dx2, dy2);
if (lw1 >= len1 || lw2 >= len2) {
// The line widths are large enough to consume the
// entire hole in the middle of the parallelogram
// so we can just fill the outer parallelogram.
fillOuterParallelogram(sg2d,
px, py, dx1, dy1, dx2, dy2,
len1, len2, lw1, lw2);
} else {
outrenderer.drawParallelogram(sg2d,
px, py, dx1, dy1, dx2, dy2,
lw1 / len1, lw2 / len2);
}
}
/**
* This utility function handles the case where a drawRectangle
* operation discovered that the interior hole in the rectangle
* or parallelogram has been completely filled in by the stroke
* width. It calculates the outer parallelogram of the stroke
* and issues a single fillParallelogram request to fill it.
*/
public void fillOuterParallelogram(SunGraphics2D sg2d,
double px, double py,
double dx1, double dy1,
double dx2, double dy2,
double len1, double len2,
double lw1, double lw2)
{
double udx1 = dx1 / len1;
double udy1 = dy1 / len1;
double udx2 = dx2 / len2;
double udy2 = dy2 / len2;
if (len1 == 0) {
// len1 is 0, replace udxy1 with perpendicular of udxy2
if (len2 == 0) {
// both are 0, use a unit Y vector for udxy2
udx2 = 0;
udy2 = 1;
}
udx1 = udy2;
udy1 = -udx2;
} else if (len2 == 0) {
// len2 is 0, replace udxy2 with perpendicular of udxy1
udx2 = udy1;
udy2 = -udx1;
}
udx1 *= lw1;
udy1 *= lw1;
udx2 *= lw2;
udy2 *= lw2;
px -= (udx1 + udx2) / 2;
py -= (udy1 + udy2) / 2;
dx1 += udx1;
dy1 += udy1;
dx2 += udx2;
dy2 += udy2;
outrenderer.fillParallelogram(sg2d, px, py, dx1, dy1, dx2, dy2);
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe.hw;
/**
* An interface for receiving notifications about imminent accelerated device's
* events. Upon receiving such event appropriate actions can be taken (for
* example, resources associated with the device can be freed).
*/
public interface AccelDeviceEventListener {
/**
* Called when the device is about to be reset.
*
* One must release all native resources associated with the device which
* prevent the device from being reset (such as Default Pool resources for
* the D3D pipeline).
*
* It is safe to remove the listener while in the call back.
*
* Note: this method is called on the rendering thread,
* do not call into user code, do not take RQ lock!
*/
public void onDeviceReset();
/**
* Called when the device is about to be disposed of.
*
* One must release all native resources associated with the device.
*
* It is safe to remove the listener while in the call back.
*
* Note: this method is called on the rendering thread,
* do not call into user code, do not take RQ lock!
*/
public void onDeviceDispose();
}

View File

@ -0,0 +1,167 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe.hw;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* This class is used to notify listeners about accelerated device's
* events such as device reset or dispose that are about to occur.
*/
public class AccelDeviceEventNotifier {
private static AccelDeviceEventNotifier theInstance;
/**
* A device is about to be reset. The listeners have to release all
* resources associated with the device which are required for the device
* to be reset.
*/
public static final int DEVICE_RESET = 0;
/**
* A device is about to be disposed. The listeners have to release all
* resources associated with the device.
*/
public static final int DEVICE_DISPOSED = 1;
private final Map<AccelDeviceEventListener, Integer> listeners;
private AccelDeviceEventNotifier() {
listeners = Collections.synchronizedMap(
new HashMap<AccelDeviceEventListener, Integer>(1));
}
/**
* Returns a singleton of AccelDeviceEventNotifier if it exists. If the
* passed boolean is false and singleton doesn't exist yet, null is
* returned. If the passed boolean is {@code true} and singleton doesn't
* exist it will be created and returned.
*
* @param create whether to create a singleton instance if doesn't yet
* exist
* @return a singleton instance or null
*/
private static synchronized
AccelDeviceEventNotifier getInstance(boolean create)
{
if (theInstance == null && create) {
theInstance = new AccelDeviceEventNotifier();
}
return theInstance;
}
/**
* Called to indicate that a device event had occured.
* If a singleton exists, the listeners (those associated with
* the device) will be notified.
*
* @param screen a screen number of the device which is a source of
* the event
* @param eventType a type of the event
* @see #DEVICE_DISPOSED
* @see #DEVICE_RESET
*/
public static final void eventOccured(int screen, int eventType) {
AccelDeviceEventNotifier notifier = getInstance(false);
if (notifier != null) {
notifier.notifyListeners(eventType, screen);
}
}
/**
* Adds the listener associated with a device on particular screen.
*
* Note: the listener must be removed as otherwise it will forever
* be referenced by the notifier.
*
* @param l the listener
* @param screen the screen number indicating which device the listener is
* interested in.
*/
public static final void addListener(AccelDeviceEventListener l,int screen){
getInstance(true).add(l, screen);
}
/**
* Removes the listener.
*
* @param l the listener
*/
public static final void removeListener(AccelDeviceEventListener l) {
getInstance(true).remove(l);
}
private final void add(AccelDeviceEventListener theListener, int screen) {
listeners.put(theListener, screen);
}
private final void remove(AccelDeviceEventListener theListener) {
listeners.remove(theListener);
}
/**
* Notifies the listeners associated with the screen's device about the
* event.
*
* Implementation note: the current list of listeners is first duplicated
* which allows the listeners to remove themselves during the iteration.
*
* @param screen a screen number with which the device which is a source of
* the event is associated with
* @param eventType a type of the event
* @see #DEVICE_DISPOSED
* @see #DEVICE_RESET
*/
private final void notifyListeners(int deviceEventType, int screen) {
HashMap<AccelDeviceEventListener, Integer> listClone;
Set<AccelDeviceEventListener> cloneSet;
synchronized(listeners) {
listClone =
new HashMap<AccelDeviceEventListener, Integer>(listeners);
}
cloneSet = listClone.keySet();
Iterator<AccelDeviceEventListener> itr = cloneSet.iterator();
while (itr.hasNext()) {
AccelDeviceEventListener current = itr.next();
Integer i = listClone.get(current);
// only notify listeners which are interested in this device
if (i != null && i.intValue() != screen) {
continue;
}
if (deviceEventType == DEVICE_RESET) {
current.onDeviceReset();
} else if (deviceEventType == DEVICE_DISPOSED) {
current.onDeviceDispose();
}
}
}
}

View File

@ -0,0 +1,95 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe.hw;
import java.awt.image.VolatileImage;
/**
* Implementors of this interface provida a way to create a
* {@code VolatileImage} whose destination surface is an
* {@link AccelSurface} of specified type.
*
* @see AccelSurface
*/
public interface AccelGraphicsConfig extends BufferedContextProvider {
/**
* Returns a VolatileImage with specified width, height, transparency
* and guaranteed accelerated surface type. If such image can not be created
* (out of vram error, specific surface type is not supported) null
* is returned.
*
* Note: if {@link AccelSurface#TEXTURE} type is requested, rendering
* to the image will be denied by throwing
* {@code UnsupportedOperationException }
* from {@link java.awt.image.VolatileImage#getGraphics} and
* {@link java.awt.image.VolatileImage#createGraphics}
*
* @param width the width of the returned {@code VolatileImage}
* @param height the height of the returned {@code VolatileImage}
* @param transparency the specified transparency mode
* @param type requested accelerated surface type as specified by constants
* in AccelSurface interface
* @return a {@code VolatileImage} backed up by requested accelerated
* surface type or null
* @throws IllegalArgumentException if the transparency is not a valid value
* @see AccelSurface#TEXTURE
* @see AccelSurface#RT_PLAIN
* @see AccelSurface#RT_TEXTURE
*/
public VolatileImage createCompatibleVolatileImage(int width, int height,
int transparency,
int type);
/**
* Returns object representing capabilities of the context associated
* with this {@code AccelGraphicsConfig}.
*
* @return ContextCapabilities object representing caps
* @see ContextCapabilities
*/
public ContextCapabilities getContextCapabilities();
/**
* Adds an {@code AccelDeviceEventListener} to listen to accelerated
* device's (which is associated with this {@code AccelGraphicsConfig})
* events.
*
* Note: a hard link to the listener may be kept so it must be explicitly
* removed via {@link #removeDeviceEventListener()}.
*
* @param l the listener
* @see AccelDeviceEventListener
*/
public void addDeviceEventListener(AccelDeviceEventListener l);
/**
* Removes an {@code AccelDeviceEventListener} from the list of listeners
* for this device's events.
*
* @param l the listener
* @see AccelDeviceEventListener
*/
public void removeDeviceEventListener(AccelDeviceEventListener l);
}

View File

@ -0,0 +1,136 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe.hw;
import java.awt.Rectangle;
import sun.java2d.Surface;
/**
* Abstraction for a hardware accelerated surface.
*/
public interface AccelSurface extends BufferedContextProvider, Surface {
/**
* Undefined
*/
public static final int UNDEFINED = 0;
/**
* Window (or window substitute) surface
*/
public static final int WINDOW = 1;
/**
* Render-To Plain surface (pbuffer for OpenGL, Render Target surface
* for Direct3D)
*/
public static final int RT_PLAIN = 2;
/**
* Texture surface
*/
public static final int TEXTURE = 3;
/**
* A back-buffer surface (SwapChain surface for Direct3D, backbuffer for
* OpenGL)
*/
public static final int FLIP_BACKBUFFER = 4;
/**
* Render-To Texture surface (fbobject for OpenGL, texture with render-to
* attribute for Direct3D)
*/
public static final int RT_TEXTURE = 5;
/**
* Returns {@code int} representing surface's type as defined by constants
* in this interface.
*
* @return an integer representing this surface's type
* @see AccelSurface#UNDEFINED
* @see AccelSurface#WINDOW
* @see AccelSurface#RT_PLAIN
* @see AccelSurface#TEXTURE
* @see AccelSurface#FLIP_BACKBUFFER
* @see AccelSurface#RT_TEXTURE
*/
public int getType();
/**
* Returns a pointer to the native surface data associated with this
* surface.
* Note: this pointer is only valid on the rendering thread.
*
* @return pointer to the native surface's data
*/
public long getNativeOps();
/**
* Returns a pointer to the real native resource
* of the specified type associated with this AccelSurface.
* Note: this pointer is only valid on the rendering thread.
*
* @param resType the type of the requested resource
* @return a long containing a pointer to the native resource of the
* specified type or 0L if such resource doesn't exist for this surface
*/
public long getNativeResource(int resType);
/**
* Marks this surface dirty.
*/
public void markDirty();
/**
* Returns whether the pipeline considers this surface valid. A surface
* may become invalid if it is disposed of, or resized.
*
* @return true if valid, false otherwise
*/
public boolean isValid();
/**
* Returns whether this surface is lost. The return value is only valid
* on the render thread, meaning that even if this method returns
* {@code true} it could be lost in the next moment unless it is called
* on the rendering thread.
*
* @return true if the surface is known to be lost, false otherwise
*/
public boolean isSurfaceLost();
/**
* Returns the requested bounds of the destination surface. The real bounds
* of the native accelerated surface may differ. Use
* {@link #getNativeBounds} to get the bounds of the native surface.
*
* @return Rectangle representing java surface's bounds
*/
public Rectangle getBounds();
/**
* Returns real bounds of the native surface, which may differ from those
* returned by {@link #getBounds}.
*
* @return Rectangle representing native surface's bounds
*/
public Rectangle getNativeBounds();
}

View File

@ -0,0 +1,74 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe.hw;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import sun.awt.image.SunVolatileImage;
import static sun.java2d.pipe.hw.AccelSurface.*;
/**
* This is an image with forced type of the accelerated surface.
*/
public class AccelTypedVolatileImage extends SunVolatileImage {
/**
* Creates a volatile image with specified type of accelerated surface.
*
* @param graphicsConfig a GraphicsConfiguration for which this image should
* be created.
* @param width width
* @param height width
* @param transparency type of {@link java.awt.Transparency transparency}
* requested for the image
* @param accType type of the desired accelerated surface as defined in
* AccelSurface interface
* @see sun.java2d.pipe.hw.AccelSurface
*/
public AccelTypedVolatileImage(GraphicsConfiguration graphicsConfig,
int width, int height, int transparency,
int accType)
{
super(null, graphicsConfig, width, height, null, transparency,
null, accType);
}
/**
* {@inheritDoc}
*
* This method will throw {@code UnsupportedOperationException} if it this
* image's destination surface can not be rendered to.
*/
@Override
public Graphics2D createGraphics() {
if (getForcedAccelSurfaceType() == TEXTURE) {
throw new UnsupportedOperationException("Can't render " +
"to a non-RT Texture");
}
return super.createGraphics();
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.java2d.pipe.hw;
import sun.java2d.pipe.BufferedContext;
/**
* Classes implementing this interface can provide the {@code BufferedContext}
* associated with or used by them.
*
* @see sun.java2d.pipe.BufferedContext
*/
public interface BufferedContextProvider {
/**
* Retrieves a context associated with object implementing this
* interface.
*
* @return associated context
* @see sun.java2d.pipe.BufferedContext
*/
public BufferedContext getContext();
}

Some files were not shown because too many files have changed in this diff Show More