提交 ed853b07 编写于 作者: L lana

Merge

......@@ -98,3 +98,5 @@ ecab7eefb8f2326fd90fb632f47f1b6f81e928f8 jdk7-b119
a661d8587b5d8986aacae086f5df66af9e1a96b1 jdk7-b121
ac311eb325bfc763698219252bf3cee9e091f3af jdk7-b122
869190935eedee7750d955019ab2a1b80f0a13a8 jdk7-b123
1c72adc9d5f331cb882cf5354ba0dcb118a60b23 jdk7-b124
0a56bdd709d01c1663047e55201d19152ffd3d69 jdk7-b125
......@@ -42,10 +42,18 @@ ifneq ($(PLATFORM), windows)
ifndef OPENJDK
ifeq ($(PLATFORM), solaris)
ifneq ($(ARCH), amd64)
# Solaris 11 does not have support for new compilation of DGA code.
OS_VERSION = $(shell uname -r)
OS_MAJOR_VERSION := $(call MajorVersion,$(OS_VERSION))
OS_MINOR_VERSION := $(call MinorVersion,$(OS_VERSION))
ifeq ($(shell $(EXPR) $(OS_MAJOR_VERSION) == 5), 1)
ifeq ($(shell $(EXPR) $(OS_MINOR_VERSION) \<= 10), 1)
DGA_SUBDIR = jdga
endif
endif
endif
endif
endif
HEADLESS_SUBDIR = headless
XAWT_SUBDIR = xawt
endif
......
......@@ -175,6 +175,10 @@ endif
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk
COMPILEFONTCONFIG_FLAGS =
ifdef ALT_COMPILEFONTCONFIG_FLAGS
COMPILEFONTCONFIG_FLAGS += $(ALT_COMPILEFONTCONFIG_FLAGS)
endif
build: fontconfigs
......@@ -406,7 +410,7 @@ COMPILEFONTCONFIG_JARFILE = $(BUILDTOOLJARDIR)/compilefontconfig.jar
$(LIBDIR)/%.bfc: $(FONTCONFIGS_SRC)/$(FONTCONFIGS_SRC_PREFIX)%.properties \
$(COMPILEFONTCONFIG_JARFILE)
$(prep-target)
$(BOOT_JAVA_CMD) -jar $(COMPILEFONTCONFIG_JARFILE) $< $@
$(BOOT_JAVA_CMD) -jar $(COMPILEFONTCONFIG_JARFILE) $(COMPILEFONTCONFIG_FLAGS) $< $@
$(install-module-file)
$(call chmod-file, 444)
@$(java-vm-cleanup)
......
......@@ -224,7 +224,7 @@ $(OBJDIR)/DllUtil.obj:: ../../../src/windows/native/sun/windows/DllUtil.h
$(OBJDIR)/DrawLine.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_DrawLine.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/loops/LineUtils.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/DrawParallelogram.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_DrawParallelogram.h $(CLASSHDRDIR)/sun_java2d_loops_FillParallelogram.h ../../../src/share/javavm/export/classfile_constants.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.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/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/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/LoopMacros.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/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/DrawParallelogram.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_DrawParallelogram.h ../../../src/share/javavm/export/classfile_constants.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.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/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/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/ParallelogramUtils.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/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/DrawPath.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_DrawPath.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/DrawPath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/ProcessPath.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
......@@ -232,7 +232,7 @@ $(OBJDIR)/DrawPolygons.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDR
$(OBJDIR)/DrawRect.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_DrawRect.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/loops/LineUtils.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/FillParallelogram.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_FillParallelogram.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/FillParallelogram.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_FillParallelogram.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/loops/ParallelogramUtils.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/FillPath.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_FillPath.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/DrawPath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/ProcessPath.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
......@@ -284,7 +284,7 @@ $(OBJDIR)/IntRgbx.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../src/sh
$(OBJDIR)/MaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/MaskFill.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskFill.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/MaskFill.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskFill.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.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/loops/ParallelogramUtils.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/MouseInfo.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/classfile_constants.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/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/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.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_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.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_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
......
......@@ -118,6 +118,8 @@ SUNWprivate_1.1 {
Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops;
Java_sun_java2d_loops_MaskBlit_MaskBlit;
Java_sun_java2d_loops_MaskFill_MaskFill;
Java_sun_java2d_loops_MaskFill_FillAAPgram;
Java_sun_java2d_loops_MaskFill_DrawAAPgram;
Java_sun_java2d_loops_TransformHelper_Transform;
Java_sun_java2d_pipe_Region_initIDs;
Java_sun_java2d_pipe_SpanClipRenderer_initIDs;
......
......@@ -115,6 +115,8 @@ SUNWprivate_1.1 {
Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops;
Java_sun_java2d_loops_MaskBlit_MaskBlit;
Java_sun_java2d_loops_MaskFill_MaskFill;
Java_sun_java2d_loops_MaskFill_FillAAPgram;
Java_sun_java2d_loops_MaskFill_DrawAAPgram;
Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans;
Java_sun_java2d_pipe_SpanClipRenderer_initIDs;
sun_awt_image_GifImageDecoder_initIDs;
......
......@@ -222,6 +222,7 @@ class Zoneinfo {
boolean continued = false;
Zone zone = null;
String l;
lineNum = 0;
try {
while ((line = in.readLine()) != null) {
......
......@@ -33,27 +33,17 @@ import sun.util.logging.PlatformLogger;
import sun.awt.image.SunWritableRaster;
/**
* The splash screen can be created at application startup, before the
* The splash screen can be displayed at application startup, before the
* Java Virtual Machine (JVM) starts. The splash screen is displayed as an
* undecorated window containing an image. You can use GIF, JPEG, and PNG files
* for the image. Animation (for GIF) and transparency (for GIF, PNG) are
* supported. The window is positioned at the center of the screen (the
* position on multi-monitor systems is not specified - it is platform and
* implementation dependent).
* The window is closed automatically as soon as the first window is displayed by
* Swing/AWT (may be also closed manually using the Java API, see below).
* undecorated window containing an image. You can use GIF, JPEG, or PNG files
* for the image. Animation is supported for the GIF format, while transparency
* is supported both for GIF and PNG. The window is positioned at the center
* of the screen. The position on multi-monitor systems is not specified. It is
* platform and implementation dependent. The splash screen window is closed
* automatically as soon as the first window is displayed by Swing/AWT (may be
* also closed manually using the Java API, see below).
* <P>
* There are two ways to show the native splash screen:
* <P>
* <UL>
* <LI>If your application is run from the command line or from a shortcut,
* use the "-splash:" Java application launcher option to show a splash screen.
* <BR>
* For example:
* <PRE>
* java -splash:filename.gif Test
* </PRE>
* <LI>If your application is packaged in a jar file, you can use the
* If your application is packaged in a jar file, you can use the
* "SplashScreen-Image" option in a manifest file to show a splash screen.
* Place the image in the jar archive and specify the path in the option.
* The path should not have a leading slash.
......@@ -64,18 +54,39 @@ import sun.awt.image.SunWritableRaster;
* Main-Class: Test
* SplashScreen-Image: filename.gif
* </PRE>
* <P>
* If the Java implementation provides the command-line interface and you run
* your application by using the command line or a shortcut, use the Java
* application launcher option to show a splash screen. The Oracle reference
* implementation allows you to specify the splash screen image location with
* the {@code -splash:} option.
* <BR>
* For example:
* <PRE>
* java -splash:filename.gif Test
* </PRE>
* The command line interface has higher precedence over the manifest
* setting.
* </UL>
* <p>
* The splash screen will be displayed as faithfully as possible to present the
* whole splash screen image given the limitations of the target platform and
* display.
* <p>
* It is implied that the specified image is presented on the screen "as is",
* i.e. preserving the exact color values as specified in the image file. Under
* certain circumstances, though, the presented image may differ, e.g. when
* applying color dithering to present a 32 bits per pixel (bpp) image on a 16
* or 8 bpp screen. The native platform display configuration may also affect
* the colors of the displayed image (e.g. color profiles, etc.)
* <p>
* The {@code SplashScreen} class provides the API for controlling the splash
* screen. This class may be used to close the splash screen, change the splash
* screen image, get the image position/size and paint in the splash screen. It
* cannot be used to create the splash screen; you should use the command line or manifest
* file option for that.
* screen image, get the splash screen native window position/size, and paint
* in the splash screen. It cannot be used to create the splash screen. You
* should use the options provided by the Java implementation for that.
* <p>
* This class cannot be instantiated. Only a single instance of this class
* can exist, and it may be obtained using the {@link #getSplashScreen()}
* can exist, and it may be obtained by using the {@link #getSplashScreen()}
* static method. In case the splash screen has not been created at
* application startup via the command line or manifest file option,
* the <code>getSplashScreen</code> method returns <code>null</code>.
......@@ -91,7 +102,7 @@ public final class SplashScreen {
/**
* Returns the {@code SplashScreen} object used for
* Java startup splash screen control.
* Java startup splash screen control on systems that support display.
*
* @throws UnsupportedOperationException if the splash screen feature is not
* supported by the current toolkit
......@@ -219,6 +230,9 @@ public final class SplashScreen {
* <p>
* You cannot control the size or position of the splash screen.
* The splash screen size is adjusted automatically when the image changes.
* <p>
* The image may contain transparent areas, and thus the reported bounds may
* be larger than the visible splash screen image on the screen.
*
* @return a {@code Rectangle} containing the splash screen bounds
* @throws IllegalStateException if the splash screen has already been closed
......@@ -237,6 +251,9 @@ public final class SplashScreen {
* <p>
* You cannot control the size or position of the splash screen.
* The splash screen size is adjusted automatically when the image changes.
* <p>
* The image may contain transparent areas, and thus the reported size may
* be larger than the visible splash screen image on the screen.
*
* @return a {@link Dimension} object indicating the splash screen size
* @throws IllegalStateException if the splash screen has already been closed
......@@ -254,6 +271,10 @@ public final class SplashScreen {
* screen window. You should call {@code update()} on the
* <code>SplashScreen</code> when you want the splash screen to be
* updated immediately.
* <p>
* The pixel (0, 0) in the coordinate space of the graphics context
* corresponds to the origin of the splash screen native window bounds (see
* {@link #getBounds()}).
*
* @return graphics context for the splash screen overlay surface
* @throws IllegalStateException if the splash screen has already been closed
......@@ -334,6 +355,11 @@ public final class SplashScreen {
* Determines whether the splash screen is visible. The splash screen may
* be hidden using {@link #close()}, it is also hidden automatically when
* the first AWT/Swing window is made visible.
* <p>
* Note that the native platform may delay presenting the splash screen
* native window on the screen. The return value of {@code true} for this
* method only guarantees that the conditions to hide the splash screen
* window have not occurred yet.
*
* @return true if the splash screen is visible (has not been closed yet),
* false otherwise
......
......@@ -99,6 +99,37 @@ import java.util.Set;
* values are specified, such as {@code NumericShaper.Range.BALINESE},
* those ranges are ignored.
*
* <p><b>Decimal Digits Precedence</b></p>
*
* <p>A Unicode range may have more than one set of decimal digits. If
* multiple decimal digits sets are specified for the same Unicode
* range, one of the sets will take precedence as follows.
*
* <table border=1 cellspacing=3 cellpadding=0 summary="NumericShaper constants precedence.">
* <tr>
* <th class="TableHeadingColor">Unicode Range</th>
* <th class="TableHeadingColor"><code>NumericShaper</code> Constants</th>
* <th class="TableHeadingColor">Precedence</th>
* </tr>
* <tr>
* <td rowspan="2">Arabic</td>
* <td>{@link NumericShaper#ARABIC NumericShaper.ARABIC}<br>
* {@link NumericShaper#EASTERN_ARABIC NumericShaper.EASTERN_ARABIC}</td>
* <td>{@link NumericShaper#EASTERN_ARABIC NumericShaper.EASTERN_ARABIC}</td>
* </tr>
* <tr>
* <td>{@link NumericShaper.Range#ARABIC}<br>
* {@link NumericShaper.Range#EASTERN_ARABIC}</td>
* <td>{@link NumericShaper.Range#EASTERN_ARABIC}</td>
* </tr>
* <tr>
* <td>Tai Tham</td>
* <td>{@link NumericShaper.Range#TAI_THAM_HORA}<br>
* {@link NumericShaper.Range#TAI_THAM_THAM}</td>
* <td>{@link NumericShaper.Range#TAI_THAM_THAM}</td>
* </tr>
* </table>
*
* @since 1.4
*/
......
......@@ -625,7 +625,7 @@ public class IndexColorModel extends ColorModel {
}
nBits[0] = nBits[1] = nBits[2] = 8;
}
return nBits;
return nBits.clone();
}
/**
......
......@@ -121,7 +121,7 @@ public abstract class SampleModel
*/
public SampleModel(int dataType, int w, int h, int numBands)
{
float size = (float)w*h;
long size = (long)w * h;
if (w <= 0 || h <= 0) {
throw new IllegalArgumentException("Width ("+w+") and height ("+
h+") must be > 0");
......
......@@ -92,7 +92,8 @@ public class SinglePixelPackedSampleModel extends SampleModel
* Constructs a SinglePixelPackedSampleModel with bitMasks.length bands.
* Each sample is stored in a data array element in the position of
* its corresponding bit mask. Each bit mask must be contiguous and
* masks must not overlap.
* masks must not overlap. Bit masks exceeding data type capacity are
* truncated.
* @param dataType The data type for storing samples.
* @param w The width (in pixels) of the region of the
* image data described.
......@@ -120,7 +121,8 @@ public class SinglePixelPackedSampleModel extends SampleModel
* and a scanline stride equal to scanlineStride data array elements.
* Each sample is stored in a data array element in the position of
* its corresponding bit mask. Each bit mask must be contiguous and
* masks must not overlap.
* masks must not overlap. Bit masks exceeding data type capacity are
* truncated.
* @param dataType The data type for storing samples.
* @param w The width (in pixels) of the region of
* image data described.
......@@ -153,11 +155,13 @@ public class SinglePixelPackedSampleModel extends SampleModel
this.bitOffsets = new int[numBands];
this.bitSizes = new int[numBands];
int maxMask = (int)((1L << DataBuffer.getDataTypeSize(dataType)) - 1);
this.maxBitSize = 0;
for (int i=0; i<numBands; i++) {
int bitOffset = 0, bitSize = 0, mask;
mask = bitMasks[i];
this.bitMasks[i] &= maxMask;
mask = this.bitMasks[i];
if (mask != 0) {
while ((mask & 1) == 0) {
mask = mask >>> 1;
......@@ -243,30 +247,12 @@ public class SinglePixelPackedSampleModel extends SampleModel
/** Returns the number of bits per sample for all bands. */
public int[] getSampleSize() {
int mask;
int sampleSize[] = new int [numBands];
for (int i=0; i<numBands; i++) {
sampleSize[i] = 0;
mask = bitMasks[i] >>> bitOffsets[i];
while ((mask & 1) != 0) {
sampleSize[i] ++;
mask = mask >>> 1;
}
}
return sampleSize;
return bitSizes.clone();
}
/** Returns the number of bits per sample for the specified band. */
public int getSampleSize(int band) {
int sampleSize = 0;
int mask = bitMasks[band] >>> bitOffsets[band];
while ((mask & 1) != 0) {
sampleSize ++;
mask = mask >>> 1;
}
return sampleSize;
return bitSizes[band];
}
/** Returns the offset (in data array elements) of pixel (x,y).
......
......@@ -1662,6 +1662,81 @@ public class SimpleDateFormat extends DateFormat {
return 0;
}
/**
* Parses numeric forms of time zone offset, such as "hh:mm", and
* sets calb to the parsed value.
*
* @param text the text to be parsed
* @param start the character position to start parsing
* @param sign 1: positive; -1: negative
* @param count 0: 'Z' or "GMT+hh:mm" parsing; 1 - 3: the number of 'X's
* @param colon true - colon required between hh and mm; false - no colon required
* @param calb a CalendarBuilder in which the parsed value is stored
* @return updated parsed position, or its negative value to indicate a parsing error
*/
private int subParseNumericZone(String text, int start, int sign, int count,
boolean colon, CalendarBuilder calb) {
int index = start;
parse:
try {
char c = text.charAt(index++);
// Parse hh
int hours;
if (!isDigit(c)) {
break parse;
}
hours = c - '0';
c = text.charAt(index++);
if (isDigit(c)) {
hours = hours * 10 + (c - '0');
} else {
// If no colon in RFC 822 or 'X' (ISO), two digits are
// required.
if (count > 0 || !colon) {
break parse;
}
--index;
}
if (hours > 23) {
break parse;
}
int minutes = 0;
if (count != 1) {
// Proceed with parsing mm
c = text.charAt(index++);
if (colon) {
if (c != ':') {
break parse;
}
c = text.charAt(index++);
}
if (!isDigit(c)) {
break parse;
}
minutes = c - '0';
c = text.charAt(index++);
if (!isDigit(c)) {
break parse;
}
minutes = minutes * 10 + (c - '0');
if (minutes > 59) {
break parse;
}
}
minutes += hours * 60;
calb.set(Calendar.ZONE_OFFSET, minutes * MILLIS_PER_MINUTE * sign)
.set(Calendar.DST_OFFSET, 0);
return index;
} catch (IndexOutOfBoundsException e) {
}
return 1 - index; // -(index - 1)
}
private boolean isDigit(char c) {
return c >= '0' && c <= '9';
}
/**
* Private member function that converts the parsed date strings into
* timeFields. Returns -start (for ParsePosition) if failed.
......@@ -1907,170 +1982,74 @@ public class SimpleDateFormat extends DateFormat {
case PATTERN_ZONE_NAME: // 'z'
case PATTERN_ZONE_VALUE: // 'Z'
// First try to parse generic forms such as GMT-07:00. Do this first
// in case localized TimeZoneNames contains the string "GMT"
// for a zone; in that case, we don't want to match the first three
// characters of GMT+/-hh:mm etc.
{
int sign = 0;
int offset;
// For time zones that have no known names, look for strings
// of the form:
// GMT[+-]hours:minutes or
// GMT.
if ((text.length() - start) >= GMT.length() &&
text.regionMatches(true, start, GMT, 0, GMT.length())) {
int num;
calb.set(Calendar.DST_OFFSET, 0);
pos.index = start + GMT.length();
try { // try-catch for "GMT" only time zone string
try {
char c = text.charAt(pos.index);
if (c == '+') {
sign = 1;
} else if (c == '-') {
sign = -1;
}
}
catch(StringIndexOutOfBoundsException e) {}
if (sign == 0) { /* "GMT" without offset */
calb.set(Calendar.ZONE_OFFSET, 0);
return pos.index;
}
// Look for hours.
try {
char c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
num = c - '0';
if (sign == 0) {
// Try parsing a custom time zone "GMT+hh:mm" or "GMT".
if ((c == 'G' || c == 'g')
&& (text.length() - start) >= GMT.length()
&& text.regionMatches(true, start, GMT, 0, GMT.length())) {
pos.index = start + GMT.length();
if (text.charAt(++pos.index) != ':') {
if ((text.length() - pos.index) > 0) {
c = text.charAt(pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
num *= 10;
num += c - '0';
pos.index++;
}
if (num > 23) {
--pos.index;
break parsing;
}
if (text.charAt(pos.index) != ':') {
break parsing;
}
// Look for minutes.
offset = num * 60;
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
num = c - '0';
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
num *= 10;
num += c - '0';
if (num > 59) {
break parsing;
}
} catch (StringIndexOutOfBoundsException e) {
break parsing;
}
offset += num;
// Fall through for final processing below of 'offset' and 'sign'.
} else {
// If the first character is a sign, look for numeric timezones of
// the form [+-]hhmm as specified by RFC 822. Otherwise, check
// for named time zones by looking through the locale data from
// the TimeZoneNames strings.
try {
char c = text.charAt(pos.index);
if (c == '+') {
sign = 1;
} else if (c == '-') {
sign = -1;
} else {
// Try parsing the text as a time zone name (abbr).
int i = subParseZoneString(text, pos.index, calb);
if (i != 0) {
return i;
}
break parsing;
}
// Parse the text as an RFC 822 time zone string. This code is
// actually a little more permissive than RFC 822. It will
// try to do its best with numbers that aren't strictly 4
// digits long.
// Look for hh.
int hours = 0;
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
hours = c - '0';
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
hours *= 10;
hours += c - '0';
if (hours > 23) {
break parsing;
if (sign == 0) { /* "GMT" without offset */
calb.set(Calendar.ZONE_OFFSET, 0)
.set(Calendar.DST_OFFSET, 0);
return pos.index;
}
// Look for mm.
int minutes = 0;
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
// Parse the rest as "hh:mm"
int i = subParseNumericZone(text, ++pos.index,
sign, 0, true, calb);
if (i > 0) {
return i;
}
minutes = c - '0';
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
pos.index = -i;
} else {
// Try parsing the text as a time zone
// name or abbreviation.
int i = subParseZoneString(text, pos.index, calb);
if (i > 0) {
return i;
}
minutes *= 10;
minutes += c - '0';
if (minutes > 59) {
break parsing;
pos.index = -i;
}
offset = hours * 60 + minutes;
} catch (StringIndexOutOfBoundsException e) {
break parsing;
} else {
// Parse the rest as "hhmm" (RFC 822)
int i = subParseNumericZone(text, ++pos.index,
sign, 0, false, calb);
if (i > 0) {
return i;
}
pos.index = -i;
}
// Do the final processing for both of the above cases. We only
// arrive here if the form GMT+/-... or an RFC 822 form was seen.
if (sign != 0) {
offset *= MILLIS_PER_MINUTE * sign;
calb.set(Calendar.ZONE_OFFSET, offset).set(Calendar.DST_OFFSET, 0);
return ++pos.index;
} catch (IndexOutOfBoundsException e) {
}
}
break parsing;
case PATTERN_ISO_ZONE: // 'X'
{
int sign = 0;
int offset = 0;
if ((text.length() - pos.index) <= 0) {
break parsing;
}
iso8601: {
try {
int sign = 0;
char c = text.charAt(pos.index);
if (c == 'Z') {
calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0);
......@@ -2082,73 +2061,16 @@ public class SimpleDateFormat extends DateFormat {
sign = 1;
} else if (c == '-') {
sign = -1;
}
// Look for hh.
int hours = 0;
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
hours = c - '0';
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
hours *= 10;
hours += c - '0';
if (hours > 23) {
break parsing;
}
if (count == 1) { // "X"
offset = hours * 60;
break iso8601;
}
c = text.charAt(++pos.index);
// Skip ':' if "XXX"
if (c == ':') {
if (count == 2) {
break parsing;
}
c = text.charAt(++pos.index);
} else {
if (count == 3) {
// missing ':'
break parsing;
}
}
// Look for mm.
int minutes = 0;
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
minutes = c - '0';
c = text.charAt(++pos.index);
if (c < '0' || c > '9') { /* must be from '0' to '9'. */
break parsing;
}
minutes *= 10;
minutes += c - '0';
if (minutes > 59) {
break parsing;
}
offset = hours * 60 + minutes;
} catch (StringIndexOutOfBoundsException e) {
++pos.index;
break parsing;
}
int i = subParseNumericZone(text, ++pos.index, sign, count,
count == 3, calb);
if (i > 0) {
return i;
}
// Do the final processing for both of the above cases. We only
// arrive here if the form GMT+/-... or an RFC 822 form was seen.
if (sign != 0) {
offset *= MILLIS_PER_MINUTE * sign;
calb.set(Calendar.ZONE_OFFSET, offset).set(Calendar.DST_OFFSET, 0);
return ++pos.index;
}
pos.index = -i;
}
break parsing;
......
......@@ -1449,10 +1449,15 @@ public final class Locale implements Cloneable, Serializable {
* three-letter language abbreviation is not available for this locale.
*/
public String getISO3Language() throws MissingResourceException {
String language3 = getISO3Code(_baseLocale.getLanguage(), LocaleISOData.isoLanguageTable);
String lang = _baseLocale.getLanguage();
if (lang.length() == 3) {
return lang;
}
String language3 = getISO3Code(lang, LocaleISOData.isoLanguageTable);
if (language3 == null) {
throw new MissingResourceException("Couldn't find 3-letter language code for "
+ _baseLocale.getLanguage(), "FormatData_" + toString(), "ShortLanguage");
+ lang, "FormatData_" + toString(), "ShortLanguage");
}
return language3;
}
......
......@@ -52,6 +52,8 @@ import javax.print.attribute.PrintRequestAttribute;
public final class DialogTypeSelection extends EnumSyntax
implements PrintRequestAttribute {
private static final long serialVersionUID = 7518682952133256029L;
/**
*
*/
......
......@@ -310,7 +310,7 @@ public class MidiSystem {
} else {
transmitter = device.getTransmitter();
}
if (!(transmitter instanceof MidiDeviceReceiver)) {
if (!(transmitter instanceof MidiDeviceTransmitter)) {
transmitter = new MidiDeviceTransmitterEnvelope(device, transmitter);
}
return transmitter;
......
......@@ -359,7 +359,22 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
f.getWidth()-1, f.getHeight()-1);
}
g.drawRect( newX, newY, f.getWidth()-1, f.getHeight()-1);
/* Work around for 6635462: XOR mode may cause a SurfaceLost on first use.
* Swing doesn't expect that its XOR drawRect did
* not complete, so believes that on re-entering at
* the next update location, that there is an XOR rect
* to draw out at "currentLoc". But in fact
* its now got a new clean surface without that rect,
* so drawing it "out" in fact draws it on, leaving garbage.
* So only update/set currentLoc if the draw completed.
*/
sun.java2d.SurfaceData sData =
((sun.java2d.SunGraphics2D)g).getSurfaceData();
if (!sData.isSurfaceLost()) {
currentLoc = new Point (newX, newY);
}
;
g.dispose();
}
} else if (dragMode == FASTER_DRAG_MODE) {
......@@ -412,7 +427,14 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
g.drawRect( currentBounds.x, currentBounds.y, currentBounds.width-1, currentBounds.height-1);
}
g.drawRect( newX, newY, newWidth-1, newHeight-1);
// Work around for 6635462, see comment in dragFrame()
sun.java2d.SurfaceData sData =
((sun.java2d.SunGraphics2D)g).getSurfaceData();
if (!sData.isSurfaceLost()) {
currentBounds = new Rectangle (newX, newY, newWidth, newHeight);
}
g.setPaintMode();
g.dispose();
}
......
......@@ -40,7 +40,8 @@ import java.beans.*;
/**
* A component that lets the user graphically select a value by sliding
* a knob within a bounded interval.
* a knob within a bounded interval. The knob is always positioned
* at the points that match integer values within the specified interval.
* <p>
* The slider can show both
* major tick marks, and minor tick marks between the major ones. The number of
......
......@@ -908,6 +908,14 @@ public class BasicSpinnerUI extends SpinnerUI
int height = parent.getHeight();
Insets insets = parent.getInsets();
if (nextButton == null && previousButton == null) {
setBounds(editor, insets.left, insets.top, width - insets.left - insets.right,
height - insets.top - insets.bottom);
return;
}
Dimension nextD = preferredSize(nextButton);
Dimension previousD = preferredSize(previousButton);
int buttonsWidth = Math.max(nextD.width, previousD.width);
......
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -37,10 +37,10 @@ import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.Properties;
......@@ -329,6 +329,8 @@ public abstract class FontConfiguration {
* tables.
*/
public static void saveBinary(OutputStream out) throws IOException {
sanityCheck();
DataOutputStream dataOut = new DataOutputStream(out);
writeShortTable(dataOut, head);
writeShortTable(dataOut, table_scriptIDs);
......@@ -350,7 +352,6 @@ public abstract class FontConfiguration {
if (verbose) {
dump();
}
sanityCheck();
}
//private static boolean loadingProperties;
......@@ -1343,6 +1344,11 @@ public abstract class FontConfiguration {
private static short[] table_stringIDs;
private static char[] table_stringTable;
/**
* Checks consistencies of complied fontconfig data. This method
* is called only at the build-time from
* build.tools.compilefontconfig.CompileFontConfig.
*/
private static void sanityCheck() {
int errors = 0;
......@@ -1358,12 +1364,20 @@ public abstract class FontConfiguration {
//componentFontNameID starts from "1"
for (int ii = 1; ii < table_filenames.length; ii++) {
if (table_filenames[ii] == -1) {
System.out.println("\n Warning: "
+ "<filename."
// The corresponding finename entry for a component
// font name is mandatory on Windows, but it's
// optional on Solaris and Linux.
if (osName.contains("Windows")) {
System.err.println("\n Error: <filename."
+ getString(table_componentFontNameIDs[ii])
+ "> entry is missing!!!");
if (!osName.contains("Linux")) {
errors++;
} else {
if (verbose && !isEmpty(table_filenames)) {
System.err.println("\n Note: 'filename' entry is undefined for \""
+ getString(table_componentFontNameIDs[ii])
+ "\"");
}
}
}
}
......@@ -1382,7 +1396,7 @@ public abstract class FontConfiguration {
int jj = iii * NUM_STYLES + iij;
short ffid = table_scriptFonts[fid + jj];
if (ffid == 0) {
System.out.println("\n Error: <"
System.err.println("\n Error: <"
+ getFontName(iii) + "."
+ getStyleName(iij) + "."
+ getString(table_scriptIDs[ii])
......@@ -1402,7 +1416,7 @@ public abstract class FontConfiguration {
script.contains("symbol")) {
continue;
}
System.out.println("\nError: "
System.err.println("\nError: "
+ "<awtfontpath."
+ script
+ "> entry is missing!!!");
......@@ -1411,11 +1425,19 @@ public abstract class FontConfiguration {
}
}
if (errors != 0) {
System.out.println("!!THERE ARE " + errors + " ERROR(S) IN "
System.err.println("!!THERE ARE " + errors + " ERROR(S) IN "
+ "THE FONTCONFIG FILE, PLEASE CHECK ITS CONTENT!!\n");
System.exit(1);
}
}
private static boolean isEmpty(short[] a) {
for (short s : a) {
if (s != -1) {
return false;
}
}
return true;
}
//dump the fontconfig data tables
......@@ -1652,20 +1674,16 @@ public abstract class FontConfiguration {
private static void writeShortTable(DataOutputStream out, short[] data)
throws IOException {
for (int i = 0; i < data.length; i++) {
out.writeShort(data[i]);
for (short val : data) {
out.writeShort(val);
}
}
private static short[] toList(HashMap map) {
private static short[] toList(HashMap<String, Short> map) {
short[] list = new short[map.size()];
for (int i = 0; i < list.length; i++) {
list[i] = -1;
}
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, Short> entry = (Entry <String, Short>)iterator.next();
list[entry.getValue().shortValue()] = getStringID(entry.getKey());
Arrays.fill(list, (short) -1);
for (Entry<String, Short> entry : map.entrySet()) {
list[entry.getValue()] = getStringID(entry.getKey());
}
return list;
}
......@@ -1763,25 +1781,19 @@ public abstract class FontConfiguration {
int len = table_scriptIDs.length + scriptFonts.size() * 20;
table_scriptFonts = new short[len];
Iterator iterator = scriptAllfonts.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, Short> entry = (Entry <Short, Short>)iterator.next();
table_scriptFonts[entry.getKey().intValue()] = (short)entry.getValue().shortValue();
for (Entry<Short, Short> entry : scriptAllfonts.entrySet()) {
table_scriptFonts[entry.getKey().intValue()] = entry.getValue();
}
int off = table_scriptIDs.length;
iterator = scriptFonts.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, Short[]> entry = (Entry <Short, Short[]>)iterator.next();
for (Entry<Short, Short[]> entry : scriptFonts.entrySet()) {
table_scriptFonts[entry.getKey().intValue()] = (short)-off;
Short[] v = entry.getValue();
int i = 0;
while (i < 20) {
for (int i = 0; i < 20; i++) {
if (v[i] != null) {
table_scriptFonts[off++] = v[i].shortValue();
table_scriptFonts[off++] = v[i];
} else {
table_scriptFonts[off++] = 0;
}
i++;
}
}
......@@ -1792,9 +1804,7 @@ public abstract class FontConfiguration {
//(3) sequences elcID -> XXXX[1|5] -> scriptID[]
head[INDEX_sequences] = (short)(head[INDEX_elcIDs] + table_elcIDs.length);
table_sequences = new short[elcIDs.size() * NUM_FONTS];
iterator = sequences.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, short[]> entry = (Entry <Short, short[]>)iterator.next();
for (Entry<Short, short[]> entry : sequences.entrySet()) {
//table_sequences[entry.getKey().intValue()] = (short)-off;
int k = entry.getKey().intValue();
short[] v = entry.getValue();
......@@ -1827,31 +1837,24 @@ public abstract class FontConfiguration {
//(6)componentFontNameID -> filenameID
head[INDEX_filenames] = (short)(head[INDEX_componentFontNameIDs] + table_componentFontNameIDs.length);
table_filenames = new short[table_componentFontNameIDs.length];
for (int i = 0; i < table_filenames.length; i++) {
table_filenames[i] = -1;
}
iterator = filenames.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, Short> entry = (Entry <Short, Short>)iterator.next();
table_filenames[entry.getKey().shortValue()] = entry.getValue().shortValue();
Arrays.fill(table_filenames, (short) -1);
for (Entry<Short, Short> entry : filenames.entrySet()) {
table_filenames[entry.getKey()] = entry.getValue();
}
//(7)scriptID-> awtfontpath
//the paths are stored as scriptID -> stringID in awtfontpahts
head[INDEX_awtfontpaths] = (short)(head[INDEX_filenames] + table_filenames.length);
table_awtfontpaths = new short[table_scriptIDs.length];
iterator = awtfontpaths.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, Short> entry = (Entry <Short, Short>)iterator.next();
table_awtfontpaths[entry.getKey().shortValue()] = entry.getValue().shortValue();
for (Entry<Short, Short> entry : awtfontpaths.entrySet()) {
table_awtfontpaths[entry.getKey()] = entry.getValue();
}
//(8)exclusions
head[INDEX_exclusions] = (short)(head[INDEX_awtfontpaths] + table_awtfontpaths.length);
table_exclusions = new short[scriptIDs.size()];
iterator = exclusions.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, int[]> entry = (Entry <Short, int[]>)iterator.next();
for (Entry<Short, int[]> entry : exclusions.entrySet()) {
int[] exI = entry.getValue();
char[] exC = new char[exI.length * 2];
int j = 0;
......@@ -1859,17 +1862,15 @@ public abstract class FontConfiguration {
exC[j++] = (char) (exI[i] >> 16);
exC[j++] = (char) (exI[i] & 0xffff);
}
table_exclusions[entry.getKey().shortValue()] = getStringID(new String (exC));
table_exclusions[entry.getKey()] = getStringID(new String (exC));
}
//(9)proportionals
head[INDEX_proportionals] = (short)(head[INDEX_exclusions] + table_exclusions.length);
table_proportionals = new short[proportionals.size() * 2];
iterator = proportionals.entrySet().iterator();
int j = 0;
while (iterator.hasNext()) {
Entry<Short, Short> entry = (Entry <Short, Short>)iterator.next();
table_proportionals[j++] = entry.getKey().shortValue();
table_proportionals[j++] = entry.getValue().shortValue();
for (Entry<Short, Short> entry : proportionals.entrySet()) {
table_proportionals[j++] = entry.getKey();
table_proportionals[j++] = entry.getValue();
}
//(10) see (1) for info, the only difference is "xxx.motif"
......@@ -1878,22 +1879,18 @@ public abstract class FontConfiguration {
len = table_scriptIDs.length + scriptFontsMotif.size() * 20;
table_scriptFontsMotif = new short[len];
iterator = scriptAllfontsMotif.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, Short> entry = (Entry <Short, Short>)iterator.next();
for (Entry<Short, Short> entry : scriptAllfontsMotif.entrySet()) {
table_scriptFontsMotif[entry.getKey().intValue()] =
(short)entry.getValue().shortValue();
(short)entry.getValue();
}
off = table_scriptIDs.length;
iterator = scriptFontsMotif.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Short, Short[]> entry = (Entry <Short, Short[]>)iterator.next();
for (Entry<Short, Short[]> entry : scriptFontsMotif.entrySet()) {
table_scriptFontsMotif[entry.getKey().intValue()] = (short)-off;
Short[] v = entry.getValue();
int i = 0;
while (i < 20) {
if (v[i] != null) {
table_scriptFontsMotif[off++] = v[i].shortValue();
table_scriptFontsMotif[off++] = v[i];
} else {
table_scriptFontsMotif[off++] = 0;
}
......@@ -1907,12 +1904,10 @@ public abstract class FontConfiguration {
//(11)short[] alphabeticSuffix
head[INDEX_alphabeticSuffix] = (short)(head[INDEX_scriptFontsMotif] + table_scriptFontsMotif.length);
table_alphabeticSuffix = new short[alphabeticSuffix.size() * 2];
iterator = alphabeticSuffix.entrySet().iterator();
j = 0;
while (iterator.hasNext()) {
Entry<Short, Short> entry = (Entry <Short, Short>)iterator.next();
table_alphabeticSuffix[j++] = entry.getKey().shortValue();
table_alphabeticSuffix[j++] = entry.getValue().shortValue();
for (Entry<Short, Short> entry : alphabeticSuffix.entrySet()) {
table_alphabeticSuffix[j++] = entry.getKey();
table_alphabeticSuffix[j++] = entry.getValue();
}
//(15)short[] fallbackScriptIDs; just put the ID in head
......
......@@ -102,26 +102,6 @@ public abstract class SunToolkit extends Toolkit
public final static int MAX_BUTTONS_SUPPORTED = 20;
public SunToolkit() {
/* If awt.threadgroup is set to class name the instance of
* this class is created (should be subclass of ThreadGroup)
* and EventDispatchThread is created inside of it
*
* If loaded class overrides uncaughtException instance
* handles all uncaught exception on EventDispatchThread
*/
ThreadGroup threadGroup = null;
String tgName = System.getProperty("awt.threadgroup", "");
if (tgName.length() != 0) {
try {
Constructor ctor = Class.forName(tgName).
getConstructor(new Class[] {String.class});
threadGroup = (ThreadGroup)ctor.newInstance(new Object[] {"AWT-ThreadGroup"});
} catch (Exception e) {
System.err.println("Failed loading " + tgName + ": " + e);
}
}
Runnable initEQ = new Runnable() {
public void run () {
EventQueue eventQueue;
......@@ -144,18 +124,8 @@ public abstract class SunToolkit extends Toolkit
}
};
if (threadGroup != null) {
Thread eqInitThread = new Thread(threadGroup, initEQ, "EventQueue-Init");
eqInitThread.start();
try {
eqInitThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
initEQ.run();
}
}
public boolean useBufferPerWindow() {
return false;
......
......@@ -635,6 +635,88 @@ public class DuctusRenderingEngine extends RenderingEngine {
return r;
}
/**
* {@inheritDoc}
*/
@Override
public AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0 && lw2 > 0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1 && lw2 > 1) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0;
}
Rasterizer r = getRasterizer();
r.setUsage(Rasterizer.EOFILL);
r.beginPath();
r.beginSubpath((float) x, (float) y);
r.appendLine((float) (x+dx1), (float) (y+dy1));
r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.appendLine((float) (x+dx2), (float) (y+dy2));
r.closedSubpath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.beginSubpath((float) x, (float) y);
r.appendLine((float) (x+dx1), (float) (y+dy1));
r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.appendLine((float) (x+dx2), (float) (y+dy2));
r.closedSubpath();
}
try {
r.endPath();
r.getAlphaBox(bbox);
clip.clipBoxToBounds(bbox);
if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
dropRasterizer(r);
return null;
}
r.setOutputArea(bbox[0], bbox[1],
bbox[2] - bbox[0],
bbox[3] - bbox[1]);
} catch (PRException e) {
/*
* This exeption is thrown from the native part of the Ductus
* (only in case of a debug build) to indicate that some
* segments of the path have very large coordinates.
* See 4485298 for more info.
*/
System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
}
return r;
}
private void feedConsumer(PathConsumer consumer, PathIterator pi) {
try {
consumer.beginPath();
......
......@@ -58,10 +58,10 @@ public class FileFontStrike extends PhysicalStrike {
private static final int SEGINTARRAY = 3;
private static final int SEGLONGARRAY = 4;
private int glyphCacheFormat = UNINITIALISED;
private volatile int glyphCacheFormat = UNINITIALISED;
/* segmented arrays are blocks of 256 */
private static final int SEGSHIFT = 8;
/* segmented arrays are blocks of 32 */
private static final int SEGSHIFT = 5;
private static final int SEGSIZE = 1 << SEGSHIFT;
private boolean segmentedCache;
......@@ -171,7 +171,7 @@ public class FileFontStrike extends PhysicalStrike {
mapper = fileFont.getMapper();
int numGlyphs = mapper.getNumGlyphs();
/* Always segment for fonts with > 2K glyphs, but also for smaller
/* Always segment for fonts with > 256 glyphs, but also for smaller
* fonts with non-typical sizes and transforms.
* Segmenting for all non-typical pt sizes helps to minimise memory
* usage when very many distinct strikes are created.
......@@ -522,32 +522,33 @@ public class FileFontStrike extends PhysicalStrike {
}
/* Called only from synchronized code or constructor */
private void initGlyphCache() {
private synchronized void initGlyphCache() {
int numGlyphs = mapper.getNumGlyphs();
int tmpFormat = UNINITIALISED;
if (segmentedCache) {
int numSegments = (numGlyphs + SEGSIZE-1)/SEGSIZE;
if (longAddresses) {
glyphCacheFormat = SEGLONGARRAY;
tmpFormat = SEGLONGARRAY;
segLongGlyphImages = new long[numSegments][];
this.disposer.segLongGlyphImages = segLongGlyphImages;
} else {
glyphCacheFormat = SEGINTARRAY;
tmpFormat = SEGINTARRAY;
segIntGlyphImages = new int[numSegments][];
this.disposer.segIntGlyphImages = segIntGlyphImages;
}
} else {
if (longAddresses) {
glyphCacheFormat = LONGARRAY;
tmpFormat = LONGARRAY;
longGlyphImages = new long[numGlyphs];
this.disposer.longGlyphImages = longGlyphImages;
} else {
glyphCacheFormat = INTARRAY;
tmpFormat = INTARRAY;
intGlyphImages = new int[numGlyphs];
this.disposer.intGlyphImages = intGlyphImages;
}
}
glyphCacheFormat = tmpFormat;
}
float getGlyphAdvance(int glyphCode) {
......
......@@ -343,7 +343,21 @@ public abstract class Font2D {
}
strike = createStrike(desc);
//StrikeCache.addStrike();
/* If we are creating many strikes on this font which
* involve non-quadrant rotations, or more general
* transforms which include shears, then force the use
* of weak references rather than soft references.
* This means that it won't live much beyond the next GC,
* which is what we want for what is likely a transient strike.
*/
int txType = desc.glyphTx.getType();
if (txType == AffineTransform.TYPE_GENERAL_TRANSFORM ||
(txType & AffineTransform.TYPE_GENERAL_ROTATION) != 0 &&
strikeCache.size() > 10) {
strikeRef = StrikeCache.getStrikeRef(strike, true);
} else {
strikeRef = StrikeCache.getStrikeRef(strike);
}
strikeCache.put(desc, strikeRef);
//strike.lastlookupTime = System.currentTimeMillis();
lastFontStrike = new SoftReference(strike);
......
......@@ -367,16 +367,17 @@ public abstract class SurfaceData
public static final TextPipe aaTextRenderer;
public static final TextPipe lcdTextRenderer;
protected static final CompositePipe colorPipe;
protected static final AlphaColorPipe colorPipe;
protected static final PixelToShapeConverter colorViaShape;
protected static final PixelToParallelogramConverter colorViaPgram;
protected static final TextPipe colorText;
protected static final CompositePipe clipColorPipe;
protected static final TextPipe clipColorText;
protected static final AAShapePipe AAColorShape;
protected static final PixelToShapeConverter AAColorViaShape;
protected static final PixelToParallelogramConverter AAColorViaShape;
protected static final PixelToParallelogramConverter AAColorViaPgram;
protected static final AAShapePipe AAClipColorShape;
protected static final PixelToShapeConverter AAClipColorViaShape;
protected static final PixelToParallelogramConverter AAClipColorViaShape;
protected static final CompositePipe paintPipe;
protected static final SpanShapeRenderer paintShape;
......@@ -385,9 +386,9 @@ public abstract class SurfaceData
protected static final CompositePipe clipPaintPipe;
protected static final TextPipe clipPaintText;
protected static final AAShapePipe AAPaintShape;
protected static final PixelToShapeConverter AAPaintViaShape;
protected static final PixelToParallelogramConverter AAPaintViaShape;
protected static final AAShapePipe AAClipPaintShape;
protected static final PixelToShapeConverter AAClipPaintViaShape;
protected static final PixelToParallelogramConverter AAClipPaintViaShape;
protected static final CompositePipe compPipe;
protected static final SpanShapeRenderer compShape;
......@@ -396,9 +397,9 @@ public abstract class SurfaceData
protected static final CompositePipe clipCompPipe;
protected static final TextPipe clipCompText;
protected static final AAShapePipe AACompShape;
protected static final PixelToShapeConverter AACompViaShape;
protected static final PixelToParallelogramConverter AACompViaShape;
protected static final AAShapePipe AAClipCompShape;
protected static final PixelToShapeConverter AAClipCompViaShape;
protected static final PixelToParallelogramConverter AAClipCompViaShape;
protected static final DrawImagePipe imagepipe;
......@@ -427,6 +428,22 @@ public abstract class SurfaceData
}
}
private static PixelToParallelogramConverter
makeConverter(AAShapePipe renderer,
ParallelogramPipe pgrampipe)
{
return new PixelToParallelogramConverter(renderer,
pgrampipe,
1.0/8.0, 0.499,
false);
}
private static PixelToParallelogramConverter
makeConverter(AAShapePipe renderer)
{
return makeConverter(renderer, renderer);
}
static {
colorPrimitives = new LoopPipe();
......@@ -445,9 +462,10 @@ public abstract class SurfaceData
clipColorPipe = new SpanClipRenderer(colorPipe);
clipColorText = new TextRenderer(clipColorPipe);
AAColorShape = new AAShapePipe(colorPipe);
AAColorViaShape = new PixelToShapeConverter(AAColorShape);
AAColorViaShape = makeConverter(AAColorShape);
AAColorViaPgram = makeConverter(AAColorShape, colorPipe);
AAClipColorShape = new AAShapePipe(clipColorPipe);
AAClipColorViaShape = new PixelToShapeConverter(AAClipColorShape);
AAClipColorViaShape = makeConverter(AAClipColorShape);
paintPipe = new AlphaPaintPipe();
paintShape = new SpanShapeRenderer.Composite(paintPipe);
......@@ -456,9 +474,9 @@ public abstract class SurfaceData
clipPaintPipe = new SpanClipRenderer(paintPipe);
clipPaintText = new TextRenderer(clipPaintPipe);
AAPaintShape = new AAShapePipe(paintPipe);
AAPaintViaShape = new PixelToShapeConverter(AAPaintShape);
AAPaintViaShape = makeConverter(AAPaintShape);
AAClipPaintShape = new AAShapePipe(clipPaintPipe);
AAClipPaintViaShape = new PixelToShapeConverter(AAClipPaintShape);
AAClipPaintViaShape = makeConverter(AAClipPaintShape);
compPipe = new GeneralCompositePipe();
compShape = new SpanShapeRenderer.Composite(compPipe);
......@@ -467,9 +485,9 @@ public abstract class SurfaceData
clipCompPipe = new SpanClipRenderer(compPipe);
clipCompText = new TextRenderer(clipCompPipe);
AACompShape = new AAShapePipe(compPipe);
AACompViaShape = new PixelToShapeConverter(AACompShape);
AACompViaShape = makeConverter(AACompShape);
AAClipCompShape = new AAShapePipe(clipCompPipe);
AAClipCompViaShape = new PixelToShapeConverter(AAClipCompShape);
AAClipCompViaShape = makeConverter(AAClipCompShape);
imagepipe = new DrawImage();
}
......@@ -591,12 +609,12 @@ public abstract class SurfaceData
if (sg2d.clipState == sg2d.CLIP_SHAPE) {
sg2d.drawpipe = AAClipCompViaShape;
sg2d.fillpipe = AAClipCompViaShape;
sg2d.shapepipe = AAClipCompShape;
sg2d.shapepipe = AAClipCompViaShape;
sg2d.textpipe = clipCompText;
} else {
sg2d.drawpipe = AACompViaShape;
sg2d.fillpipe = AACompViaShape;
sg2d.shapepipe = AACompShape;
sg2d.shapepipe = AACompViaShape;
sg2d.textpipe = compText;
}
} else {
......@@ -616,13 +634,17 @@ public abstract class SurfaceData
if (sg2d.clipState == sg2d.CLIP_SHAPE) {
sg2d.drawpipe = AAClipColorViaShape;
sg2d.fillpipe = AAClipColorViaShape;
sg2d.shapepipe = AAClipColorShape;
sg2d.shapepipe = AAClipColorViaShape;
sg2d.textpipe = clipColorText;
} else {
sg2d.drawpipe = AAColorViaShape;
sg2d.fillpipe = AAColorViaShape;
sg2d.shapepipe = AAColorShape;
if (sg2d.paintState > sg2d.PAINT_OPAQUECOLOR ||
PixelToParallelogramConverter converter =
(sg2d.alphafill.canDoParallelograms()
? AAColorViaPgram
: AAColorViaShape);
sg2d.drawpipe = converter;
sg2d.fillpipe = converter;
sg2d.shapepipe = converter;
if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR ||
sg2d.compositeState > sg2d.COMP_ISCOPY)
{
sg2d.textpipe = colorText;
......@@ -634,12 +656,12 @@ public abstract class SurfaceData
if (sg2d.clipState == sg2d.CLIP_SHAPE) {
sg2d.drawpipe = AAClipPaintViaShape;
sg2d.fillpipe = AAClipPaintViaShape;
sg2d.shapepipe = AAClipPaintShape;
sg2d.shapepipe = AAClipPaintViaShape;
sg2d.textpipe = clipPaintText;
} else {
sg2d.drawpipe = AAPaintViaShape;
sg2d.fillpipe = AAPaintViaShape;
sg2d.shapepipe = AAPaintShape;
sg2d.shapepipe = AAPaintViaShape;
sg2d.textpipe = paintText;
}
}
......@@ -793,6 +815,18 @@ public abstract class SurfaceData
}
}
private static CompositeType getFillCompositeType(SunGraphics2D sg2d) {
CompositeType compType = sg2d.imageComp;
if (sg2d.compositeState == sg2d.COMP_ISCOPY) {
if (compType == CompositeType.SrcOverNoEa) {
compType = CompositeType.OpaqueSrcOverNoEa;
} else {
compType = CompositeType.SrcNoEa;
}
}
return compType;
}
/**
* Returns a MaskFill object that can be used on this destination
* with the source (paint) and composite types determined by the given
......@@ -802,9 +836,10 @@ public abstract class SurfaceData
* surface) before returning a specific MaskFill object.
*/
protected MaskFill getMaskFill(SunGraphics2D sg2d) {
return MaskFill.getFromCache(getPaintSurfaceType(sg2d),
sg2d.imageComp,
getSurfaceType());
SurfaceType src = getPaintSurfaceType(sg2d);
CompositeType comp = getFillCompositeType(sg2d);
SurfaceType dst = getSurfaceType();
return MaskFill.getFromCache(src, comp, dst);
}
private static RenderCache loopcache = new RenderCache(30);
......@@ -816,9 +851,7 @@ public abstract class SurfaceData
*/
public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
SurfaceType src = getPaintSurfaceType(sg2d);
CompositeType comp = (sg2d.compositeState == sg2d.COMP_ISCOPY
? CompositeType.SrcNoEa
: sg2d.imageComp);
CompositeType comp = getFillCompositeType(sg2d);
SurfaceType dst = sg2d.getSurfaceData().getSurfaceType();
Object o = loopcache.get(src, comp, dst);
......
......@@ -27,6 +27,7 @@ package sun.java2d.loops;
import java.awt.image.BufferedImage;
import java.awt.AlphaComposite;
import java.util.HashMap;
/**
* A CompositeType object provides a chained description of a type of
......@@ -51,6 +52,11 @@ import java.awt.AlphaComposite;
* the indicated algorithm if all of the more specific searches fail.
*/
public final class CompositeType {
private static int unusedUID = 1;
private static final HashMap<String,Integer> compositeUIDMap =
new HashMap<String,Integer>(100);
/*
* CONSTANTS USED BY ALL PRIMITIVES TO DESCRIBE THE COMPOSITING
* ALGORITHMS THEY CAN PERFORM
......@@ -152,6 +158,22 @@ public final class CompositeType {
public static final CompositeType
SrcOverNoEa = SrcOver.deriveSubType(DESC_SRC_OVER_NO_EA);
/*
* A special CompositeType for the case where we are filling in
* SrcOverNoEa mode with an opaque color. In that case then the
* best loop for us to use would be a SrcNoEa loop, but what if
* there is no such loop? In that case then we would end up
* backing off to a Src loop (which should still be fine) or an
* AnyAlpha loop which would be slower than a SrcOver loop in
* most cases.
* The fix is to use the following chain which looks for loops
* in the following order:
* SrcNoEa, Src, SrcOverNoEa, SrcOver, AnyAlpha
*/
public static final CompositeType
OpaqueSrcOverNoEa = SrcOverNoEa.deriveSubType(DESC_SRC)
.deriveSubType(DESC_SRC_NO_EA);
/*
* END OF CompositeType OBJECTS FOR THE VARIOUS CONSTANTS
*/
......@@ -210,7 +232,6 @@ public final class CompositeType {
}
}
private static int unusedUID = 1;
private int uniqueID;
private String desc;
private CompositeType next;
......@@ -218,14 +239,20 @@ public final class CompositeType {
private CompositeType(CompositeType parent, String desc) {
next = parent;
this.desc = desc;
this.uniqueID = makeUniqueID();
this.uniqueID = makeUniqueID(desc);
}
private synchronized static final int makeUniqueID() {
public synchronized static final int makeUniqueID(String desc) {
Integer i = compositeUIDMap.get(desc);
if (i == null) {
if (unusedUID > 255) {
throw new InternalError("composite type id overflow");
}
return unusedUID++;
i = unusedUID++;
compositeUIDMap.put(desc, i);
}
return i;
}
public int getUniqueID() {
......
......@@ -50,6 +50,10 @@ import sun.java2d.SurfaceData;
public class MaskFill extends GraphicsPrimitive
{
public static final String methodSignature = "MaskFill(...)".toString();
public static final String fillPgramSignature =
"FillAAPgram(...)".toString();
public static final String drawPgramSignature =
"DrawAAPgram(...)".toString();
public static final int primTypeID = makePrimTypeID();
......@@ -92,6 +96,14 @@ public class MaskFill extends GraphicsPrimitive
return fill;
}
protected MaskFill(String alternateSignature,
SurfaceType srctype,
CompositeType comptype,
SurfaceType dsttype)
{
super(alternateSignature, primTypeID, srctype, comptype, dsttype);
}
protected MaskFill(SurfaceType srctype,
CompositeType comptype,
SurfaceType dsttype)
......@@ -115,6 +127,23 @@ public class MaskFill extends GraphicsPrimitive
int x, int y, int w, int h,
byte[] mask, int maskoff, int maskscan);
public native void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
Composite comp,
double x, double y,
double dx1, double dy1,
double dx2, double dy2);
public native void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
Composite comp,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2);
public boolean canDoParallelograms() {
return (getNativePrim() != 0);
}
static {
GraphicsPrimitiveMgr.registerGeneral(new MaskFill(null, null, null));
}
......@@ -182,12 +211,22 @@ public class MaskFill extends GraphicsPrimitive
private static class TraceMaskFill extends MaskFill {
MaskFill target;
MaskFill fillPgramTarget;
MaskFill drawPgramTarget;
public TraceMaskFill(MaskFill target) {
super(target.getSourceType(),
target.getCompositeType(),
target.getDestType());
this.target = target;
this.fillPgramTarget = new MaskFill(fillPgramSignature,
target.getSourceType(),
target.getCompositeType(),
target.getDestType());
this.drawPgramTarget = new MaskFill(drawPgramSignature,
target.getSourceType(),
target.getCompositeType(),
target.getDestType());
}
public GraphicsPrimitive traceWrap() {
......@@ -203,5 +242,32 @@ public class MaskFill extends GraphicsPrimitive
target.MaskFill(sg2d, sData, comp, x, y, w, h,
mask, maskoff, maskscan);
}
public void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
Composite comp,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
tracePrimitive(fillPgramTarget);
target.FillAAPgram(sg2d, sData, comp,
x, y, dx1, dy1, dx2, dy2);
}
public void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
Composite comp,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
tracePrimitive(drawPgramTarget);
target.DrawAAPgram(sg2d, sData, comp,
x, y, dx1, dy1, dx2, dy2, lw1, lw2);
}
public boolean canDoParallelograms() {
return target.canDoParallelograms();
}
}
}
......@@ -28,6 +28,7 @@ package sun.java2d.pipe;
import java.awt.BasicStroke;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import java.awt.geom.PathIterator;
import sun.awt.SunHints;
import sun.java2d.SunGraphics2D;
......@@ -39,7 +40,9 @@ import sun.java2d.SunGraphics2D;
* This class sets up the Generator and computes the alpha tiles
* and then passes them on to a CompositePipe object for painting.
*/
public class AAShapePipe implements ShapeDrawPipe {
public class AAShapePipe
implements ShapeDrawPipe, ParallelogramPipe
{
static RenderingEngine renderengine = RenderingEngine.getInstance();
CompositePipe outpipe;
......@@ -65,6 +68,59 @@ public class AAShapePipe implements ShapeDrawPipe {
renderPath(sg, s, null);
}
private static Rectangle2D computeBBox(double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
double lox, loy, hix, hiy;
lox = hix = x;
loy = hiy = y;
if (dx1 < 0) { lox += dx1; } else { hix += dx1; }
if (dy1 < 0) { loy += dy1; } else { hiy += dy1; }
if (dx2 < 0) { lox += dx2; } else { hix += dx2; }
if (dy2 < 0) { loy += dy2; } else { hiy += dy2; }
return new Rectangle2D.Double(lox, loy, hix-lox, hiy-loy);
}
public void fillParallelogram(SunGraphics2D sg,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
Region clip = sg.getCompClip();
int abox[] = new int[4];
AATileGenerator aatg =
renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
clip, abox);
if (aatg == null) {
// Nothing to render
return;
}
renderTiles(sg, computeBBox(x, y, dx1, dy1, dx2, dy2), aatg, abox);
}
public void drawParallelogram(SunGraphics2D sg,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
Region clip = sg.getCompClip();
int abox[] = new int[4];
AATileGenerator aatg =
renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
clip, abox);
if (aatg == null) {
// Nothing to render
return;
}
// Note that bbox is of the original shape, not the wide path.
// This is appropriate for handing to Paint methods...
renderTiles(sg, computeBBox(x, y, dx1, dy1, dx2, dy2), aatg, abox);
}
private static byte[] theTile;
public synchronized static byte[] getAlphaTile(int len) {
......@@ -85,8 +141,6 @@ public class AAShapePipe implements ShapeDrawPipe {
boolean adjust = (bs != null &&
sg.strokeHint != SunHints.INTVAL_STROKE_PURE);
boolean thin = (sg.strokeState <= sg.STROKE_THINDASHED);
Object context = null;
byte alpha[] = null;
Region clip = sg.getCompClip();
int abox[] = new int[4];
......@@ -98,6 +152,14 @@ public class AAShapePipe implements ShapeDrawPipe {
return;
}
renderTiles(sg, s, aatg, abox);
}
public void renderTiles(SunGraphics2D sg, Shape s,
AATileGenerator aatg, int abox[])
{
Object context = null;
byte alpha[] = null;
try {
context = outpipe.startSequence(sg, s,
new Rectangle(abox[0], abox[1],
......
......@@ -34,7 +34,7 @@ import sun.java2d.SunGraphics2D;
* into a destination that supports direct alpha compositing of a solid
* color, according to one of the rules in the AlphaComposite class.
*/
public class AlphaColorPipe implements CompositePipe {
public class AlphaColorPipe implements CompositePipe, ParallelogramPipe {
public AlphaColorPipe() {
}
......@@ -64,4 +64,23 @@ public class AlphaColorPipe implements CompositePipe {
public void endSequence(Object context) {
return;
}
public void fillParallelogram(SunGraphics2D sg,
double x, double y,
double dx1, double dy1,
double dx2, double dy2)
{
sg.alphafill.FillAAPgram(sg, sg.getSurfaceData(), sg.composite,
x, y, dx1, dy1, dx2, dy2);
}
public void drawParallelogram(SunGraphics2D sg,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2)
{
sg.alphafill.DrawAAPgram(sg, sg.getSurfaceData(), sg.composite,
x, y, dx1, dy1, dx2, dy2, lw1, lw2);
}
}
......@@ -280,6 +280,72 @@ public abstract class RenderingEngine {
boolean normalize,
int bbox[]);
/**
* Construct an antialiased tile generator for the given parallelogram
* store the bounds of the tile iteration in the bbox parameter.
* The parallelogram is specified as a starting point and 2 delta
* vectors that indicate the slopes of the 2 pairs of sides of the
* parallelogram.
* The 4 corners of the parallelogram are defined by the 4 points:
* <ul>
* <li> {@code x}, {@code y}
* <li> {@code x+dx1}, {@code y+dy1}
* <li> {@code x+dx1+dx2}, {@code y+dy1+dy2}
* <li> {@code x+dx2}, {@code y+dy2}
* </ul>
* The {@code lw1} and {@code lw2} parameters provide a specification
* for an optionally stroked parallelogram if they are positive numbers.
* The {@code lw1} parameter is the ratio of the length of the {@code dx1},
* {@code dx2} delta vector to half of the line width in that same
* direction.
* The {@code lw2} parameter provides the same ratio for the other delta
* vector.
* If {@code lw1} and {@code lw2} are both greater than zero, then
* the parallelogram figure is doubled by both expanding and contracting
* each delta vector by its corresponding {@code lw} value.
* If either (@code lw1) or {@code lw2} are also greater than 1, then
* the inner (contracted) parallelogram disappears and the figure is
* simply a single expanded parallelogram.
* The {@code clip} parameter specifies the current clip in effect
* in device coordinates and can be used to prune the data for the
* operation, but the renderer is not required to perform any
* clipping.
* <p>
* Upon returning, this method will fill the {@code bbox} parameter
* with 4 values indicating the bounds of the iteration of the
* tile generator.
* The iteration order of the tiles will be as specified by the
* pseudo-code:
* <pre>
* for (y = bbox[1]; y < bbox[3]; y += tileheight) {
* for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
* }
* }
* </pre>
* If there is no output to be rendered, this method may return
* null.
*
* @param x the X coordinate of the first corner of the parallelogram
* @param y the Y coordinate of the first corner of the parallelogram
* @param dx1 the X coordinate delta of the first leg of the parallelogram
* @param dy1 the Y coordinate delta of the first leg of the parallelogram
* @param dx2 the X coordinate delta of the second leg of the parallelogram
* @param dy2 the Y coordinate delta of the second leg of the parallelogram
* @param lw1 the line width ratio for the first leg of the parallelogram
* @param lw2 the line width ratio for the second leg of the parallelogram
* @param clip the current clip in effect in device coordinates
* @param bbox returns the bounds of the iteration
* @return the {@code AATileGenerator} instance to be consulted
* for tile coverages, or null if there is no output to render
* @since 1.7
*/
public abstract AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[]);
/**
* Returns the minimum pen width that the antialiasing rasterizer
* can represent without dropouts occuring.
......@@ -393,5 +459,24 @@ public abstract class RenderingEngine {
bs, thin, normalize,
bbox);
}
public AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
System.out.println(name+".getAATileGenerator("+
x+", "+y+", "+
dx1+", "+dy1+", "+
dx2+", "+dy2+", "+
lw1+", "+lw2+", "+
clip+")");
return target.getAATileGenerator(x, y,
dx1, dy1,
dx2, dy2,
lw1, lw2,
clip, bbox);
}
}
}
......@@ -557,6 +557,69 @@ public class PiscesRenderingEngine extends RenderingEngine {
return ptg;
}
public AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0 && lw2 > 0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1 && lw2 > 1) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0;
}
Renderer r = new Renderer(3, 3,
clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
PathIterator.WIND_EVEN_ODD);
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
}
r.pathDone();
r.endRendering();
PiscesTileGenerator ptg = new PiscesTileGenerator(r, r.MAX_AA_ALPHA);
ptg.getBbox(bbox);
return ptg;
}
/**
* Returns the minimum pen width that the antialiasing rasterizer
* can represent without dropouts occuring.
......
......@@ -178,7 +178,7 @@ int awt_parseRaster(JNIEnv *env, jobject jraster, RasterS_t *rasterP) {
jnbits = (*env)->GetObjectField(env, rasterP->jsampleModel,
g_SPPSMnBitsID);
if (jmask == NULL || joffs == NULL || jnbits == NULL ||
rasterP->sppsm.maxBitSize < 0 || rasterP->sppsm.maxBitSize > 8)
rasterP->sppsm.maxBitSize < 0)
{
JNU_ThrowInternalError(env, "Can't grab SPPSM fields");
return -1;
......@@ -280,6 +280,17 @@ int awt_parseRaster(JNIEnv *env, jobject jraster, RasterS_t *rasterP) {
rasterP->chanOffsets);
}
/* additioanl check for sppsm fields validity: make sure that
* size of raster samples doesn't exceed the data type cpacity.
*/
if (rasterP->dataType > UNKNOWN_DATA_TYPE && /* data type has been recognized */
rasterP->sppsm.maxBitSize > 0 && /* raster has SPP sample model */
rasterP->sppsm.maxBitSize > (rasterP->dataSize * 8))
{
JNU_ThrowInternalError(env, "Raster samples are too big");
return -1;
}
#if 0
fprintf(stderr,"---------------------\n");
fprintf(stderr,"Width : %d\n",rasterP->width);
......
......@@ -88,27 +88,18 @@ ditherColor(rgbquad_t value, ImageFormat * format, int row, int col)
/* blend (lerp between) two rgb quads
src and dst alpha is ignored
the algorithm: src*alpha+dst*(1-alpha)=(src-dst)*alpha+dst, rb and g are done separately
it's possible to verify that it's almost accurate indeed */
*/
INLINE rgbquad_t
blendRGB(rgbquad_t dst, rgbquad_t src, rgbquad_t alpha)
{
const rgbquad_t dstrb = dst & 0xFF00FF;
const rgbquad_t dstg = dst & 0xFF00;
const rgbquad_t srcrb = src & 0xFF00FF;
const rgbquad_t srcg = src & 0xFF00;
rgbquad_t drb = srcrb - dstrb;
rgbquad_t dg = srcg - dstg;
alpha += 1;
drb *= alpha;
dg *= alpha;
drb >>= 8;
dg >>= 8;
return ((drb + dstrb) & 0xFF00FF) | ((dg + dstg) & 0xFF00);
const rgbquad_t a = alpha;
const rgbquad_t a1 = 0xFF - alpha;
return MAKE_QUAD(
(rgbquad_t)((QUAD_RED(src) * a + QUAD_RED(dst) * a1) / 0xFF),
(rgbquad_t)((QUAD_GREEN(src) * a + QUAD_GREEN(dst) * a1) / 0xFF),
(rgbquad_t)((QUAD_BLUE(src) * a + QUAD_BLUE(dst) * a1) / 0xFF),
0);
}
/* scales rgb quad by alpha. basically similar to what's above. src alpha is retained.
......
......@@ -26,14 +26,11 @@
#include "math.h"
#include "GraphicsPrimitiveMgr.h"
#include "LineUtils.h"
#include "LoopMacros.h"
#include "Trace.h"
#include "ParallelogramUtils.h"
#include "sun_java2d_loops_FillParallelogram.h"
#include "sun_java2d_loops_DrawParallelogram.h"
DECLARE_SOLID_DRAWLINE(AnyInt);
#define HANDLE_PGRAM_EDGE(X1, Y1, X2, Y2, \
pRasInfo, pixel, pPrim, pFunc, pCompInfo) \
do { \
......@@ -46,28 +43,6 @@ DECLARE_SOLID_DRAWLINE(AnyInt);
ix1, iy1, ix2, iy2, JNI_TRUE); \
} while (0)
#define PGRAM_MIN_MAX(bmin, bmax, v0, dv1, dv2) \
do { \
double vmin, vmax; \
if (dv1 < 0) { \
vmin = v0+dv1; \
vmax = v0; \
} else { \
vmin = v0; \
vmax = v0+dv1; \
} \
if (dv2 < 0) { \
vmin -= dv2; \
} else { \
vmax += dv2; \
} \
bmin = (jint) floor(vmin + 0.5); \
bmax = (jint) floor(vmax + 0.5); \
} while(0)
#define PGRAM_INIT_X(starty, x, y, slope) \
(DblToLong((x) + (slope) * ((starty)+0.5 - (y))) + LongOneHalf - 1)
typedef struct {
jdouble x0;
jdouble y0;
......@@ -136,20 +111,8 @@ Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram
* Sort parallelogram by y values, ensure that each delta vector
* has a non-negative y delta.
*/
if (dy1 < 0) {
x0 += dx1; y0 += dy1;
dx1 = -dx1; dy1 = -dy1;
}
if (dy2 < 0) {
x0 += dx2; y0 += dy2;
dx2 = -dx2; dy2 = -dy2;
}
/* Sort delta vectors so dxy1 is left of dxy2. */
if (dx1 * dy2 > dx2 * dy1) {
double v = dx1; dx1 = dx2; dx2 = v;
v = dy1; dy1 = dy2; dy2 = v;
v = lw1; lw1 = lw2; lw2 = v;
}
SORT_PGRAM(x0, y0, dx1, dy1, dx2, dy2,
v = lw1; lw1 = lw2; lw2 = v;);
// dx,dy for line width in the "1" and "2" directions.
ldx1 = dx1 * lw1;
......@@ -161,7 +124,7 @@ Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram
ox0 = x0 - (ldx1 + ldx2) / 2.0;
oy0 = y0 - (ldy1 + ldy2) / 2.0;
PGRAM_MIN_MAX(ix1, ix2, ox0, dx1+ldx1, dx2+ldx2);
PGRAM_MIN_MAX(ix1, ix2, ox0, dx1+ldx1, dx2+ldx2, JNI_FALSE);
iy1 = (jint) floor(oy0 + 0.5);
iy2 = (jint) floor(oy0 + dy1 + ldy1 + dy2 + ldy2 + 0.5);
......@@ -212,7 +175,7 @@ Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram
// Only need to generate 4 quads if the interior still
// has a hole in it (i.e. if the line width ratios were
// both less than 1.0)
if (lw1 < 1.0f && lw2 < 1.0f) {
if (lw1 < 1.0 && lw2 < 1.0) {
// If the line widths are both less than a pixel wide
// then we can use a drawline function instead for even
// more performance.
......
......@@ -25,31 +25,10 @@
#include "math.h"
#include "GraphicsPrimitiveMgr.h"
#include "ParallelogramUtils.h"
#include "sun_java2d_loops_FillParallelogram.h"
#define PGRAM_MIN_MAX(bmin, bmax, v0, dv1, dv2) \
do { \
double vmin, vmax; \
if (dv1 < 0) { \
vmin = v0+dv1; \
vmax = v0; \
} else { \
vmin = v0; \
vmax = v0+dv1; \
} \
if (dv2 < 0) { \
vmin -= dv2; \
} else { \
vmax += dv2; \
} \
bmin = (jint) floor(vmin + 0.5); \
bmax = (jint) floor(vmax + 0.5); \
} while(0)
#define PGRAM_INIT_X(starty, x, y, slope) \
(DblToLong((x) + (slope) * ((starty)+0.5 - (y))) + LongOneHalf - 1)
/*
* Class: sun_java2d_loops_FillParallelogram
* Method: FillParallelogram
......@@ -76,22 +55,11 @@ Java_sun_java2d_loops_FillParallelogram_FillParallelogram
/*
* Sort parallelogram by y values, ensure that each delta vector
* has a non-negative y delta, and eliminate degenerate parallelograms.
* has a non-negative y delta.
*/
if (dy1 < 0) {
x0 += dx1; y0 += dy1;
dx1 = -dx1; dy1 = -dy1;
}
if (dy2 < 0) {
x0 += dx2; y0 += dy2;
dx2 = -dx2; dy2 = -dy2;
}
/* Sort delta vectors so dxy1 is left of dxy2. */
if (dx1 * dy2 > dx2 * dy1) {
double v = dx1; dx1 = dx2; dx2 = v;
v = dy1; dy1 = dy2; dy2 = v;
}
PGRAM_MIN_MAX(ix1, ix2, x0, dx1, dx2);
SORT_PGRAM(x0, y0, dx1, dy1, dx2, dy2, );
PGRAM_MIN_MAX(ix1, ix2, x0, dx1, dx2, JNI_FALSE);
iy1 = (jint) floor(y0 + 0.5);
iy2 = (jint) floor(y0 + dy1 + dy2 + 0.5);
......
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef ParallelogramUtils_h_Included
#define ParallelogramUtils_h_Included
#ifdef __cplusplus
extern "C" {
#endif
#define PGRAM_MIN_MAX(bmin, bmax, v0, dv1, dv2, AA) \
do { \
double vmin, vmax; \
if (dv1 < 0) { \
vmin = v0+dv1; \
vmax = v0; \
} else { \
vmin = v0; \
vmax = v0+dv1; \
} \
if (dv2 < 0) { \
vmin += dv2; \
} else { \
vmax += dv2; \
} \
if (AA) { \
bmin = (jint) floor(vmin); \
bmax = (jint) ceil(vmax); \
} else { \
bmin = (jint) floor(vmin + 0.5); \
bmax = (jint) floor(vmax + 0.5); \
} \
} while(0)
#define PGRAM_INIT_X(starty, x, y, slope) \
(DblToLong((x) + (slope) * ((starty)+0.5 - (y))) + LongOneHalf - 1)
/*
* Sort parallelogram by y values, ensure that each delta vector
* has a non-negative y delta.
*/
#define SORT_PGRAM(x0, y0, dx1, dy1, dx2, dy2, OTHER_SWAP_CODE) \
do { \
if (dy1 < 0) { \
x0 += dx1; y0 += dy1; \
dx1 = -dx1; dy1 = -dy1; \
} \
if (dy2 < 0) { \
x0 += dx2; y0 += dy2; \
dx2 = -dx2; dy2 = -dy2; \
} \
/* Sort delta vectors so dxy1 is left of dxy2. */ \
if (dx1 * dy2 > dx2 * dy1) { \
double v; \
v = dx1; dx1 = dx2; dx2 = v; \
v = dy1; dy1 = dy2; dy2 = v; \
OTHER_SWAP_CODE \
} \
} while(0)
#endif /* ParallelogramUtils_h_Included */
......@@ -119,7 +119,8 @@ Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile
PtrCoord(srcInfo.rasBase,
srcInfo.bounds.x1, srcInfo.pixelStride,
srcInfo.bounds.y1, srcInfo.scanStride);
unsigned char *pMask =
unsigned char *pMask, *pMaskAlloc;
pMask = pMaskAlloc =
(*env)->GetPrimitiveArrayCritical(env, maskArray, 0);
if (pMask == NULL) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
......@@ -274,7 +275,7 @@ Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile
bpos += width * height * sizeof(jint);
(*env)->ReleasePrimitiveArrayCritical(env, maskArray,
pMask, JNI_ABORT);
pMaskAlloc, JNI_ABORT);
}
SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
}
......
......@@ -137,7 +137,7 @@ void getALSAVersion(char* buffer, int len) {
file = fopen(ALSA_VERSION_PROC_FILE, "r");
ALSAVersionString[0] = 0;
if (file) {
fgets(ALSAVersionString, ALSAVersionString_LENGTH, file);
if (NULL != fgets(ALSAVersionString, ALSAVersionString_LENGTH, file)) {
// parse for version number
totalLen = strlen(ALSAVersionString);
inVersionString = FALSE;
......@@ -171,8 +171,10 @@ void getALSAVersion(char* buffer, int len) {
// null terminate
ALSAVersionString[len] = 0;
}
fclose(file);
hasGottenALSAVersion = TRUE;
}
}
strncpy(buffer, ALSAVersionString, len);
}
......
......@@ -32,6 +32,9 @@
#include <alsa/asoundlib.h>
#include "PlatformMidi.h"
#include "PLATFORM_API_LinuxOS_ALSA_MidiUtils.h"
#if defined(i586)
#include <sys/utsname.h>
#endif
/*
* Helper methods
......@@ -73,9 +76,38 @@ char* MIDI_IN_GetErrorStr(INT32 err) {
return (char*) getErrorStr(err);
}
INT32 MIDI_IN_GetNumDevices() {
/* Workaround for 6842956: 32bit app on 64bit linux
* gets assertion failure trying to open midiIn ports.
* Untill the issue is fixed in ALSA
* (https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4807)
* report no midi in devices in the configuration.
*/
#if defined(i586)
static int jre32onlinux64 = -1;
if (jre32onlinux64 < 0) {
jre32onlinux64 = 0;
/* The workaround may be disabled setting "JAVASOUND_ENABLE_MIDIIN"
* environment variable.
*/
if (getenv("JAVASOUND_ENABLE_MIDIIN") == NULL) {
struct utsname u;
jre32onlinux64 = 0;
if (uname(&u) == 0) {
if (strstr(u.machine, "64") != NULL) {
TRACE0("jre32 on linux64 detected - report no midiIn devices\n");
jre32onlinux64 = 1;
}
}
}
}
if (jre32onlinux64) {
return 0;
}
#endif
TRACE0("MIDI_IN_GetNumDevices()\n");
return getMidiDeviceCount(SND_RAWMIDI_STREAM_INPUT);
}
......
/*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -372,7 +372,7 @@ INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex,
snd_rawmidi_t* native_handle;
snd_midi_event_t* event_parser = NULL;
int err;
UINT32 deviceID;
UINT32 deviceID = 0;
char devicename[100];
#ifdef ALSA_MIDI_USE_PLUGHW
int usePlugHw = 1;
......
/*
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -127,7 +127,7 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
int ret;
int sampleSizeInBytes, significantBits, isSigned, isBigEndian, enc;
int origSampleSizeInBytes, origSignificantBits;
int channels, minChannels, maxChannels;
unsigned int channels, minChannels, maxChannels;
int rate, bitIndex;
for (bitIndex = 0; bitIndex <= MAX_BIT_INDEX; bitIndex++) handledBits[bitIndex] = FALSE;
......@@ -152,7 +152,6 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
}
}
snd_pcm_hw_params_get_format_mask(hwParams, formatMask);
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
if (ret == 0) {
ret = snd_pcm_hw_params_get_channels_min(hwParams, &minChannels);
if (ret != 0) {
......@@ -165,13 +164,6 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
ERROR1("snd_pcm_hw_params_get_channels_max returned error %d\n", ret);
}
}
#else
minChannels = snd_pcm_hw_params_get_channels_min(hwParams);
maxChannels = snd_pcm_hw_params_get_channels_max(hwParams);
if (minChannels > maxChannels) {
ERROR2("MinChannels=%d, maxChannels=%d\n", minChannels, maxChannels);
}
#endif
// since we queried the hw: device, for many soundcards, it will only
// report the maximum number of channels (which is the only way to talk
......@@ -222,7 +214,7 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
} else {
for (channels = minChannels; channels <= maxChannels; channels++) {
DAUDIO_AddAudioFormat(creator, significantBits,
(channels < 0)?-1:(sampleSizeInBytes * channels),
sampleSizeInBytes * channels,
channels, rate,
enc, isSigned, isBigEndian);
}
......@@ -254,7 +246,7 @@ typedef struct tag_AlsaPcmInfo {
snd_pcm_sw_params_t* swParams;
int bufferSizeInBytes;
int frameSize; // storage size in Bytes
int periods;
unsigned int periods;
snd_pcm_uframes_t periodSize;
#ifdef GET_POSITION_METHOD2
// to be used exclusively by getBytePosition!
......@@ -305,8 +297,8 @@ int setHWParams(AlsaPcmInfo* info,
int channels,
int bufferSizeInFrames,
snd_pcm_format_t format) {
unsigned int rrate;
int ret, dir, periods, periodTime;
unsigned int rrate, periodTime, periods;
int ret, dir;
snd_pcm_uframes_t alsaBufferSizeInFrames = (snd_pcm_uframes_t) bufferSizeInFrames;
/* choose all parameters */
......@@ -335,12 +327,8 @@ int setHWParams(AlsaPcmInfo* info,
}
/* set the stream rate */
rrate = (int) (sampleRate + 0.5f);
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
dir = 0;
ret = snd_pcm_hw_params_set_rate_near(info->handle, info->hwParams, &rrate, &dir);
#else
ret = snd_pcm_hw_params_set_rate_near(info->handle, info->hwParams, rrate, 0);
#endif
if (ret < 0) {
ERROR2("Rate %dHz not available for playback: %s\n", (int) (sampleRate+0.5f), snd_strerror(ret));
return FALSE;
......@@ -350,12 +338,7 @@ int setHWParams(AlsaPcmInfo* info,
return FALSE;
}
/* set the buffer time */
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret = snd_pcm_hw_params_set_buffer_size_near(info->handle, info->hwParams, &alsaBufferSizeInFrames);
#else
ret = snd_pcm_hw_params_set_buffer_size_near(info->handle, info->hwParams, alsaBufferSizeInFrames);
#endif
if (ret < 0) {
ERROR2("Unable to set buffer size to %d frames: %s\n",
(int) alsaBufferSizeInFrames, snd_strerror(ret));
......@@ -366,12 +349,7 @@ int setHWParams(AlsaPcmInfo* info,
if (bufferSizeInFrames > 1024) {
dir = 0;
periodTime = DEFAULT_PERIOD_TIME;
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret = snd_pcm_hw_params_set_period_time_near(info->handle, info->hwParams, &periodTime, &dir);
#else
periodTime = snd_pcm_hw_params_set_period_time_near(info->handle, info->hwParams, periodTime, &dir);
ret = periodTime;
#endif
if (ret < 0) {
ERROR2("Unable to set period time to %d: %s\n", DEFAULT_PERIOD_TIME, snd_strerror(ret));
return FALSE;
......@@ -380,12 +358,7 @@ int setHWParams(AlsaPcmInfo* info,
/* set the period count for very small buffer sizes to 2 */
dir = 0;
periods = 2;
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret = snd_pcm_hw_params_set_periods_near(info->handle, info->hwParams, &periods, &dir);
#else
periods = snd_pcm_hw_params_set_periods_near(info->handle, info->hwParams, periods, &dir);
ret = periods;
#endif
if (ret < 0) {
ERROR2("Unable to set period count to %d: %s\n", /*periods*/ 2, snd_strerror(ret));
return FALSE;
......@@ -421,12 +394,6 @@ int setSWParams(AlsaPcmInfo* info) {
ERROR1("Unable to set avail min for playback: %s\n", snd_strerror(ret));
return FALSE;
}
/* align all transfers to 1 sample */
ret = snd_pcm_sw_params_set_xfer_align(info->handle, info->swParams, 1);
if (ret < 0) {
ERROR1("Unable to set transfer align: %s\n", snd_strerror(ret));
return FALSE;
}
/* write the parameters to the playback device */
ret = snd_pcm_sw_params(info->handle, info->swParams);
if (ret < 0) {
......@@ -448,7 +415,6 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
int ret = 0;
AlsaPcmInfo* info = NULL;
/* snd_pcm_uframes_t is 64 bit on 64-bit systems */
snd_pcm_uframes_t alsaPeriodSize = 0;
snd_pcm_uframes_t alsaBufferSizeInFrames = 0;
......@@ -484,21 +450,13 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
bufferSizeInBytes / frameSize,
format)) {
info->frameSize = frameSize;
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret = snd_pcm_hw_params_get_period_size(info->hwParams, &alsaPeriodSize, &dir);
info->periodSize = (int) alsaPeriodSize;
ret = snd_pcm_hw_params_get_period_size(info->hwParams, &info->periodSize, &dir);
if (ret < 0) {
ERROR1("ERROR: snd_pcm_hw_params_get_period: %s\n", snd_strerror(ret));
}
snd_pcm_hw_params_get_periods(info->hwParams, &(info->periods), &dir);
snd_pcm_hw_params_get_buffer_size(info->hwParams, &alsaBufferSizeInFrames);
info->bufferSizeInBytes = (int) alsaBufferSizeInFrames * frameSize;
#else
info->periodSize = snd_pcm_hw_params_get_period_size(info->hwParams, &dir);
info->periods = snd_pcm_hw_params_get_periods(info->hwParams, &dir);
info->bufferSizeInBytes = snd_pcm_hw_params_get_buffer_size(info->hwParams) * frameSize;
ret = 0;
#endif
TRACE3(" DAUDIO_Open: period size = %d frames, periods = %d. Buffer size: %d bytes.\n",
(int) info->periodSize, info->periods, info->bufferSizeInBytes);
}
......
/*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -24,6 +24,7 @@
*/
// define this with a later version of ALSA than 0.9.0rc3
// (starting from 1.0.0 it became default behaviour)
#define ALSA_PCM_NEW_HW_PARAMS_API
#include <alsa/asoundlib.h>
#include "Utilities.h"
......
/*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -380,7 +380,7 @@ void PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator) {
void* controls[10];
int numControls;
char* portName;
int isPlayback;
int isPlayback = 0;
int isMono;
int isStereo;
char* type;
......
......@@ -191,7 +191,7 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
fp_gdk_threads_enter();
const char *title = (*env)->GetStringUTFChars(env, jtitle, 0);
const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0);
if (mode == 1) {
/* Save action */
......@@ -212,7 +212,9 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
}
}
if (jtitle != NULL) {
(*env)->ReleaseStringUTFChars(env, jtitle, title);
}
/* Set the directory */
if (jdir != NULL) {
......
......@@ -517,13 +517,15 @@ void ADD_SUFF(IntArgbPreSrcMaskFill)(void *rasBase,
ADD_SUFF(AnyIntSetRect)(pRasInfo, 0, 0, width, height,
fgColor, pPrim, pCompInfo);
#else
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
if (cnstA != 0xff) {
fgColor = (cnstA << 24) | (cnstR << 16) | (cnstG << 8) | cnstB;
}
ADD_SUFF(AnyIntSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
#endif
return;
}
......@@ -582,11 +584,13 @@ void ADD_SUFF(FourByteAbgrPreSrcMaskFill)(void *rasBase,
}
if (pMask == NULL) {
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
fgColor = (cnstR << 24) | (cnstG << 16) | (cnstB << 8) | cnstA;
ADD_SUFF(Any4ByteSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
return;
}
......
......@@ -150,10 +150,12 @@ void ADD_SUFF(IntArgbSrcMaskFill)(void *rasBase,
}
if (pMask == NULL) {
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
ADD_SUFF(AnyIntSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
return;
}
......@@ -214,15 +216,17 @@ void ADD_SUFF(FourByteAbgrSrcMaskFill)(void *rasBase,
cnstB = (fgColor ) & 0xff;
if (pMask == NULL) {
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
if (cnstA == 0) {
fgColor = 0;
} else {
fgColor = (fgColor << 8) | cnstA;
}
ADD_SUFF(Any4ByteSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
return;
}
......@@ -390,10 +394,12 @@ void ADD_SUFF(IntRgbSrcMaskFill)(void *rasBase,
if (cnstA == 0) fgColor = 0;
if (pMask == NULL) {
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
ADD_SUFF(AnyIntSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
return;
}
......@@ -458,10 +464,12 @@ void ADD_SUFF(IntBgrSrcMaskFill)(void *rasBase,
}
if (pMask == NULL) {
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
ADD_SUFF(AnyIntSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
return;
}
......@@ -526,10 +534,12 @@ void ADD_SUFF(ThreeByteBgrSrcMaskFill)(void *rasBase,
}
if (pMask == NULL) {
void *pBase = pRasInfo->rasBase;
pRasInfo->rasBase = rasBase;
ADD_SUFF(Any3ByteSetRect)(pRasInfo,
pRasInfo->bounds.x1, pRasInfo->bounds.y1,
pRasInfo->bounds.x2, pRasInfo->bounds.y2,
0, 0, width, height,
fgColor, pPrim, pCompInfo);
pRasInfo->rasBase = pBase;
return;
}
......
......@@ -187,7 +187,9 @@ Java_java_awt_Component_initIDs
"()Ljava/awt/Point;");
keyclass = (*env)->FindClass(env, "java/awt/event/KeyEvent");
DASSERT (keyclass != NULL);
if (JNU_IsNull(env, keyclass)) {
return;
}
componentIDs.isProxyActive =
(*env)->GetFieldID(env, keyclass, "isProxyActive",
......@@ -715,9 +717,11 @@ Window get_xawt_root_shell(JNIEnv *env) {
if (xawt_root_shell == None){
if (classXRootWindow == NULL){
jclass cls_tmp = (*env)->FindClass(env, "sun/awt/X11/XRootWindow");
if (!JNU_IsNull(env, cls_tmp)) {
classXRootWindow = (jclass)(*env)->NewGlobalRef(env, cls_tmp);
(*env)->DeleteLocalRef(env, cls_tmp);
}
}
if( classXRootWindow != NULL) {
methodGetXRootWindow = (*env)->GetStaticMethodID(env, classXRootWindow, "getXRootWindow", "()J");
}
......
......@@ -999,6 +999,8 @@ public abstract class WComponentPeer extends WObjectPeer
public void setBoundsOperation(int operation) {
}
private volatile boolean isAccelCapable = true;
/**
* Returns whether this component is capable of being hw accelerated.
* More specifically, whether rendering to this component or a
......@@ -1009,11 +1011,22 @@ public abstract class WComponentPeer extends WObjectPeer
* {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
* PERPIXEL_TRANSLUCENT}.
*
* Another condition is if Xor paint mode was detected when rendering
* to an on-screen accelerated surface associated with this peer.
* in this case both on- and off-screen acceleration for this peer is
* disabled.
*
* @return {@code true} if this component is capable of being hw
* accelerated, {@code false} otherwise
* @see GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
*/
public boolean isAccelCapable() {
if (!isAccelCapable ||
!isContainingTopLevelAccelCapable((Component)target))
{
return false;
}
boolean isTranslucent =
SunToolkit.isContainingTopLevelTranslucent((Component)target);
// D3D/OGL and translucent windows interacted poorly in Windows XP;
......@@ -1021,6 +1034,14 @@ public abstract class WComponentPeer extends WObjectPeer
return !isTranslucent || Win32GraphicsEnvironment.isVistaOS();
}
/**
* Disables acceleration for this peer.
*/
public void disableAcceleration() {
isAccelCapable = false;
}
native void setRectangularShape(int lox, int loy, int hix, int hiy,
Region region);
......
......@@ -437,6 +437,10 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
protected int getElem(final int x, final int y,
final SurfaceData sData)
{
if (sData.isSurfaceLost()) {
return 0;
}
int retPixel;
D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock();
......@@ -456,6 +460,10 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
protected void setElem(final int x, final int y, final int pixel,
final SurfaceData sData)
{
if (sData.isSurfaceLost()) {
return;
}
D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock();
try {
......@@ -512,15 +520,32 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
}
/**
* If acceleration should no longer be used for this surface.
* This implementation flags to the manager that it should no
* longer attempt to re-create a D3DSurface.
*/
void disableAccelerationForSurface() {
if (offscreenImage != null) {
SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
if (sm instanceof D3DVolatileSurfaceManager) {
setSurfaceLost(true);
((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
}
}
}
public void validatePipe(SunGraphics2D sg2d) {
TextPipe textpipe;
boolean validated = false;
// REMIND: the D3D pipeline doesn't support XOR!, more
// fixes will be needed below
// fixes will be needed below. For now we disable D3D rendering
// for the surface which had any XOR rendering done to.
if (sg2d.compositeState >= sg2d.COMP_XOR) {
super.validatePipe(sg2d);
sg2d.imagepipe = d3dImagePipe;
disableAccelerationForSurface();
return;
}
......@@ -894,8 +919,26 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
return peer.getTarget();
}
@Override
void disableAccelerationForSurface() {
// for on-screen surfaces we need to make sure a backup GDI surface is
// is used until a new one is set (which may happen during a resize). We
// don't want the screen update maanger to replace the surface right way
// because it causes repainting issues in Swing, so we invalidate it,
// this will prevent SUM from issuing a replaceSurfaceData call.
setSurfaceLost(true);
invalidate();
flush();
peer.disableAcceleration();
ScreenUpdateManager.getInstance().dropScreenSurface(this);
}
@Override
void restoreSurface() {
if (!peer.isAccelCapable()) {
throw new InvalidPipeException("Onscreen acceleration " +
"disabled for this surface");
}
Window fsw = graphicsDevice.getFullScreenWindow();
if (fsw != null && fsw != peer.getTarget()) {
throw new InvalidPipeException("Can't restore onscreen surface"+
......
......@@ -133,7 +133,9 @@ public class WGLVolatileSurfaceManager
@Override
protected boolean isConfigValid(GraphicsConfiguration gc) {
return ((gc == null) || (gc == vImg.getGraphicsConfig()));
return ((gc == null) ||
((gc instanceof WGLGraphicsConfig) &&
(gc == vImg.getGraphicsConfig())));
}
@Override
......
......@@ -188,5 +188,6 @@ UTC-02:920,920::GMT-0200:
UTC-11:921,921::GMT-1100:
Ulaanbaatar Standard Time:922,922::Asia/Ulaanbaatar:
Venezuela Standard Time:923,923::America/Caracas:
Western Brazilian Standard Time:924,924:BR:America/Rio_Branco:
Armenian Standard Time:925,925:AM:Asia/Yerevan:
Magadan Standard Time:924,924::Asia/Magadan:
Western Brazilian Standard Time:925,925:BR:America/Rio_Branco:
Armenian Standard Time:926,926:AM:Asia/Yerevan:
......@@ -54,7 +54,7 @@ static BOOL UpdateInstance(JNIEnv *env);
InstanceAccess& operator=(const InstanceAccess&);
InstanceAccess* operator&();
};
friend InstanceAccess;
friend class InstanceAccess;
private:
Devices(int numElements);
......
......@@ -173,7 +173,7 @@ extern JavaVM *jvm;
// Platform encoding is Unicode (UTF-16), re-define JNU_ functions
// to proper JNI functions.
#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<jchar*>(x), static_cast<jsize>(_tcslen(x)))
#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<const jchar*>(x), static_cast<jsize>(_tcslen(x)))
#define JNU_GetStringPlatformChars(env, x, y) reinterpret_cast<LPCWSTR>(env->GetStringChars(x, y))
#define JNU_ReleaseStringPlatformChars(env, x, y) env->ReleaseStringChars(x, reinterpret_cast<const jchar*>(y))
......
......@@ -47,12 +47,21 @@ void * operator new(size_t size, const char * filename, int linenumber) {
return ptr;
}
void * operator new[](size_t size, const char * filename, int linenumber) {
void * ptr = DMem_AllocateBlock(size, filename, linenumber);
if (ptr == NULL) {
throw std::bad_alloc();
}
return ptr;
}
#if _MSC_VER >= 1200
void operator delete(void *ptr, const char*, int) {
DASSERTMSG(FALSE, "This version of 'delete' should never get called!!!");
}
#endif
void operator delete(void *ptr) {
void operator delete(void *ptr) throw() {
DMem_FreeBlock(ptr);
}
......
......@@ -48,11 +48,14 @@
};
extern void * operator new(size_t size, const char * filename, int linenumber);
extern void * operator new[](size_t size, const char * filename, int linenumber);
#if _MSC_VER >= 1200
/* VC 6.0 is more strict about enforcing matching placement new & delete */
extern void operator delete(void *ptr, const char*, int);
#endif
extern void operator delete(void *ptr);
extern void operator delete(void *ptr) throw();
extern void DumpClipRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist);
extern void DumpUpdateRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist);
......
......@@ -650,7 +650,7 @@ UINT AwtDesktopProperties::GetIntegerParameter(UINT spi) {
}
void AwtDesktopProperties::SetStringProperty(LPCTSTR propName, LPTSTR value) {
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
GetEnv()->CallVoidMethod(self,
AwtDesktopProperties::setStringPropertyID,
key, JNU_NewStringPlatform(GetEnv(), value));
......@@ -658,7 +658,7 @@ void AwtDesktopProperties::SetStringProperty(LPCTSTR propName, LPTSTR value) {
}
void AwtDesktopProperties::SetIntegerProperty(LPCTSTR propName, int value) {
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
GetEnv()->CallVoidMethod(self,
AwtDesktopProperties::setIntegerPropertyID,
key, (jint)value);
......@@ -666,7 +666,7 @@ void AwtDesktopProperties::SetIntegerProperty(LPCTSTR propName, int value) {
}
void AwtDesktopProperties::SetBooleanProperty(LPCTSTR propName, BOOL value) {
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
GetEnv()->CallVoidMethod(self,
AwtDesktopProperties::setBooleanPropertyID,
key, value ? JNI_TRUE : JNI_FALSE);
......@@ -674,7 +674,7 @@ void AwtDesktopProperties::SetBooleanProperty(LPCTSTR propName, BOOL value) {
}
void AwtDesktopProperties::SetColorProperty(LPCTSTR propName, DWORD value) {
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
GetEnv()->CallVoidMethod(self,
AwtDesktopProperties::setColorPropertyID,
key, GetRValue(value), GetGValue(value),
......@@ -726,7 +726,7 @@ void AwtDesktopProperties::SetFontProperty(HDC dc, int fontID,
style |= java_awt_Font_ITALIC;
}
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
GetEnv()->CallVoidMethod(self,
AwtDesktopProperties::setFontPropertyID,
key, fontName, style, pointSize);
......@@ -744,7 +744,7 @@ void AwtDesktopProperties::SetFontProperty(LPCTSTR propName, const LOGFONT & fon
jint pointSize;
jint style;
fontName = JNU_NewStringPlatform(GetEnv(), const_cast<LPWSTR>(font.lfFaceName));
fontName = JNU_NewStringPlatform(GetEnv(), font.lfFaceName);
#if 0
HDC hdc;
......@@ -767,7 +767,7 @@ void AwtDesktopProperties::SetFontProperty(LPCTSTR propName, const LOGFONT & fon
style |= java_awt_Font_ITALIC;
}
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setFontPropertyID,
key, fontName, style, pointSize);
......@@ -776,8 +776,8 @@ void AwtDesktopProperties::SetFontProperty(LPCTSTR propName, const LOGFONT & fon
}
void AwtDesktopProperties::SetSoundProperty(LPCTSTR propName, LPCTSTR winEventName) {
jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
jstring event = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(winEventName));
jstring key = JNU_NewStringPlatform(GetEnv(), propName);
jstring event = JNU_NewStringPlatform(GetEnv(), winEventName);
GetEnv()->CallVoidMethod(self,
AwtDesktopProperties::setSoundPropertyID,
key, event);
......
......@@ -230,7 +230,7 @@ LRESULT CALLBACK AwtDialog::ModalFilterProc(int code,
if (::IsIconic(hWnd)) {
::ShowWindow(hWnd, SW_RESTORE);
}
PopupAllDialogs(blocker, TRUE, ::GetForegroundWindow(), FALSE);
PopupBlockers(blocker, TRUE, ::GetForegroundWindow(), FALSE);
// return 1 to prevent the system from allowing the operation
return 1;
}
......@@ -256,7 +256,7 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode,
HWND blocker = AwtWindow::GetModalBlocker(AwtComponent::GetTopLevelParentForWindow(hWnd));
if (::IsWindow(blocker)) {
BOOL onTaskbar = !(::WindowFromPoint(mhs->pt) == hWnd);
PopupAllDialogs(hWnd, FALSE, ::GetForegroundWindow(), onTaskbar);
PopupBlockers(blocker, FALSE, ::GetForegroundWindow(), onTaskbar);
// return a nonzero value to prevent the system from passing
// the message to the target window procedure
return 1;
......@@ -268,60 +268,60 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode,
}
/*
* The function goes through the heirarchy of the blocker dialogs and
* popups all the dialogs. Note that the function starts from the top
* blocker dialog and goes down to the dialog which is the bottom dialog.
* Using another traversal may cause to the flickering issue as a bottom
* dialog will cover a top dialog for some period of time.
* The function goes through the hierarchy of the blockers and
* popups all the blockers. Note that the function starts from the top
* blocker and goes down to the blocker which is the bottom one.
* Using another traversal algorithm (bottom->top) may cause to flickering
* as the bottom blocker will cover the top blocker for a while.
*/
void AwtDialog::PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
void AwtDialog::PopupBlockers(HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
{
HWND blocker = AwtWindow::GetModalBlocker(dialog);
BOOL isBlocked = ::IsWindow(blocker);
if (isBlocked) {
PopupAllDialogs(blocker, isModalHook, prevFGWindow, onTaskbar);
HWND nextBlocker = AwtWindow::GetModalBlocker(blocker);
BOOL nextBlockerExists = ::IsWindow(nextBlocker);
if (nextBlockerExists) {
PopupBlockers(nextBlocker, isModalHook, prevFGWindow, onTaskbar);
}
PopupOneDialog(dialog, blocker, isModalHook, prevFGWindow, onTaskbar);
PopupBlocker(blocker, nextBlocker, isModalHook, prevFGWindow, onTaskbar);
}
/*
* The function popups the dialog, it distinguishes non-blocked dialogs
* and activates the dialogs (sets as foreground window). If the dialog is
* blocked, then it changes the Z-order of the dialog.
* The function popups the blocker, for a non-blocked blocker we need
* to activate the blocker but if a blocker is blocked, then we need
* to change z-order of the blocker placing the blocker under the next blocker.
*/
void AwtDialog::PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
void AwtDialog::PopupBlocker(HWND blocker, HWND nextBlocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
{
if (dialog == AwtToolkit::GetInstance().GetHWnd()) {
if (blocker == AwtToolkit::GetInstance().GetHWnd()) {
return;
}
// fix for 6494032
if (isModalHook && !::IsWindowVisible(dialog)) {
::ShowWindow(dialog, SW_SHOWNA);
if (isModalHook && !::IsWindowVisible(blocker)) {
::ShowWindow(blocker, SW_SHOWNA);
}
BOOL isBlocked = ::IsWindow(blocker);
BOOL nextBlockerExists = ::IsWindow(nextBlocker);
UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
if (isBlocked) {
if (nextBlockerExists) {
// Fix for 6829546: if blocker is a top-most window, but window isn't, then
// calling ::SetWindowPos(dialog, blocker, ...) makes window top-most as well
BOOL isBlockerTopmost = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
BOOL isDialogTopmost = (::GetWindowLong(dialog, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
if (!isBlockerTopmost || isDialogTopmost) {
::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
BOOL topmostNextBlocker = (::GetWindowLong(nextBlocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
BOOL topmostBlocker = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
if (!topmostNextBlocker || topmostBlocker) {
::SetWindowPos(blocker, nextBlocker, 0, 0, 0, 0, flags);
} else {
::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
::SetWindowPos(blocker, HWND_TOP, 0, 0, 0, 0, flags);
}
} else {
::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
::SetWindowPos(blocker, HWND_TOP, 0, 0, 0, 0, flags);
// no beep/flash if the mouse was clicked in the taskbar menu
// or the dialog is currently inactive
if (!isModalHook && !onTaskbar && (dialog == prevFGWindow)) {
AnimateModalBlocker(dialog);
if (!isModalHook && !onTaskbar && (blocker == prevFGWindow)) {
AnimateModalBlocker(blocker);
}
::BringWindowToTop(dialog);
::SetForegroundWindow(dialog);
::BringWindowToTop(blocker);
::SetForegroundWindow(blocker);
}
}
......
......@@ -113,8 +113,8 @@ private:
*/
static void ModalPerformActivation(HWND hWnd);
static void PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
static void PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
static void PopupBlockers(HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
static void PopupBlocker(HWND blocker, HWND nextBlocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
public:
......
......@@ -41,9 +41,6 @@
class AwtTextArea : public AwtTextComponent {
// inner classes
class OleCallback;
public:
/* java.awt.TextArea fields ids */
......@@ -89,36 +86,11 @@ public:
static void _ReplaceText(void *param);
protected:
INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; }
void EditSetSel(CHARRANGE &cr);
void EditGetSel(CHARRANGE &cr);
LONG EditGetCharFromPos(POINT& pt);
private:
// RichEdit 1.0 control generates EN_CHANGE notifications not only
// on text changes, but also on any character formatting change.
// This flag is true when the latter case is detected.
BOOL m_bIgnoreEnChange;
// RichEdit 1.0 control undoes a character formatting change
// if it is the latest. We don't create our own undo buffer,
// but just prohibit undo in case if the latest operation
// is a formatting change.
BOOL m_bCanUndo;
HWND m_hEditCtrl;
static WNDPROC sm_pDefWindowProc;
LONG m_lHDeltaAccum;
LONG m_lVDeltaAccum;
static OleCallback sm_oleCallback;
/*****************************************************************
* Inner class OleCallback declaration.
*/
class AwtTextArea::OleCallback : public IRichEditOleCallback {
class OleCallback : public IRichEditOleCallback {
public:
OleCallback();
......@@ -143,7 +115,32 @@ protected:
CHARRANGE FAR * pchrg, HMENU FAR * phmenu);
private:
ULONG m_refs; // Reference count
};
};//OleCallback class
INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; }
void EditSetSel(CHARRANGE &cr);
void EditGetSel(CHARRANGE &cr);
LONG EditGetCharFromPos(POINT& pt);
private:
// RichEdit 1.0 control generates EN_CHANGE notifications not only
// on text changes, but also on any character formatting change.
// This flag is true when the latter case is detected.
BOOL m_bIgnoreEnChange;
// RichEdit 1.0 control undoes a character formatting change
// if it is the latest. We don't create our own undo buffer,
// but just prohibit undo in case if the latest operation
// is a formatting change.
BOOL m_bCanUndo;
HWND m_hEditCtrl;
static WNDPROC sm_pDefWindowProc;
LONG m_lHDeltaAccum;
LONG m_lVDeltaAccum;
static OleCallback sm_oleCallback;
};
......
......@@ -110,7 +110,7 @@ class CriticalSection {
private:
const CriticalSection& critSec;
};
friend Lock;
friend class Lock;
private:
CRITICAL_SECTION rep;
......
......@@ -64,6 +64,7 @@ public class WindowOpacity
boolean passed;
Frame f = new Frame("Opacity test");
f.setUndecorated(true);
passed = false;
try {
......
......@@ -25,7 +25,7 @@
* @test
* @bug 5010310 6319835 6904882 6968373
* @summary test fonts can be created in the presence of a security manager
* @run main/othervm/secure=java.lang.SecurityManager FontPrivilege
* @run main FontPrivilege
*/
import java.awt.Font;
......@@ -33,6 +33,8 @@ import java.awt.Font;
public class FontPrivilege {
public static void main(String[] args) throws Exception {
System.setSecurityManager(new SecurityManager());
new Font("Helvetica", Font.PLAIN, 12).getFamily();
new Font("foo bar", Font.PLAIN, 12).getFamily();
}
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 6996867
* @summary Render as LCD Text in SrcEa composite mode.
*/
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class LCDTextSrcEa extends Component {
static int SZ=150;
BufferedImage target =
new BufferedImage(SZ, SZ, BufferedImage.TYPE_INT_RGB);
public static void main(String args[]) {
Frame f = new Frame("LCD Text SrcEa Test");
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
LCDTextSrcEa td = new LCDTextSrcEa();
f.add("Center", td);
f.pack();
f.setVisible(true);
}
public Dimension getPreferredSize() {
return new Dimension(SZ,SZ);
}
public void paint(Graphics gx) {
Graphics2D g2d = (Graphics2D) target.getGraphics();
g2d.setColor(Color.white);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, 0.01f));
g2d.setRenderingHint(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR);
g2d.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.black);
g2d.drawString("Some sample text.", 10, 20);
gx.drawImage(target, 0, 0, null);
boolean nongrey = false;
//Test BI: should be some non-greyscale color
for (int px=0;px<SZ;px++) {
for (int py=0;py<SZ;py++) {
int rgb = target.getRGB(px, py);
int r = (rgb & 0xff0000) >> 16;
int g = (rgb & 0x00ff00) >> 8;
int b = (rgb & 0x0000ff);
if (r != g || r !=b || g != b) {
nongrey=true;
break;
}
}
}
if (!nongrey) {
throw new RuntimeException("No LCD text found");
}
}
}
Filled AA Pure Rect(5, 29.4, 10, 10)
Stroked AA Pure Rect(5, 4.4, 10, 10)
Stroked AA Line(20, 20, -10, 20)
<html>
<!--
@test
@bug 6391770
@summary Content of the Window should be laid out in the area left after WarningWindow was added.
@author Yuri Nesterenko
@run applet WindowWithWarningTest.html
-->
<head>
<title>WindowWithWarningTest</title>
</head>
<pre>
This test will run automatically.
</pre>
<body>
<applet code="WindowWithWarningTest.class" width=350 height=300></applet>
</body>
</html>
......@@ -60,7 +60,6 @@ public class StringWidth extends Frame {
pg.dispose();
pj.end();
setVisible(false);
System.exit(0);
}
public static void main(String[] args) {
......
此差异已折叠。
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7003643
* @summary Make sure MessageFormat.toPattern produces correct quoting. (SPI part is tested in PluggableLocale tests.)
*/
import java.text.*;
import java.util.*;
public class Bug7003643 {
private static final int N = 5;
private static final String[] elements = {
"'{'", "'{", "{", "''", "}", "a", "'",
};
public static void main(String[] args) {
Random rand = new Random();
int count = 0;
int max = (int) (Math.pow((double)elements.length, (double)N)/0.52);
while (count < max) {
// Create a random pattern. If the produced pattern is
// valid, then proceed with the round-trip testing.
StringBuilder sb = new StringBuilder();
for (int i = 0; i < N; i++) {
sb.append(elements[rand.nextInt(elements.length)]);
}
String pattern = sb.toString();
MessageFormat mf = null;
try {
mf = new MessageFormat(pattern);
} catch (IllegalArgumentException e) {
// bad pattern data
}
if (mf == null) {
continue;
}
count++;
String res1 = MessageFormat.format(pattern, 123);
String toPattern = mf.toPattern();
String res2 = MessageFormat.format(toPattern, 123);
if (!res1.equals(res2)) {
String s = String.format("Failed%n pattern=\"%s\" => result=\"%s\"%n"
+ " toPattern()=\"%s\" => result=\"%s\"%n",
pattern, res1, toPattern, res2);
throw new RuntimeException(s);
}
}
}
}
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册