upload preview scale code

Signed-off-by: penghongxing <penghongxing@huawei.com>
This commit is contained in:
penghongxing 2023-12-16 20:55:00 +08:00
parent 6a63bc2aea
commit 15cd3ad346
24 changed files with 660 additions and 67 deletions

View File

@ -489,6 +489,27 @@ void SubwindowOhos::ClearMenu()
#endif
}
void SubwindowOhos::ShowPreviewNG()
{
ShowWindow();
ResizeWindow();
window_->SetTouchable(false);
}
void SubwindowOhos::HidePreviewNG()
{
auto overlayManager = GetOverlayManager();
CHECK_NULL_VOID(overlayManager);
overlayManager->RemovePixelMap();
overlayManager->RemoveEventColumn();
auto aceContainer = Platform::AceContainer::GetContainer(childContainerId_);
CHECK_NULL_VOID(aceContainer);
auto pipeline = DynamicCast<NG::PipelineContext>(aceContainer->GetPipelineContext());
CHECK_NULL_VOID(pipeline);
pipeline->FlushPipelineImmediately();
HideSubWindowNG();
}
void SubwindowOhos::ShowMenuNG(const RefPtr<NG::FrameNode> menuNode, int32_t targetId, const NG::OffsetF& offset)
{
auto aceContainer = Platform::AceContainer::GetContainer(childContainerId_);

View File

@ -59,6 +59,8 @@ public:
NG::RectF GetRect() override;
void ShowMenu(const RefPtr<Component>& newComponent) override;
void ShowMenuNG(const RefPtr<NG::FrameNode> menuNode, int32_t targetId, const NG::OffsetF& offset) override;
void ShowPreviewNG() override;
void HidePreviewNG() override;
void HideMenuNG(const RefPtr<NG::FrameNode>& menu, int32_t targetId) override;
void HideMenuNG(bool showPreviewAnimation, bool startDrag) override;
void ShowPopup(const RefPtr<Component>& newComponent, bool disableTouchEvent = true) override;

View File

@ -39,6 +39,8 @@ public:
virtual NG::RectF GetRect() = 0;
virtual void ShowMenu(const RefPtr<Component>& newComponent) = 0;
virtual void ShowMenuNG(const RefPtr<NG::FrameNode> menuNode, int32_t targetId, const NG::OffsetF& offset) = 0;
virtual void ShowPreviewNG() = 0;
virtual void HidePreviewNG() = 0;
virtual void HideMenuNG(const RefPtr<NG::FrameNode>& menu, int32_t targetId) = 0;
virtual void HideMenuNG(bool showPreviewAnimation = true, bool startDrag = false) = 0;
virtual void ShowPopup(const RefPtr<Component>& newComponent, bool disableTouchEvent = true) = 0;

View File

@ -178,6 +178,19 @@ Rect SubwindowManager::GetParentWindowRect()
return currentSubwindow_->GetParentWindowRect();
}
RefPtr<Subwindow> SubwindowManager::ShowPreviewNG()
{
auto containerId = Container::CurrentId();
auto subwindow = GetSubwindow(containerId);
if (!subwindow) {
subwindow = Subwindow::CreateSubwindow(containerId);
subwindow->InitContainer();
AddSubwindow(containerId, subwindow);
}
subwindow->ShowPreviewNG();
return subwindow;
}
void SubwindowManager::ShowMenuNG(
const RefPtr<NG::FrameNode>& menuNode, int32_t targetId, const NG::OffsetF& offset, bool isAboveApps)
{
@ -191,6 +204,14 @@ void SubwindowManager::ShowMenuNG(
subwindow->ShowMenuNG(menuNode, targetId, offset);
}
void SubwindowManager::HidePreviewNG()
{
auto subwindow = GetCurrentWindow();
if (subwindow) {
subwindow->HidePreviewNG();
}
}
void SubwindowManager::HideMenuNG(const RefPtr<NG::FrameNode>& menu, int32_t targetId)
{
auto subwindow = GetCurrentWindow();

View File

@ -61,6 +61,8 @@ public:
const RefPtr<Subwindow>& GetCurrentWindow();
Rect GetParentWindowRect();
RefPtr<Subwindow> ShowPreviewNG();
void HidePreviewNG();
void ShowMenu(const RefPtr<Component>& newComponent);
void ShowMenuNG(
const RefPtr<NG::FrameNode>& menuNode, int32_t targetId, const NG::OffsetF& offset, bool isAboveApps = false);

View File

@ -2146,6 +2146,7 @@ var FinishCallbackType;
FinishCallbackType["REMOVED"] = 0;
FinishCallbackType["LOGICALLY"] = 1;
})(FinishCallbackType || (FinishCallbackType = {}));
var WebLayoutMode;
(function (WebLayoutMode) {
WebLayoutMode[WebLayoutMode["NONE"] = 0] = "NONE";

View File

@ -43,6 +43,7 @@ enum class GridColumnType {
CAR_DIALOG,
LIST_CARD,
NAVIGATION_TOOLBAR,
DRAG_PANEL,
};
class GridLayoutInfo : public virtual AceType {

View File

@ -84,6 +84,9 @@ const std::map<GridColumnType, std::vector<SystemGridInfo>> SYSTEM_GRID_TYPES =
{ GridColumnType::NAVIGATION_TOOLBAR, { SystemGridInfo(GridSizeType::SM, LARGE_GUTTER, LARGE_MARGIN, 4),
SystemGridInfo(GridSizeType::MD, LARGE_GUTTER, LARGE_MARGIN, 8),
SystemGridInfo(GridSizeType::LG, LARGE_GUTTER, LARGE_MARGIN, 12) } },
{ GridColumnType::DRAG_PANEL, { SystemGridInfo(GridSizeType::SM, SMALL_GUTTER, SMALL_MARGIN, 3),
SystemGridInfo(GridSizeType::MD, SMALL_GUTTER, SMALL_GUTTER, 4),
SystemGridInfo(GridSizeType::LG, SMALL_GUTTER, SMALL_MARGIN, 5) } },
};
} // namespace

View File

@ -30,6 +30,7 @@
#include "core/common/ace_application_info.h"
#include "core/common/container.h"
#include "core/components/common/layout/constants.h"
#include "core/components/common/layout/grid_system_manager.h"
#include "core/components_ng/base/frame_scene_status.h"
#include "core/components_ng/base/inspector.h"
#include "core/components_ng/base/ui_node.h"
@ -2397,6 +2398,39 @@ std::vector<RefPtr<FrameNode>> FrameNode::GetNodesById(const std::unordered_set<
return nodes;
}
double FrameNode::GetMaxWidthWithColumnType(GridColumnType gridColumnType)
{
RefPtr<GridColumnInfo> columnInfo = GridSystemManager::GetInstance().GetInfoByType(gridColumnType);
if (columnInfo->GetParent()) {
columnInfo->GetParent()->BuildColumnWidth();
}
auto gridSizeType = GridSystemManager::GetInstance().GetCurrentSize();
if (gridSizeType > GridSizeType::LG) {
gridSizeType = GridSizeType::LG;
}
auto columns = columnInfo->GetColumns(gridSizeType);
return columnInfo->GetWidth(columns);
}
double FrameNode::GetPreviewScaleVal() const
{
double scale = 1.0;
auto maxWidth = GetMaxWidthWithColumnType(GridColumnType::DRAG_PANEL);
auto geometryNode = GetGeometryNode();
CHECK_NULL_RETURN(geometryNode, scale);
auto width = geometryNode->GetFrameRect().Width();
if (GetTag() != V2::WEB_ETS_TAG && width != 0 && width > maxWidth &&
previewOption_.mode != DragPreviewMode::DISABLE_SCALE) {
scale = maxWidth / width;
}
return scale;
}
bool FrameNode::IsPreviewNeedScale() const
{
return GetPreviewScaleVal() < 1.0f;
}
int32_t FrameNode::GetNodeExpectedRate()
{
if (sceneRateMap_.empty()) {
@ -2847,6 +2881,31 @@ bool FrameNode::CheckNeedForceMeasureAndLayout()
return CheckNeedMeasure(flag) || CheckNeedLayout(flag);
}
OffsetF FrameNode::GetGlobalOffset()
{
auto frameOffset = GetPaintRectOffset();
auto pipelineContext = PipelineContext::GetCurrentContext();
CHECK_NULL_RETURN(pipelineContext, OffsetF(0.0f, 0.0f));
auto windowOffset = pipelineContext->GetWindow()->GetCurrentWindowRect().GetOffset();
frameOffset += OffsetT<float> { windowOffset.GetX(), windowOffset.GetY() };
return frameOffset;
}
RefPtr<PixelMap> FrameNode::GetPixelMap()
{
auto gestureHub = GetOrCreateGestureEventHub();
CHECK_NULL_RETURN(gestureHub, nullptr);
RefPtr<PixelMap> pixelMap = gestureHub->GetPixelMap();
// if gesture already have pixel map return directly
if (pixelMap) {
return pixelMap;
}
CHECK_NULL_RETURN(renderContext_, nullptr);
pixelMap = renderContext_->GetThumbnailPixelMap();
gestureHub->SetPixelMap(pixelMap);
return pixelMap;
}
float FrameNode::GetBaselineDistance() const
{
const auto& children = frameProxy_->GetAllFrameChildren();

View File

@ -370,6 +370,11 @@ public:
return isLayoutDirtyMarked_;
}
void SetLayoutDirtyMarked(bool marked)
{
isLayoutDirtyMarked_ = marked;
}
bool HasPositionProp() const
{
CHECK_NULL_RETURN(renderContext_, false);
@ -496,6 +501,12 @@ public:
static std::vector<RefPtr<FrameNode>> GetNodesById(const std::unordered_set<int32_t>& set);
static double GetMaxWidthWithColumnType(GridColumnType gridColumnType);
double GetPreviewScaleVal() const;
bool IsPreviewNeedScale() const;
void SetViewPort(RectF viewPort)
{
viewPort_ = viewPort;
@ -626,7 +637,8 @@ public:
{
return localMat_;
}
OffsetF GetGlobalOffset();
RefPtr<PixelMap> GetPixelMap();
RefPtr<FrameNode> GetPageNode();
void NotifyFillRequestSuccess(RefPtr<PageNodeInfoWrap> nodeWrap, AceAutoFillType autoFillType);
void NotifyFillRequestFailed(int32_t errCode);

View File

@ -546,6 +546,80 @@ OffsetF DragEventActuator::GetFloatImageOffset(const RefPtr<FrameNode>& frameNod
return OffsetF(offsetX, offsetY);
}
void DragEventActuator::UpdatePreviewPositionAndScale(const RefPtr<FrameNode> imageNode, const OffsetF& frameOffset)
{
auto imageContext = imageNode->GetRenderContext();
CHECK_NULL_VOID(imageContext);
imageContext->UpdatePosition(OffsetT<Dimension>(Dimension(frameOffset.GetX()), Dimension(frameOffset.GetY())));
ClickEffectInfo clickEffectInfo;
clickEffectInfo.level = ClickEffectLevel::LIGHT;
clickEffectInfo.scaleNumber = SCALE_NUMBER;
imageContext->UpdateClickEffectLevel(clickEffectInfo);
}
void DragEventActuator::CreatePreviewNode(const RefPtr<FrameNode> frameNode, OHOS::Ace::RefPtr<FrameNode>& imageNode)
{
CHECK_NULL_VOID(frameNode);
auto pixelMap = frameNode->GetPixelMap();
CHECK_NULL_VOID(pixelMap);
auto frameOffset = frameNode->GetGlobalOffset();
imageNode = FrameNode::GetOrCreateFrameNode(V2::IMAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
[]() {return AceType::MakeRefPtr<ImagePattern>(); });
CHECK_NULL_VOID(imageNode);
imageNode->SetDragPreviewOptions(frameNode->GetDragPreviewOption());
auto renderProps = imageNode->GetPaintProperty<ImageRenderProperty>();
renderProps->UpdateImageInterpolation(ImageInterpolation::HIGH);
auto props = imageNode->GetLayoutProperty<ImageLayoutProperty>();
props->UpdateAutoResize(false);
props->UpdateImageSourceInfo(ImageSourceInfo(pixelMap));
auto targetSize = CalcSize(NG::CalcLength(pixelMap->GetWidth()), NG::CalcLength(pixelMap->GetHeight()));
props->UpdateUserDefinedIdealSize(targetSize);
UpdatePreviewPositionAndScale(imageNode, frameOffset);
imageNode->MarkDirtyNode(NG::PROPERTY_UPDATE_MEASURE);
imageNode->MarkModifyDone();
imageNode->SetLayoutDirtyMarked(true);
imageNode->CreateLayoutTask();
}
void DragEventActuator::SetPreviewDefaultAnimateProperty(const RefPtr<FrameNode> imageNode)
{
if (imageNode->IsPreviewNeedScale()) {
auto imageContext = imageNode->GetRenderContext();
CHECK_NULL_VOID(imageContext);
imageContext->UpdateTransformScale({ 1.0f, 1.0f });
imageContext->UpdateTransformTranslate({ 0.0f, 0.0f, 0.0f });
}
}
void DragEventActuator::MountPixelMap(const RefPtr<OverlayManager> manager, const RefPtr<GestureEventHub> gestureHub,
const RefPtr<FrameNode> imageNode)
{
CHECK_NULL_VOID(manager);
CHECK_NULL_VOID(imageNode);
CHECK_NULL_VOID(gestureHub);
auto columnNode = FrameNode::CreateFrameNode(V2::COLUMN_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
AceType::MakeRefPtr<LinearLayoutPattern>(true));
columnNode->AddChild(imageNode);
auto hub = columnNode->GetOrCreateGestureEventHub();
CHECK_NULL_VOID(hub);
hub->SetPixelMap(gestureHub->GetPixelMap());
auto container = Container::Current();
if (container && container->IsScenceBoardWindow()) {
auto frameNode = gestureHub->GetFrameNode();
CHECK_NULL_VOID(frameNode);
auto windowScene = manager->FindWindowScene(frameNode);
manager->MountPixelMapToWindowScene(columnNode, windowScene);
} else {
manager->MountPixelMapToRootNode(columnNode);
}
SetPreviewDefaultAnimateProperty(imageNode);
columnNode->MarkDirtyNode(NG::PROPERTY_UPDATE_MEASURE);
columnNode->MarkModifyDone();
columnNode->CreateLayoutTask();
}
void DragEventActuator::SetPixelMap(const RefPtr<DragEventActuator>& actuator)
{
if (SystemProperties::GetDebugEnabled()) {
@ -617,6 +691,7 @@ void DragEventActuator::SetPixelMap(const RefPtr<DragEventActuator>& actuator)
if (SystemProperties::GetDebugEnabled()) {
LOGI("DragEvent set pixelMap success.");
}
SetPreviewDefaultAnimateProperty(imageNode);
}
void DragEventActuator::SetEventColumn(const RefPtr<DragEventActuator>& actuator)
@ -786,6 +861,7 @@ void DragEventActuator::SetTextAnimation(const RefPtr<GestureEventHub>& gestureH
pattern->CloseHandleAndSelect();
auto dragNode = pattern->MoveDragNode();
CHECK_NULL_VOID(dragNode);
dragNode->SetDragPreviewOptions(frameNode->GetDragPreviewOption());
// create columnNode
auto columnNode = FrameNode::CreateFrameNode(V2::COLUMN_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
AceType::MakeRefPtr<LinearLayoutPattern>(true));
@ -833,9 +909,11 @@ void DragEventActuator::HideTextAnimation(bool startDrag, double globalX, double
if (SystemProperties::GetDebugEnabled()) {
LOGI("In removeColumnNode callback, set DragWindowVisible true.");
}
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
auto gestureHub = weakEvent.Upgrade();
CHECK_NULL_VOID(gestureHub);
if (!gestureHub->IsPixelMapNeedScale()) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
}
gestureHub->SetPixelMap(nullptr);
};
AnimationOption option;
@ -854,8 +932,7 @@ void DragEventActuator::HideTextAnimation(bool startDrag, double globalX, double
auto pixelMap = gestureHub->GetPixelMap();
float scale = 1.0f;
if (pixelMap) {
scale =
gestureHub->GetPixelMapScale(dragNode->GetDragPreviewOption(), pixelMap->GetHeight(), pixelMap->GetWidth());
scale = static_cast<float>(frameNode->GetPreviewScaleVal());
}
auto context = dragNode->GetRenderContext();
CHECK_NULL_VOID(context);

View File

@ -31,6 +31,7 @@ class GestureEventHub;
class PanRecognizer;
class LongPressRecognizer;
class FrameNode;
class OverlayManager;
class DragEvent : public AceType {
DECLARE_ACE_TYPE(DragEvent, AceType)
@ -107,6 +108,11 @@ public:
#ifdef ENABLE_DRAG_FRAMEWORK
void SetThumbnailCallback(std::function<void(Offset)>&& callback);
void SetFilter(const RefPtr<DragEventActuator>& actuator);
static void UpdatePreviewPositionAndScale(const RefPtr<FrameNode> imageNode, const OffsetF& frameOffset);
static void CreatePreviewNode(const RefPtr<FrameNode> frameNode, OHOS::Ace::RefPtr<FrameNode>& imageNode);
static void SetPreviewDefaultAnimateProperty(const RefPtr<FrameNode> imageNode);
static void MountPixelMap(const RefPtr<OverlayManager> overlayManager, const RefPtr<GestureEventHub> manager,
const RefPtr<FrameNode> imageNode);
void SetPixelMap(const RefPtr<DragEventActuator>& actuator);
void SetEventColumn(const RefPtr<DragEventActuator>& actuator);
void HideFilter();

View File

@ -20,10 +20,12 @@
#include "base/log/log_wrapper.h"
#include "base/memory/ace_type.h"
#include "base/subwindow/subwindow_manager.h"
#include "base/utils/time_util.h"
#include "core/common/container.h"
#include "core/common/interaction/interaction_data.h"
#include "core/common/interaction/interaction_interface.h"
#include "core/components/container_modal/container_modal_constants.h"
#include "core/components_ng/base/frame_node.h"
#include "core/components_ng/event/click_event.h"
#include "core/components_ng/event/event_hub.h"
@ -385,6 +387,22 @@ void GestureEventHub::CombineIntoExclusiveRecognizer(
result.swap(finalResult);
}
#ifdef ENABLE_DRAG_FRAMEWORK
bool GestureEventHub::IsPixelMapNeedScale() const
{
CHECK_NULL_RETURN(pixelMap_, false);
auto frameNode = GetFrameNode();
CHECK_NULL_RETURN(frameNode, false);
auto width = pixelMap_->GetWidth();
auto maxWidth = FrameNode::GetMaxWidthWithColumnType(GridColumnType::DRAG_PANEL);
if (frameNode->GetTag() == V2::WEB_ETS_TAG ||
frameNode->GetDragPreviewOption().mode == DragPreviewMode::DISABLE_SCALE || width == 0 || width < maxWidth) {
return false;
}
return true;
}
#endif
void GestureEventHub::InitDragDropEvent()
{
auto actionStartTask = [weak = WeakClaim(this)](const GestureEvent& info) {
@ -591,56 +609,24 @@ float GestureEventHub::GetPixelMapScale(
return scale * windowScale;
}
std::function<void()> GestureEventHub::GetMousePixelMapCallback(const GestureEvent& info)
void GestureEventHub::GenerateMousePixelMap(const GestureEvent& info)
{
auto&& callback = [weak = WeakClaim(this), info]() {
auto gestureHub = weak.Upgrade();
CHECK_NULL_VOID(gestureHub);
std::shared_ptr<Media::PixelMap> pixelMap;
auto frameNode = gestureHub->GetFrameNode();
CHECK_NULL_VOID(frameNode);
RefPtr<RenderContext> context;
if (gestureHub->GetTextDraggable()) {
auto pattern = frameNode->GetPattern<TextDragBase>();
CHECK_NULL_VOID(pattern);
auto dragNode = pattern->MoveDragNode();
CHECK_NULL_VOID(dragNode);
context = dragNode->GetRenderContext();
} else {
context = frameNode->GetRenderContext();
}
CHECK_NULL_VOID(context);
auto thumbnailPixelMap = context->GetThumbnailPixelMap();
CHECK_NULL_VOID(thumbnailPixelMap);
pixelMap = thumbnailPixelMap->GetPixelMapSharedPtr();
CHECK_NULL_VOID(pixelMap);
float scale = gestureHub->GetPixelMapScale(
frameNode->GetDragPreviewOption(), pixelMap->GetHeight(), pixelMap->GetWidth());
pixelMap->scale(scale, scale, Media::AntiAliasingOption::NONE);
auto pipeline = PipelineContext::GetCurrentContext();
CHECK_NULL_VOID(pipeline);
auto dragDropManager = pipeline->GetDragDropManager();
CHECK_NULL_VOID(dragDropManager);
if (!dragDropManager->IsDragged()) {
return;
}
int32_t width = pixelMap->GetWidth();
int32_t height = pixelMap->GetHeight();
auto pixelMapOffset = gestureHub->GetPixelMapOffset(info, SizeF(width, height), scale, !NearEqual(scale, 1.0f));
ShadowInfoCore shadowInfo { pixelMap, pixelMapOffset.GetX(), pixelMapOffset.GetY() };
int ret = InteractionInterface::GetInstance()->UpdateShadowPic(shadowInfo);
if (ret != 0) {
return;
}
if (SystemProperties::GetDebugEnabled()) {
TAG_LOGI(AceLogTag::ACE_GESTURE, "In setThumbnailPixelMap callback, set DragWindowVisible true.");
}
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
dragDropManager->SetIsDragWindowShow(true);
dragDropManager->FireOnEditableTextComponent(frameNode, DragEventType::ENTER);
dragDropManager->SetPreviewRect(Rect(pixelMapOffset.GetX(), pixelMapOffset.GetY(), width, height));
};
return callback;
auto frameNode = GetFrameNode();
CHECK_NULL_VOID(frameNode);
RefPtr<RenderContext> context;
if (GetTextDraggable()) {
auto pattern = frameNode->GetPattern<TextDragBase>();
CHECK_NULL_VOID(pattern);
auto dragNode = pattern->MoveDragNode();
CHECK_NULL_VOID(dragNode);
context = dragNode->GetRenderContext();
} else {
context = frameNode->GetRenderContext();
}
CHECK_NULL_VOID(context);
auto thumbnailPixelMap = context->GetThumbnailPixelMap();
CHECK_NULL_VOID(thumbnailPixelMap);
SetPixelMap(thumbnailPixelMap);
}
#endif
@ -799,16 +785,18 @@ void GestureEventHub::OnDragStart(const GestureEvent& info, const RefPtr<Pipelin
std::shared_ptr<Media::PixelMap> pixelMap;
if (dragDropInfo.pixelMap != nullptr) {
pixelMap = dragDropInfo.pixelMap->GetPixelMapSharedPtr();
SetPixelMap(dragDropInfo.pixelMap);
} else if (g_getPixelMapSucc) {
pixelMap = g_pixelMap->GetPixelMapSharedPtr();
SetPixelMap(g_pixelMap);
} else if (info.GetInputEventType() == InputEventType::MOUSE_BUTTON) {
dragDropManager->SetIsMouseDrag(true);
pixelMap = CreatePixelMapFromString(DEFAULT_MOUSE_DRAG_IMAGE);
CHECK_NULL_VOID(pixelMap);
auto taskScheduler = pipeline->GetTaskExecutor();
CHECK_NULL_VOID(taskScheduler);
auto callback = GetMousePixelMapCallback(info);
taskScheduler->PostTask(callback, TaskExecutor::TaskType::UI);
GenerateMousePixelMap(info);
pixelMap = pixelMap_->GetPixelMapSharedPtr();
} else {
CHECK_NULL_VOID(pixelMap_);
if (pixelMap == nullptr) {
@ -819,14 +807,28 @@ void GestureEventHub::OnDragStart(const GestureEvent& info, const RefPtr<Pipelin
info.GetInputEventType() == InputEventType::MOUSE_BUTTON ? 1.0f : DEFALUT_DRAG_PPIXELMAP_SCALE;
float scale = GetPixelMapScale(frameNode->GetDragPreviewOption(), pixelMap->GetHeight(), pixelMap->GetWidth()) *
defaultPixelMapScale;
pixelMap->scale(scale, scale, Media::AntiAliasingOption::HIGH);
auto overlayManager = pipeline->GetOverlayManager();
CHECK_NULL_VOID(overlayManager);
if (IsPixelMapNeedScale()) {
RefPtr<FrameNode> imageNode = overlayManager->GetPixelMapContentNode();
DragEventActuator::CreatePreviewNode(frameNode, imageNode);
CHECK_NULL_VOID(imageNode);
auto window = SubwindowManager::GetInstance()->ShowPreviewNG();
CHECK_NULL_VOID(window);
overlayManager = window->GetOverlayManager();
CHECK_NULL_VOID(overlayManager);
DragEventActuator::MountPixelMap(overlayManager, eventHub->GetGestureEventHub(), imageNode);
dragDropManager->DoDragStartAnimation(overlayManager, info);
scale = static_cast<float>(imageNode->GetPreviewScaleVal());
if (pixelMap_ != nullptr) {
pixelMap = pixelMap_->GetPixelMapSharedPtr();
}
}
if (!overlayManager->GetIsOnAnimation()) {
dragEventActuator_->SetIsNotInPreviewState(true);
}
uint32_t width = pixelMap->GetWidth();
uint32_t height = pixelMap->GetHeight();
pixelMap->scale(scale, scale, Media::AntiAliasingOption::HIGH);
auto width = pixelMap->GetWidth();
auto height = pixelMap->GetHeight();
auto pixelMapOffset = GetPixelMapOffset(info, SizeF(width, height), scale, !NearEqual(scale, defaultPixelMapScale));
auto extraInfoLimited = dragDropInfo.extraInfo.size() > EXTRA_INFO_MAX_LENGTH
? dragDropInfo.extraInfo.substr(EXTRA_INFO_MAX_LENGTH + 1)
@ -840,6 +842,10 @@ void GestureEventHub::OnDragStart(const GestureEvent& info, const RefPtr<Pipelin
info.GetScreenLocation().GetY(), info.GetTargetDisplayId(), true, summary };
ret = InteractionInterface::GetInstance()->StartDrag(dragData, GetDragCallback(pipeline, eventHub));
if (ret != 0) {
if (dragDropManager->IsNeedScaleDragPreview()) {
SubwindowManager::GetInstance()->HidePreviewNG();
overlayManager->RemovePixelMap();
}
return;
}
dragDropManager->SetDraggingPointer(info.GetPointerId());
@ -850,13 +856,17 @@ void GestureEventHub::OnDragStart(const GestureEvent& info, const RefPtr<Pipelin
eventManager->DoMouseActionRelease();
eventManager->SetIsDragging(true);
if (info.GetInputEventType() != InputEventType::MOUSE_BUTTON && dragEventActuator_->GetIsNotInPreviewState()) {
overlayManager->RemovePixelMap();
pipeline->FlushPipelineImmediately();
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
if (!dragDropManager->IsNeedScaleDragPreview()) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
overlayManager->RemovePixelMap();
pipeline->FlushPipelineImmediately();
}
dragDropManager->FireOnEditableTextComponent(frameNode, DragEventType::ENTER);
} else if (info.GetInputEventType() == InputEventType::MOUSE_BUTTON &&
(dragDropInfo.pixelMap || dragDropInfo.customNode)) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
if (!dragDropManager->IsNeedScaleDragPreview()) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
}
dragDropManager->SetIsDragWindowShow(true);
}
dragDropProxy_ = dragDropManager->CreateFrameworkDragDropProxy();

View File

@ -524,11 +524,11 @@ public:
#ifdef ENABLE_DRAG_FRAMEWORK
int32_t SetDragData(const RefPtr<UnifiedData>& unifiedData, std::string& udKey);
OnDragCallbackCore GetDragCallback(const RefPtr<PipelineBase>& context, const WeakPtr<EventHub>& hub);
std::function<void()> GetMousePixelMapCallback(const GestureEvent& info);
void GenerateMousePixelMap(const GestureEvent& info);
OffsetF GetPixelMapOffset(
const GestureEvent& info, const SizeF& size, const float scale = 1.0f, const bool needScale = false) const;
float GetPixelMapScale(const DragPreviewOption& option, const int32_t height, const int32_t width) const;
bool IsPixelMapNeedScale() const;
#endif // ENABLE_DRAG_FRAMEWORK
void InitDragDropEvent();
void HandleOnDragStart(const GestureEvent& info);

View File

@ -96,6 +96,22 @@ RefPtr<DragDropProxy> DragDropManager::CreateTextDragDropProxy()
return MakeRefPtr<DragDropProxy>(currentId_);
}
void DragDropManager::OnDragOut()
{
#ifdef ENABLE_DRAG_FRAMEWORK
if (IsNeedScaleDragPreview()) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
auto containerId = Container::CurrentId();
auto subwindow = SubwindowManager::GetInstance()->GetSubwindow(containerId);
CHECK_NULL_VOID(subwindow);
auto overlayManager = subwindow->GetOverlayManager();
overlayManager->RemovePixelMap();
SubwindowManager::GetInstance()->HidePreviewNG();
info_.scale = -1.0;
}
#endif
}
void DragDropManager::CreateDragWindow(const GestureEvent& info, uint32_t width, uint32_t height)
{
#if !defined(PREVIEW)
@ -1176,6 +1192,136 @@ void DragDropManager::UpdateVelocityTrackerPoint(const Point& point, bool isEnd)
velocityTracker_.UpdateTrackerPoint(point.GetX(), point.GetY(), curTime, isEnd);
}
#ifdef ENABLE_DRAG_FRAMEWORK
bool DragDropManager::GetDragPreviewInfo(const RefPtr<OverlayManager> overlayManager,
DragPreviewInfo& dragPreviewInfo)
{
if (!overlayManager->GetHasPixelMap()) {
return false;
}
auto imageNode = overlayManager->GetPixelMapContentNode();
if (!imageNode) {
return false;
}
double maxWidth = FrameNode::GetMaxWidthWithColumnType(GridColumnType::DRAG_PANEL);
auto width = imageNode->GetGeometryNode()->GetFrameRect().Width();
dragPreviewInfo.scale = static_cast<float>(imageNode->GetPreviewScaleVal());
dragPreviewInfo.height = imageNode->GetGeometryNode()->GetFrameRect().Height();
dragPreviewInfo.width = static_cast<double>(width);
dragPreviewInfo.maxWidth = maxWidth;
dragPreviewInfo.imageNode = imageNode;
return true;
}
bool DragDropManager::IsNeedScaleDragPreview()
{
return info_.scale > 0 && info_.scale < 1.0f;
}
double DragDropManager::CalcDragPreviewDistanceWithPoint(
const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info)
{
CHECK_NULL_RETURN(info.imageNode, 0.0);
auto nodeOffset = info.imageNode->GetTransformRelativeOffset();
auto renderContext = info.imageNode->GetRenderContext();
CHECK_NULL_RETURN(renderContext, 0.0);
auto width = renderContext->GetPaintRectWithTransform().Width();
nodeOffset.SetX(nodeOffset.GetX() + width / 2);
nodeOffset.SetY(nodeOffset.GetY() + preserverHeight.ConvertToPx());
auto pipeline = PipelineContext::GetCurrentContext();
if (pipeline) {
auto windowOffset = pipeline->GetWindow()->GetCurrentWindowRect().GetOffset();
x += windowOffset.GetX();
y += windowOffset.GetY();
}
return sqrt(pow(nodeOffset.GetX() - x, 2) + pow(nodeOffset.GetY() - y, 2));
}
Offset DragDropManager::CalcDragMoveOffset(
const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info)
{
CHECK_NULL_RETURN(info.imageNode, Offset(0.0f, 0.0f));
auto originPoint = info.imageNode->GetOffsetRelativeToWindow();
if (IsNeedScaleDragPreview()) {
originPoint.SetX(originPoint.GetX() + 0.5 * (1 - info.scale) * info.width + info.maxWidth / 2);
originPoint.SetY(originPoint.GetY() + 0.5 * (1 - info.scale) * info.height + preserverHeight.ConvertToPx());
}
Offset newOffset { x - originPoint.GetX(), y - originPoint.GetY() };
auto pipeline = PipelineContext::GetCurrentContext();
if (pipeline) {
auto windowOffset = pipeline->GetWindow()->GetCurrentWindowRect().GetOffset();
newOffset.SetX(newOffset.GetX() + windowOffset.GetX());
newOffset.SetY(newOffset.GetY() + windowOffset.GetY());
}
return newOffset;
}
void DragDropManager::DoDragMoveAnimate(const PointerEvent& pointerEvent)
{
if (!IsNeedScaleDragPreview()) {
return;
}
auto pipeline = PipelineContext::GetCurrentContext();
auto containerId = Container::CurrentId();
auto subwindow = SubwindowManager::GetInstance()->GetSubwindow(containerId);
CHECK_NULL_VOID(subwindow);
auto overlayManager = subwindow->GetOverlayManager();
CHECK_NULL_VOID(overlayManager);
Dimension preserveHeight = 8.0_vp;
auto x = pointerEvent.GetPoint().GetX();
auto y = pointerEvent.GetPoint().GetY();
Offset newOffset = CalcDragMoveOffset(preserveHeight, x, y, info_);
AnimationOption option;
const RefPtr<Curve> curve = AceType::MakeRefPtr<ResponsiveSpringMotion>(0.347f, 0.99f, 0.0f);
constexpr int32_t animateDuration = 30;
option.SetCurve(curve);
option.SetDuration(animateDuration);
auto distance = CalcDragPreviewDistanceWithPoint(preserveHeight, x, y, info_);
option.SetOnFinishEvent([distance, overlayManager, pipeline]() {
constexpr decltype(distance) MAX_DIS = 5.0;
if (distance < MAX_DIS) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
if (overlayManager->GetHasPixelMap()) {
SubwindowManager::GetInstance()->HidePreviewNG();
overlayManager->RemovePixelMap();
}
}
});
auto renderContext = info_.imageNode->GetRenderContext();
CHECK_NULL_VOID(renderContext);
AnimationUtils::Animate(
option,
[renderContext, localPoint = newOffset]() {
renderContext->UpdateTransformTranslate({ localPoint.GetX(), localPoint.GetY(), 0.0f });
},
option.GetOnFinishEvent());
}
void DragDropManager::DoDragStartAnimation(const RefPtr<OverlayManager> overlayManager, const GestureEvent& event)
{
CHECK_NULL_VOID(overlayManager);
if (!(GetDragPreviewInfo(overlayManager, info_)) || !IsNeedScaleDragPreview()) {
return;
}
Dimension preserveHeight = 8.0_vp;
Offset newOffset = CalcDragMoveOffset(preserveHeight,
static_cast<int32_t>(event.GetGlobalLocation().GetX()), static_cast<int32_t>(event.GetGlobalLocation().GetY()),
info_);
AnimationOption option;
const RefPtr<Curve> curve = AceType::MakeRefPtr<ResponsiveSpringMotion>(0.347f, 0.99f, 0.0f);
constexpr int32_t animateDuration = 30;
option.SetCurve(curve);
option.SetDuration(animateDuration);
auto renderContext = info_.imageNode->GetRenderContext();
AnimationUtils::Animate(
option,
[renderContext, scale = info_.scale, newOffset]() {
renderContext->UpdateTransformScale({ scale, scale });
renderContext->UpdateTransformTranslate({ newOffset.GetX(), newOffset.GetY(), 0.0f });
},
option.GetOnFinishEvent());
}
#endif
void DragDropManager::FireOnEditableTextComponent(const RefPtr<FrameNode>& frameNode,
DragEventType type)
{

View File

@ -72,6 +72,8 @@ public:
textFieldDragFrameNodes_.try_emplace(id, dragFrameNode);
}
void OnDragOut();
void UpdateDragWindowPosition(int32_t globalX, int32_t globalY);
void OnDragStart(const Point& point);
void OnDragStart(const Point& point, const RefPtr<FrameNode>& frameNode);
@ -234,7 +236,28 @@ public:
return true;
}
typedef struct DragPreviewInfo {
double width { 0.0 };
double height { 0.0 };
double maxWidth { 0.0 };
double scale { -1.0 };
RefPtr<FrameNode> imageNode { nullptr };
} DragPreviewInfo;
#ifdef ENABLE_DRAG_FRAMEWORK
bool IsNeedScaleDragPreview();
void DoDragMoveAnimate(const PointerEvent& pointerEvent);
void DoDragStartAnimation(const RefPtr<OverlayManager> overlayManager, const GestureEvent& event);
#endif
private:
#ifdef ENABLE_DRAG_FRAMEWORK
double CalcDragPreviewDistanceWithPoint(
const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info);
Offset CalcDragMoveOffset(
const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info);
bool GetDragPreviewInfo(
const OHOS::Ace::RefPtr<OHOS::Ace::NG::OverlayManager> overlayManager, DragPreviewInfo& dragPreviewInfo);
#endif
RefPtr<FrameNode> FindDragFrameNodeByPosition(float globalX, float globalY, DragType dragType, bool findDrop);
void FireOnDragEvent(
const RefPtr<FrameNode>& frameNode, const Point& point, DragEventType type, const std::string& extraInfo);
@ -288,6 +311,7 @@ private:
VelocityTracker velocityTracker_;
DragDropMgrState dragDropState_ = DragDropMgrState::IDLE;
Rect previewRect_ { -1, -1, -1, -1 };
DragPreviewInfo info_;
ACE_DISALLOW_COPY_AND_MOVE(DragDropManager);
};

View File

@ -107,7 +107,6 @@ void DragDropProxy::onDragCancel()
auto manager = pipeline->GetDragDropManager();
CHECK_NULL_VOID(manager);
CHECK_NULL_VOID(manager->CheckDragDropProxy(id_));
manager->onDragCancel();
}

View File

@ -3070,9 +3070,13 @@ void OverlayManager::RemovePixelMapAnimation(bool startDrag, double x, double y)
scaleOption.SetOnFinishEvent([this, id = Container::CurrentId()] {
ContainerScope scope(id);
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
auto pipeline = PipelineContext::GetCurrentContext();
CHECK_NULL_VOID(pipeline);
auto dragDropManager = pipeline->GetDragDropManager();
CHECK_NULL_VOID(dragDropManager);
if (!dragDropManager->IsNeedScaleDragPreview()) {
InteractionInterface::GetInstance()->SetDragWindowVisible(true);
}
auto taskScheduler = pipeline->GetTaskExecutor();
CHECK_NULL_VOID(taskScheduler);
taskScheduler->PostTask(

View File

@ -229,6 +229,16 @@ public:
return pixmapColumnNodeWeak_.Upgrade();
}
RefPtr<FrameNode> GetPixelMapContentNode() const
{
auto column = pixmapColumnNodeWeak_.Upgrade();
if (!column) {
return nullptr;
}
auto imageNode = AceType::DynamicCast<FrameNode>(column->GetFirstChild());
return imageNode;
}
bool GetHasFilter()
{
return hasFilter_;

View File

@ -2493,6 +2493,7 @@ void PipelineContext::OnDragEvent(const PointerEvent& pointerEvent, DragEventAct
manager->OnDragMoveOut(pointerEvent, extraInfo);
manager->ClearSummary();
manager->ClearExtraInfo();
manager->OnDragOut();
return;
}
#endif // ENABLE_DRAG_FRAMEWORK
@ -2510,8 +2511,19 @@ void PipelineContext::OnDragEvent(const PointerEvent& pointerEvent, DragEventAct
#ifndef ENABLE_DRAG_FRAMEWORK
manager->RestoreClipboardData();
#endif // ENABLE_DRAG_FRAMEWORK
#ifdef ENABLE_DRAG_FRAMEWORK
SubwindowManager::GetInstance()->HidePreviewNG();
auto overlayManager = GetOverlayManager();
CHECK_NULL_VOID(overlayManager);
overlayManager->RemovePixelMap();
#endif
return;
}
#ifdef ENABLE_DRAG_FRAMEWORK
if (action == DragEventAction::DRAG_EVENT_MOVE) {
manager->DoDragMoveAnimate(pointerEvent);
}
#endif
manager->OnDragMove(pointerEvent, extraInfo);
}

View File

@ -30,6 +30,8 @@ public:
MOCK_METHOD0(GetRect, NG::RectF());
MOCK_METHOD1(ShowMenu, void(const RefPtr<Component>& newComponent));
MOCK_METHOD3(ShowMenuNG, void(const RefPtr<NG::FrameNode> menuNode, int32_t targetId, const NG::OffsetF& offset));
MOCK_METHOD0(ShowPreviewNG, void());
MOCK_METHOD0(HidePreviewNG, void());
MOCK_METHOD2(HideMenuNG, void(const RefPtr<NG::FrameNode>& menu, int32_t targetId));
MOCK_METHOD2(HideMenuNG, void(bool showPreviewAnimation, bool startDrag));
MOCK_METHOD2(ShowPopup, void(const RefPtr<Component>& newComponent, bool disableTouchEvent));

View File

@ -24,6 +24,7 @@ ace_unittest("geometry_test") {
"matrix3_test.cpp",
"matrix4_test.cpp",
"quaternion_test.cpp",
"subwindow_manager_test.cpp",
"transform_util_test.cpp",
]
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "gtest/gtest.h"
#include "base/subwindow/subwindow_manager.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS::Ace {
namespace {
// SUB_WINDOW_MANAGER =
} // namespace
class SubwindowManagerTest : public testing::Test {
public:
void SetUp() override {};
void TearDown() override {};
};
/**
* @tc.name: SubwindowManagerTest_ShowPreviewNG001
* @tc.desc: Test frame node method ShowPreviewNG
* @tc.type: FUNC
*/
HWTEST_F(SubwindowManagerTest, ShowPreviewNG001, TestSize.Level1)
{
/**
* @tc.steps: step1. get subwindowManager.
*/
auto manager = SubwindowManager::GetInstance();
ASSERT_NE(manager, nullptr);
/**
* @tc.steps: step2.
* @tc.expected: expect ShowPreviewNG return result which is not nullptr.
*/
EXPECT_NE(manager->ShowPreviewNG(), nullptr);
}
/**
* @tc.name: SubwindowManagerTest_HidePreviewNG001
* @tc.desc: Test frame node method HidePreviewNG
* @tc.type: FUNC
*/
HWTEST_F(SubwindowManagerTest, HidePreviewNG001, TestSize.Level1)
{
/**
* @tc.steps: step1. get subwindowManager, and initialize parameters.
*/
auto manager = SubwindowManager::GetInstance();
ASSERT_NE(manager, nullptr);
auto subwindow = manager->ShowPreviewNG();
ASSERT_NE(subwindow, nullptr);
manager->SetCurrentSubwindow(subwindow);
ASSERT_NE(manager->GetCurrentWindow(), nullptr);
/**
* @tc.steps: step2. call HidePreviewNG.
* @tc.expected: expect HidePreviewNG run ok, and current window is not nullptr.
*/
manager->HidePreviewNG();
EXPECT_NE(manager->GetCurrentWindow(), nullptr);
}
}

View File

@ -67,6 +67,8 @@ const float CONTAINER_HEIGHT = 1000.0f;
const SizeF CONTAINER_SIZE(CONTAINER_WIDTH, CONTAINER_HEIGHT);
const OffsetF OFFSETF { 1.0, 1.0 };
const float DEFAULT_X = 10;
const float DEFAULT_Y = 10;
constexpr uint64_t TIMESTAMP_1 = 100;
constexpr uint64_t TIMESTAMP_2 = 101;
@ -2245,4 +2247,102 @@ HWTEST_F(FrameNodeTestNg, CollectTouchInfos003, TestSize.Level1)
GET_PARENT->CollectTouchInfos(globalPoint, parentRevertPoint, touchInfos);
EXPECT_EQ(touchInfos.size(), 0);
}
/**
* @tc.name: FrameNodeTestNg_IsPreviewNeedScale001
* @tc.desc: Test frame node method IsPreviewNeedScale
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeTestNg, IsPreviewNeedScale001, TestSize.Level1)
{
/**
* @tc.steps: step1. initialize parameters.
*/
FRAME_NODE->isActive_ = true;
FRAME_NODE->eventHub_->SetEnabled(true);
SystemProperties::debugEnabled_ = true;
/**
* @tc.steps: step2. call IsPreviewNeedScale
* @tc.expected: expect IsPreviewNeedScale return false.
*/
EXPECT_FALSE(FRAME_NODE->IsPreviewNeedScale());
/**
* @tc.steps: step2. set a large size and call IsPreviewNeedScale.
* @tc.expected: expect IsPreviewNeedScale return true.
*/
auto geometryNode = FRAME_NODE->GetGeometryNode();
geometryNode->SetFrameSize(CONTAINER_SIZE);
EXPECT_TRUE(FRAME_NODE->IsPreviewNeedScale());
}
/**
* @tc.name: FrameNodeTestNg_GetGlobalOffset001
* @tc.desc: Test frame node method GetGlobalOffset
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeTestNg, GetGlobalOffset001, TestSize.Level1)
{
/**
* @tc.steps: step1. initialize parameters.
*/
FRAME_NODE->isActive_ = true;
FRAME_NODE->eventHub_->SetEnabled(true);
SystemProperties::debugEnabled_ = true;
auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
ASSERT_NE(mockRenderContext, nullptr);
mockRenderContext->rect_ = RectF(DEFAULT_X, DEFAULT_Y, DEFAULT_X, DEFAULT_Y);
FRAME_NODE->renderContext_ = mockRenderContext;
/**
* @tc.steps: step2. call GetGlobalOffset.
* @tc.expected: expect GetGlobalOffset return the result which is not (0, 0).
*/
EXPECT_NE(FRAME_NODE->GetGlobalOffset(), OffsetF(0.0f, 0.0f));
}
/**
* @tc.name: FrameNodeTestNg_GetPixelMap001
* @tc.desc: Test frame node method GetPixelMap
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeTestNg, GetPixelMap001, TestSize.Level1)
{
/**
* @tc.steps: step1. initialize parameters.
*/
FRAME_NODE->isActive_ = true;
FRAME_NODE->eventHub_->SetEnabled(true);
SystemProperties::debugEnabled_ = true;
auto gestureHub = FRAME_NODE->GetOrCreateGestureEventHub();
ASSERT_NE(gestureHub, nullptr);
auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
ASSERT_NE(mockRenderContext, nullptr);
FRAME_NODE->renderContext_ = mockRenderContext;
/**
* @tc.steps: step2. Don't initialize pixelMap and rosenNode.
* @tc.expected: expect GetPixelMap() == nullptr.
*/
EXPECT_EQ(FRAME_NODE->GetPixelMap(), nullptr);
/**
* @tc.steps: step3. set a pixelMap of gestureHub, and call GetPixelMap.
* @tc.expected: expect GetPixelMap() != nullptr.
*/
void* voidPtr = static_cast<void*>(new char[0]);
RefPtr<PixelMap> pixelMap = PixelMap::CreatePixelMap(voidPtr);
ASSERT_NE(pixelMap, nullptr);
gestureHub->SetPixelMap(pixelMap);
EXPECT_NE(FRAME_NODE->GetPixelMap(), nullptr);
/**
* @tc.steps: step4. set a pixelMap of the renderContext, and call GetPixelMap.
* @tc.expected: expect GetPixelMap() != nullptr.
*/
gestureHub->SetPixelMap(nullptr);
// mockRenderContext->pixelMap_ = pixelMap;
EXPECT_EQ(FRAME_NODE->GetPixelMap(), nullptr);
}
} // namespace OHOS::Ace::NG