Mercurial > hg > release > icedtea7-forest-2.3 > jdk
changeset 4738:a75913596199 icedtea-2.1-branchpoint
Merge
author | andrew |
---|---|
date | Mon, 13 Feb 2012 16:35:01 +0000 |
parents | 74b5ed1f8dd6 (current diff) afdcedc27c23 (diff) |
children | 2bc1f3f7576e |
files | |
diffstat | 5 files changed, 128 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/make/sun/xawt/mapfile-vers Mon Jan 09 10:47:30 2012 +0000 +++ b/make/sun/xawt/mapfile-vers Mon Feb 13 16:35:01 2012 +0000 @@ -322,6 +322,8 @@ Java_sun_awt_X11_XlibWrapper_XSynchronize; Java_java_awt_FileDialog_initIDs; Java_sun_awt_X11_XWindow_initIDs; + Java_sun_awt_X11_XWindowPeer_getLocalHostname; + Java_sun_awt_X11_XWindowPeer_getJvmPID; Java_sun_java2d_opengl_OGLContext_getOGLIdString; Java_sun_java2d_opengl_OGLMaskFill_maskFill;
--- a/src/share/classes/sun/java2d/loops/Blit.java Mon Jan 09 10:47:30 2012 +0000 +++ b/src/share/classes/sun/java2d/loops/Blit.java Mon Feb 13 16:35:01 2012 +0000 @@ -172,11 +172,11 @@ while (si.nextSpan(span)) { int w = span[2] - span[0]; int h = span[3] - span[1]; - srcRas = srcRas.createChild(srcx + span[0], srcy + span[1], - w, h, 0, 0, null); - dstRas = dstRas.createWritableChild(span[0], span[1], - w, h, 0, 0, null); - ctx.compose(srcRas, dstRas, dstRas); + Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1], + w, h, 0, 0, null); + WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1], + w, h, 0, 0, null); + ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas); } ctx.dispose(); }
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Mon Jan 09 10:47:30 2012 +0000 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Mon Feb 13 16:35:01 2012 +0000 @@ -208,12 +208,19 @@ return name; } + private static native String getLocalHostname(); + private static native int getJvmPID(); + void postInit(XCreateWindowParams params) { super.postInit(params); // Init WM_PROTOCOLS atom initWMProtocols(); + // Set _NET_WM_PID and WM_CLIENT_MACHINE using this JVM + XAtom.get("WM_CLIENT_MACHINE").setProperty(getWindow(), getLocalHostname()); + XAtom.get("_NET_WM_PID").setCard32Property(getWindow(), getJvmPID()); + // Set WM_TRANSIENT_FOR and group_leader Window t_window = (Window)target; Window owner = t_window.getOwner();
--- a/src/solaris/native/sun/xawt/XToolkit.c Mon Jan 09 10:47:30 2012 +0000 +++ b/src/solaris/native/sun/xawt/XToolkit.c Mon Feb 13 16:35:01 2012 +0000 @@ -47,6 +47,8 @@ #include "java_awt_TrayIcon.h" #include <X11/extensions/XTest.h> +#include <unistd.h> + uint32_t awt_NumLockMask = 0; Boolean awt_ModLockIsShiftLock = False; @@ -1087,3 +1089,38 @@ return local_num_buttons; } + +/* + * Class: sun_awt_X11_XWindowPeer + * Method: getJvmPID + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindowPeer_getJvmPID +(JNIEnv *env, jclass cls) +{ + /* Return the JVM's PID. */ + return getpid(); +} + +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 1024 /* Overestimated */ +#endif + +/* + * Class: sun_awt_X11_XWindowPeer + * Method: getLocalHostname + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_sun_awt_X11_XWindowPeer_getLocalHostname +(JNIEnv *env, jclass cls) +{ + /* Return the machine's FQDN. */ + char hostname[HOST_NAME_MAX + 1]; + if (gethostname(hostname, HOST_NAME_MAX + 1) == 0) { + hostname[HOST_NAME_MAX] = '\0'; + jstring res = (*env)->NewStringUTF(env, hostname); + return res; + } + + return (jstring)NULL; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/java2d/loops/Bug7049339.java Mon Feb 13 16:35:01 2012 +0000 @@ -0,0 +1,77 @@ +/* + * Copyright 2011 Red Hat, Inc. All Rights Reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 7049339 + @summary Copying images with a non-rectangular clip and a custom composite + fails + @author Denis Lila <dlila@redhat.com> + @run main Bug7049339 + */ + +import java.awt.Composite; +import java.awt.CompositeContext; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.Raster; +import java.awt.image.WritableRaster; + +public class Bug7049339 { + public static void main(String[] argv) { + int x = 100, y = 100; + BufferedImage src = new BufferedImage(x, y, BufferedImage.TYPE_INT_ARGB); + BufferedImage dst = new BufferedImage(x, y, BufferedImage.TYPE_3BYTE_BGR); + + Graphics2D dstg2d = dst.createGraphics(); + dstg2d.setComposite(new Composite() { + @Override + public CompositeContext createContext( + ColorModel srcColorModel, + ColorModel dstColorModel, + RenderingHints hints) + { + return new CompositeContext() { + @Override + public void compose(Raster src, Raster dstIn, + WritableRaster dstOut) + { + // do nothing + } + @Override + public void dispose() { + } + }; + } + }); + Shape clip = new Ellipse2D.Double(x/4, y/4, x/2, y/2); + dstg2d.setClip(clip); + // This will throw a RasterFormatException if the bug is present. + dstg2d.drawImage(src, 0, 0, null); + } +}