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 RS_UNI_RENDER_JUDGEMENT_H 17 #define RS_UNI_RENDER_JUDGEMENT_H 18 19 #include <string> 20 21 #include "common/rs_macros.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 enum class UniRenderEnabledType { 26 UNI_RENDER_DISABLED = 0, 27 UNI_RENDER_ENABLED_FOR_ALL, 28 }; 29 // Judge the unified rendering strategy of RenderService. 30 class RSB_EXPORT RSUniRenderJudgement final { 31 public: 32 ~RSUniRenderJudgement() = default; 33 34 // used by render server 35 static UniRenderEnabledType GetUniRenderEnabledType(); 36 static void InitUniRenderConfig(); 37 static bool IsUniRender(); 38 39 private: 40 RSUniRenderJudgement() = default; 41 // dealing with Windows type end of line "\r\n" 42 static std::ifstream& SafeGetLine(std::ifstream &configFile, std::string &line); 43 44 static void InitUniRenderWithConfigFile(); 45 #ifdef RS_ENABLE_UNI_RENDER 46 static inline UniRenderEnabledType uniRenderEnabledType_ = UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL; 47 #else 48 static inline UniRenderEnabledType uniRenderEnabledType_ = UniRenderEnabledType::UNI_RENDER_DISABLED; 49 #endif 50 }; 51 } // namespace Rosen 52 } // namespace OHOS 53 #endif // RS_UNI_RENDER_JUDGEMENT_H 54