From 23a8422f6df376e747d8d7851372f4022d6f29b1 Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Thu, 20 Jul 2023 16:37:45 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!16135?= =?UTF-8?q?=20:=20=E3=80=904.0-Beta2=E3=80=91=E4=BF=AE=E5=A4=8DXComponent?= =?UTF-8?q?=20Texture=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=9C=89=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA=E5=86=85=E5=AE=B9=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pattern/xcomponent/xcomponent_pattern.cpp | 11 +++++------ .../pattern/xcomponent/xcomponent_pattern.h | 2 +- .../render/adapter/rosen_render_surface.cpp | 10 +--------- .../render/adapter/rosen_render_surface.h | 8 +------- frameworks/core/components_ng/render/render_surface.h | 3 +-- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index 22bd3d6c0fc..bdec852b0c3 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -127,8 +127,7 @@ void XComponentPattern::OnAttachToFrameNode() renderContext->SetClipToFrame(true); renderContext->SetClipToBounds(true); renderSurface_ = RenderSurface::Create(); - instanceId_ = Container::CurrentId(); - renderSurface_->SetInstanceId(instanceId_); + scopeId_ = Container::CurrentId(); if (type_ == XComponentType::SURFACE) { renderContextForSurface_ = RenderContext::Create(); static RenderContext::ContextParam param = { RenderContext::ContextType::SURFACE, id_ + "Surface" }; @@ -349,7 +348,7 @@ void XComponentPattern::InitNativeWindow(float textureWidth, float textureHeight void XComponentPattern::XComponentSizeInit() { - ContainerScope scope(instanceId_); + ContainerScope scope(scopeId_); auto context = PipelineContext::GetCurrentContext(); CHECK_NULL_VOID(context); InitNativeWindow(initSize_.Width(), initSize_.Height()); @@ -368,7 +367,7 @@ void XComponentPattern::XComponentSizeInit() void XComponentPattern::XComponentSizeChange(float textureWidth, float textureHeight) { - ContainerScope scope(instanceId_); + ContainerScope scope(scopeId_); auto context = PipelineContext::GetCurrentContext(); CHECK_NULL_VOID(context); auto viewScale = context->GetViewScale(); @@ -679,9 +678,9 @@ std::vector XComponentPattern::SetHistoryPo ExternalEvent XComponentPattern::CreateExternalEvent() { - return [weak = AceType::WeakClaim(this), instanceId = instanceId_]( + return [weak = AceType::WeakClaim(this), scopeId = scopeId_]( const std::string& componentId, const uint32_t nodeId, const bool isDestroy) { - ContainerScope scope(instanceId); + ContainerScope scope(scopeId); auto context = PipelineContext::GetCurrentContext(); CHECK_NULL_VOID(context); auto frontEnd = AceType::DynamicCast(context->GetFrontend()); diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h index 0053f05e973..12227ed8b3f 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h @@ -185,7 +185,7 @@ private: std::vector nativeXComponentTouchPoints_; RefPtr extSurfaceClient_; WeakPtr context_; - int32_t instanceId_; + int32_t scopeId_; SizeF initSize_; #ifdef OHOS_PLATFORM int64_t startIncreaseTime_ = 0; diff --git a/frameworks/core/components_ng/render/adapter/rosen_render_surface.cpp b/frameworks/core/components_ng/render/adapter/rosen_render_surface.cpp index 1f1e7722624..5164778015a 100644 --- a/frameworks/core/components_ng/render/adapter/rosen_render_surface.cpp +++ b/frameworks/core/components_ng/render/adapter/rosen_render_surface.cpp @@ -20,10 +20,8 @@ #include "base/memory/referenced.h" #include "base/utils/system_properties.h" #include "base/utils/utils.h" -#include "core/components_ng/base/frame_node.h" #include "core/components_ng/render/adapter/rosen_render_context.h" #include "core/components_ng/render/drawing.h" -#include "core/pipeline_ng/pipeline_context.h" namespace OHOS::Ace::NG { namespace { @@ -162,7 +160,6 @@ void RosenRenderSurface::SetExtSurfaceCallback(const RefPtr(paintRect.Width()); auto height = static_cast(paintRect.Height()); - ACE_SCOPED_TRACE("RosenRenderSurface::ConsumeBuffer (%d, %d)", width, height); sptr surfaceBuffer = nullptr; int32_t fence = -1; @@ -194,15 +190,11 @@ void RosenRenderSurface::ConsumeBuffer() auto* recordingCanvas = static_cast(canvas.get()); recordingCanvas->DrawSurfaceBuffer(info); #else - Rosen::RSModifierType::CONTENT_STYLE, - [surfaceBuffer, width, height](const std::shared_ptr& canvas) { + Rosen::RSModifierType::CONTENT_STYLE, [surfaceBuffer, width, height](const std::shared_ptr& canvas) { CHECK_NULL_VOID(canvas); #endif }); rosenRenderContext->StopRecordingIfNeeded(); - auto host = rosenRenderContext->GetHost(); - CHECK_NULL_VOID(host); - host->MarkNeedRenderOnly(); surfaceErr = consumerSurface_->ReleaseBuffer(surfaceBuffer, fence); if (surfaceErr != SURFACE_ERROR_OK) { diff --git a/frameworks/core/components_ng/render/adapter/rosen_render_surface.h b/frameworks/core/components_ng/render/adapter/rosen_render_surface.h index e3f02edd465..229c1737fc8 100644 --- a/frameworks/core/components_ng/render/adapter/rosen_render_surface.h +++ b/frameworks/core/components_ng/render/adapter/rosen_render_surface.h @@ -58,12 +58,7 @@ public: { isTexture_ = isTexture; } - - void SetInstanceId(int32_t instanceId) override - { - instanceId_ = instanceId; - } - + void ConsumeBuffer(); #ifdef OHOS_PLATFORM @@ -88,7 +83,6 @@ private: WeakPtr renderContext_ = nullptr; RefPtr extSurfaceCallbackInterface_ = nullptr; bool isTexture_ = false; - int32_t instanceId_; ACE_DISALLOW_COPY_AND_MOVE(RosenRenderSurface); }; diff --git a/frameworks/core/components_ng/render/render_surface.h b/frameworks/core/components_ng/render/render_surface.h index e8279223cf4..3ba0e1563da 100644 --- a/frameworks/core/components_ng/render/render_surface.h +++ b/frameworks/core/components_ng/render/render_surface.h @@ -70,9 +70,8 @@ public: virtual void SetIsFullScreen(bool isFullScreen) {} - virtual void SetInstanceId(int32_t instanceId) {} - protected: + ACE_DISALLOW_COPY_AND_MOVE(RenderSurface); }; } // namespace OHOS::Ace::NG -- Gitee