!39085 卡片SurfaceNode调用SetBounds时做四舍五入取整

Merge pull request !39085 from crecsent2021/20240727
This commit is contained in:
openharmony_ci 2024-07-29 13:23:53 +00:00 committed by Gitee
commit 62f6b5528a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 5 deletions

View File

@ -1366,7 +1366,8 @@ void FormPattern::AttachRSNode(const std::shared_ptr<Rosen::RSSurfaceNode>& node
boundWidth = size.Width() - cardInfo_.borderWidth * DOUBLE;
boundHeight = size.Height() - cardInfo_.borderWidth * DOUBLE;
}
externalRenderContext->SetBounds(cardInfo_.borderWidth, cardInfo_.borderWidth, boundWidth, boundHeight);
externalRenderContext->SetBounds(round(cardInfo_.borderWidth), round(cardInfo_.borderWidth),
round(boundWidth), round(boundHeight));
bool isRecover = want.GetBoolParam(OHOS::AppExecFwk::Constants::FORM_IS_RECOVER_FORM, false);
if (isRecover || formChildrenNodeMap_.find(FormChildNodeType::FORM_FORBIDDEN_ROOT_NODE)
@ -1445,8 +1446,8 @@ void FormPattern::FireFormSurfaceChangeCallback(float width, float height, float
{
auto externalRenderContext = DynamicCast<NG::RosenRenderContext>(GetExternalRenderContext());
CHECK_NULL_VOID(externalRenderContext);
externalRenderContext->SetBounds(borderWidth, borderWidth, width - borderWidth * DOUBLE,
height - borderWidth * DOUBLE);
externalRenderContext->SetBounds(round(borderWidth), round(borderWidth), round(width - borderWidth * DOUBLE),
round(height - borderWidth * DOUBLE));
auto host = GetHost();
CHECK_NULL_VOID(host);
auto renderContext = host->GetRenderContext();

View File

@ -112,8 +112,8 @@ void FormRenderer::RunFormPageInner(const OHOS::AAFwk::Want& want, const OHOS::A
if (rsSurfaceNode == nullptr) {
return;
}
rsSurfaceNode->SetBounds(borderWidth_, borderWidth_, width_ - borderWidth_ * DOUBLE,
height_ - borderWidth_ * DOUBLE);
rsSurfaceNode->SetBounds(round(borderWidth_), round(borderWidth_), round(width_ - borderWidth_ * DOUBLE),
round(height_ - borderWidth_ * DOUBLE));
if (renderingMode_ == AppExecFwk::Constants::RenderingMode::SINGLE_COLOR) {
HILOG_INFO("InitUIContent SetFormBackgroundColor #00FFFFFF");
uiContent_->SetFormBackgroundColor(TRANSPARENT_COLOR);