Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6087d55c
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看板
提交
6087d55c
编写于
1月 19, 2012
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7131153: GetDC called way too many times - causes bad performance.
Reviewed-by: igor, jgodinez
上级
49fdd328
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
5 deletion
+21
-5
src/windows/native/sun/font/fontpath.c
src/windows/native/sun/font/fontpath.c
+21
-5
未找到文件。
src/windows/native/sun/font/fontpath.c
浏览文件 @
6087d55c
...
...
@@ -185,6 +185,12 @@ static int CALLBACK CheckFontFamilyProcW(
return
0
;
}
/* This HDC is initialised and released in the populate family map
* JNI entry point, and used within the call which would otherwise
* create many DCs.
*/
static
HDC
screenDC
=
NULL
;
static
int
DifferentFamily
(
wchar_t
*
family
,
wchar_t
*
fullName
)
{
LOGFONTW
lfw
;
CheckFamilyInfo
info
;
...
...
@@ -202,7 +208,7 @@ static int DifferentFamily(wchar_t *family, wchar_t* fullName) {
memset
(
&
lfw
,
0
,
sizeof
(
lfw
));
wcscpy
(
lfw
.
lfFaceName
,
fullName
);
lfw
.
lfCharSet
=
DEFAULT_CHARSET
;
EnumFontFamiliesExW
(
GetDC
(
NULL
)
,
&
lfw
,
EnumFontFamiliesExW
(
screenDC
,
&
lfw
,
(
FONTENUMPROCW
)
CheckFontFamilyProcW
,
(
LPARAM
)(
&
info
),
0L
);
...
...
@@ -299,7 +305,7 @@ static int CALLBACK EnumFamilyNamesA(
memset
(
&
lfa
,
0
,
sizeof
(
lfa
));
strcpy
(
lfa
.
lfFaceName
,
lpelfe
->
elfLogFont
.
lfFaceName
);
lfa
.
lfCharSet
=
lpelfe
->
elfLogFont
.
lfCharSet
;
EnumFontFamiliesExA
(
GetDC
(
NULL
)
,
&
lfa
,
EnumFontFamiliesExA
(
screenDC
,
&
lfa
,
(
FONTENUMPROCA
)
EnumFontFacesInFamilyProcA
,
lParam
,
0L
);
return
1
;
...
...
@@ -353,7 +359,7 @@ static int CALLBACK EnumFamilyNamesW(
memset
(
&
lfw
,
0
,
sizeof
(
lfw
));
wcscpy
(
lfw
.
lfFaceName
,
lpelfe
->
elfLogFont
.
lfFaceName
);
lfw
.
lfCharSet
=
lpelfe
->
elfLogFont
.
lfCharSet
;
EnumFontFamiliesExW
(
GetDC
(
NULL
)
,
&
lfw
,
EnumFontFamiliesExW
(
screenDC
,
&
lfw
,
(
FONTENUMPROCW
)
EnumFontFacesInFamilyProcW
,
lParam
,
0L
);
return
1
;
...
...
@@ -613,13 +619,17 @@ Java_sun_awt_Win32FontManager_populateFontFileNameMap0
return
;
}
screenDC
=
GetDC
(
NULL
);
if
(
screenDC
==
NULL
)
{
return
;
}
/* Enumerate fonts via GDI to build maps of fonts and families */
if
(
IS_NT
)
{
LOGFONTW
lfw
;
memset
(
&
lfw
,
0
,
sizeof
(
lfw
));
lfw
.
lfCharSet
=
DEFAULT_CHARSET
;
/* all charsets */
wcscpy
(
lfw
.
lfFaceName
,
L""
);
/* one face per family (CHECK) */
EnumFontFamiliesExW
(
GetDC
(
NULL
)
,
&
lfw
,
EnumFontFamiliesExW
(
screenDC
,
&
lfw
,
(
FONTENUMPROCW
)
EnumFamilyNamesW
,
(
LPARAM
)(
&
fmi
),
0L
);
}
else
{
...
...
@@ -627,7 +637,7 @@ Java_sun_awt_Win32FontManager_populateFontFileNameMap0
memset
(
&
lfa
,
0
,
sizeof
(
lfa
));
lfa
.
lfCharSet
=
DEFAULT_CHARSET
;
/* all charsets */
strcpy
(
lfa
.
lfFaceName
,
""
);
/* one face per family */
ret
=
EnumFontFamiliesExA
(
GetDC
(
NULL
)
,
&
lfa
,
ret
=
EnumFontFamiliesExA
(
screenDC
,
&
lfa
,
(
FONTENUMPROCA
)
EnumFamilyNamesA
,
(
LPARAM
)(
&
fmi
),
0L
);
}
...
...
@@ -637,6 +647,8 @@ Java_sun_awt_Win32FontManager_populateFontFileNameMap0
ret
=
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
fontKeyName
,
0L
,
KEY_READ
,
&
hkeyFonts
);
if
(
ret
!=
ERROR_SUCCESS
)
{
ReleaseDC
(
NULL
,
screenDC
);
screenDC
=
NULL
;
return
;
}
...
...
@@ -653,6 +665,8 @@ Java_sun_awt_Win32FontManager_populateFontFileNameMap0
dwMaxValueNameLen
>=
MAX_BUFFER
||
dwMaxValueDataLen
>=
MAX_BUFFER
)
{
RegCloseKey
(
hkeyFonts
);
ReleaseDC
(
NULL
,
screenDC
);
screenDC
=
NULL
;
return
;
}
for
(
nval
=
0
;
nval
<
dwNumValues
;
nval
++
)
{
...
...
@@ -692,4 +706,6 @@ Java_sun_awt_Win32FontManager_populateFontFileNameMap0
}
}
RegCloseKey
(
hkeyFonts
);
ReleaseDC
(
NULL
,
screenDC
);
screenDC
=
NULL
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录