• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_BOOTANIMATION_INCLUDE_BOOT_ANIMATION_H
17 #define FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_ANIMATION_H
18 
19 #include <include/core/SkCanvas.h>
20 #include <include/core/SkData.h>
21 #include <include/core/SkImageInfo.h>
22 #include <include/core/SkImage.h>
23 #include <include/codec/SkCodec.h>
24 
25 #include <display.h>
26 #include <foundation/windowmanager/interfaces/innerkits/wm/window_manager.h>
27 #include <ipc_skeleton.h>
28 #include <iremote_broker.h>
29 #include <iservice_registry.h>
30 #include <platform/ohos/rs_irender_service.h>
31 #include <parameters.h>
32 #include <render_context/render_context.h>
33 #include <system_ability_definition.h>
34 #include <ui/rs_surface_extractor.h>
35 #include <vsync_helper.h>
36 #include <window.h>
37 #include <window_option.h>
38 #include <window_scene.h>
39 #include "event_handler.h"
40 #include "player.h"
41 #include "vsync_receiver.h"
42 
43 namespace OHOS {
44 class BootAnimation {
45 public:
46     void Init(int32_t width, int32_t height);
47     void Draw();
48     void CheckExitAnimation();
49     void PlaySound();
50     void Run(std::vector<sptr<OHOS::Rosen::Display>>& displays);
51 private:
52     void OnDraw(SkCanvas* canvas);
53     void InitBootWindow();
54     void InitRsSurface();
55     void InitPicCoordinates();
56     void RequestNextVsync();
57     int32_t windowWidth_;
58     int32_t windowHeight_;
59     sptr<OHOS::Rosen::Window> window_;
60     sptr<OHOS::Rosen::WindowScene> scene_;
61     std::unique_ptr<OHOS::Rosen::RSSurfaceFrame> framePtr_;
62     std::shared_ptr<OHOS::Rosen::RSSurface> rsSurface_;
63     OHOS::Rosen::RenderContext* rc_;
64     int32_t freq_ = 30;
65     int32_t bootPicCurNo_ = 0;
66     int32_t realHeight_ = 0;
67     int32_t realWidth_ = 0;
68     int32_t pointX_ = 0;
69     int32_t pointY_ = 0;
70     int32_t maxPicNum_ = 0;
71     bool needCheckExit = false;
72     std::shared_ptr<OHOS::Rosen::VSyncReceiver> receiver_ = nullptr;
73     std::shared_ptr<Media::Player> soundPlayer_ = nullptr;
74     std::shared_ptr<OHOS::AppExecFwk::EventHandler> mainHandler_ = nullptr;
75     std::shared_ptr<AppExecFwk::EventRunner> runner_ = nullptr;
76 };
77 } // namespace OHOS
78 
79 #endif // FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_ANIMATION_H
80