未验证 提交 6fa5b022 编写于 作者: S SimpleCodeer 提交者: Gitee

Description: improve bitmap search performance

IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I6FTGQ
Feature or Bugfix: Fea1
Binary Source:No
Signed-off-by: NSimpleCodeer <dulu150@126.com>
上级 e43962af
......@@ -68,7 +68,7 @@ uint8_t* UIFontCache::GetSpace(uint16_t fontId, uint32_t unicode, uint32_t size,
ListInit(&bitmap->hashHead);
ListInit(&bitmap->lruHead);
ListAdd(&bitmap->hashHead, hashTable_ + fontId % FONT_CACHE_HASH_NR);
ListAdd(&bitmap->hashHead, hashTable_ + unicode % FONT_CACHE_HASH_NR);
ListAdd(&bitmap->lruHead, &lruList_);
bitmap->fontId = fontId;
......@@ -96,7 +96,7 @@ void UIFontCache::PutSpace(uint8_t* addr)
uint8_t* UIFontCache::GetBitmap(uint16_t fontKey, uint32_t unicode, TextStyle textStyle)
{
Bitmap* bitmap = nullptr;
ListHead* head = hashTable_ + fontKey % FONT_CACHE_HASH_NR;
ListHead* head = hashTable_ + unicode % FONT_CACHE_HASH_NR;
for (ListHead* node = head->next; node != head; node = node->next) {
bitmap = reinterpret_cast<struct Bitmap*>(reinterpret_cast<uint8_t*>(node) -
offsetof(struct Bitmap, hashHead));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册