From 6faa2a831acc48c37e6ce89203dd393a3f3f1435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=AD=8C?= Date: Mon, 8 Jul 2024 09:14:13 +0800 Subject: [PATCH] View.setAlpha can be usedwithout LAYER_TYPE_SOFTWARE --- cmake/ssd202-mtitoolchain.cmake | 5 ++++- src/gui/view/view.cc | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/ssd202-mtitoolchain.cmake b/cmake/ssd202-mtitoolchain.cmake index 35d82530..d77d1f7d 100755 --- a/cmake/ssd202-mtitoolchain.cmake +++ b/cmake/ssd202-mtitoolchain.cmake @@ -8,4 +8,7 @@ SET(CMAKE_SYSTEM_PROCESSOR arm) SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-g++) SET(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-gcc) SET(CMAKE_ASM_COMPILER ${TOOLCHAIN_DIR}/bin/arm-linux-gnueabihf-gcc) -SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR}/arm-linux-gnueabihf/libc) +SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR}) + +set(ENV{PKG_CONFIG_PATH} "${TOOLCHAIN_DIR}/sysroot//usr/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") +set(CMAKE_SYSROOT ${TOOLCHAIN_DIR}/sysroot) diff --git a/src/gui/view/view.cc b/src/gui/view/view.cc index 4aab5566..f938eedc 100755 --- a/src/gui/view/view.cc +++ b/src/gui/view/view.cc @@ -3052,7 +3052,7 @@ bool View::draw(Canvas&canvas,ViewGroup*parent,long drawingTime){ } // Deal with alpha if it is or used to be <1 - if (alpha < 1 || (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) != 0) { + if (alpha < 1.f || (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) != 0) { if (alpha < 1) { mPrivateFlags3 |= PFLAG3_VIEW_IS_ANIMATING_ALPHA; } else { @@ -3079,7 +3079,7 @@ bool View::draw(Canvas&canvas,ViewGroup*parent,long drawingTime){ if (!drawingWithRenderNode) { // apply clips directly, since RenderNode won't do it for this draw - int clips=0; + int clips = 0; if ((parentFlags & ViewGroup::FLAG_CLIP_CHILDREN) != 0 && cache == nullptr) { if (offsetForScroll){ canvas.rectangle(sx,sy,getWidth(),getHeight()); @@ -3102,6 +3102,7 @@ bool View::draw(Canvas&canvas,ViewGroup*parent,long drawingTime){ } if (!drawingWithDrawingCache) { + if(alpha<1.0)canvas.push_group(); if (drawingWithRenderNode) { mPrivateFlags &= ~PFLAG_DIRTY_MASK; //((DisplayListCanvas) canvas).drawRenderNode(renderNode); @@ -3113,14 +3114,17 @@ bool View::draw(Canvas&canvas,ViewGroup*parent,long drawingTime){ draw(canvas); } } + if(alpha<1.0){ + canvas.pop_group_to_source(); + canvas.paint_with_alpha(alpha); + } } else if (cache != nullptr) { mPrivateFlags &= ~PFLAG_DIRTY_MASK; cache->flush(); canvas.save(); canvas.reset_clip(); canvas.set_source(cache,0,0); - if(alpha<1.f)canvas.paint_with_alpha(alpha); - else canvas.paint(); + canvas.paint_with_alpha(alpha); canvas.restore(); } while(restoreTo-- >0) {