!393 窗口大小变化时添加动画

Merge pull request !393 from mux/master
This commit is contained in:
openharmony_ci 2022-02-12 11:42:21 +00:00 committed by Gitee
commit 0c20ee6d9f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
14 changed files with 15 additions and 81 deletions

View File

@ -30,13 +30,12 @@ enum RSRootNodeCommandType : uint16_t {
class RootNodeCommandHelper {
public:
static void Create(RSContext& context, NodeId id);
static void AttachRSSurfaceNode(
RSContext& context, NodeId id, NodeId surfaceNodeId, int width, int height);
static void AttachRSSurfaceNode(RSContext& context, NodeId id, NodeId surfaceNodeId);
};
ADD_COMMAND(RSRootNodeCreate, ARG(ROOT_NODE, ROOT_NODE_CREATE, RootNodeCommandHelper::Create, NodeId))
ADD_COMMAND(RSRootNodeAttachRSSurfaceNode, ARG(ROOT_NODE, ROOT_NODE_ATTACH, RootNodeCommandHelper::AttachRSSurfaceNode,
NodeId, NodeId, int, int))
ADD_COMMAND(RSRootNodeAttachRSSurfaceNode,
ARG(ROOT_NODE, ROOT_NODE_ATTACH, RootNodeCommandHelper::AttachRSSurfaceNode, NodeId, NodeId))
} // namespace Rosen
} // namespace OHOS

View File

@ -30,9 +30,6 @@ public:
void Clear();
const RectI& GetDirtyRegion() const;
bool IsDirty() const;
void SetSurfaceSize(int w, int h);
int GetSurfaceWidth() const;
int GetSurfaceHeight() const;
void UpdateDirty();
private:

View File

@ -29,7 +29,7 @@ public:
virtual void Prepare(const std::shared_ptr<RSNodeVisitor>& visitor) override;
virtual void Process(const std::shared_ptr<RSNodeVisitor>& visitor) override;
void AttachRSSurfaceNode(NodeId SurfaceNodeId, int width, int height);
void AttachRSSurfaceNode(NodeId SurfaceNodeId);
RSRenderNodeType GetType() const override
{
@ -45,8 +45,6 @@ public:
void ClearSurfaceNodeInRS();
private:
int32_t surfaceWidth_ = 0;
int32_t surfaceHeight_ = 0;
std::shared_ptr<RSSurface> rsSurface_ = nullptr;
NodeId surfaceNodeId_;
std::vector<NodeId> childSurfaceNodeId_;

View File

@ -27,11 +27,10 @@ void RootNodeCommandHelper::Create(RSContext& context, NodeId id)
context.GetMutableNodeMap().RegisterRenderNode(node);
}
void RootNodeCommandHelper::AttachRSSurfaceNode(
RSContext& context, NodeId id, NodeId surfaceNodeId, int width, int height)
void RootNodeCommandHelper::AttachRSSurfaceNode(RSContext& context, NodeId id, NodeId surfaceNodeId)
{
if (auto node = context.GetNodeMap().GetRenderNode<RSRootRenderNode>(id)) {
node->AttachRSSurfaceNode(surfaceNodeId, width, height);
node->AttachRSSurfaceNode(surfaceNodeId);
context.GetGlobalRootRenderNode()->AddChild(node);
}
}

View File

@ -51,22 +51,6 @@ bool RSDirtyRegionManager::IsDirty() const
return (dirtyRegion_.width_ > 0) && (dirtyRegion_.height_ > 0);
}
void RSDirtyRegionManager::SetSurfaceSize(int w, int h)
{
surfaceWidth_ = w;
surfaceHeight_ = h;
}
int RSDirtyRegionManager::GetSurfaceWidth() const
{
return surfaceWidth_;
}
int RSDirtyRegionManager::GetSurfaceHeight() const
{
return surfaceHeight_;
}
void RSDirtyRegionManager::UpdateDirty()
{
PushHistory(dirtyRegion_);

View File

@ -29,21 +29,19 @@ RSRootRenderNode::RSRootRenderNode(NodeId id, std::weak_ptr<RSContext> context)
RSRootRenderNode::~RSRootRenderNode() {}
void RSRootRenderNode::AttachRSSurfaceNode(NodeId surfaceNodeId, int width, int height)
void RSRootRenderNode::AttachRSSurfaceNode(NodeId surfaceNodeId)
{
surfaceNodeId_ = surfaceNodeId;
surfaceWidth_ = width;
surfaceHeight_ = height;
}
int32_t RSRootRenderNode::GetSurfaceWidth() const
{
return surfaceWidth_;
return GetRenderProperties().GetFrameWidth();
}
int32_t RSRootRenderNode::GetSurfaceHeight() const
{
return surfaceHeight_;
return GetRenderProperties().GetFrameHeight();
}
std::shared_ptr<RSSurface> RSRootRenderNode::GetSurface()

View File

@ -15,8 +15,8 @@
#include "pipeline/rs_render_thread_visitor.h"
#include <include/core/SkFont.h>
#include <include/core/SkColor.h>
#include <include/core/SkFont.h>
#include <include/core/SkPaint.h>
#include "pipeline/rs_canvas_render_node.h"

View File

@ -19,8 +19,8 @@
#include "pipeline/rs_node_map.h"
#include "platform/common/rs_log.h"
#include "transaction/rs_transaction_proxy.h"
#include "ui/rs_ui_director.h"
#include "ui/rs_surface_node.h"
#include "ui/rs_ui_director.h"
namespace OHOS {
namespace Rosen {
@ -39,10 +39,9 @@ std::shared_ptr<RSNode> RSRootNode::Create(bool isRenderServiceNode)
RSRootNode::RSRootNode(bool isRenderServiceNode) : RSCanvasNode(isRenderServiceNode) {}
void RSRootNode::AttachRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode, int width, int height) const
void RSRootNode::AttachRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode) const
{
std::unique_ptr<RSCommand> command =
std::make_unique<RSRootNodeAttachRSSurfaceNode>(GetId(), surfaceNode->GetId(), width, height);
std::unique_ptr<RSCommand> command = std::make_unique<RSRootNodeAttachRSSurfaceNode>(GetId(), surfaceNode->GetId());
auto transactionProxy = RSTransactionProxy::GetInstance();
if (transactionProxy != nullptr) {
transactionProxy->AddCommand(command, IsRenderServiceNode());

View File

@ -37,7 +37,7 @@ public:
}
protected:
void AttachRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode, int width, int height) const;
void AttachRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode) const;
RSRootNode(bool isRenderServiceNode);
RSRootNode(const RSRootNode&) = delete;

