1 /* 2 * Copyright (c) 2021 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 FRAMEWORKS_ANIMATION_SERVER_SERVER_INCLUDE_ANIMATION_MODULE_H 17 #define FRAMEWORKS_ANIMATION_SERVER_SERVER_INCLUDE_ANIMATION_MODULE_H 18 19 #include "rotation_animation.h" 20 21 #include <egl_surface.h> 22 #include <vsync_helper.h> 23 #include <window_manager.h> 24 25 #include "array.h" 26 27 namespace OHOS { 28 using PromiseGSError = Promise<GSError>; 29 30 struct Animation { 31 int32_t degree; 32 sptr<PromiseGSError> retval; 33 }; 34 35 struct AnimationScreenshotInfo { 36 struct WMImageInfo wmimage; 37 std::shared_ptr<struct Array> ptr; 38 }; 39 40 using PromiseAnimationScreenshotInfo = Promise<struct AnimationScreenshotInfo>; 41 42 class AnimationModule : IScreenShotCallback { 43 public: 44 GSError Init(); 45 GSError StartRotationAnimation(int32_t did, int32_t degree); 46 47 private: 48 void OnScreenShot(const struct WMImageInfo &info) override; 49 50 void StartAnimation(struct Animation &animation); 51 void AnimationSync(int64_t time, void *data); 52 53 std::shared_ptr<AppExecFwk::EventHandler> handler = nullptr; 54 sptr<VsyncHelper> vhelper = nullptr; 55 sptr<Window> window = nullptr; 56 #ifdef ACE_ENABLE_GPU 57 sptr<EglSurface> eglSurface = nullptr; 58 #endif 59 60 std::atomic<bool> isAnimationRunning = false; 61 sptr<PromiseAnimationScreenshotInfo> screenshotPromise = nullptr; 62 std::unique_ptr<RotationAnimation> ranimation = nullptr; 63 }; 64 } // namespace OHOS 65 66 #endif // FRAMEWORKS_ANIMATION_SERVER_SERVER_INCLUDE_ANIMATION_MODULE_H 67