Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9f1e818d
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看板
提交
9f1e818d
编写于
12月 16, 2019
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8213119: [macos] java/awt/GraphicsDevice/CheckDisplayModes.java fails
Reviewed-by: prr, jdv
上级
d0ae97c9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
26 deletion
+30
-26
src/macosx/native/sun/awt/CGraphicsDevice.m
src/macosx/native/sun/awt/CGraphicsDevice.m
+9
-6
test/java/awt/GraphicsDevice/CheckDisplayModes.java
test/java/awt/GraphicsDevice/CheckDisplayModes.java
+21
-20
未找到文件。
src/macosx/native/sun/awt/CGraphicsDevice.m
浏览文件 @
9f1e818d
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
9
, 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
...
...
@@ -94,16 +94,18 @@ static CFMutableArrayRef getAllValidDisplayModes(jint displayID){
static
CGDisplayModeRef
getBestModeForParameters
(
CFArrayRef
allModes
,
int
w
,
int
h
,
int
bpp
,
int
refrate
)
{
CGDisplayModeRef
bestGuess
=
NULL
;
CFIndex
numModes
=
CFArrayGetCount
(
allModes
),
n
;
int
thisBpp
=
0
;
for
(
n
=
0
;
n
<
numModes
;
n
++
)
{
CGDisplayModeRef
cRef
=
(
CGDisplayModeRef
)
CFArrayGetValueAtIndex
(
allModes
,
n
);
if
(
cRef
==
NULL
)
{
continue
;
}
CFStringRef
modeString
=
CGDisplayModeCopyPixelEncoding
(
cRef
);
thisBpp
=
getBPPFromModeString
(
modeString
);
int
thisBpp
=
getBPPFromModeString
(
modeString
);
CFRelease
(
modeString
);
if
(
thisBpp
!=
bpp
||
(
int
)
CGDisplayModeGetHeight
(
cRef
)
!=
h
||
(
int
)
CGDisplayModeGetWidth
(
cRef
)
!=
w
)
{
int
thisH
=
(
int
)
CGDisplayModeGetHeight
(
cRef
);
int
thisW
=
(
int
)
CGDisplayModeGetWidth
(
cRef
);
if
(
thisBpp
!=
bpp
||
thisH
!=
h
||
thisW
!=
w
)
{
// One of the key parameters does not match
continue
;
}
...
...
@@ -114,11 +116,12 @@ static CGDisplayModeRef getBestModeForParameters(CFArrayRef allModes, int w, int
// Refresh rate might be 0 in display mode and we ask for specific display rate
// but if we do not find exact match then 0 refresh rate might be just Ok
if
(
CGDisplayModeGetRefreshRate
(
cRef
)
==
refrate
)
{
int
thisRefrate
=
(
int
)
CGDisplayModeGetRefreshRate
(
cRef
);
if
(
thisRefrate
==
refrate
)
{
// Exact match
return
cRef
;
}
if
(
CGDisplayModeGetRefreshRate
(
cRef
)
==
0
)
{
if
(
thisRefrate
==
0
)
{
// Not exactly what was asked for, but may fit our needs if we don't find an exact match
bestGuess
=
cRef
;
}
...
...
test/java/awt/GraphicsDevice/CheckDisplayModes.java
浏览文件 @
9f1e818d
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2019,
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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 8007146
* @bug 8007146
8213119
* @summary [macosx] Setting a display mode crashes JDK under VNC
* @author Alexander Scherbatiy
* @run main CheckDisplayModes
...
...
@@ -36,27 +36,28 @@ public class CheckDisplayModes {
public
static
void
main
(
String
[]
args
)
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsDevice
graphicDevice
=
ge
.
getDefaultScreenDevice
();
if
(!
graphicDevice
.
isDisplayChangeSupported
())
{
System
.
err
.
println
(
"Display mode change is not supported on this host. Test is considered passed."
);
return
;
}
DisplayMode
defaultDisplayMode
=
graphicDevice
.
getDisplayMode
();
checkDisplayMode
(
defaultDisplayMode
);
graphicDevice
.
setDisplayMode
(
defaultDisplayMode
);
for
(
GraphicsDevice
graphicDevice
:
ge
.
getScreenDevices
())
{
if
(!
graphicDevice
.
isDisplayChangeSupported
())
{
System
.
err
.
println
(
"Display mode change is not supported on this host. Test is considered passed."
);
continue
;
}
DisplayMode
defaultDisplayMode
=
graphicDevice
.
getDisplayMode
();
checkDisplayMode
(
defaultDisplayMode
);
graphicDevice
.
setDisplayMode
(
defaultDisplayMode
);
DisplayMode
[]
displayModes
=
graphicDevice
.
getDisplayModes
();
boolean
isDefaultDisplayModeIncluded
=
false
;
for
(
DisplayMode
displayMode
:
displayModes
)
{
checkDisplayMode
(
displayMode
);
graphicDevice
.
setDisplayMode
(
displayMode
);
if
(
defaultDisplayMode
.
equals
(
displayMode
))
{
isDefaultDisplayModeIncluded
=
true
;
DisplayMode
[]
displayModes
=
graphicDevice
.
getDisplayModes
();
boolean
isDefaultDisplayModeIncluded
=
false
;
for
(
DisplayMode
displayMode
:
displayModes
)
{
checkDisplayMode
(
displayMode
);
graphicDevice
.
setDisplayMode
(
displayMode
);
if
(
defaultDisplayMode
.
equals
(
displayMode
))
{
isDefaultDisplayModeIncluded
=
true
;
}
}
}
if
(!
isDefaultDisplayModeIncluded
)
{
throw
new
RuntimeException
(
"Default display mode is not included"
);
if
(!
isDefaultDisplayModeIncluded
)
{
throw
new
RuntimeException
(
"Default display mode is not included"
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录