From 5e57730e2ea26b996b68b52b74fa1a722a165274 Mon Sep 17 00:00:00 2001 From: houzh Date: Mon, 3 Apr 2023 03:45:09 +0000 Subject: [PATCH] add surface global alpha support,fix idgen.strings --- scripts/idgen.py | 3 ++- src/porting/sigma/graph_gfx.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/idgen.py b/scripts/idgen.py index 3a73ddce..44a8942e 100755 --- a/scripts/idgen.py +++ b/scripts/idgen.py @@ -34,7 +34,8 @@ class CDROIDHandler( xml.sax.ContentHandler ): if pos<0 : return value=value[pos+1:].strip() - self.strings.append(value) + if(value[0].isalpha() or (value[0]=='_')) and (value not in self.strings): + self.strings.append(value) def groupby(self): new_ids = [] diff --git a/src/porting/sigma/graph_gfx.c b/src/porting/sigma/graph_gfx.c index 4016ea28..a961ff6e 100755 --- a/src/porting/sigma/graph_gfx.c +++ b/src/porting/sigma/graph_gfx.c @@ -31,6 +31,7 @@ typedef struct{ int format; int ishw; int current; + int alpha; size_t msize; char*buffer;//drawbuffer char*orig_buffer;//used only in double buffer*/ @@ -118,6 +119,8 @@ INT GFXUnlockSurface(HANDLE surface){ } INT GFXSurfaceSetOpacity(HANDLE surface,BYTE alpha){ + FBSURFACE*ngs=(FBSURFACE*)surface; + ngs->alpha=alpha; return E_OK;//dispLayer->SetOpacity(dispLayer,alpha); } @@ -262,10 +265,11 @@ INT GFXCreateSurface(int dispid,HANDLE*surface,UINT width,UINT height,INT format surf->height=width; surf->pitch=height*4; } - MI_SYS_MemsetPa(phaddr,0xFFFFFFFF,surf->msize); + MI_SYS_MemsetPa(phaddr,0x000000,surf->msize); surf->orig_buffer=surf->buffer; if(hwsurface) setfbinfo(surf); surf->ishw=hwsurface; + surf->alpha=255; //surf->image = pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8,surf->width,surf->height,surf->buffer,surf->pitch); LOGI("Surface=%x buf=%p/%p size=%dx%d/%d hw=%d\r\n",surf,surf->buffer,surf->kbuffer,width,height,surf->msize,hwsurface); *surface=surf; @@ -327,10 +331,13 @@ INT GFXBlit(HANDLE dstsurface,int dx,int dy,HANDLE srcsurface,const GFXRect*srcr bzero(&opt,sizeof(opt)); LOGV("Blit %p %d,%d-%d,%d -> %p %d,%d buffer=%p->%p",nsrc,rs.x,rs.y,rs.w,rs.h,ndst,dx,dy,pbs,pbd); - opt.u32GlobalSrcConstColor = 0xFF000000; + //nsrc->alpha=0x80; + opt.u32GlobalSrcConstColor = nsrc->alpha<<24; opt.u32GlobalDstConstColor = 0xFF000000; opt.eSrcDfbBldOp = E_MI_GFX_DFB_BLD_ONE; opt.eDstDfbBldOp = E_MI_GFX_DFB_BLD_ZERO; + opt.eDFBBlendFlag = (nsrc->alpha==255)?E_MI_GFX_DFB_BLEND_NOFX:E_MI_GFX_DFB_BLEND_SRC_PREMULTCOLOR; + opt.eMirror = E_MI_GFX_MIRROR_NONE; opt.eRotate=ndst->ishw?GFXGetRotation(nsrc->dispid):E_MI_GFX_ROTATE_0; stSrcRect.s32Xpos = rs.x; @@ -342,7 +349,6 @@ INT GFXBlit(HANDLE dstsurface,int dx,int dy,HANDLE srcsurface,const GFXRect*srcr switch(GFXGetRotation(nsrc->dispid)){ case ROTATE_0 :break; case ROTATE_90: - tmp=dx; dx=ndst->width-dy-rs.h; dy=tmp; break;