Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e8577fea
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e8577fea
编写于
11月 20, 2014
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
daa4eb15
38078fa5
变更
33
展开全部
显示空白变更内容
内联
并排
Showing
33 changed file
with
1302 addition
and
286 deletion
+1302
-286
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
+6
-1
src/macosx/classes/com/apple/laf/AquaIcon.java
src/macosx/classes/com/apple/laf/AquaIcon.java
+1
-1
src/macosx/classes/com/apple/laf/AquaImageFactory.java
src/macosx/classes/com/apple/laf/AquaImageFactory.java
+1
-1
src/macosx/classes/com/apple/laf/AquaNativeResources.java
src/macosx/classes/com/apple/laf/AquaNativeResources.java
+2
-1
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+3
-0
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+18
-0
src/macosx/native/sun/awt/CWrapper.m
src/macosx/native/sun/awt/CWrapper.m
+17
-0
src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
+2
-0
src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m
src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m
+5
-0
src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
+151
-206
src/share/classes/java/lang/reflect/Executable.java
src/share/classes/java/lang/reflect/Executable.java
+48
-1
src/share/classes/java/lang/reflect/Parameter.java
src/share/classes/java/lang/reflect/Parameter.java
+1
-1
src/share/classes/javax/swing/CellEditor.java
src/share/classes/javax/swing/CellEditor.java
+2
-2
src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
...s/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+8
-4
src/share/classes/javax/swing/plaf/basic/BasicTransferable.java
...are/classes/javax/swing/plaf/basic/BasicTransferable.java
+13
-2
src/share/classes/sun/awt/datatransfer/DataTransferer.java
src/share/classes/sun/awt/datatransfer/DataTransferer.java
+6
-5
src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
+61
-17
src/share/classes/sun/java2d/pipe/DrawImage.java
src/share/classes/sun/java2d/pipe/DrawImage.java
+1
-1
src/share/classes/sun/management/Flag.java
src/share/classes/sun/management/Flag.java
+9
-1
src/share/classes/sun/net/www/http/HttpClient.java
src/share/classes/sun/net/www/http/HttpClient.java
+8
-6
src/solaris/classes/sun/awt/X11/XDataTransferer.java
src/solaris/classes/sun/awt/X11/XDataTransferer.java
+6
-4
src/solaris/classes/sun/awt/X11/XWM.java
src/solaris/classes/sun/awt/X11/XWM.java
+6
-1
src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
+53
-7
test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java
...transfer/MappingGenerationTest/MappingGenerationTest.java
+183
-0
test/java/awt/image/DrawImage/IncorrectAlphaConversionBicubic.java
.../awt/image/DrawImage/IncorrectAlphaConversionBicubic.java
+113
-0
test/java/awt/image/DrawImage/IncorrectClipXorModeSW2Surface.java
...a/awt/image/DrawImage/IncorrectClipXorModeSW2Surface.java
+179
-0
test/java/awt/image/DrawImage/IncorrectUnmanagedImageSourceOffset.java
.../image/DrawImage/IncorrectUnmanagedImageSourceOffset.java
+150
-0
test/java/awt/image/DrawImage/UnmanagedDrawImagePerformance.java
...va/awt/image/DrawImage/UnmanagedDrawImagePerformance.java
+125
-0
test/java/lang/instrument/DaemonThread/TestDaemonThread.java
test/java/lang/instrument/DaemonThread/TestDaemonThread.java
+1
-1
test/javax/swing/DataTransfer/8059739/bug8059739.java
test/javax/swing/DataTransfer/8059739/bug8059739.java
+80
-0
test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
...avax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
+18
-12
test/sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java
...creenRenderingResizeTest/OnScreenRenderingResizeTest.java
+11
-6
test/sun/net/www/http/HttpClient/StreamingRetry.java
test/sun/net/www/http/HttpClient/StreamingRetry.java
+14
-5
未找到文件。
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
浏览文件 @
e8577fea
...
...
@@ -486,10 +486,15 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
// This is somewhat messy. The difference here from BasicComboBoxUI.EnterAction is that
// arrow up or down does not automatically select the
private
static
final
Action
triggerSelectionAction
=
new
AbstractAction
()
{
private
final
Action
triggerSelectionAction
=
new
AbstractAction
()
{
public
void
actionPerformed
(
final
ActionEvent
e
)
{
triggerSelectionEvent
((
JComboBox
)
e
.
getSource
(),
e
);
}
@Override
public
boolean
isEnabled
()
{
return
comboBox
.
isPopupVisible
()
&&
super
.
isEnabled
();
}
};
private
static
final
Action
toggleSelectionAction
=
new
AbstractAction
()
{
...
...
src/macosx/classes/com/apple/laf/AquaIcon.java
浏览文件 @
e8577fea
...
...
@@ -62,7 +62,7 @@ public class AquaIcon {
if
(
w
<=
0
||
h
<=
0
)
return
null
;
// This could be any kind of icon, so we need to make a buffer for it, draw it and then pass the new image off to appkit.
final
BufferedImage
image
=
new
BufferedImage
(
w
,
h
,
BufferedImage
.
TYPE_INT_ARGB
);
final
BufferedImage
image
=
new
BufferedImage
(
w
,
h
,
BufferedImage
.
TYPE_INT_ARGB
_PRE
);
final
Graphics
g
=
image
.
getGraphics
();
i
.
paintIcon
(
null
,
g
,
0
,
0
);
g
.
dispose
();
...
...
src/macosx/classes/com/apple/laf/AquaImageFactory.java
浏览文件 @
e8577fea
...
...
@@ -129,7 +129,7 @@ public class AquaImageFactory {
};
final
BufferedImage
image
=
new
BufferedImage
(
scaledAlertIconSize
,
scaledAlertIconSize
,
BufferedImage
.
TYPE_INT_ARGB
);
scaledAlertIconSize
,
BufferedImage
.
TYPE_INT_ARGB
_PRE
);
final
Graphics
g
=
image
.
getGraphics
();
g
.
drawImage
(
background
,
0
,
0
,
scaledAlertIconSize
,
scaledAlertIconSize
,
null
);
...
...
src/macosx/classes/com/apple/laf/AquaNativeResources.java
浏览文件 @
e8577fea
...
...
@@ -66,11 +66,12 @@ public class AquaNativeResources {
}
static
BufferedImage
getRadioButtonSizerImage
()
{
final
BufferedImage
img
=
new
BufferedImage
(
20
,
20
,
BufferedImage
.
TYPE_INT_ARGB
);
final
BufferedImage
img
=
new
BufferedImage
(
20
,
20
,
BufferedImage
.
TYPE_INT_ARGB
_PRE
);
Graphics
g
=
img
.
getGraphics
();
g
.
setColor
(
Color
.
pink
);
g
.
fillRect
(
0
,
0
,
20
,
20
);
g
.
dispose
();
return
img
;
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
e8577fea
...
...
@@ -568,7 +568,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
CWrapper
.
NSWindow
.
makeKeyWindow
(
nsWindowPtr
);
}
}
else
{
// immediately hide the window
CWrapper
.
NSWindow
.
orderOut
(
nsWindowPtr
);
// process the close
CWrapper
.
NSWindow
.
close
(
nsWindowPtr
);
}
}
else
{
// otherwise, put it in a proper z-order
...
...
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
浏览文件 @
e8577fea
...
...
@@ -54,8 +54,26 @@ final class CWrapper {
static
native
void
orderFront
(
long
window
);
static
native
void
orderFrontRegardless
(
long
window
);
static
native
void
orderWindow
(
long
window
,
int
ordered
,
long
relativeTo
);
/**
* Removes the window from the screen.
*
* @param window the pointer of the NSWindow
*/
static
native
void
orderOut
(
long
window
);
/**
* Removes the window from the screen and releases it. According to
* documentation this method should be similar to {@link #orderOut},
* because we use ReleasedWhenClosed:NO, so the window shouldn't be
* released. But the close method works differently, for example it
* close the space if the window was in the full screen via
* {@link CPlatformWindow#toggleFullScreen()}.
*
* @param window the pointer of the NSWindow
*/
static
native
void
close
(
long
window
);
static
native
void
addChildWindow
(
long
parent
,
long
child
,
int
ordered
);
static
native
void
removeChildWindow
(
long
parent
,
long
child
);
...
...
src/macosx/native/sun/awt/CWrapper.m
浏览文件 @
e8577fea
...
...
@@ -173,6 +173,23 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: close
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_close
(JNIEnv *env, jclass cls, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window close];
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: orderFrontRegardless
...
...
src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
浏览文件 @
e8577fea
...
...
@@ -72,7 +72,9 @@ OGLGC_DestroyOGLGraphicsConfig(jlong pConfigInfo)
}
[
pool
drain
];
free
(
ctxinfo
);
oglc
->
ctxInfo
=
NULL
;
}
cglinfo
->
context
=
NULL
;
}
free
(
cglinfo
);
...
...
src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m
浏览文件 @
e8577fea
...
...
@@ -187,6 +187,11 @@ OGLSD_SetScratchSurface(JNIEnv *env, jlong pConfigInfo)
}
OGLContext *oglc = cglInfo->context;
if (oglc == NULL) {
J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_SetScratchContext: ogl context is null");
return NULL;
}
CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
JNF_COCOA_ENTER(env);
...
...
src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
浏览文件 @
e8577fea
此差异已折叠。
点击以展开。
src/share/classes/java/lang/reflect/Executable.java
浏览文件 @
e8577fea
...
...
@@ -286,6 +286,53 @@ public abstract class Executable extends AccessibleObject
return
getParameterTypes
();
}
/**
* Behaves like {@code getGenericParameterTypes}, but returns type
* information for all parameters, including synthetic parameters.
*/
Type
[]
getAllGenericParameterTypes
()
{
final
boolean
genericInfo
=
hasGenericInformation
();
// Easy case: we don't have generic parameter information. In
// this case, we just return the result of
// getParameterTypes().
if
(!
genericInfo
)
{
return
getParameterTypes
();
}
else
{
final
boolean
realParamData
=
hasRealParameterData
();
final
Type
[]
genericParamTypes
=
getGenericParameterTypes
();
final
Type
[]
nonGenericParamTypes
=
getParameterTypes
();
final
Type
[]
out
=
new
Type
[
nonGenericParamTypes
.
length
];
final
Parameter
[]
params
=
getParameters
();
int
fromidx
=
0
;
// If we have real parameter data, then we use the
// synthetic and mandate flags to our advantage.
if
(
realParamData
)
{
for
(
int
i
=
0
;
i
<
out
.
length
;
i
++)
{
final
Parameter
param
=
params
[
i
];
if
(
param
.
isSynthetic
()
||
param
.
isImplicit
())
{
// If we hit a synthetic or mandated parameter,
// use the non generic parameter info.
out
[
i
]
=
nonGenericParamTypes
[
i
];
}
else
{
// Otherwise, use the generic parameter info.
out
[
i
]
=
genericParamTypes
[
fromidx
];
fromidx
++;
}
}
}
else
{
// Otherwise, use the non-generic parameter data.
// Without method parameter reflection data, we have
// no way to figure out which parameters are
// synthetic/mandated, thus, no way to match up the
// indexes.
return
genericParamTypes
.
length
==
nonGenericParamTypes
.
length
?
genericParamTypes
:
nonGenericParamTypes
;
}
return
out
;
}
}
/**
* Returns an array of {@code Parameter} objects that represent
* all the parameters to the underlying executable represented by
...
...
@@ -654,7 +701,7 @@ public abstract class Executable extends AccessibleObject
getConstantPool
(
getDeclaringClass
()),
this
,
getDeclaringClass
(),
getGenericParameterTypes
(),
get
All
GenericParameterTypes
(),
TypeAnnotation
.
TypeAnnotationTarget
.
METHOD_FORMAL_PARAMETER
);
}
...
...
src/share/classes/java/lang/reflect/Parameter.java
浏览文件 @
e8577fea
...
...
@@ -198,7 +198,7 @@ public final class Parameter implements AnnotatedElement {
public
Type
getParameterizedType
()
{
Type
tmp
=
parameterTypeCache
;
if
(
null
==
tmp
)
{
tmp
=
executable
.
getGenericParameterTypes
()[
index
];
tmp
=
executable
.
get
All
GenericParameterTypes
()[
index
];
parameterTypeCache
=
tmp
;
}
...
...
src/share/classes/javax/swing/CellEditor.java
浏览文件 @
e8577fea
/*
* Copyright (c) 1997, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
14
, 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
...
...
@@ -47,7 +47,7 @@ import javax.swing.event.*;
* new component implement the interface. Or the developer can
* choose a wrapper based approach and provide a companion object which
* implements the <code>CellEditor</code> interface (See
* <code>
J
CellEditor</code> for example). The wrapper approach
* <code>
Default
CellEditor</code> for example). The wrapper approach
* is particularly useful if the user want to use a 3rd party ISV
* editor with <code>JTable</code>, but the ISV didn't implement the
* <code>CellEditor</code> interface. The user can simply create an object
...
...
src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
浏览文件 @
e8577fea
...
...
@@ -31,16 +31,14 @@ import java.awt.event.*;
import
javax.accessibility.AccessibleContext
;
import
javax.swing.*
;
import
javax.swing.plaf.*
;
import
javax.swing.border.*
;
import
javax.swing.event.InternalFrameEvent
;
import
java.util.EventListener
;
import
java.beans.PropertyChangeListener
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.VetoableChangeListener
;
import
java.beans.PropertyVetoException
;
import
sun.swing.DefaultLookup
;
import
sun.swing.UIAction
;
import
static
sun
.
swing
.
SwingUtilities2
.
AA_TEXT_PROPERTY_KEY
;
/**
* The class that manages a basic title bar
...
...
@@ -125,6 +123,12 @@ public class BasicInternalFrameTitlePane extends JComponent
createButtons
();
addSubComponents
();
updateProperties
();
}
private
void
updateProperties
()
{
final
Object
aaTextInfo
=
frame
.
getClientProperty
(
AA_TEXT_PROPERTY_KEY
);
putClientProperty
(
AA_TEXT_PROPERTY_KEY
,
aaTextInfo
);
}
protected
void
addSubComponents
()
{
...
...
src/share/classes/javax/swing/plaf/basic/BasicTransferable.java
浏览文件 @
e8577fea
...
...
@@ -24,6 +24,8 @@
*/
package
javax.swing.plaf.basic
;
import
sun.awt.datatransfer.DataTransferer
;
import
java.io.*
;
import
java.awt.datatransfer.*
;
import
javax.swing.plaf.UIResource
;
...
...
@@ -145,7 +147,7 @@ class BasicTransferable implements Transferable, UIResource {
}
else
if
(
Reader
.
class
.
equals
(
flavor
.
getRepresentationClass
()))
{
return
new
StringReader
(
data
);
}
else
if
(
InputStream
.
class
.
equals
(
flavor
.
getRepresentationClass
()))
{
return
new
StringBufferInputStream
(
data
);
return
createInputStream
(
flavor
,
data
);
}
// fall through to unsupported
}
else
if
(
isPlainFlavor
(
flavor
))
{
...
...
@@ -156,7 +158,7 @@ class BasicTransferable implements Transferable, UIResource {
}
else
if
(
Reader
.
class
.
equals
(
flavor
.
getRepresentationClass
()))
{
return
new
StringReader
(
data
);
}
else
if
(
InputStream
.
class
.
equals
(
flavor
.
getRepresentationClass
()))
{
return
new
StringBufferInputStream
(
data
);
return
createInputStream
(
flavor
,
data
);
}
// fall through to unsupported
...
...
@@ -168,6 +170,15 @@ class BasicTransferable implements Transferable, UIResource {
throw
new
UnsupportedFlavorException
(
flavor
);
}
private
InputStream
createInputStream
(
DataFlavor
flavor
,
String
data
)
throws
IOException
,
UnsupportedFlavorException
{
String
cs
=
DataTransferer
.
getTextCharset
(
flavor
);
if
(
cs
==
null
)
{
throw
new
UnsupportedFlavorException
(
flavor
);
}
return
new
ByteArrayInputStream
(
data
.
getBytes
(
cs
));
}
// --- richer subclass flavors ----------------------------------------------
protected
boolean
isRicherFlavor
(
DataFlavor
flavor
)
{
...
...
src/share/classes/sun/awt/datatransfer/DataTransferer.java
浏览文件 @
e8577fea
...
...
@@ -77,6 +77,7 @@ import java.util.Comparator;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.SortedMap
;
...
...
@@ -273,7 +274,7 @@ public abstract class DataTransferer {
* instead, null will be returned.
*/
public
static
synchronized
DataTransferer
getInstance
()
{
return
((
ComponentFactory
)
Toolkit
.
getDefaultToolkit
()).
getDataTransferer
();
return
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
getDataTransferer
();
}
/**
...
...
@@ -2424,8 +2425,8 @@ search:
* If there are no platform-specific mappings for this native, the method
* returns an empty <code>List</code>.
*/
public
Li
st
getPlatformMappingsForNative
(
String
nat
)
{
return
new
ArrayList
();
public
Li
nkedHashSet
<
DataFlavor
>
getPlatformMappingsForNative
(
String
nat
)
{
return
new
LinkedHashSet
<>
();
}
/**
...
...
@@ -2433,8 +2434,8 @@ search:
* If there are no platform-specific mappings for this flavor, the method
* returns an empty <code>List</code>.
*/
public
Li
st
getPlatformMappingsForFlavor
(
DataFlavor
df
)
{
return
new
ArrayList
();
public
Li
nkedHashSet
<
String
>
getPlatformMappingsForFlavor
(
DataFlavor
df
)
{
return
new
LinkedHashSet
<>
();
}
/**
...
...
src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
浏览文件 @
e8577fea
...
...
@@ -47,7 +47,7 @@ import sun.java2d.pipe.RenderQueue;
import
static
sun
.
java2d
.
pipe
.
BufferedOpCodes
.*;
import
java.lang.annotation.Native
;
class
OGLBlitLoops
{
final
class
OGLBlitLoops
{
static
void
register
()
{
Blit
blitIntArgbPreToSurface
=
...
...
@@ -56,7 +56,9 @@ class OGLBlitLoops {
Blit
blitIntArgbPreToTexture
=
new
OGLSwToTextureBlit
(
SurfaceType
.
IntArgbPre
,
OGLSurfaceData
.
PF_INT_ARGB_PRE
);
TransformBlit
transformBlitIntArgbPreToSurface
=
new
OGLSwToSurfaceTransform
(
SurfaceType
.
IntArgbPre
,
OGLSurfaceData
.
PF_INT_ARGB_PRE
);
GraphicsPrimitive
[]
primitives
=
{
// surface->surface ops
new
OGLSurfaceToSurfaceBlit
(),
...
...
@@ -100,7 +102,7 @@ class OGLBlitLoops {
CompositeType
.
AnyAlpha
,
blitIntArgbPreToSurface
),
new
OGLAnyCompositeBlit
(
OGLSurfaceData
.
OpenGLSurface
),
new
OGLAnyCompositeBlit
(),
new
OGLSwToSurfaceScale
(
SurfaceType
.
IntRgb
,
OGLSurfaceData
.
PF_INT_RGB
),
...
...
@@ -145,8 +147,9 @@ class OGLBlitLoops {
OGLSurfaceData
.
PF_BYTE_GRAY
),
new
OGLSwToSurfaceTransform
(
SurfaceType
.
UshortGray
,
OGLSurfaceData
.
PF_USHORT_GRAY
),
new
OGLSwToSurfaceTransform
(
SurfaceType
.
IntArgbPre
,
OGLSurfaceData
.
PF_INT_ARGB_PRE
),
transformBlitIntArgbPreToSurface
,
new
OGLGeneralTransformedBlit
(
transformBlitIntArgbPreToSurface
),
// texture->surface ops
new
OGLTextureToSurfaceBlit
(),
...
...
@@ -178,9 +181,6 @@ class OGLBlitLoops {
new
OGLGeneralBlit
(
OGLSurfaceData
.
OpenGLTexture
,
CompositeType
.
SrcNoEa
,
blitIntArgbPreToTexture
),
new
OGLAnyCompositeBlit
(
OGLSurfaceData
.
OpenGLTexture
),
};
GraphicsPrimitiveMgr
.
register
(
primitives
);
}
...
...
@@ -781,11 +781,11 @@ class OGLTextureToSurfaceTransform extends TransformBlit {
* This general Blit implementation converts any source surface to an
* intermediate IntArgbPre surface, and then uses the more specific
* IntArgbPre->OpenGLSurface/Texture loop to get the intermediate
* (premultiplied) surface down to OpenGL.
* (premultiplied) surface down to OpenGL
using simple blit
.
*/
class
OGLGeneralBlit
extends
Blit
{
private
Blit
performop
;
private
final
Blit
performop
;
private
WeakReference
srcTmp
;
OGLGeneralBlit
(
SurfaceType
dstType
,
...
...
@@ -826,12 +826,56 @@ class OGLGeneralBlit extends Blit {
}
}
class
OGLAnyCompositeBlit
extends
Blit
{
/**
* This general TransformedBlit implementation converts any source surface to an
* intermediate IntArgbPre surface, and then uses the more specific
* IntArgbPre->OpenGLSurface/Texture loop to get the intermediate
* (premultiplied) surface down to OpenGL using simple transformBlit.
*/
final
class
OGLGeneralTransformedBlit
extends
TransformBlit
{
private
final
TransformBlit
performop
;
private
WeakReference
<
SurfaceData
>
srcTmp
;
OGLGeneralTransformedBlit
(
final
TransformBlit
performop
)
{
super
(
SurfaceType
.
Any
,
CompositeType
.
AnyAlpha
,
OGLSurfaceData
.
OpenGLSurface
);
this
.
performop
=
performop
;
}
@Override
public
synchronized
void
Transform
(
SurfaceData
src
,
SurfaceData
dst
,
Composite
comp
,
Region
clip
,
AffineTransform
at
,
int
hint
,
int
srcx
,
int
srcy
,
int
dstx
,
int
dsty
,
int
width
,
int
height
){
Blit
convertsrc
=
Blit
.
getFromCache
(
src
.
getSurfaceType
(),
CompositeType
.
SrcNoEa
,
SurfaceType
.
IntArgbPre
);
// use cached intermediate surface, if available
final
SurfaceData
cachedSrc
=
srcTmp
!=
null
?
srcTmp
.
get
()
:
null
;
// convert source to IntArgbPre
src
=
convertFrom
(
convertsrc
,
src
,
srcx
,
srcy
,
width
,
height
,
cachedSrc
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
// transform IntArgbPre intermediate surface to OpenGL surface
performop
.
Transform
(
src
,
dst
,
comp
,
clip
,
at
,
hint
,
0
,
0
,
dstx
,
dsty
,
width
,
height
);
if
(
src
!=
cachedSrc
)
{
// cache the intermediate surface
srcTmp
=
new
WeakReference
<>(
src
);
}
}
}
final
class
OGLAnyCompositeBlit
extends
Blit
{
private
WeakReference
<
SurfaceData
>
dstTmp
;
public
OGLAnyCompositeBlit
(
SurfaceType
dstType
)
{
super
(
SurfaceType
.
Any
,
CompositeType
.
Any
,
dstTyp
e
);
OGLAnyCompositeBlit
(
)
{
super
(
SurfaceType
.
Any
,
CompositeType
.
Any
,
OGLSurfaceData
.
OpenGLSurfac
e
);
}
public
synchronized
void
Blit
(
SurfaceData
src
,
SurfaceData
dst
,
Composite
comp
,
Region
clip
,
int
sx
,
int
sy
,
int
dx
,
int
dy
,
...
...
@@ -848,15 +892,15 @@ class OGLAnyCompositeBlit extends Blit {
cachedDst
=
dstTmp
.
get
();
}
// convert
source
to IntArgbPre
// convert
destination
to IntArgbPre
SurfaceData
dstBuffer
=
convertFrom
(
convertdst
,
dst
,
dx
,
dy
,
w
,
h
,
cachedDst
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
Region
bufferClip
=
clip
==
null
?
null
:
clip
.
getTranslatedRegion
(-
dx
,
-
dy
);
Blit
performop
=
Blit
.
getFromCache
(
src
.
getSurfaceType
(),
CompositeType
.
Any
,
dstBuffer
.
getSurfaceType
());
performop
.
Blit
(
src
,
dstBuffer
,
comp
,
clip
,
sx
,
sy
,
0
,
0
,
w
,
h
);
performop
.
Blit
(
src
,
dstBuffer
,
comp
,
bufferClip
,
sx
,
sy
,
0
,
0
,
w
,
h
);
if
(
dstBuffer
!=
cachedDst
)
{
// cache the intermediate surface
...
...
src/share/classes/sun/java2d/pipe/DrawImage.java
浏览文件 @
e8577fea
...
...
@@ -510,7 +510,7 @@ public class DrawImage implements DrawImagePipe
// We need to transform to a temp image and then copy
// just the pieces that are valid data to the dest.
BufferedImage
tmpimg
=
new
BufferedImage
(
dx2
-
dx1
,
dy2
-
dy1
,
BufferedImage
.
TYPE_INT_ARGB
);
BufferedImage
.
TYPE_INT_ARGB
_PRE
);
SurfaceData
tmpData
=
SurfaceData
.
getPrimarySurfaceData
(
tmpimg
);
SurfaceType
tmpType
=
tmpData
.
getSurfaceType
();
MaskBlit
tmpmaskblit
=
...
...
src/share/classes/sun/management/Flag.java
浏览文件 @
e8577fea
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
4
, 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
...
...
@@ -28,6 +28,7 @@ package sun.management;
import
java.util.*
;
import
com.sun.management.VMOption
;
import
com.sun.management.VMOption.Origin
;
import
java.security.AccessController
;
/**
* Flag class is a helper class for constructing a VMOption.
...
...
@@ -114,6 +115,13 @@ class Flag {
static
synchronized
native
void
setStringValue
(
String
name
,
String
value
);
static
{
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"management"
);
return
null
;
}
});
initialize
();
}
private
static
native
void
initialize
();
...
...
src/share/classes/sun/net/www/http/HttpClient.java
浏览文件 @
e8577fea
...
...
@@ -657,9 +657,10 @@ public class HttpClient extends NetworkClient {
cachedHttpClient
=
false
;
if
(!
failedOnce
&&
requests
!=
null
)
{
failedOnce
=
true
;
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
||
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
(!
retryPostProp
||
streaming
)))
{
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
||
streaming
||
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
!
retryPostProp
))
{
// do not retry the request
}
else
{
// try once more
...
...
@@ -769,9 +770,10 @@ public class HttpClient extends NetworkClient {
}
else
if
(
nread
!=
8
)
{
if
(!
failedOnce
&&
requests
!=
null
)
{
failedOnce
=
true
;
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
||
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
(!
retryPostProp
||
streaming
)))
{
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
||
streaming
||
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
!
retryPostProp
))
{
// do not retry the request
}
else
{
closeServer
();
...
...
src/solaris/classes/sun/awt/X11/XDataTransferer.java
浏览文件 @
e8577fea
...
...
@@ -45,6 +45,7 @@ import java.net.URISyntaxException;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
javax.imageio.ImageIO
;
...
...
@@ -328,8 +329,9 @@ public class XDataTransferer extends DataTransferer {
* a valid MIME and return a list of flavors to which the data in this MIME
* type can be translated by the Data Transfer subsystem.
*/
public
List
<
DataFlavor
>
getPlatformMappingsForNative
(
String
nat
)
{
List
<
DataFlavor
>
flavors
=
new
ArrayList
();
public
LinkedHashSet
<
DataFlavor
>
getPlatformMappingsForNative
(
String
nat
)
{
LinkedHashSet
<
DataFlavor
>
flavors
=
new
LinkedHashSet
<>();
if
(
nat
==
null
)
{
return
flavors
;
...
...
@@ -389,8 +391,8 @@ public class XDataTransferer extends DataTransferer {
* MIME types to which the data in this flavor can be translated by the Data
* Transfer subsystem.
*/
public
Li
st
getPlatformMappingsForFlavor
(
DataFlavor
df
)
{
Li
st
natives
=
new
ArrayList
(
1
);
public
Li
nkedHashSet
<
String
>
getPlatformMappingsForFlavor
(
DataFlavor
df
)
{
Li
nkedHashSet
<
String
>
natives
=
new
LinkedHashSet
<>
(
1
);
if
(
df
==
null
)
{
return
natives
;
...
...
src/solaris/classes/sun/awt/X11/XWM.java
浏览文件 @
e8577fea
...
...
@@ -595,8 +595,13 @@ final class XWM
return
isNetWMName
(
"Mutter"
)
||
isNetWMName
(
"GNOME Shell"
);
}
static
int
awtWMNonReparenting
=
-
1
;
static
boolean
isNonReparentingWM
()
{
return
(
XWM
.
getWMID
()
==
XWM
.
COMPIZ_WM
||
XWM
.
getWMID
()
==
XWM
.
LG3D_WM
||
XWM
.
getWMID
()
==
XWM
.
CWM_WM
);
if
(
awtWMNonReparenting
==
-
1
)
{
awtWMNonReparenting
=
(
XToolkit
.
getEnv
(
"_JAVA_AWT_WM_NONREPARENTING"
)
!=
null
)
?
1
:
0
;
}
return
(
awtWMNonReparenting
==
1
||
XWM
.
getWMID
()
==
XWM
.
COMPIZ_WM
||
XWM
.
getWMID
()
==
XWM
.
LG3D_WM
||
XWM
.
getWMID
()
==
XWM
.
CWM_WM
);
}
/*
...
...
src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
浏览文件 @
e8577fea
/*
* Copyright (c) 2007, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
4
, 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
...
...
@@ -48,7 +48,7 @@ import sun.java2d.pipe.RenderQueue;
import
static
sun
.
java2d
.
pipe
.
BufferedOpCodes
.*;
import
sun.java2d.windows.GDIWindowSurfaceData
;
class
D3DBlitLoops
{
final
class
D3DBlitLoops
{
static
void
register
()
{
Blit
blitIntArgbPreToSurface
=
...
...
@@ -57,7 +57,9 @@ class D3DBlitLoops {
Blit
blitIntArgbPreToTexture
=
new
D3DSwToTextureBlit
(
SurfaceType
.
IntArgbPre
,
D3DSurfaceData
.
ST_INT_ARGB_PRE
);
TransformBlit
transformBlitIntArgbPreToSurface
=
new
D3DSwToSurfaceTransform
(
SurfaceType
.
IntArgbPre
,
D3DSurfaceData
.
ST_INT_ARGB_PRE
);
GraphicsPrimitive
[]
primitives
=
{
// prevent D3DSurface -> Screen blits
new
D3DSurfaceToGDIWindowSurfaceBlit
(),
...
...
@@ -123,8 +125,6 @@ class D3DBlitLoops {
new
D3DSwToSurfaceTransform
(
SurfaceType
.
IntArgb
,
D3DSurfaceData
.
ST_INT_ARGB
),
new
D3DSwToSurfaceTransform
(
SurfaceType
.
IntArgbPre
,
D3DSurfaceData
.
ST_INT_ARGB_PRE
),
new
D3DSwToSurfaceTransform
(
SurfaceType
.
IntRgb
,
D3DSurfaceData
.
ST_INT_RGB
),
new
D3DSwToSurfaceTransform
(
SurfaceType
.
IntBgr
,
...
...
@@ -140,6 +140,9 @@ class D3DBlitLoops {
// REMIND: we don't have a native sw loop to back this loop up
// new D3DSwToSurfaceTransform(SurfaceType.ByteIndexedBm,
// D3DSurfaceData.ST_BYTE_INDEXED_BM),
transformBlitIntArgbPreToSurface
,
new
D3DGeneralTransformedBlit
(
transformBlitIntArgbPreToSurface
),
// texture->surface ops
new
D3DTextureToSurfaceBlit
(),
...
...
@@ -712,11 +715,11 @@ class D3DTextureToSurfaceTransform extends TransformBlit {
* This general Blit implementation converts any source surface to an
* intermediate IntArgbPre surface, and then uses the more specific
* IntArgbPre->D3DSurface/Texture loop to get the intermediate
* (premultiplied) surface down to D3D.
* (premultiplied) surface down to D3D
using simple blit
.
*/
class
D3DGeneralBlit
extends
Blit
{
private
Blit
performop
;
private
final
Blit
performop
;
private
WeakReference
srcTmp
;
D3DGeneralBlit
(
SurfaceType
dstType
,
...
...
@@ -757,6 +760,49 @@ class D3DGeneralBlit extends Blit {
}
}
/**
* This general TransformedBlit implementation converts any source surface to an
* intermediate IntArgbPre surface, and then uses the more specific
* IntArgbPre->D3DSurface/Texture loop to get the intermediate
* (premultiplied) surface down to D3D using simple transformBlit.
*/
final
class
D3DGeneralTransformedBlit
extends
TransformBlit
{
private
final
TransformBlit
performop
;
private
WeakReference
<
SurfaceData
>
srcTmp
;
D3DGeneralTransformedBlit
(
final
TransformBlit
performop
)
{
super
(
SurfaceType
.
Any
,
CompositeType
.
AnyAlpha
,
D3DSurfaceData
.
D3DSurface
);
this
.
performop
=
performop
;
}
@Override
public
synchronized
void
Transform
(
SurfaceData
src
,
SurfaceData
dst
,
Composite
comp
,
Region
clip
,
AffineTransform
at
,
int
hint
,
int
srcx
,
int
srcy
,
int
dstx
,
int
dsty
,
int
width
,
int
height
){
Blit
convertsrc
=
Blit
.
getFromCache
(
src
.
getSurfaceType
(),
CompositeType
.
SrcNoEa
,
SurfaceType
.
IntArgbPre
);
// use cached intermediate surface, if available
final
SurfaceData
cachedSrc
=
srcTmp
!=
null
?
srcTmp
.
get
()
:
null
;
// convert source to IntArgbPre
src
=
convertFrom
(
convertsrc
,
src
,
srcx
,
srcy
,
width
,
height
,
cachedSrc
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
// transform IntArgbPre intermediate surface to D3D surface
performop
.
Transform
(
src
,
dst
,
comp
,
clip
,
at
,
hint
,
0
,
0
,
dstx
,
dsty
,
width
,
height
);
if
(
src
!=
cachedSrc
)
{
// cache the intermediate surface
srcTmp
=
new
WeakReference
<>(
src
);
}
}
}
/*
* The following classes prohibit copying D3DSurfaces to the screen
* (the D3D->sysmem->GDI path is known to be very very slow).
...
...
test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java
0 → 100644
浏览文件 @
e8577fea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.datatransfer.DataFlavor
;
import
java.awt.datatransfer.SystemFlavorMap
;
import
java.util.List
;
/*
@test
@bug 4512530 8027148
@summary tests that mappings for text flavors are generated properly
@author das@sparc.spb.su area=datatransfer
*/
public
class
MappingGenerationTest
{
private
static
final
SystemFlavorMap
fm
=
(
SystemFlavorMap
)
SystemFlavorMap
.
getDefaultFlavorMap
();
public
static
void
main
(
String
[]
args
)
{
test1
();
test2
();
test3
();
test4
();
test5
();
test6
();
}
/**
* Verifies that Lists returned from getNativesForFlavor() and
* getFlavorsForNative() are not modified with a subsequent call
* to addUnencodedNativeForFlavor() and addFlavorForUnencodedNative()
* respectively.
*/
public
static
void
test1
()
{
DataFlavor
df
=
new
DataFlavor
(
"text/plain-test1"
,
null
);
String
nat
=
"native1"
;
List
<
String
>
natives
=
fm
.
getNativesForFlavor
(
df
);
fm
.
addUnencodedNativeForFlavor
(
df
,
nat
);
List
<
String
>
nativesNew
=
fm
.
getNativesForFlavor
(
df
);
if
(
natives
.
equals
(
nativesNew
))
{
System
.
err
.
println
(
"orig="
+
natives
);
System
.
err
.
println
(
"new="
+
nativesNew
);
throw
new
RuntimeException
(
"Test failed"
);
}
List
<
DataFlavor
>
flavors
=
fm
.
getFlavorsForNative
(
nat
);
fm
.
addFlavorForUnencodedNative
(
nat
,
df
);
List
<
DataFlavor
>
flavorsNew
=
fm
.
getFlavorsForNative
(
nat
);
if
(
flavors
.
equals
(
flavorsNew
))
{
System
.
err
.
println
(
"orig="
+
flavors
);
System
.
err
.
println
(
"new="
+
flavorsNew
);
throw
new
RuntimeException
(
"Test failed"
);
}
}
/**
* Verifies that SystemFlavorMap is not affected by modification of
* the Lists returned from getNativesForFlavor() and
* getFlavorsForNative().
*/
public
static
void
test2
()
{
DataFlavor
df
=
new
DataFlavor
(
"text/plain-test2"
,
null
);
String
nat
=
"native2"
;
DataFlavor
extraDf
=
new
DataFlavor
(
"text/test"
,
null
);
List
<
String
>
natives
=
fm
.
getNativesForFlavor
(
df
);
natives
.
add
(
"Should not be here"
);
java
.
util
.
List
nativesNew
=
fm
.
getNativesForFlavor
(
df
);
if
(
natives
.
equals
(
nativesNew
))
{
System
.
err
.
println
(
"orig="
+
natives
);
System
.
err
.
println
(
"new="
+
nativesNew
);
throw
new
RuntimeException
(
"Test failed"
);
}
List
<
DataFlavor
>
flavors
=
fm
.
getFlavorsForNative
(
nat
);
flavors
.
add
(
extraDf
);
java
.
util
.
List
flavorsNew
=
fm
.
getFlavorsForNative
(
nat
);
if
(
flavors
.
equals
(
flavorsNew
))
{
System
.
err
.
println
(
"orig="
+
flavors
);
System
.
err
.
println
(
"new="
+
flavorsNew
);
throw
new
RuntimeException
(
"Test failed"
);
}
}
/**
* Verifies that addUnencodedNativeForFlavor() for a particular text flavor
* doesn't affect mappings for other flavors.
*/
public
static
void
test3
()
{
DataFlavor
df1
=
new
DataFlavor
(
"text/plain-test3"
,
null
);
DataFlavor
df2
=
new
DataFlavor
(
"text/plain-test3; charset=Unicode; class=java.io.Reader"
,
null
);
String
nat
=
"native3"
;
List
<
String
>
natives
=
fm
.
getNativesForFlavor
(
df2
);
fm
.
addUnencodedNativeForFlavor
(
df1
,
nat
);
List
<
String
>
nativesNew
=
fm
.
getNativesForFlavor
(
df2
);
if
(!
natives
.
equals
(
nativesNew
))
{
System
.
err
.
println
(
"orig="
+
natives
);
System
.
err
.
println
(
"new="
+
nativesNew
);
throw
new
RuntimeException
(
"Test failed"
);
}
}
/**
* Verifies that addUnencodedNativeForFlavor() really adds the specified
* flavor-to-native mapping to the existing mappings.
*/
public
static
void
test4
()
{
DataFlavor
df
=
new
DataFlavor
(
"text/plain-test4; charset=Unicode; class=java.io.Reader"
,
null
);
String
nat
=
"native4"
;
List
<
String
>
natives
=
fm
.
getNativesForFlavor
(
df
);
if
(!
natives
.
contains
(
nat
))
{
fm
.
addUnencodedNativeForFlavor
(
df
,
nat
);
List
<
String
>
nativesNew
=
fm
.
getNativesForFlavor
(
df
);
natives
.
add
(
nat
);
if
(!
natives
.
equals
(
nativesNew
))
{
System
.
err
.
println
(
"orig="
+
natives
);
System
.
err
.
println
(
"new="
+
nativesNew
);
throw
new
RuntimeException
(
"Test failed"
);
}
}
}
/**
* Verifies that a flavor doesn't have any flavor-to-native mappings after
* a call to setNativesForFlavor() with this flavor and an empty native
* array as arguments.
*/
public
static
void
test5
()
{
final
DataFlavor
flavor
=
new
DataFlavor
(
"text/plain-TEST5; charset=Unicode"
,
null
);
fm
.
getNativesForFlavor
(
flavor
);
fm
.
setNativesForFlavor
(
flavor
,
new
String
[
0
]);
List
<
String
>
natives
=
fm
.
getNativesForFlavor
(
flavor
);
if
(!
natives
.
isEmpty
())
{
System
.
err
.
println
(
"natives="
+
natives
);
throw
new
RuntimeException
(
"Test failed"
);
}
}
/**
* Verifies that a native doesn't have any native-to-flavor mappings after
* a call to setFlavorsForNative() with this native and an empty flavor
* array as arguments.
*/
public
static
void
test6
()
{
final
String
nat
=
"STRING"
;
fm
.
getFlavorsForNative
(
nat
);
fm
.
setFlavorsForNative
(
nat
,
new
DataFlavor
[
0
]);
List
<
DataFlavor
>
flavors
=
fm
.
getFlavorsForNative
(
nat
);
if
(!
flavors
.
isEmpty
())
{
System
.
err
.
println
(
"flavors="
+
flavors
);
throw
new
RuntimeException
(
"Test failed"
);
}
}
}
test/java/awt/image/DrawImage/IncorrectAlphaConversionBicubic.java
0 → 100644
浏览文件 @
e8577fea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.AlphaComposite
;
import
java.awt.Color
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.RenderingHints
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.DataBufferByte
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.DataBufferShort
;
import
java.awt.image.VolatileImage
;
import
static
java
.
awt
.
Transparency
.
TRANSLUCENT
;
/**
* @test
* @bug 8062164
* @summary We should get correct alpha, when we draw to/from VolatileImage and
* bicubic interpolation is enabled
* @author Sergey Bylokhov
*/
public
final
class
IncorrectAlphaConversionBicubic
{
private
static
final
Color
RGB
=
new
Color
(
200
,
255
,
7
,
123
);
private
static
final
int
SIZE
=
100
;
public
static
void
main
(
final
String
[]
args
)
{
final
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
final
GraphicsDevice
gd
=
ge
.
getDefaultScreenDevice
();
final
GraphicsConfiguration
gc
=
gd
.
getDefaultConfiguration
();
final
VolatileImage
vi
=
gc
.
createCompatibleVolatileImage
(
SIZE
,
SIZE
,
TRANSLUCENT
);
final
BufferedImage
bi
=
makeUnmanagedBI
(
gc
,
TRANSLUCENT
);
final
int
expected
=
bi
.
getRGB
(
2
,
2
);
int
attempt
=
0
;
BufferedImage
snapshot
;
while
(
true
)
{
if
(++
attempt
>
10
)
{
throw
new
RuntimeException
(
"Too many attempts: "
+
attempt
);
}
vi
.
validate
(
gc
);
final
Graphics2D
g2d
=
vi
.
createGraphics
();
g2d
.
setComposite
(
AlphaComposite
.
Src
);
g2d
.
scale
(
2
,
2
);
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_INTERPOLATION
,
RenderingHints
.
VALUE_INTERPOLATION_BICUBIC
);
g2d
.
drawImage
(
bi
,
0
,
0
,
null
);
g2d
.
dispose
();
snapshot
=
vi
.
getSnapshot
();
if
(
vi
.
contentsLost
())
{
continue
;
}
break
;
}
final
int
actual
=
snapshot
.
getRGB
(
2
,
2
);
if
(
actual
!=
expected
)
{
System
.
err
.
println
(
"Actual: "
+
Integer
.
toHexString
(
actual
));
System
.
err
.
println
(
"Expected: "
+
Integer
.
toHexString
(
expected
));
throw
new
RuntimeException
(
"Test failed"
);
}
}
private
static
BufferedImage
makeUnmanagedBI
(
GraphicsConfiguration
gc
,
int
type
)
{
BufferedImage
img
=
gc
.
createCompatibleImage
(
SIZE
,
SIZE
,
type
);
Graphics2D
g2d
=
img
.
createGraphics
();
g2d
.
setColor
(
RGB
);
g2d
.
fillRect
(
0
,
0
,
SIZE
,
SIZE
);
g2d
.
dispose
();
final
DataBuffer
db
=
img
.
getRaster
().
getDataBuffer
();
if
(
db
instanceof
DataBufferInt
)
{
((
DataBufferInt
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferShort
)
{
((
DataBufferShort
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferByte
)
{
((
DataBufferByte
)
db
).
getData
();
}
else
{
try
{
img
.
setAccelerationPriority
(
0.0f
);
}
catch
(
final
Throwable
ignored
)
{
}
}
return
img
;
}
}
test/java/awt/image/DrawImage/IncorrectClipXorModeSW2Surface.java
0 → 100644
浏览文件 @
e8577fea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.Color
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Image
;
import
java.awt.Rectangle
;
import
java.awt.Shape
;
import
java.awt.geom.AffineTransform
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.DataBufferByte
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.DataBufferShort
;
import
java.awt.image.VolatileImage
;
import
java.io.File
;
import
java.io.IOException
;
import
javax.imageio.ImageIO
;
import
static
java
.
awt
.
geom
.
Rectangle2D
.
Double
;
/**
* @test
* @bug 8061456
* @summary Tests drawing BI to volatile image using different clips + xor mode.
* Results of the blit BI to compatibleImage is used for comparison.
* @author Sergey Bylokhov
*/
public
final
class
IncorrectClipXorModeSW2Surface
{
private
static
int
[]
SIZES
=
{
2
,
10
,
100
};
private
static
final
Shape
[]
SHAPES
=
{
new
Rectangle
(
0
,
0
,
0
,
0
),
new
Rectangle
(
0
,
0
,
1
,
1
),
new
Rectangle
(
0
,
1
,
1
,
1
),
new
Rectangle
(
1
,
0
,
1
,
1
),
new
Rectangle
(
1
,
1
,
1
,
1
),
new
Double
(
0
,
0
,
0.5
,
0.5
),
new
Double
(
0
,
0.5
,
0.5
,
0.5
),
new
Double
(
0.5
,
0
,
0.5
,
0.5
),
new
Double
(
0.5
,
0.5
,
0.5
,
0.5
),
new
Double
(
0.25
,
0.25
,
0.5
,
0.5
),
new
Double
(
0
,
0.25
,
1
,
0.5
),
new
Double
(
0.25
,
0
,
0.5
,
1
),
new
Double
(.
10
,
.
10
,
.
20
,
.
20
),
new
Double
(.
75
,
.
75
,
.
20
,
.
20
),
new
Double
(.
75
,
.
10
,
.
20
,
.
20
),
new
Double
(.
10
,
.
75
,
.
20
,
.
20
),
};
public
static
void
main
(
final
String
[]
args
)
throws
IOException
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsConfiguration
gc
=
ge
.
getDefaultScreenDevice
()
.
getDefaultConfiguration
();
AffineTransform
at
;
for
(
int
size
:
SIZES
)
{
at
=
AffineTransform
.
getScaleInstance
(
size
,
size
);
for
(
Shape
clip
:
SHAPES
)
{
clip
=
at
.
createTransformedShape
(
clip
);
for
(
Shape
to
:
SHAPES
)
{
to
=
at
.
createTransformedShape
(
to
);
// Prepare test images
BufferedImage
snapshot
;
BufferedImage
bi
=
getBufferedImage
(
size
);
VolatileImage
vi
=
getVolatileImage
(
gc
,
size
);
while
(
true
)
{
vi
.
validate
(
gc
);
Graphics2D
g2d
=
vi
.
createGraphics
();
g2d
.
setColor
(
Color
.
GREEN
);
g2d
.
fillRect
(
0
,
0
,
size
,
size
);
g2d
.
dispose
();
if
(
vi
.
validate
(
gc
)
!=
VolatileImage
.
IMAGE_OK
)
{
continue
;
}
draw
(
clip
,
to
,
bi
,
vi
);
snapshot
=
vi
.
getSnapshot
();
if
(
vi
.
contentsLost
())
{
continue
;
}
break
;
}
// Prepare gold images
BufferedImage
goldvi
=
getCompatibleImage
(
gc
,
size
);
BufferedImage
goldbi
=
getBufferedImage
(
size
);
draw
(
clip
,
to
,
goldbi
,
goldvi
);
validate
(
snapshot
,
goldvi
);
vi
.
flush
();
}
}
}
}
private
static
void
draw
(
Shape
clip
,
Shape
shape
,
Image
from
,
Image
to
)
{
Graphics2D
g2d
=
(
Graphics2D
)
to
.
getGraphics
();
g2d
.
setXORMode
(
Color
.
BLACK
);
g2d
.
setClip
(
clip
);
Rectangle
toBounds
=
shape
.
getBounds
();
g2d
.
drawImage
(
from
,
toBounds
.
x
,
toBounds
.
y
,
toBounds
.
width
,
toBounds
.
height
,
null
);
g2d
.
dispose
();
}
private
static
BufferedImage
getBufferedImage
(
int
sw
)
{
final
BufferedImage
bi
=
new
BufferedImage
(
sw
,
sw
,
BufferedImage
.
TYPE_INT_ARGB
);
Graphics2D
g2d
=
bi
.
createGraphics
();
g2d
.
setColor
(
Color
.
RED
);
g2d
.
fillRect
(
0
,
0
,
sw
,
sw
);
g2d
.
dispose
();
final
DataBuffer
db
=
bi
.
getRaster
().
getDataBuffer
();
if
(
db
instanceof
DataBufferInt
)
{
((
DataBufferInt
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferShort
)
{
((
DataBufferShort
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferByte
)
{
((
DataBufferByte
)
db
).
getData
();
}
else
{
try
{
bi
.
setAccelerationPriority
(
0.0f
);
}
catch
(
final
Throwable
ignored
)
{
}
}
return
bi
;
}
private
static
VolatileImage
getVolatileImage
(
GraphicsConfiguration
gc
,
int
size
)
{
return
gc
.
createCompatibleVolatileImage
(
size
,
size
);
}
private
static
BufferedImage
getCompatibleImage
(
GraphicsConfiguration
gc
,
int
size
)
{
BufferedImage
image
=
gc
.
createCompatibleImage
(
size
,
size
);
Graphics2D
g2d
=
image
.
createGraphics
();
g2d
.
setColor
(
Color
.
GREEN
);
g2d
.
fillRect
(
0
,
0
,
size
,
size
);
g2d
.
dispose
();
return
image
;
}
private
static
void
validate
(
BufferedImage
bi
,
BufferedImage
goldbi
)
throws
IOException
{
for
(
int
x
=
0
;
x
<
bi
.
getWidth
();
++
x
)
{
for
(
int
y
=
0
;
y
<
bi
.
getHeight
();
++
y
)
{
if
(
goldbi
.
getRGB
(
x
,
y
)
!=
bi
.
getRGB
(
x
,
y
))
{
ImageIO
.
write
(
bi
,
"png"
,
new
File
(
"actual.png"
));
ImageIO
.
write
(
goldbi
,
"png"
,
new
File
(
"expected.png"
));
throw
new
RuntimeException
(
"Test failed."
);
}
}
}
}
}
test/java/awt/image/DrawImage/IncorrectUnmanagedImageSourceOffset.java
0 → 100644
浏览文件 @
e8577fea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.AlphaComposite
;
import
java.awt.Color
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Image
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.DataBufferByte
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.DataBufferShort
;
import
java.awt.image.VolatileImage
;
import
java.io.File
;
import
java.io.IOException
;
import
javax.imageio.ImageIO
;
import
static
java
.
awt
.
Transparency
.*;
import
static
java
.
awt
.
image
.
BufferedImage
.*;
/**
* @test
* @bug 8029253
* @summary Tests asymmetric source offsets when unmanaged image is drawn to VI.
* Results of the blit to compatibleImage are used for comparison.
* @author Sergey Bylokhov
*/
public
final
class
IncorrectUnmanagedImageSourceOffset
{
private
static
final
int
[]
TYPES
=
{
TYPE_INT_RGB
,
TYPE_INT_ARGB
,
TYPE_INT_ARGB_PRE
,
TYPE_INT_BGR
,
TYPE_3BYTE_BGR
,
TYPE_4BYTE_ABGR
,
TYPE_4BYTE_ABGR_PRE
,
/*TYPE_USHORT_565_RGB,
TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY,
TYPE_USHORT_GRAY,*/
TYPE_BYTE_BINARY
,
TYPE_BYTE_INDEXED
};
private
static
final
int
[]
TRANSPARENCIES
=
{
OPAQUE
,
BITMASK
,
TRANSLUCENT
};
public
static
void
main
(
final
String
[]
args
)
throws
IOException
{
for
(
final
int
viType
:
TRANSPARENCIES
)
{
for
(
final
int
biType
:
TYPES
)
{
BufferedImage
bi
=
makeUnmanagedBI
(
biType
);
fill
(
bi
);
test
(
bi
,
viType
);
}
}
}
private
static
void
test
(
BufferedImage
bi
,
int
type
)
throws
IOException
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsConfiguration
gc
=
ge
.
getDefaultScreenDevice
()
.
getDefaultConfiguration
();
VolatileImage
vi
=
gc
.
createCompatibleVolatileImage
(
511
,
255
,
type
);
BufferedImage
gold
=
gc
.
createCompatibleImage
(
511
,
255
,
type
);
// draw to compatible Image
Graphics2D
big
=
gold
.
createGraphics
();
// force scaled blit
big
.
drawImage
(
bi
,
7
,
11
,
127
,
111
,
7
,
11
,
127
*
2
,
111
,
null
);
big
.
dispose
();
// draw to volatile image
BufferedImage
snapshot
;
while
(
true
)
{
vi
.
validate
(
gc
);
if
(
vi
.
validate
(
gc
)
!=
VolatileImage
.
IMAGE_OK
)
{
try
{
Thread
.
sleep
(
100
);
}
catch
(
final
InterruptedException
ignored
)
{
}
continue
;
}
Graphics2D
vig
=
vi
.
createGraphics
();
// force scaled blit
vig
.
drawImage
(
bi
,
7
,
11
,
127
,
111
,
7
,
11
,
127
*
2
,
111
,
null
);
vig
.
dispose
();
snapshot
=
vi
.
getSnapshot
();
if
(
vi
.
contentsLost
())
{
try
{
Thread
.
sleep
(
100
);
}
catch
(
final
InterruptedException
ignored
)
{
}
continue
;
}
break
;
}
// validate images
for
(
int
x
=
7
;
x
<
127
;
++
x
)
{
for
(
int
y
=
11
;
y
<
111
;
++
y
)
{
if
(
gold
.
getRGB
(
x
,
y
)
!=
snapshot
.
getRGB
(
x
,
y
))
{
ImageIO
.
write
(
gold
,
"png"
,
new
File
(
"gold.png"
));
ImageIO
.
write
(
snapshot
,
"png"
,
new
File
(
"bi.png"
));
throw
new
RuntimeException
(
"Test failed."
);
}
}
}
}
private
static
BufferedImage
makeUnmanagedBI
(
final
int
type
)
{
final
BufferedImage
bi
=
new
BufferedImage
(
511
,
255
,
type
);
final
DataBuffer
db
=
bi
.
getRaster
().
getDataBuffer
();
if
(
db
instanceof
DataBufferInt
)
{
((
DataBufferInt
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferShort
)
{
((
DataBufferShort
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferByte
)
{
((
DataBufferByte
)
db
).
getData
();
}
else
{
try
{
bi
.
setAccelerationPriority
(
0.0f
);
}
catch
(
final
Throwable
ignored
)
{
}
}
return
bi
;
}
private
static
void
fill
(
final
Image
image
)
{
final
Graphics2D
graphics
=
(
Graphics2D
)
image
.
getGraphics
();
graphics
.
setComposite
(
AlphaComposite
.
Src
);
for
(
int
i
=
0
;
i
<
image
.
getHeight
(
null
);
++
i
)
{
graphics
.
setColor
(
new
Color
(
i
,
0
,
0
));
graphics
.
fillRect
(
0
,
i
,
image
.
getWidth
(
null
),
1
);
}
graphics
.
dispose
();
}
}
test/java/awt/image/DrawImage/UnmanagedDrawImagePerformance.java
0 → 100644
浏览文件 @
e8577fea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.AlphaComposite
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Image
;
import
java.awt.Polygon
;
import
java.awt.geom.AffineTransform
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.DataBufferByte
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.DataBufferShort
;
import
java.awt.image.VolatileImage
;
import
static
java
.
awt
.
Transparency
.*;
import
static
java
.
awt
.
image
.
BufferedImage
.*;
/*
* @test
* @bug 8029253 8059941
* @summary Unmanaged images should be drawn fast.
* @author Sergey Bylokhov
*/
public
final
class
UnmanagedDrawImagePerformance
{
private
static
final
int
[]
TYPES
=
{
TYPE_INT_RGB
,
TYPE_INT_ARGB
,
TYPE_INT_ARGB_PRE
,
TYPE_INT_BGR
,
TYPE_3BYTE_BGR
,
TYPE_4BYTE_ABGR
,
TYPE_4BYTE_ABGR_PRE
,
TYPE_USHORT_565_RGB
,
TYPE_USHORT_555_RGB
,
TYPE_BYTE_GRAY
,
TYPE_USHORT_GRAY
,
TYPE_BYTE_BINARY
,
TYPE_BYTE_INDEXED
};
private
static
final
int
[]
TRANSPARENCIES
=
{
OPAQUE
,
BITMASK
,
TRANSLUCENT
};
private
static
final
int
SIZE
=
1000
;
private
static
final
AffineTransform
[]
TRANSFORMS
=
{
AffineTransform
.
getScaleInstance
(.
5
,
.
5
),
AffineTransform
.
getScaleInstance
(
1
,
1
),
AffineTransform
.
getScaleInstance
(
2
,
2
),
AffineTransform
.
getShearInstance
(
7
,
11
)};
public
static
void
main
(
final
String
[]
args
)
{
for
(
final
AffineTransform
atfm
:
TRANSFORMS
)
{
for
(
final
int
viType
:
TRANSPARENCIES
)
{
for
(
final
int
biType
:
TYPES
)
{
final
BufferedImage
bi
=
makeUnmanagedBI
(
biType
);
final
VolatileImage
vi
=
makeVI
(
viType
);
final
long
time
=
test
(
bi
,
vi
,
atfm
)
/
1000000000
;
if
(
time
>
1
)
{
throw
new
RuntimeException
(
String
.
format
(
"drawImage is slow: %d seconds"
,
time
));
}
}
}
}
}
private
static
long
test
(
Image
bi
,
Image
vi
,
AffineTransform
atfm
)
{
final
Polygon
p
=
new
Polygon
();
p
.
addPoint
(
0
,
0
);
p
.
addPoint
(
SIZE
,
0
);
p
.
addPoint
(
0
,
SIZE
);
p
.
addPoint
(
SIZE
,
SIZE
);
p
.
addPoint
(
0
,
0
);
Graphics2D
g2d
=
(
Graphics2D
)
vi
.
getGraphics
();
g2d
.
clip
(
p
);
g2d
.
transform
(
atfm
);
g2d
.
setComposite
(
AlphaComposite
.
SrcOver
);
final
long
start
=
System
.
nanoTime
();
g2d
.
drawImage
(
bi
,
0
,
0
,
null
);
final
long
time
=
System
.
nanoTime
()
-
start
;
g2d
.
dispose
();
return
time
;
}
private
static
VolatileImage
makeVI
(
final
int
type
)
{
final
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
final
GraphicsDevice
gd
=
ge
.
getDefaultScreenDevice
();
final
GraphicsConfiguration
gc
=
gd
.
getDefaultConfiguration
();
return
gc
.
createCompatibleVolatileImage
(
SIZE
,
SIZE
,
type
);
}
private
static
BufferedImage
makeUnmanagedBI
(
final
int
type
)
{
final
BufferedImage
img
=
new
BufferedImage
(
SIZE
,
SIZE
,
type
);
final
DataBuffer
db
=
img
.
getRaster
().
getDataBuffer
();
if
(
db
instanceof
DataBufferInt
)
{
((
DataBufferInt
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferShort
)
{
((
DataBufferShort
)
db
).
getData
();
}
else
if
(
db
instanceof
DataBufferByte
)
{
((
DataBufferByte
)
db
).
getData
();
}
else
{
try
{
img
.
setAccelerationPriority
(
0.0f
);
}
catch
(
final
Throwable
ignored
)
{
}
}
return
img
;
}
}
test/java/lang/instrument/DaemonThread/TestDaemonThread.java
浏览文件 @
e8577fea
...
...
@@ -28,7 +28,7 @@
*
* @build jdk.testlibrary.* DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
* @run shell ../MakeJAR3.sh DummyAgent
* @run main
TestDaemonThreadLauncher /timeout=240
* @run main
/timeout=240 TestDaemonThreadLauncher
*
*/
import
java.io.File
;
...
...
test/javax/swing/DataTransfer/8059739/bug8059739.java
0 → 100644
浏览文件 @
e8577fea
/*
* Copyright (c) 2014, 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 8059739
@summary Dragged and Dropped data is corrupted for two data types
@author Anton Nashatyrev
*/
import
javax.swing.*
;
import
java.awt.datatransfer.Clipboard
;
import
java.awt.datatransfer.DataFlavor
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
public
class
bug8059739
{
private
static
boolean
passed
=
true
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
runTest
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
passed
=
false
;
}
}
});
if
(!
passed
)
{
throw
new
RuntimeException
(
"Test FAILED."
);
}
else
{
System
.
out
.
println
(
"Passed."
);
}
}
private
static
void
runTest
()
throws
Exception
{
String
testString
=
"my string"
;
JTextField
tf
=
new
JTextField
(
testString
);
tf
.
selectAll
();
Clipboard
clipboard
=
new
Clipboard
(
"clip"
);
tf
.
getTransferHandler
().
exportToClipboard
(
tf
,
clipboard
,
TransferHandler
.
COPY
);
DataFlavor
[]
dfs
=
clipboard
.
getAvailableDataFlavors
();
for
(
DataFlavor
df:
dfs
)
{
String
charset
=
df
.
getParameter
(
"charset"
);
if
(
InputStream
.
class
.
isAssignableFrom
(
df
.
getRepresentationClass
())
&&
charset
!=
null
)
{
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
(
InputStream
)
clipboard
.
getData
(
df
),
charset
));
String
s
=
br
.
readLine
();
System
.
out
.
println
(
"Content: '"
+
s
+
"'"
);
passed
&=
s
.
contains
(
testString
);
}
}
}
}
test/javax/swing/JComboBox/Consumed
EscTest/ConsumedEsc
Test.java
→
test/javax/swing/JComboBox/Consumed
KeyTest/ConsumedKey
Test.java
浏览文件 @
e8577fea
...
...
@@ -24,22 +24,28 @@
import
javax.swing.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.KeyEvent
;
import
java.awt.Robot
;
import
java.awt.Toolkit
;
import
java.awt.Robot
;
import
sun.awt.SunToolkit
;
/*
@test
@bug 8031485
@bug 8031485
8058193
@summary Combo box consuming escape and enter key events
@author Petr Pchelko
@run main Consumed
Esc
Test
@run main Consumed
Key
Test
*/
public
class
Consumed
Esc
Test
{
public
class
Consumed
Key
Test
{
private
static
volatile
JFrame
frame
;
private
static
volatile
boolean
passed
=
false
;
private
static
volatile
boolean
passed
;
public
static
void
main
(
String
...
args
)
throws
Exception
{
test
(
KeyEvent
.
VK_ESCAPE
);
test
(
KeyEvent
.
VK_ENTER
);
}
private
static
void
test
(
final
int
key
)
throws
Exception
{
passed
=
false
;
try
{
SwingUtilities
.
invokeAndWait
(()
->
{
frame
=
new
JFrame
();
...
...
@@ -48,7 +54,7 @@ public class ConsumedEscTest {
panel
.
add
(
combo
);
combo
.
requestFocusInWindow
();
frame
.
setBounds
(
100
,
150
,
300
,
100
);
addAction
(
panel
);
addAction
(
panel
,
key
);
frame
.
add
(
panel
);
frame
.
setVisible
(
true
);
});
...
...
@@ -56,24 +62,25 @@ public class ConsumedEscTest {
Robot
robot
=
new
Robot
();
robot
.
waitForIdle
();
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
robot
.
keyPress
(
KeyEvent
.
VK_ESCAPE
);
robot
.
keyPress
(
key
);
robot
.
waitForIdle
();
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
robot
.
keyRelease
(
KeyEvent
.
VK_ESCAPE
);
robot
.
keyRelease
(
key
);
robot
.
waitForIdle
();
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
if
(!
passed
)
{
throw
new
RuntimeException
(
"FAILED:
ESC
was consumed by combo box"
);
throw
new
RuntimeException
(
"FAILED:
"
+
KeyEvent
.
getKeyText
(
key
)
+
"
was consumed by combo box"
);
}
}
finally
{
if
(
frame
!=
null
)
{
frame
.
dispose
();
}
}
}
private
static
void
addAction
(
JComponent
comp
)
{
KeyStroke
k
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_ESCAPE
,
0
);
private
static
void
addAction
(
JComponent
comp
,
final
int
key
)
{
KeyStroke
k
=
KeyStroke
.
getKeyStroke
(
key
,
0
);
Object
actionKey
=
"cancel"
;
comp
.
getInputMap
(
JComponent
.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
).
put
(
k
,
actionKey
);
Action
cancelAction
=
new
AbstractAction
()
{
...
...
@@ -84,5 +91,4 @@ public class ConsumedEscTest {
};
comp
.
getActionMap
().
put
(
actionKey
,
cancelAction
);
}
}
test/sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java
浏览文件 @
e8577fea
/*
* Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
4
, 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
...
...
@@ -89,8 +89,13 @@ public class OnScreenRenderingResizeTest {
public
void
update
(
Graphics
g
)
{}
};
frame
.
setBackground
(
bgColor
);
frame
.
setUndecorated
(
true
);
frame
.
pack
();
frame
.
setSize
(
FRAME_W
,
FRAME_H
);
GraphicsConfiguration
gc
=
frame
.
getGraphicsConfiguration
();
Rectangle
gcBounds
=
gc
.
getBounds
();
frame
.
setBounds
(
gcBounds
.
width
/
4
,
gcBounds
.
height
/
4
,
FRAME_W
,
FRAME_H
);
frame
.
addWindowListener
(
new
WindowAdapter
()
{
public
void
windowClosing
(
WindowEvent
e
)
{
done
=
true
;
...
...
@@ -108,9 +113,8 @@ public class OnScreenRenderingResizeTest {
ex
.
printStackTrace
();
}
GraphicsConfiguration
gc
=
frame
.
getGraphicsConfiguration
();
int
maxW
=
gc
.
getBounds
().
width
/
2
;
int
maxH
=
gc
.
getBounds
().
height
/
2
;
int
maxW
=
gcBounds
.
width
/
2
;
int
maxH
=
gcBounds
.
height
/
2
;
int
minW
=
frame
.
getWidth
();
int
minH
=
frame
.
getHeight
();
int
incW
=
10
,
incH
=
10
,
cnt
=
0
;
...
...
@@ -155,6 +159,7 @@ public class OnScreenRenderingResizeTest {
Insets
in
=
frame
.
getInsets
();
frame
.
getGraphics
().
drawImage
(
output
,
in
.
left
,
in
.
top
,
null
);
if
(
cnt
==
90
&&
robot
!=
null
)
{
robot
.
waitForIdle
();
// area where we blitted to should be either white or green
Point
p
=
frame
.
getLocationOnScreen
();
p
.
translate
(
in
.
left
+
10
,
in
.
top
+
10
);
...
...
@@ -172,7 +177,7 @@ public class OnScreenRenderingResizeTest {
frame
.
getWidth
()-
in
.
left
-
in
.
right
,
frame
.
getHeight
()-
in
.
top
-
in
.
bottom
-
5
-
IMAGE_H
));
int
accepted2
[]
=
{
Color
.
white
.
getRGB
()
};
checkBI
(
bi
,
accepted
1
);
checkBI
(
bi
,
accepted
2
);
}
Thread
.
yield
();
...
...
test/sun/net/www/http/HttpClient/StreamingRetry.java
浏览文件 @
e8577fea
...
...
@@ -23,8 +23,8 @@
/*
* @test
* @bug 6672144
* @summary
HttpURLConnection.getInputStream sends POST request after failed chunked send
* @bug 6672144
8050983
* @summary
Do not retry failed request with a streaming body.
*/
import
java.net.HttpURLConnection
;
...
...
@@ -33,6 +33,7 @@ import java.net.URL;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
static
java
.
lang
.
System
.
out
;
public
class
StreamingRetry
implements
Runnable
{
static
final
int
ACCEPT_TIMEOUT
=
20
*
1000
;
// 20 seconds
...
...
@@ -43,11 +44,17 @@ public class StreamingRetry implements Runnable {
}
void
instanceMain
()
throws
IOException
{
test
();
out
.
println
(
"Test with default method"
);
test
(
null
);
out
.
println
(
"Test with POST method"
);
test
(
"POST"
);
out
.
println
(
"Test with PUT method"
);
test
(
"PUT"
);
if
(
failed
>
0
)
throw
new
RuntimeException
(
"Some tests failed"
);
}
void
test
()
throws
IOException
{
void
test
(
String
method
)
throws
IOException
{
ss
=
new
ServerSocket
(
0
);
ss
.
setSoTimeout
(
ACCEPT_TIMEOUT
);
int
port
=
ss
.
getLocalPort
();
...
...
@@ -58,6 +65,8 @@ public class StreamingRetry implements Runnable {
URL
url
=
new
URL
(
"http://localhost:"
+
port
+
"/"
);
HttpURLConnection
uc
=
(
HttpURLConnection
)
url
.
openConnection
();
uc
.
setDoOutput
(
true
);
if
(
method
!=
null
)
uc
.
setRequestMethod
(
method
);
uc
.
setChunkedStreamingMode
(
4096
);
OutputStream
os
=
uc
.
getOutputStream
();
os
.
write
(
"Hello there"
.
getBytes
());
...
...
@@ -79,7 +88,7 @@ public class StreamingRetry implements Runnable {
ss
.
close
();
fail
(
"The server shouldn't accept a second connection"
);
}
catch
(
IOException
e
)
{
//OK, the clien
will close the server socket if successful
l
//OK, the clien
t will close the server socket if successfu
l
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录