Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
5db07805
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
5db07805
编写于
12月 08, 2020
作者:
C
Chris Yang
提交者:
GitHub
12月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable clipRRect for android platform view hybrid composition (#21817)
上级
dd464a8d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
64 addition
and
2 deletion
+64
-2
shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack.java
.../embedding/engine/mutatorsstack/FlutterMutatorsStack.java
+34
-0
shell/platform/android/platform_view_android_jni_impl.cc
shell/platform/android/platform_view_android_jni_impl.cc
+30
-2
testing/scenario_app/android/reports/screenshots/dev.flutter.scenariosui.PlatformViewUiTests__testPlatformViewCliprrect.png
...riosui.PlatformViewUiTests__testPlatformViewCliprrect.png
+0
-0
未找到文件。
shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack.java
浏览文件 @
5db07805
...
...
@@ -47,6 +47,7 @@ public class FlutterMutatorsStack {
@Nullable
private
Matrix
matrix
;
@Nullable
private
Rect
rect
;
@Nullable
private
Path
path
;
@Nullable
private
float
[]
radiis
;
private
FlutterMutatorType
type
;
...
...
@@ -60,6 +61,19 @@ public class FlutterMutatorsStack {
this
.
rect
=
rect
;
}
/**
* Initialize a clip rrect mutator.
*
* @param rect the rect of the rrect
* @param radiis the radiis of the rrect. Array of 8 values, 4 pairs of [X,Y]. This value cannot
* be null.
*/
public
FlutterMutator
(
Rect
rect
,
float
[]
radiis
)
{
this
.
type
=
FlutterMutatorType
.
CLIP_RRECT
;
this
.
rect
=
rect
;
this
.
radiis
=
radiis
;
}
/**
* Initialize a clip path mutator.
*
...
...
@@ -154,6 +168,26 @@ public class FlutterMutatorsStack {
finalClippingPaths
.
add
(
path
);
}
/**
* Push a clipRRect {@link io.flutter.embedding.engine.mutatorsstack.Mutator} to the stack.
*
* @param left left offset of the rrect.
* @param top top offset of the rrect.
* @param right right position of the rrect.
* @param bottom bottom position of the rrect.
* @param radiis the radiis of the rrect. It must be size of 8, including an x and y for each
* corner.
*/
public
void
pushClipRRect
(
int
left
,
int
top
,
int
right
,
int
bottom
,
float
[]
radiis
)
{
Rect
rect
=
new
Rect
(
left
,
top
,
right
,
bottom
);
FlutterMutator
mutator
=
new
FlutterMutator
(
rect
,
radiis
);
mutators
.
add
(
mutator
);
Path
path
=
new
Path
();
path
.
addRoundRect
(
new
RectF
(
rect
),
radiis
,
Path
.
Direction
.
CCW
);
path
.
transform
(
finalMatrix
);
finalClippingPaths
.
add
(
path
);
}
/**
* Get a list of all the raw mutators. The 0 index of the returned list is the top of the stack.
*/
...
...
shell/platform/android/platform_view_android_jni_impl.cc
浏览文件 @
5db07805
...
...
@@ -122,6 +122,7 @@ static fml::jni::ScopedJavaGlobalRef<jclass>* g_mutators_stack_class = nullptr;
static
jmethodID
g_mutators_stack_init_method
=
nullptr
;
static
jmethodID
g_mutators_stack_push_transform_method
=
nullptr
;
static
jmethodID
g_mutators_stack_push_cliprect_method
=
nullptr
;
static
jmethodID
g_mutators_stack_push_cliprrect_method
=
nullptr
;
// Called By Java
static
jlong
AttachJNI
(
JNIEnv
*
env
,
...
...
@@ -918,7 +919,15 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
g_mutators_stack_class
->
obj
(),
"pushClipRect"
,
"(IIII)V"
);
if
(
g_mutators_stack_push_cliprect_method
==
nullptr
)
{
FML_LOG
(
ERROR
)
<<
"Could not locate FlutterMutatorsStack.pushCilpRect method"
;
<<
"Could not locate FlutterMutatorsStack.pushClipRect method"
;
return
false
;
}
g_mutators_stack_push_cliprrect_method
=
env
->
GetMethodID
(
g_mutators_stack_class
->
obj
(),
"pushClipRRect"
,
"(IIII[F)V"
);
if
(
g_mutators_stack_push_cliprect_method
==
nullptr
)
{
FML_LOG
(
ERROR
)
<<
"Could not locate FlutterMutatorsStack.pushClipRRect method"
;
return
false
;
}
...
...
@@ -1288,9 +1297,28 @@ void PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView(
static_cast
<
int
>
(
rect
.
right
()),
static_cast
<
int
>
(
rect
.
bottom
()));
break
;
}
case
clip_rrect
:
{
const
SkRRect
&
rrect
=
(
*
iter
)
->
GetRRect
();
const
SkRect
&
rect
=
rrect
.
rect
();
const
SkVector
&
upper_left
=
rrect
.
radii
(
SkRRect
::
kUpperLeft_Corner
);
const
SkVector
&
upper_right
=
rrect
.
radii
(
SkRRect
::
kUpperRight_Corner
);
const
SkVector
&
lower_right
=
rrect
.
radii
(
SkRRect
::
kLowerRight_Corner
);
const
SkVector
&
lower_left
=
rrect
.
radii
(
SkRRect
::
kLowerLeft_Corner
);
SkScalar
radiis
[
8
]
=
{
upper_left
.
x
(),
upper_left
.
y
(),
upper_right
.
x
(),
upper_right
.
y
(),
lower_right
.
x
(),
lower_right
.
y
(),
lower_left
.
x
(),
lower_left
.
y
(),
};
fml
::
jni
::
ScopedJavaLocalRef
<
jfloatArray
>
radiisArray
(
env
,
env
->
NewFloatArray
(
8
));
env
->
SetFloatArrayRegion
(
radiisArray
.
obj
(),
0
,
8
,
radiis
);
env
->
CallVoidMethod
(
mutatorsStack
,
g_mutators_stack_push_cliprrect_method
,
(
int
)
rect
.
left
(),
(
int
)
rect
.
top
(),
(
int
)
rect
.
right
(),
(
int
)
rect
.
bottom
(),
radiisArray
.
obj
());
break
;
}
// TODO(cyanglaz): Implement other mutators.
// https://github.com/flutter/flutter/issues/58426
case
clip_rrect
:
case
clip_path
:
case
opacity
:
break
;
...
...
testing/scenario_app/android/reports/screenshots/dev.flutter.scenariosui.PlatformViewUiTests__testPlatformViewCliprrect.png
查看替换文件 @
dd464a8d
浏览文件 @
5db07805
26.9 KB
|
W:
|
H:
19.0 KB
|
W:
|
H:
2-up
Swipe
Onion skin
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录