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 FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_COMPILE_PROGRESS_H 17 #define FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_COMPILE_PROGRESS_H 18 19 #ifdef RS_ENABLE_GPU 20 #include <render_context/render_context.h> 21 #endif 22 #include <ui/rs_canvas_node.h> 23 #include <ui/rs_display_node.h> 24 #include <ui/rs_surface_extractor.h> 25 #include "ui/rs_ui_director.h" 26 27 #include "draw/canvas.h" 28 #include "event_handler.h" 29 #include "log.h" 30 #include "util.h" 31 #include "vsync_receiver.h" 32 #include <map> 33 34 namespace OHOS { 35 class BootCompileProgress { 36 public: 37 void Init(const std::string& configPath, const BootAnimationConfig& config); 38 39 private: 40 void OnVsync(); 41 void DrawCompileProgress(); 42 void UpdateCompileProgress(); 43 bool CreateCanvasNode(); 44 bool RegisterVsyncCallback(); 45 Rosen::Drawing::Brush DrawProgressPoint(int32_t idx, int32_t frameNum); 46 bool IsBmsBundleReady(); 47 void DrawMarginBrush(Rosen::Drawing::RecordingCanvas* canvas); 48 void RecordDeviceType(); 49 void SetFrame(); 50 void SetSpecialProgressFrame(int32_t maxLength, int32_t screenId); 51 52 int32_t windowWidth_ = 0; 53 int32_t windowHeight_ = 0; 54 int32_t times_ = 0; 55 int32_t rotateDegree_ = 0; 56 int32_t progress_ = 0; 57 int32_t timeLimitSec_ = -1; 58 int64_t startTimeMs_ = -1; 59 int64_t endTimePredictMs_ = -1; 60 int32_t fontSize_ = 0; 61 Rosen::ScreenId screenId_; 62 std::string displayInfo_ = ""; 63 float currentRadius_ = 0.0f; 64 int32_t screenStatus_ = -1; 65 66 volatile bool isUpdateOptEnd_ = false; 67 bool isWearable_ = false; 68 bool isOther_ = false; 69 70 std::shared_ptr<Rosen::RSSurfaceNode> rsSurfaceNode_; 71 std::shared_ptr<Rosen::RSCanvasNode> rsCanvasNode_; 72 std::shared_ptr<Rosen::RSUIDirector> rsUIDirector_; 73 std::shared_ptr<Rosen::Drawing::Typeface> tf_; 74 std::shared_ptr<Rosen::VSyncReceiver> receiver_; 75 std::shared_ptr<OHOS::AppExecFwk::EventHandler> compileHandler_; 76 std::shared_ptr<OHOS::AppExecFwk::EventRunner> compileRunner_; 77 std::shared_ptr<Rosen::RSInterpolator> sharpCurve_; 78 std::map<int32_t, BootAnimationProgressConfig> progressConfigsMap_; 79 }; 80 } // namespace OHOS 81 82 #endif //FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_COMPILEPROGRESS_H 83