mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
!48369 修复context在解绑canvas后仍能在该canvas上绘制的问题
Merge pull request !48369 from 陈俞池/cc1112
This commit is contained in:
commit
3afbd3bbd6
@ -38,11 +38,6 @@ void CanvasPattern::OnDetachFromFrameNode(FrameNode* frameNode)
|
||||
DetachRenderContext();
|
||||
}
|
||||
|
||||
void CanvasPattern::OnDetachFromMainTree()
|
||||
{
|
||||
DetachRenderContext();
|
||||
}
|
||||
|
||||
void CanvasPattern::AttachRenderContext()
|
||||
{
|
||||
isAttached_ = true;
|
||||
|
@ -194,7 +194,6 @@ public:
|
||||
private:
|
||||
void OnAttachToFrameNode() override;
|
||||
void OnDetachFromFrameNode(FrameNode* frameNode) override;
|
||||
void OnDetachFromMainTree() override;
|
||||
void FireOnContext2DAttach();
|
||||
void FireOnContext2DDetach();
|
||||
bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override;
|
||||
|
@ -60,6 +60,9 @@ void CanvasRenderingContext2DModelNG::OnDetachFromCanvas()
|
||||
if (onContext2DDetach_) {
|
||||
onContext2DDetach_();
|
||||
}
|
||||
if (apiVersion_ > static_cast<int32_t>(PlatformVersion::VERSION_FOURTEEN)) {
|
||||
weakPattern_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2DModelNG::SetPattern(RefPtr<AceType> newPattern)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "base/geometry/dimension.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "core/common/container.h"
|
||||
#include "core/components/common/layout/constants.h"
|
||||
#include "core/components_ng/pattern/canvas/canvas_renderer_type.h"
|
||||
#include <stdint.h>
|
||||
@ -29,7 +30,10 @@ class RenderingContext2DModel : public AceType {
|
||||
DECLARE_ACE_TYPE(RenderingContext2DModel, AceType)
|
||||
|
||||
public:
|
||||
RenderingContext2DModel() = default;
|
||||
RenderingContext2DModel()
|
||||
{
|
||||
apiVersion_ = Container::GetCurrentApiTargetVersion();
|
||||
}
|
||||
virtual ~RenderingContext2DModel() = default;
|
||||
|
||||
virtual void SetPattern(RefPtr<AceType> pattern) = 0;
|
||||
@ -131,6 +135,8 @@ public:
|
||||
pattern->SetTranslateY(transform.translateY);
|
||||
}
|
||||
|
||||
protected:
|
||||
int32_t apiVersion_ = 0;
|
||||
ACE_DISALLOW_COPY_AND_MOVE(RenderingContext2DModel);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user