Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
39f1cae5
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看板
提交
39f1cae5
编写于
4月 02, 2014
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8029196: Focus border of JButton.buttonType=roundRect is cut off
Reviewed-by: pchelko, alexsch
上级
60f4ef3a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
22 deletion
+54
-22
src/macosx/classes/apple/laf/JRSUIConstants.java
src/macosx/classes/apple/laf/JRSUIConstants.java
+8
-1
src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java
...macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java
+5
-2
src/macosx/classes/com/apple/laf/AquaPainter.java
src/macosx/classes/com/apple/laf/AquaPainter.java
+39
-17
src/macosx/native/com/apple/laf/JRSUIController.m
src/macosx/native/com/apple/laf/JRSUIController.m
+2
-2
未找到文件。
src/macosx/classes/apple/laf/JRSUIConstants.java
浏览文件 @
39f1cae5
/*
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -31,6 +31,13 @@ import java.nio.ByteBuffer;
...
@@ -31,6 +31,13 @@ import java.nio.ByteBuffer;
import
java.lang.annotation.Native
;
import
java.lang.annotation.Native
;
public
final
class
JRSUIConstants
{
public
final
class
JRSUIConstants
{
/**
* There is no way to get width of focus border, so it is hardcoded here.
* All components, which can be focused should take care about it.
*/
public
static
final
int
FOCUS_SIZE
=
4
;
private
static
native
long
getPtrForConstant
(
final
int
constant
);
private
static
native
long
getPtrForConstant
(
final
int
constant
);
static
class
Key
{
static
class
Key
{
...
...
src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java
浏览文件 @
39f1cae5
/*
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -36,6 +36,8 @@ import apple.laf.JRSUIConstants.*;
...
@@ -36,6 +36,8 @@ import apple.laf.JRSUIConstants.*;
import
com.apple.laf.AquaUtilControlSize.*
;
import
com.apple.laf.AquaUtilControlSize.*
;
import
com.apple.laf.AquaUtils.RecyclableSingleton
;
import
com.apple.laf.AquaUtils.RecyclableSingleton
;
import
static
apple
.
laf
.
JRSUIConstants
.
FOCUS_SIZE
;
/**
/**
* All the "magic numbers" in this class should go away once
* All the "magic numbers" in this class should go away once
* <rdar://problem/4613866> "default font" and sizes for controls in Java Aqua Look and Feel
* <rdar://problem/4613866> "default font" and sizes for controls in Java Aqua Look and Feel
...
@@ -145,7 +147,8 @@ public class AquaButtonExtendedTypes {
...
@@ -145,7 +147,8 @@ public class AquaButtonExtendedTypes {
protected
static
Map
<
String
,
TypeSpecifier
>
getAllTypes
()
{
protected
static
Map
<
String
,
TypeSpecifier
>
getAllTypes
()
{
final
Map
<
String
,
TypeSpecifier
>
specifiersByName
=
new
HashMap
<
String
,
TypeSpecifier
>();
final
Map
<
String
,
TypeSpecifier
>
specifiersByName
=
new
HashMap
<
String
,
TypeSpecifier
>();
final
Insets
focusInsets
=
new
Insets
(
4
,
4
,
4
,
4
);
final
Insets
focusInsets
=
new
Insets
(
FOCUS_SIZE
,
FOCUS_SIZE
,
FOCUS_SIZE
,
FOCUS_SIZE
);
final
TypeSpecifier
[]
specifiers
=
{
final
TypeSpecifier
[]
specifiers
=
{
new
TypeSpecifier
(
"toolbar"
,
true
)
{
new
TypeSpecifier
(
"toolbar"
,
true
)
{
...
...
src/macosx/classes/com/apple/laf/AquaPainter.java
浏览文件 @
39f1cae5
/*
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -141,39 +141,59 @@ abstract class AquaPainter <T extends JRSUIState> {
...
@@ -141,39 +141,59 @@ abstract class AquaPainter <T extends JRSUIState> {
paintFromSingleCachedImage
(
g
,
control
,
stateToPaint
,
boundsRect
);
paintFromSingleCachedImage
(
g
,
control
,
stateToPaint
,
boundsRect
);
}
}
/**
* Paints a native control, which identified by its size and a set of
* additional arguments using a cached image.
*
* @param g Graphics to draw the control
* @param control the reference to the native control
* @param controlState the state of the native control
* @param bounds the rectangle where the native part should be drawn.
* Note: the focus can/will be drawn outside of this bounds.
*/
static
void
paintFromSingleCachedImage
(
final
Graphics2D
g
,
static
void
paintFromSingleCachedImage
(
final
Graphics2D
g
,
final
JRSUIControl
control
,
final
JRSUIState
controlState
,
final
JRSUIControl
control
,
final
Rectangle
bounds
)
{
final
JRSUIState
controlState
,
final
Rectangle
bounds
)
{
if
(
bounds
.
width
<=
0
||
bounds
.
height
<=
0
)
{
if
(
bounds
.
width
<=
0
||
bounds
.
height
<=
0
)
{
return
;
return
;
}
}
int
focus
=
0
;
if
(
controlState
.
is
(
JRSUIConstants
.
Focused
.
YES
))
{
focus
=
JRSUIConstants
.
FOCUS_SIZE
;
}
final
int
imgX
=
bounds
.
x
-
focus
;
final
int
imgY
=
bounds
.
y
-
focus
;
final
int
imgW
=
bounds
.
width
+
(
focus
<<
1
);
final
int
imgH
=
bounds
.
height
+
(
focus
<<
1
);
final
GraphicsConfiguration
config
=
g
.
getDeviceConfiguration
();
final
GraphicsConfiguration
config
=
g
.
getDeviceConfiguration
();
final
ImageCache
cache
=
ImageCache
.
getInstance
();
final
ImageCache
cache
=
ImageCache
.
getInstance
();
final
int
width
=
bounds
.
width
;
final
AquaPixelsKey
key
=
new
AquaPixelsKey
(
config
,
imgW
,
imgH
,
final
int
height
=
bounds
.
height
;
bounds
,
controlState
);
AquaPixelsKey
key
=
new
AquaPixelsKey
(
config
,
Image
img
=
cache
.
getImage
(
key
);
width
,
height
,
bounds
,
controlState
);
Image
img
=
(
BufferedImage
)
cache
.
getImage
(
key
);
if
(
img
==
null
)
{
if
(
img
==
null
)
{
Image
baseImage
=
createImage
(
width
,
height
,
bounds
,
control
,
Image
baseImage
=
createImage
(
imgX
,
imgY
,
imgW
,
imgH
,
bounds
,
controlState
);
control
,
controlState
);
img
=
new
MultiResolutionBufferedImage
(
baseImage
,
img
=
new
MultiResolutionBufferedImage
(
baseImage
,
(
rvWidth
,
rvHeight
)
->
createImage
(
rvWidth
,
rvHeight
,
(
rvWidth
,
rvHeight
)
->
createImage
(
imgX
,
imgY
,
bounds
,
control
,
controlState
));
rvWidth
,
rvHeight
,
bounds
,
control
,
controlState
));
if
(!
controlState
.
is
(
JRSUIConstants
.
Animating
.
YES
))
{
if
(!
controlState
.
is
(
JRSUIConstants
.
Animating
.
YES
))
{
cache
.
setImage
(
key
,
img
);
cache
.
setImage
(
key
,
img
);
}
}
}
}
g
.
drawImage
(
img
,
bounds
.
x
,
bounds
.
y
,
bounds
.
width
,
bounds
.
height
,
null
);
g
.
drawImage
(
img
,
imgX
,
imgY
,
imgW
,
imgH
,
null
);
}
}
private
static
Image
createImage
(
int
imgW
,
int
imgH
,
final
Rectangle
bounds
,
private
static
Image
createImage
(
int
imgX
,
int
imgY
,
int
imgW
,
int
imgH
,
final
JRSUIControl
control
,
JRSUIState
controlState
)
{
final
Rectangle
bounds
,
final
JRSUIControl
control
,
JRSUIState
controlState
)
{
BufferedImage
img
=
new
BufferedImage
(
imgW
,
imgH
,
BufferedImage
img
=
new
BufferedImage
(
imgW
,
imgH
,
BufferedImage
.
TYPE_INT_ARGB_PRE
);
BufferedImage
.
TYPE_INT_ARGB_PRE
);
...
@@ -181,8 +201,9 @@ abstract class AquaPainter <T extends JRSUIState> {
...
@@ -181,8 +201,9 @@ abstract class AquaPainter <T extends JRSUIState> {
final
DataBufferInt
buffer
=
(
DataBufferInt
)
raster
.
getDataBuffer
();
final
DataBufferInt
buffer
=
(
DataBufferInt
)
raster
.
getDataBuffer
();
control
.
set
(
controlState
);
control
.
set
(
controlState
);
control
.
paint
(
SunWritableRaster
.
stealData
(
buffer
,
0
),
control
.
paint
(
SunWritableRaster
.
stealData
(
buffer
,
0
),
imgW
,
imgH
,
imgW
,
imgH
,
0
,
0
,
bounds
.
width
,
bounds
.
height
);
bounds
.
x
-
imgX
,
bounds
.
y
-
imgY
,
bounds
.
width
,
bounds
.
height
);
SunWritableRaster
.
markDirty
(
buffer
);
SunWritableRaster
.
markDirty
(
buffer
);
return
img
;
return
img
;
}
}
...
@@ -212,6 +233,7 @@ abstract class AquaPainter <T extends JRSUIState> {
...
@@ -212,6 +233,7 @@ abstract class AquaPainter <T extends JRSUIState> {
this
.
hash
=
hash
();
this
.
hash
=
hash
();
}
}
@Override
public
int
getPixelCount
()
{
public
int
getPixelCount
()
{
return
pixelCount
;
return
pixelCount
;
}
}
...
...
src/macosx/native/com/apple/laf/JRSUIController.m
浏览文件 @
39f1cae5
/*
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -199,7 +199,7 @@ static inline jint doPaintImage
...
@@ -199,7 +199,7 @@ static inline jint doPaintImage
CGColorSpaceRef
colorspace
=
CGColorSpaceCreateDeviceRGB
();
CGColorSpaceRef
colorspace
=
CGColorSpaceCreateDeviceRGB
();
CGContextRef
cgRef
=
CGBitmapContextCreate
(
rawPixelData
,
imgW
,
imgH
,
8
,
imgW
*
4
,
colorspace
,
kCGImageAlphaPremultipliedFirst
|
kCGBitmapByteOrder32Host
);
CGContextRef
cgRef
=
CGBitmapContextCreate
(
rawPixelData
,
imgW
,
imgH
,
8
,
imgW
*
4
,
colorspace
,
kCGImageAlphaPremultipliedFirst
|
kCGBitmapByteOrder32Host
);
CGColorSpaceRelease
(
colorspace
);
CGColorSpaceRelease
(
colorspace
);
CGContextScaleCTM
(
cgRef
,
imgW
/
w
,
imgH
/
h
);
CGContextScaleCTM
(
cgRef
,
imgW
/
(
w
+
x
+
x
)
,
imgH
/
(
h
+
y
+
y
)
);
jint
status
=
doPaintCGContext
(
cgRef
,
controlPtr
,
oldProperties
,
newProperties
,
x
,
y
,
w
,
h
);
jint
status
=
doPaintCGContext
(
cgRef
,
controlPtr
,
oldProperties
,
newProperties
,
x
,
y
,
w
,
h
);
CGContextRelease
(
cgRef
);
CGContextRelease
(
cgRef
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录