Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
6fa6f77b
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6fa6f77b
编写于
10月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
10月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!512 渲染脏区域简单切分
Merge pull request !512 from pssea/master
上级
f400063f
11f742ea
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
15 deletion
+62
-15
frameworks/components/root_view.cpp
frameworks/components/root_view.cpp
+58
-13
interfaces/kits/components/root_view.h
interfaces/kits/components/root_view.h
+4
-2
未找到文件。
frameworks/components/root_view.cpp
浏览文件 @
6fa6f77b
...
@@ -31,6 +31,7 @@ const constexpr uint8_t MAX_SPLIT_NUM = 32; // split at most 32 parts
...
@@ -31,6 +31,7 @@ const constexpr uint8_t MAX_SPLIT_NUM = 32; // split at most 32 parts
const
constexpr
uint8_t
VIEW_STACK_DEPTH
=
COMPONENT_NESTING_DEPTH
*
2
;
const
constexpr
uint8_t
VIEW_STACK_DEPTH
=
COMPONENT_NESTING_DEPTH
*
2
;
#else
#else
const
constexpr
uint8_t
VIEW_STACK_DEPTH
=
COMPONENT_NESTING_DEPTH
;
const
constexpr
uint8_t
VIEW_STACK_DEPTH
=
COMPONENT_NESTING_DEPTH
;
const
constexpr
uint8_t
MAX_INVALIDATE_SIZE
=
24
;
#endif
#endif
static
Rect
g_maskStack
[
COMPONENT_NESTING_DEPTH
];
static
Rect
g_maskStack
[
COMPONENT_NESTING_DEPTH
];
static
UIView
*
g_viewStack
[
VIEW_STACK_DEPTH
];
static
UIView
*
g_viewStack
[
VIEW_STACK_DEPTH
];
...
@@ -353,6 +354,7 @@ void RootView::OptimizeInvalidMap()
...
@@ -353,6 +354,7 @@ void RootView::OptimizeInvalidMap()
}
}
curview
=
g_viewStack
[
--
stackCount
];
curview
=
g_viewStack
[
--
stackCount
];
Rect
rect
;
if
(
!
curview
->
IsVisible
()
||
!
rect
.
Intersect
(
curview
->
GetRect
(),
GetScreenRect
()))
{
if
(
!
curview
->
IsVisible
()
||
!
rect
.
Intersect
(
curview
->
GetRect
(),
GetScreenRect
()))
{
curview
=
nullptr
;
curview
=
nullptr
;
continue
;
continue
;
...
@@ -396,6 +398,52 @@ void RootView::DrawInvalidMap(const Rect& buffRect)
...
@@ -396,6 +398,52 @@ void RootView::DrawInvalidMap(const Rect& buffRect)
}
}
}
}
}
}
#else
void
RootView
::
OptimizeAddRect
(
Rect
&
rect
)
{
Rect
joinRect
;
for
(
ListNode
<
Rect
>*
iter
=
invalidateRects_
.
Begin
();
iter
!=
invalidateRects_
.
End
();
iter
=
iter
->
next_
)
{
if
(
iter
->
data_
.
IsContains
(
rect
))
{
return
;
}
if
(
iter
->
data_
.
IsIntersect
(
rect
))
{
joinRect
.
Join
(
iter
->
data_
,
rect
);
if
(
joinRect
.
GetSize
()
<
iter
->
data_
.
GetSize
()
+
rect
.
GetSize
())
{
iter
->
data_
=
joinRect
;
return
;
}
}
}
if
(
invalidateRects_
.
Size
()
<
MAX_INVALIDATE_SIZE
)
{
invalidateRects_
.
PushBack
(
rect
);
}
else
{
invalidateRects_
.
Clear
();
invalidateRects_
.
PushBack
(
GetScreenRect
());
}
}
void
RootView
::
OptimizeInvalidateRects
()
{
Rect
joinRect
;
for
(
ListNode
<
Rect
>*
iter1
=
invalidateRects_
.
Begin
();
iter1
!=
invalidateRects_
.
End
();
iter1
=
iter1
->
next_
)
{
for
(
ListNode
<
Rect
>*
iter2
=
invalidateRects_
.
Begin
();
iter2
!=
invalidateRects_
.
End
();
iter2
=
iter2
->
next_
)
{
if
(
iter1
==
iter2
)
{
continue
;
}
if
(
iter2
->
data_
.
IsIntersect
(
iter1
->
data_
))
{
joinRect
.
Join
(
iter1
->
data_
,
iter2
->
data_
);
if
(
joinRect
.
GetSize
()
<
(
iter1
->
data_
.
GetSize
()
+
iter2
->
data_
.
GetSize
()))
{
iter2
->
data_
=
joinRect
;
iter1
=
invalidateRects_
.
Remove
(
iter1
)
->
prev_
;
break
;
}
}
}
}
}
#endif
#endif
void
RootView
::
AddInvalidateRect
(
Rect
&
rect
,
UIView
*
view
)
void
RootView
::
AddInvalidateRect
(
Rect
&
rect
,
UIView
*
view
)
...
@@ -410,12 +458,7 @@ void RootView::AddInvalidateRect(Rect& rect, UIView* view)
...
@@ -410,12 +458,7 @@ void RootView::AddInvalidateRect(Rect& rect, UIView* view)
invalidRects
[
0
].
Join
(
invalidRects
[
0
],
commonRect
);
invalidRects
[
0
].
Join
(
invalidRects
[
0
],
commonRect
);
}
}
#else
#else
if
(
!
renderFlag_
)
{
OptimizeAddRect
(
commonRect
);
invalidRect_
=
commonRect
;
renderFlag_
=
true
;
}
else
{
invalidRect_
.
Join
(
invalidRect_
,
commonRect
);
}
#endif
#endif
}
}
}
}
...
@@ -440,7 +483,7 @@ void RootView::Measure()
...
@@ -440,7 +483,7 @@ void RootView::Measure()
MeasureView
(
childrenHead_
);
MeasureView
(
childrenHead_
);
}
}
#else
#else
if
(
renderFlag_
)
{
if
(
invalidateRects_
.
Size
()
>
0
)
{
MeasureView
(
childrenHead_
);
MeasureView
(
childrenHead_
);
}
}
#endif
#endif
...
@@ -473,10 +516,9 @@ void RootView::Render()
...
@@ -473,10 +516,9 @@ void RootView::Render()
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__
pthread_mutex_lock
(
&
lock_
);
pthread_mutex_lock
(
&
lock_
);
#endif
#endif
Rect
invalidRectTmp
=
invalidRect_
;
#if !LOCAL_RENDER
invalidRect_
=
{
0
,
0
,
0
,
0
};
OptimizeInvalidateRects
();
bool
renderFlagTmp
=
renderFlag_
;
#endif
renderFlag_
=
false
;
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__
pthread_mutex_unlock
(
&
lock_
);
pthread_mutex_unlock
(
&
lock_
);
#endif
#endif
...
@@ -486,8 +528,11 @@ void RootView::Render()
...
@@ -486,8 +528,11 @@ void RootView::Render()
RenderManager
::
RenderRect
(
GetRect
(),
this
);
RenderManager
::
RenderRect
(
GetRect
(),
this
);
invalidateMap_
.
clear
();
invalidateMap_
.
clear
();
#else
#else
if
(
renderFlagTmp
)
{
if
(
invalidateRects_
.
Size
()
>
0
)
{
RenderManager
::
RenderRect
(
invalidRectTmp
,
this
);
for
(
ListNode
<
Rect
>*
iter
=
invalidateRects_
.
Begin
();
iter
!=
invalidateRects_
.
End
();
iter
=
iter
->
next_
)
{
RenderManager
::
RenderRect
(
iter
->
data_
,
this
);
}
invalidateRects_
.
Clear
();
#endif
#endif
#if ENABLE_WINDOW
#if ENABLE_WINDOW
...
...
interfaces/kits/components/root_view.h
浏览文件 @
6fa6f77b
...
@@ -324,9 +324,11 @@ private:
...
@@ -324,9 +324,11 @@ private:
std
::
map
<
UIView
*
,
Graphic
::
Vector
<
Rect
>>
invalidateMap_
;
std
::
map
<
UIView
*
,
Graphic
::
Vector
<
Rect
>>
invalidateMap_
;
#else
#else
bool
renderFlag_
=
false
;
void
OptimizeAddRect
(
Rect
&
rect
);
Rect
invalidRect_
;
void
OptimizeInvalidateRects
();
List
<
Rect
>
invalidateRects_
;
#endif
#endif
OnKeyActListener
*
onKeyActListener_
{
nullptr
};
OnKeyActListener
*
onKeyActListener_
{
nullptr
};
OnVirtualDeviceEventListener
*
onVirtualEventListener_
{
nullptr
};
OnVirtualDeviceEventListener
*
onVirtualEventListener_
{
nullptr
};
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__
#if defined __linux__ || defined __LITEOS__ || defined __APPLE__
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录