View File

@ -94,13 +94,6 @@ void RSUIDirector::SetRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode)
AttachSurface();
}
void RSUIDirector::SetSurfaceNodeSize(int width, int height)
{
surfaceWidth_ = width;
surfaceHeight_ = height;
AttachSurface();
}
void RSUIDirector::SetRoot(NodeId root)
{
if (root_ == root) {
@ -115,7 +108,7 @@ void RSUIDirector::AttachSurface()
{
auto node = RSNodeMap::Instance().GetNode<RSRootNode>(root_);
if (node != nullptr && surfaceNode_ != nullptr) {
node->AttachRSSurfaceNode(surfaceNode_, surfaceWidth_, surfaceHeight_);
node->AttachRSSurfaceNode(surfaceNode_);
ROSEN_LOGD("RSUIDirector::AttachSurface [%llu]", surfaceNode_->GetId());
} else {
ROSEN_LOGD("RSUIDirector::AttachSurface not ready");

View File

@ -36,7 +36,6 @@ public:
void GoForeground();
void Init();
void SetRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode);
void SetSurfaceNodeSize(int width, int height);
void SetRoot(NodeId root);
void SetUITaskRunner(const TaskRunner& uiTaskRunner);

View File

@ -68,7 +68,6 @@ int main()
std::cout << "rs app demo stage 1 " << std::endl;
rsUiDirector->SetRSSurfaceNode(surfaceNode);
rsUiDirector->SetSurfaceNodeSize(rect.width_, rect.height_);
Init(rsUiDirector, rect.width_, rect.height_);
rsUiDirector->SendMessages();
sleep(1);
@ -78,7 +77,6 @@ int main()
window->Resize(2560, resizeH);
rootNode->SetBounds(0, 0, 2560, resizeH);
rootNode->SetBackgroundColor(SK_ColorYELLOW);
rsUiDirector->SetSurfaceNodeSize(2560, resizeH);
rsUiDirector->SendMessages();
sleep(4);
@ -102,7 +100,6 @@ int main()
// window->Resize(2560, resizeH);
// rootNode->SetBounds(0, 0, 2560, resizeH);
// rootNode->SetBackgroundColor(SK_ColorYELLOW);
// rsUiDirector->SetSurfaceNodeSize(2560, resizeH);
// rsUiDirector->SendMessages();
// sleep(4);

View File

@ -96,7 +96,6 @@ void Init(std::shared_ptr<RSUIDirector> rsUiDirector, int width, int height)
if (!rsUiDirector) {
return;
}
rsUiDirector->SetSurfaceNodeSize(width, height);
rsUiDirector->Init();
std::cout << "Init Rosen Backend" << std::endl;

View File

@ -48,32 +48,6 @@ void RSUIDirectorTest::TearDownTestCase() {}
void RSUIDirectorTest::SetUp() {}
void RSUIDirectorTest::TearDown() {}
/**
* @tc.name: SetSurfaceNodeSize001
* @tc.desc:
* @tc.type:FUNC
* @tc.require:AR000GGR40
* @tc.author:
*/
HWTEST_F(RSUIDirectorTest, SetSurfaceNodeSize001, TestSize.Level1)
{
std::shared_ptr<RSUIDirector> director = RSUIDirector::Create();
director->SetSurfaceNodeSize(g_normalInt_1, g_normalInt_2);
}
/**
* @tc.name: SetSurfaceNodeSize002
* @tc.desc:
* @tc.type:FUNC
* @tc.require:AR000GGR40
* @tc.author:
*/
HWTEST_F(RSUIDirectorTest, SetSurfaceNodeSize002, TestSize.Level1)
{
std::shared_ptr<RSUIDirector> director = RSUIDirector::Create();
director->SetSurfaceNodeSize(std::numeric_limits<int>::max(), std::numeric_limits<int>::min());
}
/**
* @tc.name: SetTimeStamp001
* @tc.desc:
@ -221,8 +195,6 @@ HWTEST_F(RSUIDirectorTest, UIDirectorTotal001, TestSize.Level1)
director->Init();
director->SetSurfaceNodeSize(800, 600);
director->SetRoot(rootNode->GetId());
director->SetTimeStamp(345);