-
Notifications
You must be signed in to change notification settings - Fork 22
ohos: Improve the skeleton code of ovCompose access to OHOS unified rendering (Render Service) #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sebuntin
wants to merge
41
commits into
Tencent-TDS:ohos-compose-1.6.1-20250919
Choose a base branch
from
sebuntin:ohos-compose-1.6.1-20250919
base: ohos-compose-1.6.1-20250919
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6b67931
ohos: Add skeleton code for OHOS text measurement and rendering
a34ddc2
feat:add picture recorder for render node
bulloo 64268a2
Merge pull request #1 from bulloo/wxjer_renderNode
sebuntin c4be0c4
ohos: Implement OHComposeNativePaint and enhance AdaptiveCanvas with …
fc27bab
ohos: Implement save, restore, and translate methods in OHNativeCanva…
f2b2658
ohos: Introduce NativeBasicShader and related gradient shaders for en…
917adb0
Merge pull request #3 from ywenjing/ohos-compose-ywjing
ywenjing ff6eb1c
refactor: Update enum references and improve rendering node structure
10e1477
ohos: Fix OverScroll animation issues by correctly parsing VSync sign…
dbef123
ohos: Provides native support for measuring, layout, and drawing of o…
b90d637
Merge pull request #7 from ywenjing/oh-compoe-ywenjing
sebuntin 11141c7
ohos: Add support for Debug configuration in build.gradle.kts and adj…
3a977da
ohos: Enhance AdaptiveCanvas with drawParagraph method and improve na…
7e33ba8
Merge pull request #8 from ywenjing/oh-compose-ywenjing
sebuntin 9a32515
ohos: Refactor Paragraph handling to integrate spanStyle and placehol…
804a59c
ohos: Refactor Paragraph handling to integrate spanStyle and placehol…
9395ef8
feat:wrapper OH_HiTrace
bulloo f4cfc11
Merge branch 'ohos-compose-1.6.1-20250919' into wxjer_trace
bulloo e13a895
ohos: Refactor Paragraph handling to integrate spanStyle and placehol…
90b3e66
Merge pull request #5 from bulloo/wxjer_trace
bulloo 18c323b
refactor: Update Paragraph class for improved style handling and memo…
9aaf8a8
feat: Add isTraceEnabled property to TraceUtil for trace control
2ce4f2f
refactor: Improve invalidate logic and enhance hash functions for bet…
1b2af1e
refactor: Enhance parameter passing and const correctness in canvas d…
2e0da5d
feat:implement drawingItem diff
bulloo 6fe1a62
Merge pull request #9 from bulloo/wxjer_diff
sebuntin 22fbf30
fix: 解决LazyColumn组件的滑动问题
c48de70
feat: Add LayerSourceType metadata to distinguish LazyList item layers
1e18964
refactor: Update logging syntax to use lambda expressions for better …
d78a58f
refactor: Add some trace point and improve rendering performance
ade7cf8
feat: Add support for drawing oval, arc, image, and path shapes in ca…
93de649
refactor: Improve rendering backend handling
604aeb2
feat: Add support for drawing points and rendering text by converting…
73b2f65
feat: Implement clipping functionality for rectangles, round rectangl…
432cdf5
feat: Enhance AdaptiveCanvas with clearClip, saveLayer, enableZ, and …
9ffee47
feat: Enhance AdaptiveCanvas with clearClip, saveLayer, enableZ, and …
f250582
feat: Enhance AdaptiveCanvas with clearClip, saveLayer, enableZ, and …
113de7d
feat: Refactor drawing logic to incorporate translation adjustments a…
181f80e
feat: Introduce AsyncTaskRenderNode for asynchronous rendering tasks …
f38294f
feat: Add CircleGradientRenderNode and PathGradientRenderNode for enh…
3d49d57
feat: Implement OHDrawingPixelMapCache for optimized pixel map handli…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...se/ui/ui/src/ohosArm64Main/kotlin/androidx/compose/ui/platform/nativefoundation/Inject.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package androidx.compose.ui.platform.nativefoundation | ||
|
|
||
| import androidx.compose.ui.arkui.RenderingBackend | ||
| import androidx.compose.ui.text.AnnotatedString | ||
| import androidx.compose.ui.text.OHOSParagraph | ||
| import androidx.compose.ui.text.OHOSParagraphIntrinsics | ||
| import androidx.compose.ui.text.Paragraph | ||
| import androidx.compose.ui.text.ParagraphIntrinsics | ||
| import androidx.compose.ui.text.Placeholder | ||
| import androidx.compose.ui.text.SpanStyle | ||
| import androidx.compose.ui.text.TextStyle | ||
| import androidx.compose.ui.text.font.FontFamily | ||
| import androidx.compose.ui.text.platform.PlatformParagraphFactory | ||
| import androidx.compose.ui.text.platform.platformParagraphFactory | ||
| import androidx.compose.ui.unit.Constraints | ||
| import androidx.compose.ui.unit.Density | ||
|
|
||
| private var didInject = false | ||
|
|
||
| internal fun injectForCompose(renderBackend: RenderingBackend) { | ||
|
|
||
| if (didInject) return | ||
| didInject = true | ||
|
|
||
| /*注入 OHOS 平台的 Paragraph */ | ||
| platformParagraphFactory = object : PlatformParagraphFactory { | ||
| override fun createParagraph( | ||
| intrinsics: ParagraphIntrinsics, | ||
| maxLines: Int, | ||
| ellipsis: Boolean, | ||
| constraints: Constraints | ||
| ): Paragraph? = if (renderBackend == RenderingBackend.ArkUIRenderNode) OHOSParagraph( | ||
| intrinsics as OHOSParagraphIntrinsics, | ||
| maxLines, | ||
| ellipsis, | ||
| constraints | ||
| ) else null | ||
|
|
||
| override fun createParagraphIntrinsics( | ||
| text: String, | ||
| style: TextStyle, | ||
| spanStyles: List<AnnotatedString.Range<SpanStyle>>, | ||
| placeholders: List<AnnotatedString.Range<Placeholder>>, | ||
| density: Density, | ||
| fontFamilyResolver: FontFamily.Resolver | ||
| ): ParagraphIntrinsics? = | ||
| if (renderBackend == RenderingBackend.ArkUIRenderNode) OHOSParagraphIntrinsics( | ||
| text, | ||
| style, | ||
| spanStyles, | ||
| placeholders, | ||
| density, | ||
| fontFamilyResolver | ||
| ) else null | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
compose/ui/ui/src/ohosArm64Main/kotlin/androidx/compose/ui/text/OHNativeParagraphProxy.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| package androidx.compose.ui.text | ||
|
|
||
| import androidx.compose.ui.geometry.Rect | ||
| import androidx.compose.ui.unit.Density | ||
| import platform.arkui.ArkUI_RenderNodeHandle | ||
| import org.jetbrains.skia.Point | ||
|
|
||
| class OHNativeParagraphProxy { | ||
|
|
||
| fun getRenderNodeHandle(): ArkUI_RenderNodeHandle? { | ||
| return null | ||
| } | ||
|
|
||
| fun getFirstBaseline(): Float { | ||
| // TODO: Implement logic to get the first baseline | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineLeft(lineIndex: Int): Float { | ||
| // TODO: Implement logic to get the line left | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineRight(lineIndex: Int): Float { | ||
| // TODO: Implement logic to get the line right | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineTop(lineIndex: Int): Float { | ||
| // TODO: Implement logic to get the line top | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineBottom(lineIndex: Int): Float { | ||
| // TODO: Implement logic to get the line bottom | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineHeight(lineIndex: Int): Float { | ||
| // TODO: Implement logic to get the line height | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineWidth(lineIndex: Int): Float { | ||
| // TODO: Implement logic to get the line width | ||
| return 0F | ||
| } | ||
|
|
||
| fun getLineStart(lineIndex: Int): Int { | ||
| // TODO: Implement logic to get the line start | ||
| return 0 | ||
| } | ||
|
|
||
| fun getLineEnd(lineIndex: Int, visibleEnd: Boolean): Int { | ||
| // TODO: Implement logic to get the line end | ||
| return 0 | ||
| } | ||
|
|
||
| fun isLineEllipsized(lineIndex: Int): Boolean { | ||
| // TODO: Implement logic to check if the line is ellipsized | ||
| return false | ||
| } | ||
|
|
||
| fun getLineForOffset(offset: Int): Int { | ||
| // TODO: Implement logic to get the line offset | ||
| return 0 | ||
| } | ||
|
|
||
| fun lineCount(): Int { | ||
| // TODO: Implement logic to get the line count | ||
| return 0 | ||
| } | ||
|
|
||
| fun getRectsForRange(start: Int, end: Int): List<Rect> { | ||
| // TODO: Implement logic to get the rects for the specified range | ||
| return emptyList() | ||
| } | ||
|
|
||
| fun getCursorRect(offset: Int): Rect { | ||
| // TODO: Implement logic to get the cursor rect at the specified offset | ||
| return Rect(0F, 0F, 0F, 0F) | ||
| } | ||
|
|
||
| // 获取坐标对应的字符所在的索引位置 | ||
| fun getOffsetForPositionX(x: Float, y: Float): Int { | ||
| // TODO: Implement logic to get the offset for the specified position | ||
| return 0 | ||
| } | ||
|
|
||
| fun getLastBaseline(): Float { | ||
| // TODO: Implement logic to get the last baseline | ||
| return 0F | ||
| } | ||
|
|
||
| // 根据字符所在的offset偏移找到该字符单词的范围 | ||
| fun getWordBoundary(offset: Int): TextRange { | ||
| // TODO: Implement logic to get the word boundary for the specified offset | ||
| return TextRange(0, 0) | ||
| } | ||
|
|
||
| fun paintWithColor(colorValue: ULong) { | ||
| } | ||
|
|
||
| fun measureAndLayout(text: String, maxWidth: Float, maxHeight: Float, density: Density): Point { | ||
| // TODO: Implement text measurement and layout logic | ||
| return Point(0F, 0F) | ||
| } | ||
|
|
||
| fun relayoutWithMaxWidth(maxWidth: Float, maxHeight: Float, maxLines: Int, ellipsis: Boolean) { | ||
| // TODO: Implement text measurement and layout logic | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.