!17334 fix DrawingSurfaceBufferInfo dstRect size error

Merge pull request !17334 from zhuxiaoyu/fix_DrawingSurfaceBufferInfo_size_error
This commit is contained in:
openharmony_ci 2024-11-21 10:09:38 +00:00 committed by Gitee
commit 6d85ee794f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 3 deletions

View File

@ -46,8 +46,9 @@ struct DrawingSurfaceBufferInfo {
DrawingSurfaceBufferInfo() = default;
DrawingSurfaceBufferInfo(const sptr<SurfaceBuffer>& surfaceBuffer, int offSetX, int offSetY, int width, int height,
pid_t pid = {}, uint64_t uid = {}, sptr<SyncFence> acquireFence = nullptr, Drawing::Rect srcRect = {})
: surfaceBuffer_(surfaceBuffer), srcRect_(srcRect), dstRect_(Drawing::Rect { offSetX, offSetY, width, height }),
pid_(pid), uid_(uid), acquireFence_(acquireFence)
: surfaceBuffer_(surfaceBuffer), srcRect_(srcRect),
dstRect_(Drawing::Rect { offSetX, offSetY, offSetX + width, offSetY + height }), pid_(pid), uid_(uid),
acquireFence_(acquireFence)
{}
sptr<SurfaceBuffer> surfaceBuffer_ = nullptr;
Drawing::Rect srcRect_;

View File

@ -813,7 +813,8 @@ void RSRenderThreadVisitor::ProcessSurfaceViewInRT(RSSurfaceRenderNode& node)
ScalingMode scalingMode = surfaceBuffer->GetSurfaceBufferScalingMode();
Drawing::Rect srcRect { 0, 0, surfaceBuffer->GetWidth(), surfaceBuffer->GetHeight() };
Drawing::Rect dstRect { 0, 0, bounds.width_, bounds.height_ };
Drawing::Rect boundsRect = { bounds.left_, bounds.top_, bounds.width_, bounds.height_ };
Drawing::Rect boundsRect = { bounds.left_, bounds.top_, bounds.left_ + bounds.width_,
bounds.top_ + bounds.height_ };
if (scalingMode == ScalingMode::SCALING_MODE_SCALE_CROP) {
RSRenderThreadUtil::SrcRectScaleDown(srcRect, boundsRect);
} else if (scalingMode == ScalingMode::SCALING_MODE_SCALE_FIT) {