1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DRAG_DATA_UTIL_H 17 #define DRAG_DATA_UTIL_H 18 19 #include "parcel.h" 20 21 #ifdef OHOS_BUILD_INTERNAL_DROP_ANIMATION 22 #include "dm_common.h" 23 #include "ui/rs_canvas_node.h" 24 #include "ui/rs_node.h" 25 #endif // OHOS_BUILD_INTERNAL_DROP_ANIMATION 26 27 #include "drag_data.h" 28 29 namespace OHOS { 30 namespace Msdp { 31 namespace DeviceStatus { 32 class DragDataUtil { 33 public: 34 static int32_t Marshalling(const DragData &dragData, Parcel &data, bool isCross = true); 35 static int32_t UnMarshalling(Parcel &data, DragData &dragData, bool isCross = true); 36 static int32_t MarshallingDetailedSummarys(const DragData &dragData, Parcel &data); 37 static int32_t UnMarshallingDetailedSummarys(Parcel &data, DragData &dragData); 38 static int32_t MarshallingSummaryExpanding(const DragData &dragData, Parcel &data); 39 static int32_t UnMarshallingSummaryExpanding(Parcel &data, DragData &dragData); 40 }; 41 42 #ifdef OHOS_BUILD_INTERNAL_DROP_ANIMATION 43 struct DragInternalInfo { 44 float positionX { -1.0f }; 45 float positionY { -1.0f }; 46 float scale { -1.0f }; 47 int32_t pixelMapX { -1 }; 48 int32_t pixelMapY { -1 }; 49 int32_t displayWidth { -1 }; 50 int32_t displayHeight { -1 }; 51 uint32_t argb { 0 }; 52 Rosen::Rotation rotation { Rosen::Rotation::ROTATION_0 }; 53 std::shared_ptr<Rosen::RSNode> rootNode { nullptr }; 54 std::shared_ptr<Rosen::RSNode> parentNode { nullptr }; 55 std::shared_ptr<Rosen::RSNode> curvesMaskNode { nullptr }; 56 std::shared_ptr<Rosen::RSNode> lightNode { nullptr }; 57 std::shared_ptr<Media::PixelMap> currentPixelMap { nullptr }; 58 std::shared_ptr<AppExecFwk::EventHandler> handler { nullptr }; 59 std::vector<std::shared_ptr<Rosen::RSCanvasNode>> nodes; 60 std::vector<std::shared_ptr<Rosen::RSCanvasNode>> multiSelectedNodes; 61 std::vector<std::shared_ptr<Media::PixelMap>> multiSelectedPixelMaps; 62 }; 63 #endif // OHOS_BUILD_INTERNAL_DROP_ANIMATION 64 } // namespace DeviceStatus 65 } // namespace Msdp 66 } // namespace OHOS 67 #endif // DRAG_DATA_UTIL_H 68