Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
508e7ffd
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,发现更多精彩内容 >>
提交
508e7ffd
编写于
9月 30, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
!451 字体绘制出现花屏问题
Merge pull request !451 from wangtiantian/bug_m
上级
19242fd6
84f2a5f6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
24 deletion
+30
-24
frameworks/font/glyphs_manager.cpp
frameworks/font/glyphs_manager.cpp
+27
-21
frameworks/font/glyphs_manager.h
frameworks/font/glyphs_manager.h
+3
-3
未找到文件。
frameworks/font/glyphs_manager.cpp
浏览文件 @
508e7ffd
...
...
@@ -92,15 +92,15 @@ int8_t GlyphsManager::GlyphNodeCacheInit()
return
RET_VALUE_OK
;
}
GlyphNode
*
GlyphsManager
::
GetNodeFromCache
(
uint32_t
unicode
)
GlyphNode
*
GlyphsManager
::
GetNodeFromCache
(
uint32_t
unicode
,
uint8_t
fontId
)
{
GlyphNode
*
node
=
nullptr
;
uint8_t
font
=
fontId
_
&
FONT_HASH_MASK
;
uint8_t
font
=
fontId
&
FONT_HASH_MASK
;
uint8_t
uc
=
unicode
&
UNICODE_HASH_MASK
;
for
(
uint8_t
i
=
0
;
i
<
NODE_HASH_NR
;
i
++
)
{
GlyphNode
*
p
=
&
((
*
nodeCache_
)[
font
][
uc
][
i
]);
if
((
p
->
unicode
==
unicode
)
&&
(
p
->
reserve
==
fontId
_
))
{
if
((
p
->
unicode
==
unicode
)
&&
(
p
->
reserve
==
fontId
))
{
node
=
p
;
break
;
}
...
...
@@ -108,12 +108,12 @@ GlyphNode* GlyphsManager::GetNodeFromCache(uint32_t unicode)
return
node
;
}
GlyphNode
*
GlyphsManager
::
GetNodeCacheSpace
(
uint32_t
unicode
)
GlyphNode
*
GlyphsManager
::
GetNodeCacheSpace
(
uint32_t
unicode
,
uint8_t
fontId
)
{
uint8_t
font
,
uc
,
i
;
GlyphNode
*
node
=
nullptr
;
font
=
fontId
_
&
FONT_HASH_MASK
;
font
=
fontId
&
FONT_HASH_MASK
;
uc
=
unicode
&
UNICODE_HASH_MASK
;
i
=
(
*
cacheStatus_
)[
font
][
uc
];
node
=
&
((
*
nodeCache_
)[
font
][
uc
][
i
]);
...
...
@@ -127,30 +127,39 @@ GlyphNode* GlyphsManager::GetNodeCacheSpace(uint32_t unicode)
return
node
;
}
GlyphNode
*
GlyphsManager
::
GetNodeFromFile
(
uint32_t
unicode
)
GlyphNode
*
GlyphsManager
::
GetNodeFromFile
(
uint32_t
unicode
,
uint8_t
fontId
)
{
uint16_t
idx
=
0
;
uint8_t
key
;
uint32_t
offset
;
uint8_t
*
tmpIndexCache
=
curIndexCache_
;
uint32_t
tmpGlyphNodeSectionStart
=
curGlyphNodeSectionStart_
;
while
(
fontId_
!=
fontId
)
{
SetCurrentFontId
(
fontId
);
if
(
!
isFontIdSet_
)
{
return
nullptr
;
}
tmpIndexCache
=
curIndexCache_
;
tmpGlyphNodeSectionStart
=
curGlyphNodeSectionStart_
;
}
for
(
int32_t
i
=
RADIX_SHIFT_START
;
i
>=
0
;
i
-=
RADIX_TREE_BITS
)
{
offset
=
idx
*
sizeof
(
IndexNode
);
key
=
static_cast
<
uint8_t
>
((
unicode
>>
static_cast
<
uint8_t
>
(
i
))
&
RADIX_TREE_MASK
);
offset
+=
key
*
sizeof
(
uint16_t
);
idx
=
*
(
reinterpret_cast
<
uint16_t
*>
(
curIndexCache_
+
offset
));
idx
=
*
(
reinterpret_cast
<
uint16_t
*>
(
tmpIndexCache
+
offset
));
if
(
idx
==
0
)
{
GRAPHIC_LOGE
(
"GlyphsManager::GetNodeFromFile unicode not found"
);
return
nullptr
;
}
}
offset
=
curGlyphNodeSectionStart_
+
(
idx
-
1
)
*
sizeof
(
GlyphNode
);
offset
=
tmpGlyphNodeSectionStart
+
(
idx
-
1
)
*
sizeof
(
GlyphNode
);
int32_t
ret
=
lseek
(
fp_
,
offset
,
SEEK_SET
);
if
(
ret
!=
static_cast
<
int32_t
>
(
offset
))
{
GRAPHIC_LOGE
(
"GlyphsManager::GetNodeFromFile lseek failed"
);
return
nullptr
;
}
GlyphNode
*
node
=
GetNodeCacheSpace
(
unicode
);
GlyphNode
*
node
=
GetNodeCacheSpace
(
unicode
,
fontId
);
ret
=
read
(
fp_
,
node
,
sizeof
(
GlyphNode
));
if
(
ret
<
0
)
{
GRAPHIC_LOGE
(
"GlyphsManager::GetNodeFromFile read failed"
);
...
...
@@ -325,20 +334,19 @@ const GlyphNode* GlyphsManager::GetGlyphNode(uint32_t unicode)
if
(
!
isFontIdSet_
)
{
return
nullptr
;
}
uint8_t
fontId
=
fontId_
;
if
(
curGlyphNode_
!=
nullptr
)
{
if
((
curGlyphNode_
->
unicode
==
unicode
)
&&
(
curGlyphNode_
->
reserve
==
fontId
_
))
{
if
((
curGlyphNode_
->
unicode
==
unicode
)
&&
(
curGlyphNode_
->
reserve
==
fontId
))
{
return
curGlyphNode_
;
}
}
GlyphNode
*
node
=
GetNodeFromCache
(
unicode
);
GlyphNode
*
node
=
GetNodeFromCache
(
unicode
,
fontId
);
if
(
node
==
nullptr
)
{
node
=
GetNodeFromFile
(
unicode
);
node
=
GetNodeFromFile
(
unicode
,
fontId
);
if
(
node
!=
nullptr
)
{
node
->
reserve
=
fontId
_
;
node
->
reserve
=
fontId
;
}
}
curGlyphNode_
=
node
;
return
node
;
}
...
...
@@ -385,19 +393,17 @@ int8_t GlyphsManager::GetBitmap(uint32_t unicode, uint8_t* bitmap, uint8_t fontI
return
INVALID_RET_VALUE
;
}
const
GlyphNode
*
node
=
GetGlyphNode
(
unicode
);
uint32_t
tmpBitMapSectionStart
=
curBitMapSectionStart_
;
while
((
fontId
!=
0
)
&&
(
node
!=
nullptr
)
&&
(
node
->
reserve
!=
fontId
))
{
SetCurrentFontId
(
fontId
);
node
=
GetGlyphNode
(
unicode
);
tmpBitMapSectionStart
=
curBitMapSectionStart_
;
}
if
(
node
==
nullptr
)
{
GRAPHIC_LOGE
(
"GlyphsManager::GetBitmap node not found"
);
return
INVALID_RET_VALUE
;
}
if
((
fontId
!=
0
)
&&
(
fontId_
!=
fontId
))
{
SetCurrentFontId
(
fontId
);
}
uint32_t
offset
=
curBitMapSectionStart_
+
node
->
dataOff
;
uint32_t
offset
=
tmpBitMapSectionStart
+
node
->
dataOff
;
uint32_t
size
=
node
->
kernOff
-
node
->
dataOff
;
int32_t
ret
=
lseek
(
fp_
,
offset
,
SEEK_SET
);
if
(
ret
!=
static_cast
<
int32_t
>
(
offset
))
{
...
...
frameworks/font/glyphs_manager.h
浏览文件 @
508e7ffd
...
...
@@ -72,9 +72,9 @@ private:
};
int8_t
GlyphNodeCacheInit
();
GlyphNode
*
GetNodeFromCache
(
uint32_t
unicode
);
GlyphNode
*
GetNodeCacheSpace
(
uint32_t
unicode
);
GlyphNode
*
GetNodeFromFile
(
uint32_t
unicode
);
GlyphNode
*
GetNodeFromCache
(
uint32_t
unicode
,
uint8_t
fontId
);
GlyphNode
*
GetNodeCacheSpace
(
uint32_t
unicode
,
uint8_t
fontId
);
GlyphNode
*
GetNodeFromFile
(
uint32_t
unicode
,
uint8_t
fontId
);
uint32_t
AlignUp
(
uint32_t
addr
,
uint32_t
align
)
{
return
(((
addr
+
(
1
<<
align
))
>>
align
)
<<
align
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录