Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
a1285661
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,发现更多精彩内容 >>
提交
a1285661
编写于
9月 28, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 28, 2021
浏览文件
操作
浏览文件
下载
差异文件
!453 修复analog clock post draw流程调用invaliddate接口导致功耗异常问题
Merge pull request !453 from guyuanzhang/clock
上级
da44ea90
b31b0106
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
24 deletion
+26
-24
frameworks/components/ui_analog_clock.cpp
frameworks/components/ui_analog_clock.cpp
+26
-24
未找到文件。
frameworks/components/ui_analog_clock.cpp
浏览文件 @
a1285661
...
...
@@ -14,6 +14,7 @@
*/
#include "components/ui_analog_clock.h"
#include "components/ui_image_view.h"
#include "draw/draw_image.h"
#include "engines/gfx/gfx_engine_manager.h"
...
...
@@ -30,7 +31,7 @@ UIAnalogClock::UIAnalogClock()
void
UIAnalogClock
::
SetHandImage
(
HandType
type
,
const
UIImageView
&
img
,
Point
position
,
Point
center
)
{
Hand
*
hand
=
nullptr
;
Hand
*
hand
=
nullptr
;
if
(
type
==
HandType
::
HOUR_HAND
)
{
hand
=
&
hourHand_
;
}
else
if
(
type
==
HandType
::
MINUTE_HAND
)
{
...
...
@@ -58,8 +59,13 @@ void UIAnalogClock::SetHandImage(HandType type, const UIImageView& img, Point po
}
}
void
UIAnalogClock
::
SetHandLine
(
HandType
type
,
Point
position
,
Point
center
,
ColorType
color
,
uint16_t
width
,
uint16_t
height
,
OpacityType
opacity
)
void
UIAnalogClock
::
SetHandLine
(
HandType
type
,
Point
position
,
Point
center
,
ColorType
color
,
uint16_t
width
,
uint16_t
height
,
OpacityType
opacity
)
{
Hand
*
hand
=
nullptr
;
if
(
type
==
HandType
::
HOUR_HAND
)
{
...
...
@@ -132,13 +138,12 @@ void UIAnalogClock::SetInitTime24Hour(uint8_t hour, uint8_t minute, uint8_t seco
currentMinute_
=
minute
%
ONE_HOUR_IN_MINUTE
;
currentSecond_
=
second
%
ONE_MINUTE_IN_SECOND
;
hourHand_
.
initAngle_
=
ConvertHandValueToAngle
(
currentHour_
,
HALF_DAY_IN_HOUR
,
currentMinute_
,
ONE_HOUR_IN_MINUTE
);
hourHand_
.
initAngle_
=
ConvertHandValueToAngle
(
currentHour_
,
HALF_DAY_IN_HOUR
,
currentMinute_
,
ONE_HOUR_IN_MINUTE
);
hourHand_
.
preAngle_
=
hourHand_
.
initAngle_
;
hourHand_
.
nextAngle_
=
hourHand_
.
initAngle_
;
minuteHand_
.
initAngle_
=
ConvertHandValueToAngle
(
currentMinute_
,
ONE_HOUR_IN_MINUTE
,
currentSecond_
,
ONE_MINUTE_IN_SECOND
);
minuteHand_
.
initAngle_
=
ConvertHandValueToAngle
(
currentMinute_
,
ONE_HOUR_IN_MINUTE
,
currentSecond_
,
ONE_MINUTE_IN_SECOND
);
minuteHand_
.
preAngle_
=
minuteHand_
.
initAngle_
;
minuteHand_
.
nextAngle_
=
minuteHand_
.
initAngle_
;
...
...
@@ -147,6 +152,7 @@ void UIAnalogClock::SetInitTime24Hour(uint8_t hour, uint8_t minute, uint8_t seco
secondHand_
.
nextAngle_
=
secondHand_
.
initAngle_
;
UpdateClock
(
true
);
Invalidate
();
}
void
UIAnalogClock
::
SetInitTime12Hour
(
uint8_t
hour
,
uint8_t
minute
,
uint8_t
second
,
bool
am
)
...
...
@@ -154,8 +160,10 @@ void UIAnalogClock::SetInitTime12Hour(uint8_t hour, uint8_t minute, uint8_t seco
SetInitTime24Hour
((
hour
%
HALF_DAY_IN_HOUR
)
+
(
am
?
0
:
HALF_DAY_IN_HOUR
),
minute
,
second
);
}
uint16_t
UIAnalogClock
::
ConvertHandValueToAngle
(
uint8_t
handValue
,
uint8_t
range
,
uint8_t
secondHandValue
,
uint8_t
ratio
)
const
uint16_t
UIAnalogClock
::
ConvertHandValueToAngle
(
uint8_t
handValue
,
uint8_t
range
,
uint8_t
secondHandValue
,
uint8_t
ratio
)
const
{
if
((
range
==
0
)
||
(
ratio
==
0
))
{
GRAPHIC_LOGW
(
"UIAnalogClock::ConvertHandValueToAngle Invalid range or ratio
\n
"
);
...
...
@@ -188,13 +196,9 @@ uint16_t UIAnalogClock::ConvertHandValueToAngle(uint8_t handValue, uint8_t range
void
UIAnalogClock
::
UpdateClock
(
bool
clockInit
)
{
Invalidate
();
hourHand_
.
nextAngle_
=
ConvertHandValueToAngle
(
currentHour_
,
HALF_DAY_IN_HOUR
,
currentMinute_
,
ONE_HOUR_IN_MINUTE
);
minuteHand_
.
nextAngle_
=
ConvertHandValueToAngle
(
currentMinute_
,
ONE_HOUR_IN_MINUTE
,
currentSecond_
,
ONE_MINUTE_IN_SECOND
);
hourHand_
.
nextAngle_
=
ConvertHandValueToAngle
(
currentHour_
,
HALF_DAY_IN_HOUR
,
currentMinute_
,
ONE_HOUR_IN_MINUTE
);
minuteHand_
.
nextAngle_
=
ConvertHandValueToAngle
(
currentMinute_
,
ONE_HOUR_IN_MINUTE
,
currentSecond_
,
ONE_MINUTE_IN_SECOND
);
secondHand_
.
nextAngle_
=
ConvertHandValueToAngle
(
currentSecond_
,
ONE_MINUTE_IN_SECOND
);
Rect
rect
=
GetRect
();
...
...
@@ -269,12 +273,10 @@ void UIAnalogClock::DrawHandImage(BufferInfo& gfxDstBuffer,
Hand
&
hand
)
{
uint8_t
pxSize
=
DrawUtils
::
GetPxSizeByColorMode
(
hand
.
imageInfo_
.
header
.
colorMode
);
TransformDataInfo
imageTranDataInfo
=
{
hand
.
imageInfo_
.
header
,
hand
.
imageInfo_
.
data
,
pxSize
,
BlurLevel
::
LEVEL0
,
TransformAlgorithm
::
BILINEAR
};
BaseGfxEngine
::
GetInstance
()
->
DrawTransform
(
gfxDstBuffer
,
invalidatedArea
,
{
0
,
0
},
Color
::
Black
(),
opaScale_
,
hand
.
trans_
,
imageTranDataInfo
);
TransformDataInfo
imageTranDataInfo
=
{
hand
.
imageInfo_
.
header
,
hand
.
imageInfo_
.
data
,
pxSize
,
BlurLevel
::
LEVEL0
,
TransformAlgorithm
::
BILINEAR
};
BaseGfxEngine
::
GetInstance
()
->
DrawTransform
(
gfxDstBuffer
,
invalidatedArea
,
{
0
,
0
},
Color
::
Black
(),
opaScale_
,
hand
.
trans_
,
imageTranDataInfo
);
}
void
UIAnalogClock
::
DrawHandLine
(
BufferInfo
&
gfxDstBuffer
,
const
Rect
&
invalidatedArea
,
Hand
&
hand
)
...
...
@@ -308,8 +310,8 @@ void UIAnalogClock::DrawHandLine(BufferInfo& gfxDstBuffer, const Rect& invalidat
end
.
x
=
xlength
+
curCenter
.
x
;
end
.
y
=
ylength
+
curCenter
.
y
;
BaseGfxEngine
::
GetInstance
()
->
DrawLine
(
gfxDstBuffer
,
start
,
end
,
invalidatedArea
,
hand
.
width_
,
hand
.
color_
,
hand
.
opacity_
);
BaseGfxEngine
::
GetInstance
()
->
DrawLine
(
gfxDstBuffer
,
start
,
end
,
invalidatedArea
,
hand
.
width_
,
hand
.
color_
,
hand
.
opacity_
);
}
void
UIAnalogClock
::
SetWorkMode
(
WorkMode
newMode
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录