fix(ohos): decode Canvas images into SDR shared memory - #97
Merged
Conversation
bytemain
force-pushed
the
cindy/task41-ohos-canvas-sdr
branch
from
July 31, 2026 05:39
5c4c608 to
87bd867
Compare
Signed-off-by: artin <artin@cat.ms>
bytemain
force-pushed
the
cindy/task41-ohos-canvas-sdr
branch
from
July 31, 2026 05:44
87bd867 to
fe7ce77
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Root cause
On HOP-AL10, a 2160x3840 HDR JPEG (
sHdr:4) decoded successfully into a hardware/surface-buffer PixelMap (memType:4) afterGetByteCount pixelFormat 0 error, but the Kuikly editor rendered it as black. The cache path previously requestedIMAGE_DYNAMIC_RANGE_AUTOand the system-selected allocator.Both editor consumers converge on this cache:
rememberAsyncImagePainterandrememberAsyncImageBitmapuseKuiklyImageCacheManager, which callsMemoryCacheModule.cacheImage. In OHOS native render,KRMemoryCacheModule::GetImage()has one external consumer:KRCanvasView::DrawImage; ordinaryKRImageViewdoes not consumeimage_cache_map_. This makes CPU-readable output a Canvas-cache contract rather than a global ArkUI Image policy.Decode policy
API 15+:
IMAGE_DYNAMIC_RANGE_SDRtone-maps HDR before allocationPIXEL_FORMAT_RGBA_8888removes the unknown/HDR pixel formatOH_ImageSourceNative_CreatePixelmapUsingAllocator(..., IMAGE_ALLOCATOR_TYPE_SHARE_MEMORY, ...)prevents a hardware/surface-buffer resultAPI 12-14 compatibility:
OH_PixelmapNative_ReadPixelsmust copy the complete row-stride buffer successfully, proving CPU readabilityValidation
fe7ce7724296849a3932678571fbcbd6322593cew(weak undefined); API12 decoder andReadPixelsare ordinary supported importsProduct gate
Physical validation remains in mobile task #41: the same HDR sample plus an ordinary SDR JPEG control must pass preview, edit, save, upload, restart/restore, and process-liveness checks on HOP-AL10.