Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
759093ae
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看板
提交
759093ae
编写于
6月 08, 2015
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
d4f48d7a
ec88b307
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
13 deletion
+22
-13
src/share/classes/sun/awt/SunToolkit.java
src/share/classes/sun/awt/SunToolkit.java
+22
-13
未找到文件。
src/share/classes/sun/awt/SunToolkit.java
浏览文件 @
759093ae
...
...
@@ -715,16 +715,19 @@ public abstract class SunToolkit extends Toolkit
}
static
final
SoftCache
imgCache
=
new
SoftCache
();
static
final
SoftCache
fileImgCache
=
new
SoftCache
();
static
final
SoftCache
urlImgCache
=
new
SoftCache
();
static
Image
getImageFromHash
(
Toolkit
tk
,
URL
url
)
{
checkPermissions
(
url
);
synchronized
(
imgCache
)
{
Image
img
=
(
Image
)
imgCache
.
get
(
url
);
synchronized
(
urlImgCache
)
{
String
key
=
url
.
toString
();
Image
img
=
(
Image
)
urlImgCache
.
get
(
key
);
if
(
img
==
null
)
{
try
{
img
=
tk
.
createImage
(
new
URLImageSource
(
url
));
imgCache
.
put
(
url
,
img
);
urlImgCache
.
put
(
key
,
img
);
}
catch
(
Exception
e
)
{
}
}
...
...
@@ -735,12 +738,12 @@ public abstract class SunToolkit extends Toolkit
static
Image
getImageFromHash
(
Toolkit
tk
,
String
filename
)
{
checkPermissions
(
filename
);
synchronized
(
i
mgCache
)
{
Image
img
=
(
Image
)
i
mgCache
.
get
(
filename
);
synchronized
(
fileI
mgCache
)
{
Image
img
=
(
Image
)
fileI
mgCache
.
get
(
filename
);
if
(
img
==
null
)
{
try
{
img
=
tk
.
createImage
(
new
FileImageSource
(
filename
));
i
mgCache
.
put
(
filename
,
img
);
fileI
mgCache
.
put
(
filename
,
img
);
}
catch
(
Exception
e
)
{
}
}
...
...
@@ -758,28 +761,29 @@ public abstract class SunToolkit extends Toolkit
protected
Image
getImageWithResolutionVariant
(
String
fileName
,
String
resolutionVariantName
)
{
synchronized
(
i
mgCache
)
{
synchronized
(
fileI
mgCache
)
{
Image
image
=
getImageFromHash
(
this
,
fileName
);
if
(
image
instanceof
MultiResolutionImage
)
{
return
image
;
}
Image
resolutionVariant
=
getImageFromHash
(
this
,
resolutionVariantName
);
image
=
createImageWithResolutionVariant
(
image
,
resolutionVariant
);
i
mgCache
.
put
(
fileName
,
image
);
fileI
mgCache
.
put
(
fileName
,
image
);
return
image
;
}
}
protected
Image
getImageWithResolutionVariant
(
URL
url
,
URL
resolutionVariantURL
)
{
synchronized
(
i
mgCache
)
{
synchronized
(
urlI
mgCache
)
{
Image
image
=
getImageFromHash
(
this
,
url
);
if
(
image
instanceof
MultiResolutionImage
)
{
return
image
;
}
Image
resolutionVariant
=
getImageFromHash
(
this
,
resolutionVariantURL
);
image
=
createImageWithResolutionVariant
(
image
,
resolutionVariant
);
imgCache
.
put
(
url
,
image
);
String
key
=
url
.
toString
();
urlImgCache
.
put
(
key
,
image
);
return
image
;
}
}
...
...
@@ -884,8 +888,13 @@ public abstract class SunToolkit extends Toolkit
return
null
;
}
protected
static
boolean
imageCached
(
Object
key
)
{
return
imgCache
.
containsKey
(
key
);
protected
static
boolean
imageCached
(
String
fileName
)
{
return
fileImgCache
.
containsKey
(
fileName
);
}
protected
static
boolean
imageCached
(
URL
url
)
{
String
key
=
url
.
toString
();
return
urlImgCache
.
containsKey
(
key
);
}
protected
static
boolean
imageExists
(
String
filename
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录