Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
09ba7191
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看板
提交
09ba7191
编写于
3月 30, 2015
作者:
A
alexsch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8075244: [macosx] The fix for JDK-8043869 should be reworked
Reviewed-by: prr, serb, ant
上级
ff0db1c6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
11 deletion
+69
-11
src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
+22
-8
test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
...reen/MultiResolutionSplash/MultiResolutionSplashTest.java
+47
-3
未找到文件。
src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
浏览文件 @
09ba7191
...
...
@@ -126,12 +126,30 @@ done:
return
buf
;
}
BOOL
isSWTRunning
()
{
char
envVar
[
80
];
// If this property is present we are running SWT
snprintf
(
envVar
,
sizeof
(
envVar
),
"JAVA_STARTED_ON_FIRST_THREAD_%d"
,
getpid
());
return
getenv
(
envVar
)
!=
NULL
;
}
char
*
SplashGetScaledImageName
(
const
char
*
jar
,
const
char
*
file
,
float
*
scaleFactor
)
{
NSAutoreleasePool
*
pool
=
[
NSAutoreleasePool
new
];
*
scaleFactor
=
1
;
if
(
isSWTRunning
()){
return
nil
;
}
NSAutoreleasePool
*
pool
=
[
NSAutoreleasePool
new
];
char
*
scaledFile
=
nil
;
float
screenScaleFactor
=
1
;
__block
float
screenScaleFactor
=
1
;
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
// initialize NSApplication and AWT stuff
[
NSApplicationAWT
sharedApplication
];
screenScaleFactor
=
[
SplashNSScreen
()
backingScaleFactor
];
}];
if
(
screenScaleFactor
>
1
)
{
NSString
*
fileName
=
[
NSString
stringWithUTF8String
:
file
];
...
...
@@ -176,12 +194,8 @@ SplashInitPlatform(Splash * splash) {
splash
->
screenFormat
.
byteOrder
=
1
?
BYTE_ORDER_LSBFIRST
:
BYTE_ORDER_MSBFIRST
;
splash
->
screenFormat
.
depthBytes
=
4
;
// If this property is present we are running SWT and should not start a runLoop
// Can't check if running SWT in webstart, so splash screen in webstart SWT
// applications is not supported
char
envVar
[
80
];
snprintf
(
envVar
,
sizeof
(
envVar
),
"JAVA_STARTED_ON_FIRST_THREAD_%d"
,
getpid
());
if
(
getenv
(
envVar
)
==
NULL
)
{
// If we are running SWT we should not start a runLoop
if
(
!
isSWTRunning
())
{
[
JNFRunLoop
performOnMainThreadWaiting
:
NO
withBlock
:
^
()
{
[
NSApplicationAWT
runAWTLoopWithApp
:[
NSApplicationAWT
sharedApplication
]];
}];
...
...
test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
浏览文件 @
09ba7191
...
...
@@ -23,21 +23,24 @@
import
java.awt.Color
;
import
java.awt.Dialog
;
import
java.awt.Frame
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Panel
;
import
java.awt.Rectangle
;
import
java.awt.Robot
;
import
java.awt.SplashScreen
;
import
java.awt.TextField
;
import
java.awt.Window
;
import
java.awt.event.KeyEvent
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
javax.imageio.ImageIO
;
import
sun.java2d.SunGraphics2D
;
/**
* test
* @bug 8043869
*
@
test
* @bug 8043869
8075244
* @author Alexander Scherbatiy
* @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
* support
...
...
@@ -45,6 +48,7 @@ import sun.java2d.SunGraphics2D;
* @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
* @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
* @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
* @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_FOCUS
*/
public
class
MultiResolutionSplashTest
{
...
...
@@ -69,6 +73,9 @@ public class MultiResolutionSplashTest {
int
index
=
Integer
.
parseInt
(
args
[
1
]);
testSplash
(
tests
[
index
]);
break
;
case
"TEST_FOCUS"
:
testFocus
();
break
;
default
:
throw
new
RuntimeException
(
"Unknown test: "
+
test
);
}
...
...
@@ -92,12 +99,49 @@ public class MultiResolutionSplashTest {
float
scaleFactor
=
getScaleFactor
();
Color
testColor
=
(
1
<
scaleFactor
)
?
test
.
color2x
:
test
.
color1x
;
if
(!
testColor
.
equals
(
splashScreenColor
))
{
if
(!
compare
(
testColor
,
splashScreenColor
))
{
throw
new
RuntimeException
(
"Image with wrong resolution is used for splash screen!"
);
}
}
static
void
testFocus
()
throws
Exception
{
System
.
out
.
println
(
"Focus Test!"
);
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
50
);
Frame
frame
=
new
Frame
();
frame
.
setSize
(
100
,
100
);
String
test
=
"123"
;
TextField
textField
=
new
TextField
(
test
);
frame
.
add
(
textField
);
frame
.
setVisible
(
true
);
robot
.
waitForIdle
();
robot
.
keyPress
(
KeyEvent
.
VK_A
);
robot
.
keyRelease
(
KeyEvent
.
VK_A
);
robot
.
keyPress
(
KeyEvent
.
VK_B
);
robot
.
keyRelease
(
KeyEvent
.
VK_B
);
robot
.
waitForIdle
();
frame
.
dispose
();
if
(!
textField
.
getText
().
equals
(
"ab"
)){
throw
new
RuntimeException
(
"Focus is lost!"
);
}
}
static
boolean
compare
(
Color
c1
,
Color
c2
){
return
compare
(
c1
.
getRed
(),
c2
.
getRed
())
&&
compare
(
c1
.
getGreen
(),
c2
.
getGreen
())
&&
compare
(
c1
.
getBlue
(),
c2
.
getBlue
());
}
static
boolean
compare
(
int
n
,
int
m
){
return
Math
.
abs
(
n
-
m
)
<=
50
;
}
static
float
getScaleFactor
()
{
final
Dialog
dialog
=
new
Dialog
((
Window
)
null
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录