From b7904a914bb439fe8b4a08260e1265f7dba9566b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E7=AB=A5?= Date: Thu, 27 Feb 2025 15:07:00 +0800 Subject: [PATCH] revert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 金童 --- .../src/pointer_drawing_manager.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/service/window_manager/src/pointer_drawing_manager.cpp b/service/window_manager/src/pointer_drawing_manager.cpp index 0f94eb6627..d5e5664401 100644 --- a/service/window_manager/src/pointer_drawing_manager.cpp +++ b/service/window_manager/src/pointer_drawing_manager.cpp @@ -2045,6 +2045,16 @@ int32_t PointerDrawingManager::UpdateLoadingAndLoadingRightPixelMap() int32_t PointerDrawingManager::SetPointerColor(int32_t color) { CALL_DEBUG_ENTER; + if (!WIN_MGR->GetExtraData().drawCursor) { + if (surfaceNode_ != nullptr) { + float alphaRatio = (static_cast(color) >> RGB_CHANNEL_BITS_LENGTH) / MAX_ALPHA_VALUE; + if (alphaRatio > 1) { + MMI_HILOGW("Invalid alphaRatio:%{public}f", alphaRatio); + } else { + surfaceNode_->SetAlpha(1 - alphaRatio); + } + } + } MMI_HILOGI("PointerColor:%{public}x", color); // ARGB从表面看比RGB多了个A,也是一种色彩模式,是在RGB的基础上添加了Alpha(透明度)通道。 // 透明度也是以0到255表示的,所以也是总共有256级,透明是0,不透明是255。 @@ -2058,15 +2068,6 @@ int32_t PointerDrawingManager::SetPointerColor(int32_t color) return ret; } MMI_HILOGD("Set pointer color successfully, color:%{public}d", color); - if (!WIN_MGR->GetExtraData().drawCursor) { - if (surfaceNode_ != nullptr) { - float alphaRatio = (static_cast(color) >> RGB_CHANNEL_BITS_LENGTH) / MAX_ALPHA_VALUE; - if (alphaRatio > 1) { - MMI_HILOGW("Invalid alphaRatio:%{public}f", alphaRatio); - } else { - surfaceNode_->SetAlpha(1 - alphaRatio); - } - } #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR if (HasMagicCursor()) { ret = MAGIC_CURSOR->SetPointerColor(color); @@ -2080,7 +2081,6 @@ int32_t PointerDrawingManager::SetPointerColor(int32_t color) MMI_HILOGE("Init layer failed"); return RET_ERR; } - } UpdatePointerVisible(); SetHardwareCursorPosition(displayInfo_.id, lastPhysicalX_, lastPhysicalY_, lastMouseStyle_); return RET_OK; -- Gitee