!426 修复snapshot不能正确截屏的问题

Merge pull request !426 from AliceGao/master
This commit is contained in:
openharmony_ci 2022-02-16 07:58:25 +00:00 committed by Gitee
commit 09a64e6368
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 4 deletions

View File

@ -119,9 +119,11 @@ void RsRenderServiceUtil::DrawBuffer(SkCanvas* canvas, sptr<OHOS::SurfaceBuffer>
std::make_unique<SkRect>(SkRect::MakeXYWH(0, 0, buffer->GetWidth(), buffer->GetHeight()));
if (isDrawnOnDisplay) {
const RSProperties& property = node.GetRenderProperties();
auto geotry = std::static_pointer_cast<RSObjAbsGeometry>(property.GetBoundsGeometry());
if (geotry) {
canvas->setMatrix(geotry->GetAbsMatrix());
auto geoptr = std::static_pointer_cast<RSObjAbsGeometry>(property.GetBoundsGeometry());
if (geoptr) {
canvas->setMatrix(geoptr->GetAbsMatrix());
canvas->scale(static_cast<double>(geoptr->GetAbsRect().width_)/static_cast<double>(buffer->GetWidth()),
static_cast<double>(geoptr->GetAbsRect().height_)/static_cast<double>(buffer->GetHeight()));
}
DealAnimation(canvas, paint, property, node.GetAnimationManager().GetTransitionProperties());
auto filter = std::static_pointer_cast<RSSkiaFilter>(property.GetBackgroundFilter());

View File

@ -148,7 +148,6 @@ void RSSurfaceCaptureTask::RSSurfaceCaptureVisitor::ProcessSurfaceRenderNode(RSS
ROSEN_LOGD("RSSurfaceCaptureTask::RSSurfaceCaptureVisitor::ProcessSurfaceRenderNode: node Buffer is nullptr!");
return;
}
RsRenderServiceUtil::DrawBuffer(canvas_.get(), node.GetBuffer(), node, isDisplayNode_);
for (auto child : node.GetChildren()) {
auto existingChild = child.lock();
if (!existingChild) {
@ -157,6 +156,7 @@ void RSSurfaceCaptureTask::RSSurfaceCaptureVisitor::ProcessSurfaceRenderNode(RSS
}
existingChild->Process(shared_from_this());
}
RsRenderServiceUtil::DrawBuffer(canvas_.get(), node.GetBuffer(), node, isDisplayNode_);
}
}
}