View.setAlpha can be usedwithout LAYER_TYPE_SOFTWARE

This commit is contained in:
侯歌 2024-07-08 09:14:13 +08:00
parent d0fa48c6e8
commit 6faa2a831a
2 changed files with 12 additions and 5 deletions

View File

@ -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)

View File

@ -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) {