Fix bug that snapshot capture uncorrectly

Signed-off-by: AliceGao <gaobinbin3@huawei.com>
Change-Id: I3715be076a2b14f89f288f8ac7d89b84f47bfe32
This commit is contained in:
AliceGao 2022-02-16 10:30:19 +08:00
parent 2bc81e75e6
commit 37af26d74b
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_);
}
}
}