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 DRAWING_UTILS_H 17 #define DRAWING_UTILS_H 18 #include <hilog/log.h> 19 #include "platform/common/rs_system_properties.h" 20 21 namespace OHOS { 22 namespace Rosen { 23 enum class RenderBackendType { 24 GLES, 25 VULKAN, 26 SOFTWARE, 27 RENDER_BACKEND_TYPE_COUNT, 28 }; 29 30 #define LOGD(fmt, ...) \ 31 ::OHOS::HiviewDFX::HiLog::Debug( \ 32 ::OHOS::HiviewDFX::HiLogLabel { LOG_CORE, 0, "Drawing" }, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 33 #define LOGI(fmt, ...) \ 34 ::OHOS::HiviewDFX::HiLog::Info( \ 35 ::OHOS::HiviewDFX::HiLogLabel { LOG_CORE, 0, "Drawing" }, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 36 #define LOGW(fmt, ...) \ 37 ::OHOS::HiviewDFX::HiLog::Warn( \ 38 ::OHOS::HiviewDFX::HiLogLabel { LOG_CORE, 0, "Drawing" }, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 39 #define LOGE(fmt, ...) \ 40 ::OHOS::HiviewDFX::HiLog::Error( \ 41 ::OHOS::HiviewDFX::HiLogLabel { LOG_CORE, 0, "Drawing" }, "%{public}s: " fmt, __func__, ##__VA_ARGS__) 42 43 class Setting { 44 public: GetRenderBackendType()45 static RenderBackendType GetRenderBackendType() 46 { 47 #if defined(ACE_ENABLE_VK) 48 if (RSSystemProperties::IsUseVulkan()) { 49 return RenderBackendType::VULKAN; 50 } 51 #endif 52 53 #if defined(ACE_ENABLE_GL) 54 if (RSSystemProperties::GetGpuApiType() == GpuApiType::OPENGL) { 55 return RenderBackendType::GLES; 56 } 57 #endif 58 return RenderBackendType::SOFTWARE; 59 } 60 }; 61 } 62 } 63 #endif