Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d854411c
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看板
提交
d854411c
编写于
5月 25, 2012
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7146550: [macosx] DnD test failure in createCompatibleWritableRaster()
Reviewed-by: kizune, serb
上级
cd7322ee
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
56 addition
and
42 deletion
+56
-42
src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
...cosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
+11
-24
src/macosx/classes/sun/lwawt/macosx/CImage.java
src/macosx/classes/sun/lwawt/macosx/CImage.java
+32
-12
src/macosx/native/sun/awt/CDragSource.h
src/macosx/native/sun/awt/CDragSource.h
+1
-1
src/macosx/native/sun/awt/CDragSource.m
src/macosx/native/sun/awt/CDragSource.m
+10
-3
src/macosx/native/sun/awt/CDragSourceContextPeer.m
src/macosx/native/sun/awt/CDragSourceContextPeer.m
+1
-1
test/java/awt/dnd/ImageDecoratedDnDNegative/ImageDecoratedDnDNegative.java
.../ImageDecoratedDnDNegative/ImageDecoratedDnDNegative.java
+1
-1
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
浏览文件 @
d854411c
...
@@ -132,44 +132,31 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
...
@@ -132,44 +132,31 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
this
.
setDefaultDragImage
(
component
);
this
.
setDefaultDragImage
(
component
);
// Get drag image (if any) as BufferedImage and convert that to CImage:
// Get drag image (if any) as BufferedImage and convert that to CImage:
long
dragImage
;
Point
dragImageOffset
;
Point
dragImageOffset
;
if
(
fDragImage
!=
null
)
{
if
(
fDragImage
!=
null
)
{
BufferedImage
bi
=
(
fDragImage
instanceof
BufferedImage
?
(
BufferedImage
)
fDragImage
:
null
);
try
{
fDragCImage
=
CImage
.
getCreator
().
createFromImageImmediately
(
fDragImage
);
if
(
bi
==
null
)
{
}
catch
(
Exception
e
)
{
// Create a new buffered image:
// image creation may fail for any reason
int
width
=
fDragImage
.
getWidth
(
null
);
throw
new
InvalidDnDOperationException
(
"Drag image can not be created."
);
int
height
=
fDragImage
.
getHeight
(
null
);
bi
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
// Draw drag image into the buffered image:
Graphics
g
=
bi
.
getGraphics
();
g
.
drawImage
(
fDragImage
,
0
,
0
,
null
);
g
.
dispose
();
}
}
/* TODO:BG
if
(
fDragCImage
==
null
)
{
fDragCImage = CImage.getCreator().createImage(bi);
throw
new
InvalidDnDOperationException
(
"Drag image is not ready."
);
dragImage = fDragCImage.getNSImage(); */
}
fDragCImage
=
null
;
dragImage
=
0L
;
dragImageOffset
=
fDragImageOffset
;
dragImageOffset
=
fDragImageOffset
;
}
else
{
}
else
{
fDragCImage
=
null
;
fDragCImage
=
null
;
dragImage
=
0L
;
dragImageOffset
=
new
Point
(
0
,
0
);
dragImageOffset
=
new
Point
(
0
,
0
);
}
}
// Get NS drag image instance if we have a drag image:
long
nsDragImage
=
0L
;
//TODO:BG (fDragCImage != null ? fDragCImage.getNSImage() : 0L);
try
{
try
{
// Create native dragging source:
// Create native dragging source:
final
long
nativeDragSource
=
createNativeDragSource
(
component
,
peer
,
nativeWindowPtr
,
transferable
,
triggerEvent
,
final
long
nativeDragSource
=
createNativeDragSource
(
component
,
peer
,
nativeWindowPtr
,
transferable
,
triggerEvent
,
(
int
)
(
dragOrigin
.
getX
()
+
componentOffset
.
x
),
(
int
)
(
dragOrigin
.
getY
()
+
componentOffset
.
y
),
extModifiers
,
(
int
)
(
dragOrigin
.
getX
()
+
componentOffset
.
x
),
(
int
)
(
dragOrigin
.
getY
()
+
componentOffset
.
y
),
extModifiers
,
clickCount
,
timestamp
,
cursor
,
drag
Image
,
dragImageOffset
.
x
,
dragImageOffset
.
y
,
clickCount
,
timestamp
,
cursor
,
fDragC
Image
,
dragImageOffset
.
x
,
dragImageOffset
.
y
,
getDragSourceContext
().
getSourceActions
(),
formats
,
formatMap
);
getDragSourceContext
().
getSourceActions
(),
formats
,
formatMap
);
if
(
nativeDragSource
==
0
)
if
(
nativeDragSource
==
0
)
...
@@ -495,7 +482,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
...
@@ -495,7 +482,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
// Native support:
// Native support:
private
native
long
createNativeDragSource
(
Component
component
,
ComponentPeer
peer
,
long
nativePeer
,
Transferable
transferable
,
private
native
long
createNativeDragSource
(
Component
component
,
ComponentPeer
peer
,
long
nativePeer
,
Transferable
transferable
,
InputEvent
triggerEvent
,
int
dragPosX
,
int
dragPosY
,
int
extModifiers
,
int
clickCount
,
long
timestamp
,
InputEvent
triggerEvent
,
int
dragPosX
,
int
dragPosY
,
int
extModifiers
,
int
clickCount
,
long
timestamp
,
Cursor
cursor
,
long
nsDragImage
,
int
dragImageOffsetX
,
int
dragImageOffsetY
,
Cursor
cursor
,
CImage
nsDragImage
,
int
dragImageOffsetX
,
int
dragImageOffsetY
,
int
sourceActions
,
long
[]
formats
,
Map
formatMap
);
int
sourceActions
,
long
[]
formats
,
Map
formatMap
);
private
native
void
doDragging
(
long
nativeDragSource
);
private
native
void
doDragging
(
long
nativeDragSource
);
...
...
src/macosx/classes/sun/lwawt/macosx/CImage.java
浏览文件 @
d854411c
...
@@ -97,35 +97,55 @@ public class CImage extends CFRetainedResource {
...
@@ -97,35 +97,55 @@ public class CImage extends CFRetainedResource {
return
createImageUsingNativeSize
(
nativeCreateNSImageFromImageName
(
name
));
return
createImageUsingNativeSize
(
nativeCreateNSImageFromImageName
(
name
));
}
}
private
static
int
[]
imageToArray
(
Image
image
)
{
private
static
int
[]
imageToArray
(
Image
image
,
boolean
prepareImage
)
{
if
(
image
==
null
)
return
null
;
if
(
image
==
null
)
return
null
;
MediaTracker
mt
=
new
MediaTracker
(
new
Label
());
if
(
prepareImage
&&
!(
image
instanceof
BufferedImage
))
{
final
int
id
=
0
;
final
MediaTracker
mt
=
new
MediaTracker
(
new
Label
());
mt
.
addImage
(
image
,
id
);
final
int
id
=
0
;
mt
.
addImage
(
image
,
id
);
try
{
try
{
mt
.
waitForID
(
id
);
mt
.
waitForID
(
id
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
}
return
null
;
}
if
(
mt
.
isErrorID
(
id
))
{
if
(
mt
.
isErrorID
(
id
))
{
return
null
;
return
null
;
}
}
}
int
w
=
image
.
getWidth
(
null
);
int
w
=
image
.
getWidth
(
null
);
int
h
=
image
.
getHeight
(
null
);
int
h
=
image
.
getHeight
(
null
);
if
(
w
<
0
||
h
<
0
)
{
return
null
;
}
BufferedImage
bimg
=
new
BufferedImage
(
w
,
h
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
BufferedImage
bimg
=
new
BufferedImage
(
w
,
h
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
Graphics2D
g2
=
bimg
.
createGraphics
();
Graphics2D
g2
=
bimg
.
createGraphics
();
g2
.
setComposite
(
AlphaComposite
.
Src
);
g2
.
setComposite
(
AlphaComposite
.
Src
);
g2
.
drawImage
(
image
,
0
,
0
,
null
);
g2
.
drawImage
(
image
,
0
,
0
,
null
);
g2
.
dispose
();
g2
.
dispose
();
return
((
DataBufferInt
)
bimg
.
getRaster
().
getDataBuffer
()).
getData
();
return
((
DataBufferInt
)
bimg
.
getRaster
().
getDataBuffer
()).
getData
();
}
}
public
CImage
createFromImageImmediately
(
final
Image
image
)
{
int
[]
buffer
=
imageToArray
(
image
,
false
);
if
(
buffer
==
null
)
{
return
null
;
}
return
new
CImage
(
nativeCreateNSImageFromArray
(
buffer
,
image
.
getWidth
(
null
),
image
.
getHeight
(
null
)));
}
// This is used to create a CImage from a Image
// This is used to create a CImage from a Image
public
CImage
createFromImage
(
final
Image
image
)
{
public
CImage
createFromImage
(
final
Image
image
)
{
int
[]
buffer
=
imageToArray
(
image
);
int
[]
buffer
=
imageToArray
(
image
,
true
);
if
(
buffer
==
null
)
{
if
(
buffer
==
null
)
{
return
null
;
return
null
;
}
}
...
@@ -146,7 +166,7 @@ public class CImage extends CFRetainedResource {
...
@@ -146,7 +166,7 @@ public class CImage extends CFRetainedResource {
num
=
0
;
num
=
0
;
for
(
Image
img
:
images
)
{
for
(
Image
img
:
images
)
{
buffers
[
num
]
=
imageToArray
(
img
);
buffers
[
num
]
=
imageToArray
(
img
,
true
);
if
(
buffers
[
num
]
==
null
)
{
if
(
buffers
[
num
]
==
null
)
{
// Unable to process the image
// Unable to process the image
continue
;
continue
;
...
...
src/macosx/native/sun/awt/CDragSource.h
浏览文件 @
d854411c
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
transferable
:(
jobject
)
jtransferable
triggerEvent
:(
jobject
)
jtrigger
transferable
:(
jobject
)
jtransferable
triggerEvent
:(
jobject
)
jtrigger
dragPosX
:(
jint
)
dragPosX
dragPosY
:(
jint
)
dragPosY
modifiers
:(
jint
)
extModifiers
clickCount
:(
jint
)
clickCount
timeStamp
:(
jlong
)
timeStamp
dragPosX
:(
jint
)
dragPosX
dragPosY
:(
jint
)
dragPosY
modifiers
:(
jint
)
extModifiers
clickCount
:(
jint
)
clickCount
timeStamp
:(
jlong
)
timeStamp
cursor
:(
jobject
)
jcursor
cursor
:(
jobject
)
jcursor
dragImage
:(
j
long
)
jnsdragimage
dragImageOffsetX
:(
jint
)
jdragimageoffsetx
dragImageOffsetY
:(
jint
)
jdragimageoffsety
dragImage
:(
j
object
)
jnsdragimage
dragImageOffsetX
:(
jint
)
jdragimageoffsetx
dragImageOffsetY
:(
jint
)
jdragimageoffsety
sourceActions
:(
jint
)
jsourceactions
formats
:(
jlongArray
)
jformats
formatMap
:(
jobject
)
jformatmap
;
sourceActions
:(
jint
)
jsourceactions
formats
:(
jlongArray
)
jformats
formatMap
:(
jobject
)
jformatmap
;
-
(
void
)
removeFromView
:(
JNIEnv
*
)
env
;
-
(
void
)
removeFromView
:(
JNIEnv
*
)
env
;
...
...
src/macosx/native/sun/awt/CDragSource.m
浏览文件 @
d854411c
...
@@ -70,6 +70,7 @@ static BOOL sIsJavaDragging;
...
@@ -70,6 +70,7 @@ static BOOL sIsJavaDragging;
JNF_CLASS_CACHE
(
DataTransfererClass
,
"sun/awt/datatransfer/DataTransferer"
);
JNF_CLASS_CACHE
(
DataTransfererClass
,
"sun/awt/datatransfer/DataTransferer"
);
JNF_CLASS_CACHE
(
CDragSourceContextPeerClass
,
"sun/lwawt/macosx/CDragSourceContextPeer"
);
JNF_CLASS_CACHE
(
CDragSourceContextPeerClass
,
"sun/lwawt/macosx/CDragSourceContextPeer"
);
JNF_CLASS_CACHE
(
CImageClass
,
"sun/lwawt/macosx/CImage"
);
static
NSDragOperation
sDragOperation
;
static
NSDragOperation
sDragOperation
;
static
NSPoint
sDraggingLocation
;
static
NSPoint
sDraggingLocation
;
...
@@ -87,7 +88,7 @@ static BOOL sNeedsEnter;
...
@@ -87,7 +88,7 @@ static BOOL sNeedsEnter;
transferable
:(
jobject
)
jtransferable
triggerEvent
:(
jobject
)
jtrigger
transferable
:(
jobject
)
jtransferable
triggerEvent
:(
jobject
)
jtrigger
dragPosX
:(
jint
)
dragPosX
dragPosY
:(
jint
)
dragPosY
modifiers
:(
jint
)
extModifiers
clickCount
:(
jint
)
clickCount
dragPosX
:(
jint
)
dragPosX
dragPosY
:(
jint
)
dragPosY
modifiers
:(
jint
)
extModifiers
clickCount
:(
jint
)
clickCount
timeStamp
:(
jlong
)
timeStamp
cursor
:(
jobject
)
jcursor
timeStamp
:(
jlong
)
timeStamp
cursor
:(
jobject
)
jcursor
dragImage
:(
j
long
)
jnsdragimage
dragImageOffsetX
:(
jint
)
jdragimageoffsetx
dragImageOffsetY
:(
jint
)
jdragimageoffsety
dragImage
:(
j
object
)
jnsdragimage
dragImageOffsetX
:(
jint
)
jdragimageoffsetx
dragImageOffsetY
:(
jint
)
jdragimageoffsety
sourceActions
:(
jint
)
jsourceactions
formats
:(
jlongArray
)
jformats
formatMap
:(
jobject
)
jformatmap
sourceActions
:(
jint
)
jsourceactions
formats
:(
jlongArray
)
jformats
formatMap
:(
jobject
)
jformatmap
{
{
self
=
[
super
init
];
self
=
[
super
init
];
...
@@ -107,8 +108,14 @@ static BOOL sNeedsEnter;
...
@@ -107,8 +108,14 @@ static BOOL sNeedsEnter;
fTriggerEvent
=
JNFNewGlobalRef
(
env
,
jtrigger
);
fTriggerEvent
=
JNFNewGlobalRef
(
env
,
jtrigger
);
fCursor
=
JNFNewGlobalRef
(
env
,
jcursor
);
fCursor
=
JNFNewGlobalRef
(
env
,
jcursor
);
fDragImage
=
(
NSImage
*
)
jlong_to_ptr
(
jnsdragimage
);
// Double-casting prevents compiler 'different size' warning.
if
(
jnsdragimage
)
{
[
fDragImage
retain
];
JNF_MEMBER_CACHE
(
nsImagePtr
,
CImageClass
,
"ptr"
,
"J"
);
jlong
imgPtr
=
JNFGetLongField
(
env
,
jnsdragimage
,
nsImagePtr
);
fDragImage
=
(
NSImage
*
)
jlong_to_ptr
(
imgPtr
);
// Double-casting prevents compiler 'd$|//
[
fDragImage
retain
];
}
fDragImageOffset
=
NSMakePoint
(
jdragimageoffsetx
,
jdragimageoffsety
);
fDragImageOffset
=
NSMakePoint
(
jdragimageoffsetx
,
jdragimageoffsety
);
fSourceActions
=
jsourceactions
;
fSourceActions
=
jsourceactions
;
...
...
src/macosx/native/sun/awt/CDragSourceContextPeer.m
浏览文件 @
d854411c
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
(JNIEnv *env, jobject jthis, jobject jcomponent, jobject jpeer, jlong jnativepeer, jobject jtransferable,
(JNIEnv *env, jobject jthis, jobject jcomponent, jobject jpeer, jlong jnativepeer, jobject jtransferable,
jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
jobject jcursor, j
long
jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
jobject jcursor, j
object
jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
jint jsourceactions, jlongArray jformats, jobject jformatmap)
jint jsourceactions, jlongArray jformats, jobject jformatmap)
{
{
id controlObj = (id) jlong_to_ptr(jnativepeer);
id controlObj = (id) jlong_to_ptr(jnativepeer);
...
...
test/java/awt/dnd/ImageDecoratedDnDNegative/ImageDecoratedDnDNegative.java
浏览文件 @
d854411c
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
/*
/*
test %W% %E%
test %W% %E%
@bug 4874070
@bug 4874070
7146550
@summary Tests basic DnD functionality
@summary Tests basic DnD functionality
@author Your Name: Alexey Utkin area=dnd
@author Your Name: Alexey Utkin area=dnd
@run applet ImageDecoratedDnDNegative.html
@run applet ImageDecoratedDnDNegative.html
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录