1 /* 2 * Copyright (c) 2024 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 RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_ANIMATION_TRACE_UTILS_H 17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_ANIMATION_TRACE_UTILS_H 18 19 #include "animation/rs_render_property_animation.h" 20 #include "modifier/rs_render_property.h" 21 22 23 namespace OHOS { 24 namespace Rosen { 25 class RSB_EXPORT RSAnimationTraceUtils { 26 public: GetInstance()27 static RSAnimationTraceUtils &GetInstance() 28 { 29 return instance_; 30 }; 31 void addAnimationNameTrace(const std::string str) const; 32 void addAnimationFinishTrace( 33 const std::string info, const uint64_t nodeId, const uint64_t animationId, bool isAddLogInfo) const; 34 void addAnimationCreateTrace(const uint64_t nodeId, const std::string& nodeName, const uint64_t propertyId, 35 const uint64_t animationId, const int animationType, const int propertyType, 36 const std::shared_ptr<RSRenderPropertyBase>& startValue, const std::shared_ptr<RSRenderPropertyBase>& endValue, 37 const int animationDelay, const int animationDur, const int repeat) const; 38 39 void addAnimationFrameTrace(const uint64_t nodeId, const std::string& nodeName, const uint64_t animationId, 40 const uint64_t propertyId, const float fraction, const std::shared_ptr<RSRenderPropertyBase>& value, 41 const int64_t time) const; 42 43 void addRenderNodeTrace(const RSRenderNode& node, const std::string name = "") const; 44 void addSpringInitialVelocityTrace(const uint64_t propertyId, const uint64_t animationId, 45 const std::shared_ptr<RSRenderPropertyBase>& initialVelocity, 46 const std::shared_ptr<RSRenderPropertyBase>& value) const; 47 48 private: 49 RSAnimationTraceUtils(); 50 ~RSAnimationTraceUtils() = default; 51 52 std::string ParseRenderPropertyVaule(const std::shared_ptr<RSRenderPropertyBase>& value, 53 const RSRenderPropertyType type = RSRenderPropertyType::INVALID) const; 54 55 std::string ParseRenderPropertyVauleInner(const std::shared_ptr<RSRenderPropertyBase>& value, 56 const RSRenderPropertyType type = RSRenderPropertyType::INVALID) const; 57 58 static RSAnimationTraceUtils instance_; 59 bool isDebugOpen_ = false; 60 }; 61 } // namespace Rosen 62 } // namespace OHOS 63 64 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_ANIMATION_TRACE_UTILS_H