Skip to content

Commit 0eadaed

Browse files
authored
feat(ohos): disable text render v2 and prevent high frequent logs by system (#1498)
1. Prevent frequent log generated by ohos internal text rendering stack, aka, skia: "Call generatePaintRegion when paragraph is not formatted" 2. Disable text render v2 by default
1 parent 94afa1f commit 0eadaed

4 files changed

Lines changed: 7 additions & 10 deletions

File tree

core-render-ohos/src/main/cpp/libohos_render/api/include/Kuikly/Kuikly.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,6 @@ void KRRegisterColorAdapter(KRColorAdapterParseColor adapter);
328328
*/
329329
void KRDisableViewReuse();
330330

331-
/**
332-
* 启用新的文本渲染能力。
333-
* 这是一个临时API,后续会删除,未经沟通,请勿调用。
334-
*/
335-
void KREnableTextRenderV2();
336331

337332
/* ============ Text Post Processor Adapter ============
338333
*

core-render-ohos/src/main/cpp/libohos_render/expand/components/richtext/KRRichTextShadow.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include "libohos_render/utils/KRStringUtil.h"
4343
#include "libohos_render/utils/KRViewUtil.h"
4444

45-
static bool KR_TEXT_RENDER_V2_ENABLED = false;
4645
#ifdef __cplusplus
4746
extern "C" {
4847
#endif
@@ -54,9 +53,6 @@ extern void OH_Drawing_DestroyTextLines(OH_Drawing_Array* lines) __attribute__((
5453
extern void OH_Drawing_SetTypographyVerticalAlignment(OH_Drawing_TypographyStyle* style,
5554
OH_Drawing_TextVerticalAlignment alignment) __attribute__((weak));
5655

57-
void KREnableTextRenderV2(){
58-
KR_TEXT_RENDER_V2_ENABLED = true;
59-
}
6056
#ifdef __cplusplus
6157
};
6258
#endif

core-render-ohos/src/main/cpp/libohos_render/expand/components/richtext/KRRichTextShadow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ inline constexpr const char *kInternalImageSrcKey = "__kr_image_src__";
4343
} // namespace richtext
4444
} // namespace kuikly
4545

46+
constexpr bool KR_TEXT_RENDER_V2_ENABLED = false;
47+
4648
/**
4749
* 跨线程安全的 OH_Drawing_Typography 持有句柄。
4850
*

core-render-ohos/src/main/cpp/libohos_render/expand/components/richtext/KRRichTextView.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ static const char * kPropNameClick = "click";
6969
static const char * kPropNameLongPress = "longPress";
7070

7171
ArkUI_NodeHandle KRRichTextView::CreateNode() {
72-
return kuikly::util::GetNodeApi()->createNode(ARKUI_NODE_TEXT);
72+
if (KR_TEXT_RENDER_V2_ENABLED){
73+
return kuikly::util::GetNodeApi()->createNode(ARKUI_NODE_TEXT);
74+
} else {
75+
return kuikly::util::GetNodeApi()->createNode(ARKUI_NODE_CUSTOM);
76+
}
7377
}
7478

7579
void KRRichTextView::OnDestroy() {

0 commit comments

Comments
 (0)