You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/10/25 16:45:48 UTC
svn commit: r588245 [2/10] - in /harmony/enhanced/classlib/branches/java6:
depends/build/ depends/files/ make/
modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/
modules/archive/ modules/archive/src/main/java/jav...
Modified: harmony/enhanced/classlib/branches/java6/depends/build/defines.mk
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/depends/build/defines.mk?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/depends/build/defines.mk (original)
+++ harmony/enhanced/classlib/branches/java6/depends/build/defines.mk Thu Oct 25 07:44:56 2007
@@ -84,3 +84,11 @@
ifeq ($(HY_ZIP_API),true)
DEFINES += -DHY_ZIP_API
endif
+
+ifeq ($(HY_LOCAL_ZLIB),true)
+DEFINES += -DHY_LOCAL_ZLIB
+OSLIBS += -lz
+MDLLIBZLIB =
+else
+MDLLIBZLIB += $(DLLPATH)libhyzlib$(HY_SHLIB_SUFFIX)
+endif
Modified: harmony/enhanced/classlib/branches/java6/depends/files/java.security
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/depends/files/java.security?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/depends/files/java.security (original)
+++ harmony/enhanced/classlib/branches/java6/depends/files/java.security Thu Oct 25 07:44:56 2007
@@ -79,7 +79,7 @@
# Class to instantiate as default JGSS manager.
-jgss.spi.manager=
+jgss.spi.manager=org.apache.harmony.auth.jgss.GSSManagerImpl
# The default SSLSocketFactory and SSLServerSocketFactory provider implementations.
Modified: harmony/enhanced/classlib/branches/java6/make/build-java.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/make/build-java.xml?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/make/build-java.xml (original)
+++ harmony/enhanced/classlib/branches/java6/make/build-java.xml Thu Oct 25 07:44:56 2007
@@ -113,13 +113,7 @@
target: -compile
================================= -->
<target name="-compile" depends="-prepare-depends, -layout">
- <fail message="The Eclipse compiler class for Ant could not be found. Please place the ECJ JAR in ANT_HOME/lib. The JAR can be downloaded directly from eclipse.org or copied from COMMON_RESOURCES/depends/jars/ecj_3.x folder after the fetch-depends target for JDKTOOLS has been run.">
- <condition>
- <not>
- <available classname="org.eclipse.jdt.core.JDTCompilerAdapter"/>
- </not>
- </condition>
- </fail>
+ <ensure-javac/>
<mkdir dir="${build.output}" />
<hy.javac destdir="${build.output}"
@@ -146,7 +140,8 @@
<src path="modules/luni/src/main/java" />
<src path="modules/math/src/main/java" />
<src path="modules/misc/src/main/java" />
- <src path="modules/nio/src/main/java" />
+ <src path="modules/nio/src/main/java/common" />
+ <src path="modules/nio/src/main/java/${hy.os.family}" />
<src path="modules/nio_char/src/main/java" />
<!-- pack200 uses customized build script and
should not be built from top-level build.xml -->
Modified: harmony/enhanced/classlib/branches/java6/make/build-test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/make/build-test.xml?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/make/build-test.xml (original)
+++ harmony/enhanced/classlib/branches/java6/make/build-test.xml Thu Oct 25 07:44:56 2007
@@ -107,21 +107,10 @@
<target name="compile-support" depends="copy-test-resources, check-support-jars"
description="Compile the unit test source">
- <fail message="The Eclipse compiler class for Ant could not be found. Please place the ECJ JAR in ANT_HOME/lib. The JAR can copied from CLASSLIB_TRUNK/depends/jars/ecj_3.2 folder after the fetch-depends target has been run.">
- <condition>
- <not>
- <available classname="org.eclipse.jdt.core.JDTCompilerAdapter"/>
- </not>
- </condition>
- </fail>
+ <ensure-javac/>
<mkdir dir="${tests.support.output}" />
- <javac
- destdir="${tests.support.output}"
- compiler="${hy.javac.compiler}"
- memoryMaximumSize="${hy.javac.maxmem}"
- source="${hy.javac.source}"
- target="${hy.javac.target}"
- debug="${hy.javac.debug}">
+ <hy.javac
+ destdir="${tests.support.output}">
<src path="${support.dir}/src/test/java" />
<classpath location="${junit.jar}" />
@@ -136,7 +125,7 @@
<include name="**/*.jar" />
</fileset>
</bootclasspath>
- </javac>
+ </hy.javac>
</target>
Modified: harmony/enhanced/classlib/branches/java6/make/properties.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/make/properties.xml?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/make/properties.xml (original)
+++ harmony/enhanced/classlib/branches/java6/make/properties.xml Thu Oct 25 07:44:56 2007
@@ -42,7 +42,7 @@
</condition>
<!-- Local variable tables should be available in debug, and unavailable in release modes. -->
- <condition property="build.compilerarg" value="-warn:none -g" else="-warn:none -g:lines,source">
+ <condition property="build.compilerarg" value="-nowarn -g" else="-nowarn -g:lines,source">
<equals arg1="${hy.cfg}" arg2="debug" />
</condition>
@@ -290,6 +290,13 @@
</not>
</condition>
+ <property name="hy.local.zlib" value="false" />
+ <condition property="hy.skip.zlib" value="true">
+ <not>
+ <equals arg1="${hy.local.zlib}" arg2="false" />
+ </not>
+ </condition>
+
<property name="hy.zip.api" value="false" />
<condition property="hy.skip.zip.api" value="true">
<not>
@@ -473,6 +480,7 @@
<env key="HY_PLATFORM" value="${hy.platform}" />
<env key="HY_NO_SIG" value="${hy.no.sig}" />
<env key="HY_NO_THR" value="${hy.no.thr}" />
+ <env key="HY_LOCAL_ZLIB" value="${hy.local.zlib}" />
<env key="HY_SHLIB_SUFFIX" value="${shlib.suffix}" />
<env key="HY_LINKLIB_SUFFIX" value="${linklib.suffix}" />
<arg line="${make.arg}" />
@@ -513,6 +521,24 @@
</concat>
</sequential>
</macrodef>
+
+ <macrodef name="ensure-javac">
+ <sequential>
+ <fail>
+ <condition>
+ <and>
+ <equals arg1="${hy.javac.compiler}" arg2="org.eclipse.jdt.core.JDTCompilerAdapter"/>
+ <not>
+ <available classname="${hy.javac.compiler}"/>
+ </not>
+ </and>
+ </condition>
+The Eclipse compiler class for Ant could not be found. Please place the ECJ JAR in ANT_HOME/lib.
+The JAR can be downloaded directly from eclipse.org or copied from COMMON_RESOURCES/depends/jars/ecj_3.x folder after the fetch-depends target for JDKTOOLS has been run.
+Alternatively, you can switch to another compiler, e.g. specify '-Dhy.javac.compiler=modern' for classic javac.
+ </fail>
+ </sequential>
+ </macrodef>
<presetdef name="hy.javac">
<javac target="${hy.javac.target}" source="${hy.javac.source}"
Modified: harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java Thu Oct 25 07:44:56 2007
@@ -39,7 +39,7 @@
Method m = methods[0];
AnnotationTypeMismatchException e = new AnnotationTypeMismatchException(
m, "some type");
- assertNotNull("can not instanciate AnnotationTypeMismatchException", e);
+ assertNotNull("can not instantiate AnnotationTypeMismatchException", e);
assertSame("wrong method name", m, e.element());
assertEquals("wrong found type", "some type", e.foundType());
}
Modified: harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java Thu Oct 25 07:44:56 2007
@@ -51,7 +51,7 @@
String elementName = "some element";
IncompleteAnnotationException e = new IncompleteAnnotationException(
clazz, elementName);
- assertNotNull("can not instanciate IncompleteAnnotationException", e);
+ assertNotNull("can not instantiate IncompleteAnnotationException", e);
assertSame("wrong annotation type", clazz, e.annotationType());
assertSame("wrong element name", elementName, e.elementName());
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/build.xml?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/build.xml Thu Oct 25 07:44:56 2007
@@ -43,7 +43,10 @@
<target name="build" depends="compile-java, copy-resources, build-jar" />
- <target name="copy-native-includes" depends="overlay-oss, copy-zipsup-include">
+ <target name="copy-native-includes"
+ depends="overlay-oss, copy-zipsup-include, copy-zlib-include" />
+
+ <target name="copy-zlib-include" unless="hy.skip.zlib">
<copy todir="${hy.hdk}/include" overwrite="yes">
<fileset dir="${hy.archive.src.main.native}/zlib_dist">
<include name="zlib.h" />
@@ -60,24 +63,25 @@
</copy>
</target>
- <target name="overlay-oss">
+ <target name="overlay-oss" unless="hy.skip.zlib">
<mkdir dir="${hy.archive.src.main.native}/zlib_dist" />
<unzip src="${zlib.zip}" dest="${hy.archive.src.main.native}/zlib_dist" />
<chmod dir="${hy.archive.src.main.native}/zlib_dist" perm="ugo+r" />
</target>
- <target name="clean-overlay-oss">
+ <target name="clean-overlay-oss" unless="hy.skip.zlib" >
<delete dir="${hy.archive.src.main.native}/zlib_dist" quiet="true" />
</target>
<!-- Build native code -->
- <target name="build-native" depends="-build-native-zip,-build-native" />
+ <target name="build-native"
+ depends="-build-native-zip,-build-native-zlib,-build-native-archive" />
<target name="-build-native-zip" if="hy.skip.zip.api">
<make dir="${hy.archive.src.main.native}/zip/${hy.os.family}" />
</target>
- <target name="-build-native">
+ <target name="-build-native-zlib" unless="hy.skip.zlib">
<make dir="${hy.archive.src.main.native}/zlib/${hy.os.family}" />
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
<fileset dir="${hy.archive.src.main.native}/zlib">
@@ -86,8 +90,10 @@
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
+ </target>
- <make dir="${hy.archive.src.main.native}/archive/${hy.os.family}" />
+ <target name="-build-native-archive">
+ <make dir="${hy.archive.src.main.native}/archive/${hy.os.family}" />
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
<fileset dir="${hy.archive.src.main.native}/archive">
<include name="*${shlib.suffix}*"/>
@@ -98,10 +104,20 @@
</target>
<!-- Clean natives -->
- <target name="clean-native">
- <make dir="${hy.archive.src.main.native}/zip/${hy.os.family}" target="clean" />
+ <target name="clean-native"
+ depends="-clean-native-zip,-clean-native-zlib,-clean-native-archive"/>
+
+ <target name="-clean-native-zip" if="hy.skip.zip.api">
+ <make dir="${hy.archive.src.main.native}/zip/${hy.os.family}"
+ target="clean" />
+ </target>
+
+ <target name="-clean-native-zlib" unless="hy.skip.zlib">
<make dir="${hy.archive.src.main.native}/zlib/${hy.os.family}"
target="clean" />
+ </target>
+
+ <target name="-clean-native-archive">
<make dir="${hy.archive.src.main.native}/archive/${hy.os.family}"
target="clean" />
</target>
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java Thu Oct 25 07:44:56 2007
@@ -112,7 +112,8 @@
}
private void openZip() throws IOException {
- int result = openZipImpl(Util.getBytes(fileName));
+ int result = openZipImpl(Util.getUTF8Bytes(fileName));
+
if (result != 0) {
switch (result) {
case 1:
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/unix/makefile?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/unix/makefile Thu Oct 25 07:44:56 2007
@@ -31,8 +31,8 @@
endif
MDLLIBFILES += \
- $(DLLPATH)libhyzlib$(HY_LINKLIB_SUFFIX) \
- $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
+ $(MDLLIBZLIB) $(LIBPATH)libhypool.a \
+ $(LIBPATH)libhyfdlibm.a $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
DLLNAME=../libhyarchive$(HY_SHLIB_SUFFIX)
EXPNAME=HYARCHIVE_0.1
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/include/shared/zipsup.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/include/shared/zipsup.h?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/include/shared/zipsup.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/include/shared/zipsup.h Thu Oct 25 07:44:56 2007
@@ -28,7 +28,11 @@
#include "hyport.h"
typedef struct HyZipCachePool HyZipCachePool;
+#if defined(HY_LOCAL_ZLIB)
+#define HY_ZIP_DLL_NAME "z"
+#else
#define HY_ZIP_DLL_NAME "hyzlib"
+#endif
#define ZIP_INTERNAL_MAX 80
#define ZIP_CM_Reduced1 2
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/zip/shared/hyzip.nls
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/zip/shared/hyzip.nls?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/zip/shared/hyzip.nls (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/zip/shared/hyzip.nls Thu Oct 25 07:44:56 2007
@@ -26,7 +26,7 @@
# Note to translators:
#
# This file uses printf style substitutions. Sequences such as %s, %.*s, %10d
-# etc. will be subsituted at runtime. The special case of %% is not a substitution.
+# etc. will be substituted at runtime. The special case of %% is not a substitution.
# It indicates a single percent sign. Please do not modify the format specifiers, or
# change their order. For instance, in a message like "from %d to %s", %d
# MUST appear before %s in any translated message, or a run-time crash
Modified: harmony/enhanced/classlib/branches/java6/modules/auth/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/auth/META-INF/MANIFEST.MF?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/auth/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/auth/META-INF/MANIFEST.MF Thu Oct 25 07:44:56 2007
@@ -17,6 +17,7 @@
java.beans,
java.io,
java.lang,
+ java.lang.reflect,
java.math;resolution:=optional,
java.net,
java.nio.charset,
@@ -32,6 +33,7 @@
javax.naming.directory,
javax.naming.ldap,
org.apache.harmony.kernel.vm,
+ org.apache.harmony.luni.util,
org.apache.harmony.security,
org.apache.harmony.security.asn1,
org.apache.harmony.security.fortress,
Modified: harmony/enhanced/classlib/branches/java6/modules/auth/src/main/java/common/org/apache/harmony/auth/login/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/auth/src/main/java/common/org/apache/harmony/auth/login/DefaultConfiguration.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/auth/src/main/java/common/org/apache/harmony/auth/login/DefaultConfiguration.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/auth/src/main/java/common/org/apache/harmony/auth/login/DefaultConfiguration.java Thu Oct 25 07:44:56 2007
@@ -59,7 +59,7 @@
"refreshLoginConfiguration"); //$NON-NLS-1$
// set of application entry
- private Map<String, List<AppConfigurationEntry>> configutations = Collections
+ private Map<String, List<AppConfigurationEntry>> configurations = Collections
.synchronizedMap(new HashMap<String, List<AppConfigurationEntry>>());
/**
@@ -74,7 +74,7 @@
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName) {
- List<AppConfigurationEntry> list = configutations.get(applicationName);
+ List<AppConfigurationEntry> list = configurations.get(applicationName);
if (list == null || list.isEmpty()) {
return null;
@@ -89,7 +89,7 @@
if (sm != null) {
sm.checkPermission(REFRESH_LOGIN_CONFIGURATION);
}
- configutations.clear();
+ configurations.clear();
init();
}
@@ -143,6 +143,6 @@
//throw new SecurityException ("Unable to load a login configuration file");
}
}
- configutations = fresh;
+ configurations = fresh;
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/auth/src/main/native/auth/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/auth/src/main/native/auth/unix/makefile?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/auth/src/main/native/auth/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/auth/src/main/native/auth/unix/makefile Thu Oct 25 07:44:56 2007
@@ -23,7 +23,7 @@
BUILDFILES = $(SHAREDSUB)auth_copyright.o authnix.o
ifneq ($(HY_ZIP_API),true)
-MDLLIBFILES += $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib$(HY_LINKLIB_SUFFIX)
+MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
endif
MDLLIBFILES += \
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Choice.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Choice.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Choice.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Choice.java Thu Oct 25 07:44:56 2007
@@ -572,8 +572,8 @@
FontMetrics fm = getFontMetrics(font);
minSize.height = fm.getHeight() + vGap + 1;
minSize.width = hGap + 16; // TODO: use arrow button size
-
- FontRenderContext frc = ((Graphics2D) getGraphics()).getFontRenderContext();
+ Graphics2D gr = (Graphics2D) getGraphics();
+ FontRenderContext frc = gr.getFontRenderContext();
int maxItemWidth = 5; // TODO: take width of some char
for (int i = 0; i < items.size(); i++) {
String item = getItem(i);
@@ -583,6 +583,7 @@
}
}
minSize.width += maxItemWidth;
+ gr.dispose();
return minSize;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Component.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Component.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Component.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Component.java Thu Oct 25 07:44:56 2007
@@ -3706,9 +3706,9 @@
if (g == null) {
return;
}
- initGraphics(g, event);
if (!getIgnoreRepaint()) {
if (event.getID() == PaintEvent.PAINT) {
+ initGraphics(g, event);
paint(g);
} else {
update(g);
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Font.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Font.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Font.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Font.java Thu Oct 25 07:44:56 2007
@@ -319,11 +319,6 @@
}
public GlyphVector createGlyphVector(FontRenderContext frc, int[] glyphCodes) throws org.apache.harmony.luni.util.NotImplementedException {
- if (!FontManager.IS_FONTLIB) {
- // TODO : to find out, how to operate with glyphcodes
- throw new NotImplementedException();
- }
-
int length = glyphCodes.length;
char[] chars = new char[length];
FontPeerImpl peer = (FontPeerImpl) getPeer();
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/FontMetrics.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/FontMetrics.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/FontMetrics.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/FontMetrics.java Thu Oct 25 07:44:56 2007
@@ -127,7 +127,7 @@
}
if ((off+len > data.length)){
- // awt.13C=number of elemets len is out of range
+ // awt.13C=number of elements len is out of range
throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$
}
@@ -146,7 +146,7 @@
}
if ((off+len > data.length)){
- // awt.13C=number of elemets len is out of range
+ // awt.13C=number of elements len is out of range
throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$
}
@@ -194,7 +194,7 @@
}
/**
- * Returns FontRenderContext instanse of the Graphics context specified.
+ * Returns FontRenderContext instance of the Graphics context specified.
* @param context the specified Graphics context
*
* @return a FontRenderContext of the specified Graphics context.
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Frame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Frame.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Frame.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/Frame.java Thu Oct 25 07:44:56 2007
@@ -572,6 +572,7 @@
if (g != null) {
menuBar.paint(g);
}
+ g.dispose();
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/List.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/List.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/List.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/List.java Thu Oct 25 07:44:56 2007
@@ -874,12 +874,14 @@
if (!isDisplayable()) {
return new Dimension();
}
- Dimension charSize = getMaxCharSize(getGraphics());
+ Graphics gr = getGraphics();
+ Dimension charSize = getMaxCharSize(gr);
int minRowHeight = charSize.height + 1;
final int MIN_CHARS_IN_ROW = 12;
int hGap = 2 * BORDER_SIZE;
int vGap = hGap;
int minWidth = charSize.width * MIN_CHARS_IN_ROW + hGap;
+ gr.dispose();
return new Dimension(minWidth, rows * minRowHeight + vGap);
} finally {
toolkit.unlockAWT();
@@ -897,7 +899,8 @@
return new Dimension();
}
int maxItemWidth = minSize.width;
- FontRenderContext frc = ((Graphics2D) getGraphics()).getFontRenderContext();
+ Graphics2D gr = (Graphics2D) getGraphics();
+ FontRenderContext frc = gr.getFontRenderContext();
Font font = getFont();
for (int i = 0; i < items.size(); i++) {
String item = getItem(i);
@@ -906,6 +909,7 @@
maxItemWidth = itemWidth;
}
}
+ gr.dispose();
return new Dimension(maxItemWidth, minSize.height);
} finally {
toolkit.unlockAWT();
@@ -1499,8 +1503,10 @@
Dimension clientSize = getClient().getSize();
vAdjustable.setUnitIncrement(itemSize.height);
vAdjustable.setBlockIncrement(clientSize.height);
- hAdjustable.setUnitIncrement(getMaxCharSize(getGraphics()).width);
+ Graphics gr = getGraphics();
+ hAdjustable.setUnitIncrement(getMaxCharSize(gr).width);
hAdjustable.setBlockIncrement(clientSize.width);
+ gr.dispose();
}
private boolean isIdxValid(int index) {
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/MenuComponent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/MenuComponent.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/MenuComponent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/MenuComponent.java Thu Oct 25 07:44:56 2007
@@ -670,6 +670,7 @@
if (gr != null) {
paint(gr);
}
+ gr.dispose();
if (showSubMenu) {
showSubMenu(selectedItemIndex);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/ModalContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/ModalContext.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/ModalContext.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/ModalContext.java Thu Oct 25 07:44:56 2007
@@ -39,8 +39,10 @@
*
*/
void runModalLoop() {
- running = true;
- toolkit.dispatchThread.runModalLoop(this);
+ if(!running) {
+ running = true;
+ toolkit.dispatchThread.runModalLoop(this);
+ }
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/PopupBox.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/PopupBox.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/PopupBox.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/PopupBox.java Thu Oct 25 07:44:56 2007
@@ -142,6 +142,7 @@
if (gr != null) {
paint(gr);
}
+ gr.dispose();
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/InputEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/InputEvent.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/InputEvent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/InputEvent.java Thu Oct 25 07:44:56 2007
@@ -58,113 +58,54 @@
public static final int ALT_GRAPH_DOWN_MASK = 8192;
- private static final int DOWN_MASKS = SHIFT_DOWN_MASK | CTRL_DOWN_MASK |
- META_DOWN_MASK | ALT_DOWN_MASK | BUTTON1_DOWN_MASK |
- BUTTON2_DOWN_MASK | BUTTON3_DOWN_MASK | ALT_GRAPH_DOWN_MASK;
+ static final int MASKS = SHIFT_MASK | CTRL_MASK | META_MASK | ALT_MASK
+ | ALT_GRAPH_MASK | BUTTON1_MASK | BUTTON2_MASK | BUTTON3_MASK;
- private long when;
- private int modifiersEx;
-
- public static String getModifiersExText(int modifiers/*Ex*/) {
- return MouseEvent.addMouseModifiersExText(
- KeyEvent.getKeyModifiersExText(modifiers), modifiers);
- }
-
- static int extractExFlags(int modifiers) {
- int exFlags = modifiers & DOWN_MASKS;
-
- if ((modifiers & SHIFT_MASK) != 0) {
- exFlags |= SHIFT_DOWN_MASK;
- }
- if ((modifiers & CTRL_MASK) != 0) {
- exFlags |= CTRL_DOWN_MASK;
- }
- if ((modifiers & META_MASK) != 0) {
- exFlags |= META_DOWN_MASK;
- }
- if ((modifiers & ALT_MASK) != 0) {
- exFlags |= ALT_DOWN_MASK;
- }
- if ((modifiers & ALT_GRAPH_MASK) != 0) {
- exFlags |= ALT_GRAPH_DOWN_MASK;
- }
- if ((modifiers & BUTTON1_MASK) != 0) {
- exFlags |= BUTTON1_DOWN_MASK;
- }
- if ((modifiers & BUTTON2_MASK) != 0) {
- exFlags |= BUTTON2_DOWN_MASK;
- }
- if ((modifiers & BUTTON3_MASK) != 0) {
- exFlags |= BUTTON3_DOWN_MASK;
- }
-
- return exFlags;
- }
+ static final int DOWN_MASKS = SHIFT_DOWN_MASK | CTRL_DOWN_MASK
+ | META_DOWN_MASK | ALT_DOWN_MASK | ALT_GRAPH_DOWN_MASK
+ | BUTTON1_DOWN_MASK | BUTTON2_DOWN_MASK | BUTTON3_DOWN_MASK;
+ private long when;
+ int modifiers;
+
InputEvent(Component source, int id, long when, int modifiers) {
super(source, id);
this.when = when;
- modifiersEx = extractExFlags(modifiers);
+ this.modifiers = modifiers;
}
+ public static String getModifiersExText(int modifiers) {
+ return MouseEvent.addMouseModifiersExText(
+ KeyEvent.getKeyModifiersExText(modifiers), modifiers);
+ }
+
public int getModifiers() {
- int modifiers = 0;
-
- if ((modifiersEx & SHIFT_DOWN_MASK) != 0) {
- modifiers |= SHIFT_MASK;
- }
- if ((modifiersEx & CTRL_DOWN_MASK) != 0) {
- modifiers |= CTRL_MASK;
- }
- if ((modifiersEx & META_DOWN_MASK) != 0) {
- modifiers |= META_MASK;
- }
- if ((modifiersEx & ALT_DOWN_MASK) != 0) {
- modifiers |= ALT_MASK;
- }
- if ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0) {
- modifiers |= ALT_GRAPH_MASK;
- }
- if ((modifiersEx & BUTTON1_DOWN_MASK) != 0) {
- modifiers |= BUTTON1_MASK;
- }
- if ((modifiersEx & BUTTON2_DOWN_MASK) != 0) {
- modifiers |= BUTTON2_MASK;
- }
- if ((modifiersEx & BUTTON3_DOWN_MASK) != 0) {
- modifiers |= BUTTON3_MASK;
- }
-
- return modifiers;
+ return modifiers & MASKS;
}
public int getModifiersEx() {
- return modifiersEx;
- }
-
- void setModifiers(int modifiers) {
- modifiersEx = extractExFlags(modifiers);
+ return modifiers & DOWN_MASKS;
}
public boolean isAltDown() {
- return ((modifiersEx & ALT_DOWN_MASK) != 0);
+ return ((modifiers & ALT_DOWN_MASK) != 0);
}
public boolean isAltGraphDown() {
- return ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0);
+ return ((modifiers & ALT_GRAPH_DOWN_MASK) != 0);
}
public boolean isControlDown() {
- return ((modifiersEx & CTRL_DOWN_MASK) != 0);
+ return ((modifiers & CTRL_DOWN_MASK) != 0);
}
public boolean isMetaDown() {
- return ((modifiersEx & META_DOWN_MASK) != 0);
+ return ((modifiers & META_DOWN_MASK) != 0);
}
public boolean isShiftDown() {
- return ((modifiersEx & SHIFT_DOWN_MASK) != 0);
+ return ((modifiers & SHIFT_DOWN_MASK) != 0);
}
public long getWhen() {
@@ -180,5 +121,4 @@
public boolean isConsumed() {
return super.isConsumed();
}
-
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/KeyEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/KeyEvent.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/KeyEvent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/KeyEvent.java Thu Oct 25 07:44:56 2007
@@ -436,7 +436,7 @@
private int keyLocation;
public static String getKeyModifiersText(int modifiers) {
- return getKeyModifiersExText(extractExFlags(modifiers));
+ return getKeyModifiersExText(extractModifiers(modifiers));
}
static String getKeyModifiersExText(int modifiersEx) {
@@ -554,7 +554,7 @@
long when, int modifiers,
int keyCode, char keyChar,
int keyLocation) {
- super(src, id, when, modifiers);
+ super(src, id, when, extractModifiers(modifiers));
if (id == KEY_TYPED) {
if (keyCode != VK_UNDEFINED) {
@@ -598,10 +598,9 @@
return keyLocation;
}
- @Override
@Deprecated
public void setModifiers(int modifiers) {
- super.setModifiers(modifiers);
+ this.modifiers = extractModifiers(modifiers);
}
public boolean isActionKey() {
@@ -678,4 +677,29 @@
return paramString;
}
+ private static int extractModifiers(int modifiers) {
+ int mod = 0;
+
+ if (((modifiers & SHIFT_MASK) != 0)
+ || ((modifiers & SHIFT_DOWN_MASK) != 0)) {
+ mod |= SHIFT_MASK | SHIFT_DOWN_MASK;
+ }
+ if (((modifiers & CTRL_MASK) != 0)
+ || ((modifiers & CTRL_DOWN_MASK) != 0)) {
+ mod |= CTRL_MASK | CTRL_DOWN_MASK;
+ }
+ if (((modifiers & META_MASK) != 0)
+ || ((modifiers & META_DOWN_MASK) != 0)) {
+ mod |= META_MASK | META_DOWN_MASK;
+ }
+ if (((modifiers & ALT_MASK) != 0) || ((modifiers & ALT_DOWN_MASK) != 0)) {
+ mod |= ALT_MASK | ALT_DOWN_MASK;
+ }
+ if (((modifiers & ALT_GRAPH_MASK) != 0)
+ || ((modifiers & ALT_GRAPH_DOWN_MASK) != 0)) {
+ mod |= ALT_GRAPH_MASK | ALT_GRAPH_DOWN_MASK;
+ }
+
+ return mod;
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/MouseEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/MouseEvent.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/MouseEvent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/event/MouseEvent.java Thu Oct 25 07:44:56 2007
@@ -63,6 +63,37 @@
private int button;
private int x;
private int y;
+
+ public MouseEvent(Component source, int id, long when, int modifiers,
+ int x, int y, int clickCount, boolean popupTrigger) {
+ this(source, id, when, modifiers, x, y, clickCount, popupTrigger,
+ NOBUTTON);
+ }
+
+ public MouseEvent(Component source, int id, long when, int modifiers,
+ int x, int y, int clickCount, boolean popupTrigger, int button) {
+ super(source, id, when, modifiers);
+
+ if ((button < NOBUTTON) || (button > BUTTON3)) {
+ // awt.18B=Invalid button value
+ throw new IllegalArgumentException(Messages.getString("awt.18B")); //$NON-NLS-1$
+ }
+
+ this.popupTrigger = popupTrigger;
+ this.clickCount = clickCount;
+ this.button = button;
+ this.x = x;
+ this.y = y;
+
+ if (getModifiers() != 0) {
+ setModifiersEx();
+ } else if (getModifiersEx() != 0) {
+ setModifiers();
+ } else if ((button != NOBUTTON)
+ && ((id >= MOUSE_CLICKED) && (id <= MOUSE_RELEASED))) {
+ setButtonModifiers();
+ }
+ }
public static String getMouseModifiersText(int modifiers) {
final StringBuffer text = new StringBuffer();
@@ -77,7 +108,15 @@
text.append(Toolkit.getProperty("AWT.control", "Ctrl")).append("+"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if ((modifiers & ALT_MASK) != 0) {
- text.append(Toolkit.getProperty("AWT.alt", "Alt")).append("+"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // XXX: The following hook is required to avoid conflicts between
+ // ALT_MASK and BUTTON2_MASK which have the same value.
+ if ((modifiers & BUTTON2_DOWN_MASK) != 0) {
+ if ((modifiers & ALT_DOWN_MASK) != 0) {
+ text.append(Toolkit.getProperty("AWT.alt", "Alt")).append("+"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ } else {
+ text.append(Toolkit.getProperty("AWT.alt", "Alt")).append("+"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
if ((modifiers & ALT_GRAPH_MASK) != 0) {
text.append(Toolkit.getProperty("AWT.altGraph", "Alt Graph")).append("+"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -113,31 +152,6 @@
return text;
}
- public MouseEvent(Component source, int id, long when,
- int modifiers, int x, int y,
- int clickCount, boolean popupTrigger) {
- this(source, id, when, modifiers, x, y,
- clickCount, popupTrigger, NOBUTTON);
- }
-
- public MouseEvent(Component source, int id, long when,
- int modifiers, int x, int y,
- int clickCount, boolean popupTrigger, int button) {
- super(source, id, when, modifiers);
-
- if ((button != NOBUTTON) && (button != BUTTON1) &&
- (button != BUTTON2) && (button != BUTTON3)) {
- // awt.18B=Invalid button value
- throw new IllegalArgumentException(Messages.getString("awt.18B")); //$NON-NLS-1$
- }
-
- this.popupTrigger = popupTrigger;
- this.clickCount = clickCount;
- this.button = button;
- this.x = x;
- this.y = y;
- }
-
public int getButton() {
return button;
}
@@ -215,12 +229,130 @@
",button=" + button; //$NON-NLS-1$
if (getModifiersEx() > 0) {
paramString +=
- ",modifiers=" + getModifiersExText(getModifiersEx()) + //$NON-NLS-1$
- ",extModifiers=" + getModifiersExText(getModifiersEx()); //$NON-NLS-1$
+ ",modifiers=" + getMouseModifiersText(modifiers) + //$NON-NLS-1$
+ ",extModifiers=" + getModifiersExText(modifiers); //$NON-NLS-1$
}
paramString += ",clickCount=" + getClickCount(); //$NON-NLS-1$
return paramString;
}
+ private void setModifiers() {
+ modifiers &= ~MASKS; // clear modifiers
+
+ if ((modifiers & SHIFT_DOWN_MASK) != 0) {
+ modifiers |= SHIFT_MASK;
+ }
+ if ((modifiers & CTRL_DOWN_MASK) != 0) {
+ modifiers |= CTRL_MASK;
+ }
+ if ((modifiers & META_DOWN_MASK) != 0) {
+ modifiers |= META_MASK;
+ }
+ if ((modifiers & ALT_DOWN_MASK) != 0) {
+ modifiers |= ALT_MASK;
+ }
+ if ((modifiers & ALT_GRAPH_DOWN_MASK) != 0) {
+ modifiers |= ALT_GRAPH_MASK;
+ }
+
+ if ((id >= MOUSE_CLICKED) && (id <= MOUSE_RELEASED)) {
+ switch (button) {
+ case BUTTON1:
+ modifiers |= BUTTON1_MASK;
+ break;
+ case BUTTON2:
+ modifiers |= BUTTON2_MASK;
+ break;
+ case BUTTON3:
+ modifiers |= BUTTON3_MASK;
+ break;
+ }
+ } else {
+ if ((modifiers & BUTTON1_DOWN_MASK) != 0) {
+ modifiers |= BUTTON1_MASK;
+ }
+ if ((modifiers & BUTTON2_DOWN_MASK) != 0) {
+ modifiers |= BUTTON2_MASK;
+ }
+ if ((modifiers & BUTTON3_DOWN_MASK) != 0) {
+ modifiers |= BUTTON3_MASK;
+ }
+ }
+ }
+
+ private void setModifiersEx() {
+ modifiers &= ~DOWN_MASKS; // clear ex modifiers
+
+ if ((modifiers & SHIFT_MASK) != 0) {
+ modifiers |= SHIFT_DOWN_MASK;
+ }
+ if ((modifiers & CTRL_MASK) != 0) {
+ modifiers |= CTRL_DOWN_MASK;
+ }
+ if ((modifiers & META_MASK) != 0) {
+ modifiers |= META_DOWN_MASK;
+ }
+ if ((modifiers & ALT_MASK) != 0) {
+ modifiers |= ALT_DOWN_MASK;
+ }
+ if ((modifiers & ALT_GRAPH_MASK) != 0) {
+ modifiers |= ALT_GRAPH_DOWN_MASK;
+ }
+
+ if ((id >= MOUSE_CLICKED) && (id <= MOUSE_RELEASED)) {
+ if ((modifiers & BUTTON1_MASK) != 0) {
+ button = BUTTON1;
+
+ if (id == MOUSE_PRESSED) {
+ modifiers |= BUTTON1_DOWN_MASK;
+ }
+ } else if ((modifiers & BUTTON2_MASK) != 0) {
+ button = BUTTON2;
+
+ if (id == MOUSE_PRESSED) {
+ modifiers |= BUTTON2_DOWN_MASK;
+ }
+ } else if ((modifiers & BUTTON3_MASK) != 0) {
+ button = BUTTON3;
+
+ if (id == MOUSE_PRESSED) {
+ modifiers |= BUTTON3_DOWN_MASK;
+ }
+ }
+ } else {
+ if ((modifiers & BUTTON1_MASK) != 0) {
+ modifiers |= BUTTON1_DOWN_MASK;
+ }
+ if ((modifiers & BUTTON2_MASK) != 0) {
+ modifiers |= BUTTON2_DOWN_MASK;
+ }
+ if ((modifiers & BUTTON3_MASK) != 0) {
+ modifiers |= BUTTON3_DOWN_MASK;
+ }
+ }
+ }
+
+ private void setButtonModifiers() {
+ switch (button) {
+ case BUTTON1:
+ modifiers |= BUTTON1_MASK;
+ if (id == MOUSE_PRESSED) {
+ modifiers |= BUTTON1_DOWN_MASK;
+ }
+ break;
+ case BUTTON2:
+ modifiers |= BUTTON2_MASK;
+ if (id == MOUSE_PRESSED) {
+ modifiers |= BUTTON2_DOWN_MASK;
+ }
+ break;
+ case BUTTON3:
+ modifiers |= BUTTON3_MASK;
+ if (id == MOUSE_PRESSED) {
+ modifiers |= BUTTON3_DOWN_MASK;
+ }
+ break;
+ }
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java Thu Oct 25 07:44:56 2007
@@ -39,7 +39,7 @@
private BigInteger validBits; // Specify valid Color Map values
private static final int CACHESIZE = 20; // Cache size. Cache used for
- // improving performace of selection
+ // improving performance of selection
// nearest color in Color Map
private final int cachetable[] = new int[CACHESIZE * 2]; // Cache table - used for
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProvider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProvider.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProvider.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProvider.java Thu Oct 25 07:44:56 2007
@@ -60,7 +60,7 @@
public String[] getNativeFormats();
- public boolean isNativeFormatAtailable(String nativeFormat);
+ public boolean isNativeFormatAvailable(String nativeFormat);
public String getText();
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProxy.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProxy.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProxy.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataProxy.java Thu Oct 25 07:44:56 2007
@@ -133,7 +133,7 @@
private Object getPlainText(DataFlavor f)
throws IOException, UnsupportedFlavorException {
- if (!data.isNativeFormatAtailable(DataProvider.FORMAT_TEXT)) {
+ if (!data.isNativeFormatAvailable(DataProvider.FORMAT_TEXT)) {
throw new UnsupportedFlavorException(f);
}
String str = data.getText();
@@ -146,7 +146,7 @@
private Object getFileList(DataFlavor f)
throws IOException, UnsupportedFlavorException {
- if (!data.isNativeFormatAtailable(DataProvider.FORMAT_FILE_LIST)) {
+ if (!data.isNativeFormatAvailable(DataProvider.FORMAT_FILE_LIST)) {
throw new UnsupportedFlavorException(f);
}
String[] files = data.getFileList();
@@ -159,7 +159,7 @@
private Object getHTML(DataFlavor f)
throws IOException, UnsupportedFlavorException {
- if (!data.isNativeFormatAtailable(DataProvider.FORMAT_HTML)) {
+ if (!data.isNativeFormatAvailable(DataProvider.FORMAT_HTML)) {
throw new UnsupportedFlavorException(f);
}
String str = data.getHTML();
@@ -172,7 +172,7 @@
private Object getURL(DataFlavor f)
throws IOException, UnsupportedFlavorException {
- if (!data.isNativeFormatAtailable(DataProvider.FORMAT_URL)) {
+ if (!data.isNativeFormatAvailable(DataProvider.FORMAT_URL)) {
throw new UnsupportedFlavorException(f);
}
String str = data.getURL();
@@ -194,7 +194,7 @@
throws IOException, UnsupportedFlavorException {
String nativeFormat = SystemFlavorMap.encodeDataFlavor(f);
if ((nativeFormat == null) ||
- !data.isNativeFormatAtailable(nativeFormat)) {
+ !data.isNativeFormatAvailable(nativeFormat)) {
throw new UnsupportedFlavorException(f);
}
byte bytes[] = data.getSerializedObject(f.getRepresentationClass());
@@ -248,7 +248,7 @@
private Image getImage(DataFlavor f)
throws IOException, UnsupportedFlavorException {
- if (!data.isNativeFormatAtailable(DataProvider.FORMAT_IMAGE)) {
+ if (!data.isNativeFormatAvailable(DataProvider.FORMAT_IMAGE)) {
throw new UnsupportedFlavorException(f);
}
RawBitmap bitmap = data.getRawBitmap();
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSnapshot.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSnapshot.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSnapshot.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSnapshot.java Thu Oct 25 07:44:56 2007
@@ -71,7 +71,7 @@
// TODO: refine the list of native formats
}
- public boolean isNativeFormatAtailable(String nativeFormat) {
+ public boolean isNativeFormatAvailable(String nativeFormat) {
if (nativeFormat == null) {
return false;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSource.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSource.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSource.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/datatransfer/DataSource.java Thu Oct 25 07:44:56 2007
@@ -228,7 +228,7 @@
}
}
- public boolean isNativeFormatAtailable(String nativeFormat) {
+ public boolean isNativeFormatAvailable(String nativeFormat) {
return getNativeFormatsList().contains(nativeFormat);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java Thu Oct 25 07:44:56 2007
@@ -55,6 +55,7 @@
import java.awt.image.WritableRaster;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -129,13 +130,16 @@
private static final Map<RenderingHints.Key, Object> DEFAULT_RENDERING_HINTS;
static {
- DEFAULT_RENDERING_HINTS = new HashMap<RenderingHints.Key, Object>();
- DEFAULT_RENDERING_HINTS.put(RenderingHints.KEY_TEXT_ANTIALIASING,
+ final Map<RenderingHints.Key, Object> m = new HashMap<RenderingHints.Key, Object>();
+
+ m.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
- DEFAULT_RENDERING_HINTS.put(RenderingHints.KEY_ANTIALIASING,
+ m.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
- DEFAULT_RENDERING_HINTS.put(RenderingHints.KEY_STROKE_CONTROL,
+ m.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_DEFAULT);
+
+ DEFAULT_RENDERING_HINTS = Collections.unmodifiableMap(m);
}
protected Surface dstSurf = null;
@@ -966,6 +970,7 @@
@Override
public void setRenderingHints(Map<?,?> hints) {
this.hints.clear();
+ this.hints.putAll(DEFAULT_RENDERING_HINTS);
this.hints.putAll(hints);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/MultiRectArea.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/MultiRectArea.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/MultiRectArea.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/MultiRectArea.java Thu Oct 25 07:44:56 2007
@@ -712,7 +712,7 @@
}
/**
- * Recturn rectangle count in the buffer
+ * Return rectangle count in the buffer
*/
public int getRectCount() {
return (rect[0] - 1) / 4;
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java Thu Oct 25 07:44:56 2007
@@ -471,7 +471,7 @@
*/
@Override
public FontExtraMetrics getExtraMetrics(){
- // Returns FontExtraMetrics instanse of the first physical
+ // Returns FontExtraMetrics instance of the first physical
// Font from the array of fonts.
return fPhysicalFonts[0].getExtraMetrics();
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java Thu Oct 25 07:44:56 2007
@@ -157,7 +157,7 @@
public abstract void dispose();
/**
- * Returns Glyph represeting missing char.
+ * Returns Glyph representing missing char.
*/
public abstract Glyph getDefaultGlyph();
@@ -462,15 +462,13 @@
}
}
+ /**
+ * Returns unicode by glyph index.
+ */
public char getUnicodeByIndex(int glyphCode) {
return 0;
}
- /**
- * Sets new font type to the font object.
- *
- * @param newType new type value
- */
@Override
protected void finalize() throws Throwable {
super.finalize();
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegmentImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegmentImpl.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegmentImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegmentImpl.java Thu Oct 25 07:44:56 2007
@@ -206,7 +206,7 @@
}
/**
- * Attemts to map each character to the corresponding advance increment
+ * Attempts to map each character to the corresponding advance increment
*/
void initAdvanceMapping() {
GlyphVector gv = getGlyphVector();
@@ -300,7 +300,7 @@
}
/**
- * Attemts to create mapping of the characters to glyphs in the glyph vector.
+ * Attempts to create mapping of the characters to glyphs in the glyph vector.
* @return array where for each character index stored corresponding glyph index
*/
private int[] getChar2Glyph() {
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLGlyph.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLGlyph.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLGlyph.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLGlyph.java Thu Oct 25 07:44:56 2007
@@ -64,15 +64,15 @@
// bim.getRaster().
- int dbufferLenght = w * h;
+ int dbufferLength = w * h;
- DataBufferByte dbuffer = new DataBufferByte(dbufferLenght);
+ DataBufferByte dbuffer = new DataBufferByte(dbufferLength);
WritableRaster scanRaster = Raster.createInterleavedRaster(dbuffer, w, h, w, 1,new int[]{0}, null);
/*WritableRaster scanRaster = Raster.createPackedRaster(
dbuffer,
- (dbufferLenght / h) << 3,
+ (dbufferLength / h) << 3,
h,
1,
null
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java Thu Oct 25 07:44:56 2007
@@ -38,9 +38,12 @@
import java.awt.image.ImageProducer;
import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
+import java.util.ConcurrentModificationException;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Vector;
+import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor;
import org.apache.harmony.awt.gl.ImageSurface;
import org.apache.harmony.awt.internal.nls.Messages;
@@ -63,7 +66,11 @@
int imageState;
int hints;
private boolean producing;
+ private boolean done;
private ImageSurface imageSurf;
+ Object surfData;
+ AwtImageBackdoorAccessor ba = AwtImageBackdoorAccessor.getInstance();
+
public OffscreenImage(ImageProducer ip){
imageState = 0;
@@ -72,6 +79,7 @@
height = -1;
observers = new Vector<ImageObserver>();
producing = false;
+ done = false;
}
@Override
@@ -80,12 +88,11 @@
// awt.38=Property name is not defined
throw new NullPointerException(Messages.getString("awt.38")); //$NON-NLS-1$
}
- if(properties == null){
- addObserver(observer);
- startProduction();
- if(properties == null) {
- return null;
- }
+ if(!done && properties == null){
+ startProduction(observer);
+ }
+ if(properties == null) {
+ return null;
}
Object prop = properties.get(name);
if(prop == null) {
@@ -101,24 +108,16 @@
@Override
public int getWidth(ImageObserver observer) {
- if((imageState & ImageObserver.WIDTH) == 0){
- addObserver(observer);
- startProduction();
- if((imageState & ImageObserver.WIDTH) == 0) {
- return -1;
- }
+ if(!done && (imageState & ImageObserver.WIDTH) == 0){
+ startProduction(observer);
}
return width;
}
@Override
public int getHeight(ImageObserver observer) {
- if((imageState & ImageObserver.HEIGHT) == 0){
- addObserver(observer);
- startProduction();
- if((imageState & ImageObserver.HEIGHT) == 0) {
- return -1;
- }
+ if(!done && (imageState & ImageObserver.HEIGHT) == 0){
+ startProduction(observer);
}
return height;
}
@@ -131,24 +130,26 @@
@Override
public void flush() {
- stopProduction();
- imageUpdate(this, ImageObserver.ABORT, -1, -1, -1, -1);
- imageState &= ~ImageObserver.ERROR;
- imageState = 0;
- image = null;
- cm = null;
- raster = null;
- hints = 0;
- width = -1;
- height = -1;
+ imageUpdate(ImageObserver.ABORT, -1, -1, -1, -1);
+ synchronized (this) {
+ imageState = 0;
+ image = null;
+ cm = null;
+ raster = null;
+ hints = 0;
+ width = -1;
+ height = -1;
+ }
}
- public void setProperties(Hashtable<?, ?> properties) {
- this.properties = properties;
- imageUpdate(this, ImageObserver.PROPERTIES, 0, 0, width, height);
+ public void setProperties(Hashtable<?, ?> properties) {
+ synchronized (this) {
+ this.properties = properties;
+ }
+ imageUpdate(ImageObserver.PROPERTIES);
}
- public void setColorModel(ColorModel cm) {
+ public synchronized void setColorModel(ColorModel cm) {
this.cm = cm;
}
@@ -164,6 +165,7 @@
*/
public void setPixels(int x, int y, int w, int h, ColorModel model,
int[] pixels, int off, int scansize) {
+
if(raster == null){
if(cm == null){
if(model == null) {
@@ -182,40 +184,42 @@
forceToIntARGB();
}
- if(cm == model && model.getTransferType() == DataBuffer.TYPE_INT &&
- raster.getNumDataElements() == 1){
+ synchronized(surfData){
+ if(cm == model && model.getTransferType() == DataBuffer.TYPE_INT &&
+ raster.getNumDataElements() == 1){
+
+ int data[] = (int[])surfData;
+ int scanline = raster.getWidth();
+ DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer();
+ int rof = dbi.getOffset() + y * scanline + x;
+ for(int lineOff = off, line = y; line < y + h;
+ line++, lineOff += scansize, rof += scanline){
- DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer();
- int data[] = dbi.getData();
- int scanline = raster.getWidth();
- int rof = dbi.getOffset() + y * scanline + x;
- for(int lineOff = off, line = y; line < y + h;
- line++, lineOff += scansize, rof += scanline){
-
- System.arraycopy(pixels, lineOff, data, rof, w);
- }
-
- }else if(isIntRGB){
- int buff[] = new int[w];
- DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer();
- int data[] = dbi.getData();
- int scanline = raster.getWidth();
- int rof = dbi.getOffset() + y * scanline + x;
- for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
- rof += scanline) {
+ System.arraycopy(pixels, lineOff, data, rof, w);
+ }
+
+ }else if(isIntRGB){
+ int buff[] = new int[w];
+ int data[] = (int[])surfData;
+ int scanline = raster.getWidth();
+ DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer();
+ int rof = dbi.getOffset() + y * scanline + x;
+ for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
+ rof += scanline) {
- for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
- buff[idx] = model.getRGB(pixels[sOff + idx]);
+ for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
+ buff[idx] = model.getRGB(pixels[sOff + idx]);
+ }
+ System.arraycopy(buff, 0, data, rof, w);
}
- System.arraycopy(buff, 0, data, rof, w);
- }
- }else{
- Object buf = null;
- for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
- for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
- int rgb = model.getRGB(pixels[sOff + idx]);
- buf = cm.getDataElements(rgb, buf);
- raster.setDataElements(sx, sy, buf);
+ }else{
+ Object buf = null;
+ for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
+ for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
+ int rgb = model.getRGB(pixels[sOff + idx]);
+ buf = cm.getDataElements(rgb, buf);
+ raster.setDataElements(sx, sy, buf);
+ }
}
}
}
@@ -224,7 +228,7 @@
imageSurf.invalidate();
}
- imageUpdate(this, ImageObserver.SOMEBITS, 0, 0, width, height);
+ imageUpdate(ImageObserver.SOMEBITS);
}
public void setPixels(int x, int y, int w, int h, ColorModel model,
@@ -247,60 +251,61 @@
forceToIntARGB();
}
- if(isIntRGB){
- int buff[] = new int[w];
- IndexColorModel icm = (IndexColorModel) model;
- int colorMap[] = new int[icm.getMapSize()];
- icm.getRGBs(colorMap);
- DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer();
- int data[] = dbi.getData();
- int scanline = raster.getWidth();
- int rof = dbi.getOffset() + y * scanline + x;
- if(model instanceof IndexColorModel){
+ synchronized(surfData){
+ if(isIntRGB){
+ int buff[] = new int[w];
+ IndexColorModel icm = (IndexColorModel) model;
+ int colorMap[] = new int[icm.getMapSize()];
+ icm.getRGBs(colorMap);
+ int data[] = (int[])surfData;
+ int scanline = raster.getWidth();
+ DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer();
+ int rof = dbi.getOffset() + y * scanline + x;
+ if(model instanceof IndexColorModel){
+
+ for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
+ rof += scanline) {
+ for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
+ buff[idx] = colorMap[pixels[sOff + idx] & 0xff];
+ }
+ System.arraycopy(buff, 0, data, rof, w);
+ }
+ }else{
- for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
- rof += scanline) {
- for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
- buff[idx] = colorMap[pixels[sOff + idx] & 0xff];
+ for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
+ rof += scanline) {
+ for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
+ buff[idx] = model.getRGB(pixels[sOff + idx] & 0xff);
+ }
+ System.arraycopy(buff, 0, data, rof, w);
}
- System.arraycopy(buff, 0, data, rof, w);
}
- }else{
+ }else if(model == cm && model.getTransferType() == DataBuffer.TYPE_BYTE &&
+ raster.getNumDataElements() == 1){
- for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
- rof += scanline) {
- for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
- buff[idx] = model.getRGB(pixels[sOff + idx] & 0xff);
- }
- System.arraycopy(buff, 0, data, rof, w);
+ byte data[] = (byte[])surfData;
+ int scanline = raster.getWidth();
+ DataBufferByte dbb = (DataBufferByte)raster.getDataBuffer();
+ int rof = dbb.getOffset() + y * scanline + x;
+ for(int lineOff = off, line = y; line < y + h;
+ line++, lineOff += scansize, rof += scanline){
+ System.arraycopy(pixels, lineOff, data, rof, w);
}
- }
- }else if(model == cm && model.getTransferType() == DataBuffer.TYPE_BYTE &&
- raster.getNumDataElements() == 1){
+ }else if(model == cm && model.getTransferType() == DataBuffer.TYPE_BYTE &&
+ cm instanceof ComponentColorModel){
- DataBufferByte dbb = (DataBufferByte)raster.getDataBuffer();
- byte data[] = dbb.getData();
- int scanline = raster.getWidth();
- int rof = dbb.getOffset() + y * scanline + x;
- for(int lineOff = off, line = y; line < y + h;
- line++, lineOff += scansize, rof += scanline){
- System.arraycopy(pixels, lineOff, data, rof, w);
- }
- }else if(model == cm && model.getTransferType() == DataBuffer.TYPE_BYTE &&
- cm instanceof ComponentColorModel){
-
- int nc = cm.getNumComponents();
- byte stride[] = new byte[scansize];
- for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
- System.arraycopy(pixels, sOff, stride, 0, scansize);
-
- raster.setDataElements(x, sy, w, 1, stride);
- }
- }else {
- for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
- for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
- int rgb = model.getRGB(pixels[sOff + idx] & 0xff);
- raster.setDataElements(sx, sy, cm.getDataElements(rgb, null));
+ byte stride[] = new byte[scansize];
+ for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
+ System.arraycopy(pixels, sOff, stride, 0, scansize);
+
+ raster.setDataElements(x, sy, w, 1, stride);
+ }
+ }else {
+ for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
+ for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
+ int rgb = model.getRGB(pixels[sOff + idx] & 0xff);
+ raster.setDataElements(sx, sy, cm.getDataElements(rgb, null));
+ }
}
}
}
@@ -309,23 +314,26 @@
imageSurf.invalidate();
}
- imageUpdate(this, ImageObserver.SOMEBITS, 0, 0, width, height);
+ imageUpdate(ImageObserver.SOMEBITS);
}
public void setDimensions(int width, int height) {
if(width <= 0 || height <= 0){
- imageComplete(ImageObserver.ERROR);
+ imageComplete(IMAGEERROR);
return;
}
+ synchronized (this) {
+ this.width = width;
+ this.height = height;
+ }
+ imageUpdate(ImageObserver.WIDTH | ImageObserver.HEIGHT);
- this.width = width;
- this.height = height;
- imageUpdate(this, (ImageObserver.HEIGHT | ImageObserver.WIDTH),
- 0, 0, width, height);
}
public void setHints(int hints) {
- this.hints = hints;
+ synchronized (this) {
+ this.hints = hints;
+ }
}
public void imageComplete(int state) {
@@ -347,16 +355,17 @@
// awt.3B=Incorrect ImageConsumer completion status
throw new IllegalArgumentException(Messages.getString("awt.3B")); //$NON-NLS-1$
}
- imageUpdate(this, flag, 0, 0, width, height);
- if((flag & (ImageObserver.ERROR | ImageObserver.ABORT |
+ imageUpdate(flag);
+ if((imageState & (ImageObserver.ERROR | ImageObserver.ABORT |
ImageObserver.ALLBITS)) != 0 ) {
+
stopProduction();
- observers.removeAllElements();
}
+
}
- public /*synchronized*/ BufferedImage getBufferedImage(){
+ public BufferedImage getBufferedImage(){
if(image == null){
ColorModel model = getColorModel();
WritableRaster wr = getRaster();
@@ -367,37 +376,38 @@
return image;
}
- public /*synchronized*/ int checkImage(ImageObserver observer){
- addObserver(observer);
+ public int checkImage(ImageObserver observer){
+ synchronized (this) {
+ addObserver(observer);
+ }
return imageState;
}
- public /*synchronized*/ boolean prepareImage(ImageObserver observer){
- if((imageState & ImageObserver.ERROR) != 0){
- if(observer != null){
- observer.imageUpdate(this, ImageObserver.ERROR |
- ImageObserver.ABORT, -1, -1, -1, -1);
+ public boolean prepareImage(ImageObserver observer){
+ if(!done){
+ if((imageState & ImageObserver.ERROR) != 0){
+ if(observer != null){
+ observer.imageUpdate(this, ImageObserver.ERROR |
+ ImageObserver.ABORT, -1, -1, -1, -1);
+ }
+ return false;
}
- return false;
+ startProduction(observer);
}
- if((imageState & ImageObserver.ALLBITS) != 0) {
- return true;
- }
- addObserver(observer);
- startProduction();
+
return ((imageState & ImageObserver.ALLBITS) != 0);
}
- public /*synchronized*/ ColorModel getColorModel(){
+ public ColorModel getColorModel(){
if(cm == null) {
- startProduction();
+ startProduction(null);
}
return cm;
}
- public /*synchronized*/ WritableRaster getRaster(){
+ public WritableRaster getRaster(){
if(raster == null) {
- startProduction();
+ startProduction(null);
}
return raster;
}
@@ -406,35 +416,45 @@
return imageState;
}
- private /*synchronized*/ void addObserver(ImageObserver observer){
+ private void addObserver(ImageObserver observer){
if(observer != null){
- if(observers.contains(observer)) {
- return;
- }
- if((imageState & ImageObserver.ERROR) != 0){
- observer.imageUpdate(this, ImageObserver.ERROR |
- ImageObserver.ABORT, -1, -1, -1, -1);
- return;
- }
- if((imageState & ImageObserver.ALLBITS) != 0){
- observer.imageUpdate(this, imageState, 0, 0, width, height);
- return;
- }
- observers.addElement(observer);
+ if(observers.contains(observer)) return;
+
+ if((imageState & ImageObserver.ERROR) != 0){
+ observer.imageUpdate(this, ImageObserver.ERROR |
+ ImageObserver.ABORT, -1, -1, -1, -1);
+
+ return;
+ }
+
+ if((imageState & ImageObserver.ALLBITS) != 0){
+ observer.imageUpdate(this, imageState, 0, 0, width, height);
+
+ return;
+ }
+ synchronized (observers) {
+ observers.add(observer);
+ }
}
}
- private synchronized void startProduction(){
- if(!producing){
- imageState &= ~ImageObserver.ABORT;
- producing = true;
- src.startProduction(this);
+ private void startProduction(ImageObserver observer){
+ addObserver(observer);
+ if(!producing && !done){
+ synchronized(this){
+ imageState &= ~ImageObserver.ABORT;
+ producing = true;
+ src.startProduction(this);
+ }
}
}
private synchronized void stopProduction(){
producing = false;
src.removeConsumer(this);
+ synchronized (observers) {
+ observers.clear();
+ }
}
private void createRaster(){
@@ -455,17 +475,32 @@
raster = cm.createCompatibleWritableRaster(width, height);
isIntRGB = true;
}
+ surfData = ba.getData(raster.getDataBuffer());
}
- private /*synchronized*/ void imageUpdate(Image img, int infoflags, int x, int y,
- int width, int height){
+ private void imageUpdate(int state){
+ imageUpdate(state, 0, 0, width, height);
+ }
+
+ private void imageUpdate(int state, int x, int y, int width, int height){
+ synchronized(this){
+ imageState |= state;
+ if((imageState & (ImageObserver.ALLBITS)) != 0 ) {
+ done = true;
+ }
+ }
+ ImageObserver observer = null;
- imageState |= infoflags;
- for (ImageObserver observer : observers) {
- observer.imageUpdate(this, infoflags, x, y, width, height);
+ for (Iterator<ImageObserver> i = observers.iterator(); i.hasNext();) {
+ try {
+ observer = i.next();
+ } catch (ConcurrentModificationException e) {
+ i = observers.iterator();
+ continue;
+ }
+ observer.imageUpdate(this, imageState, x, y, width, height);
}
-// notifyAll();
}
private void forceToIntARGB(){
@@ -513,6 +548,7 @@
}
cm = rgbCM;
raster = destRaster;
+ surfData = ba.getData(raster.getDataBuffer());
isIntRGB = true;
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLTextRenderer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLTextRenderer.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLTextRenderer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLTextRenderer.java Thu Oct 25 07:44:56 2007
@@ -108,7 +108,7 @@
GlyphMetrics glMetrics;
Color col = g.getColor();
Font font = g.getFont();
- int lenght = str.length();
+ int length = str.length();
FontPeerImpl peer = ((FontPeerImpl)font.getPeer());
AffineTransform fontAT = (AffineTransform)font.getTransform().clone();
Point.Float pos = new Point.Float();
@@ -143,7 +143,7 @@
activateVars();
- for (int i = 0; i - lenght < 0; i ++) {
+ for (int i = 0; i - length < 0; i ++) {
ch = new Character(input[i]);
if (ESCAPE.contains(ch)) continue;
glyph = peer.getGlyph(input[i]);
@@ -193,7 +193,7 @@
Color col = g.getColor();
Glyph[] input = ((CommonGlyphVector)gv).vector;
Font font = gv.getFont();
- int lenght = gv.getNumGlyphs();
+ int length = gv.getNumGlyphs();
FontPeerImpl peer = ((FontPeerImpl)font.getPeer());
AffineTransform fontAT = (AffineTransform)font.getTransform().clone();
Point.Float pos = new Point.Float();
@@ -227,7 +227,7 @@
fontAT = (AffineTransform) font.getTransform().clone();
activateVars();
- for (int i = 0; i - lenght < 0; i ++) {
+ for (int i = 0; i - length < 0; i ++) {
ch = new Character(input[i].getChar());
if (ch == ' ') continue;
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties Thu Oct 25 07:44:56 2007
@@ -235,7 +235,7 @@
awt.139=Negative dash[{0}]
awt.13A=All dash lengths zero
awt.13B=offset off is out of range
-awt.13C=number of elemets len is out of range
+awt.13C=number of elements len is out of range
awt.13D=Rectangle width and height must be > 0
awt.13E=Cannot call method from the event dispatcher thread
awt.13F=Delay must be to 0 to 60,000ms