⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compo_rect.c

📁 COMPO source code for reference
💻 C
📖 第 1 页 / 共 5 页
字号:
                /* Blend this layer onto our source into the cache */                HALCOMPO_BlendRectangle(Overlay_p->HalOverlay,CacheBitmap_p, FinalRect_p,CacheBitmap_p,TRUE, QueueUsed, IsTopField,                                        ScreenRect_p->SrcSliceNbr, Device_p->ReadParams.ScreenHeight, UseNonRecurrentCompositionList);            }            else            {                /* Blend this layer onto our source into the final destination*/                HALCOMPO_BlendRectangle(Overlay_p->HalOverlay,CacheBitmap_p, FinalRect_p,FinalBitmap_p,FALSE, QueueUsed, IsTopField,                                        ScreenRect_p->SrcSliceNbr, Device_p->ReadParams.ScreenHeight, UseNonRecurrentCompositionList);            }        }    }}/*******************************************************************************Name        :  GetPassParamsDescription :Parameters  :Assumptions :Limitations :Returns     :*******************************************************************************/static void GetPassParams(stcompo_ScreenRect_t* ScreenRect_p,STGXOBJ_Rectangle_t* DstRect_p ,PassParams_t* Params_p){    /* horizontal related */    if (DstRect_p->Width != 0)    {        Params_p->HNbPass = (ScreenRect_p->Rect.Width + DstRect_p->Width - 1) /  DstRect_p->Width;    }    else    {        Params_p->HNbPass = 0;    }    Params_p->Width   = DstRect_p->Width;    /* Vertical related */    if (DstRect_p->Height != 0)    {        Params_p->Height  = DstRect_p->Height;        Params_p->VNbPass = (ScreenRect_p->Rect.Height + DstRect_p->Height - 1) / DstRect_p->Height;    }    else    {        Params_p->VNbPass = 0;    }    Params_p->Height  = DstRect_p->Height;}/*******************************************************************************Name        : SetupScreenCompositionDescription : Go through screen rectangle list in order to build              the screen composition list of operations.Parameters  :Assumptions :Limitations :Returns     :*******************************************************************************/static void SetupScreenComposition(stcompo_Device_t* Device_p, BOOL IsTopField){    stcompo_ScreenRect_t* ScreenRect_p = Device_p->FirstScreenRect_p;    STCOMPO_QueueUsed_t   QueueUsed;    /* Initialization of the compostion list of operations */    HALCOMPO_InitCompositionList(Device_p->HalCompoHandle);    if ((Device_p->HalComposeScreen) == HALCOMPO_ComposeScreenCQ)    {            QueueUsed = STCOMPO_MAIN;    }    else    {            QueueUsed = STCOMPO_AUX;    }    #ifdef COMPO_BLITTER_BENCHMARK         HALCOMPO_NodeGenerationBlitterBenchStart(QueueUsed);    #endif    while (ScreenRect_p != Device_p->NextScreenRect_p)    {        BOOL ContainsRecurrentCompositionVps, UseNonRecurrentCompositionList;        /* Test whether the ScreenRect_p contains at least one recurrent composition viewport */        ContainsRecurrentCompositionVps = CheckForRecurrentCompositionVps(ScreenRect_p, &Device_p->BackgroundOverlay);        /* NonRecurrentCompositionList is used only when there is no recurrent composition viewports */        UseNonRecurrentCompositionList  = !ContainsRecurrentCompositionVps;        if ((ScreenRect_p->Complexity == 1) && (ScreenRect_p->Overlay_pp[0] == &(Device_p->BackgroundOverlay)))        {            /* Only BackGound color to Fill into destination : Don't need to applied cache size constraints nor 128 pixels max width src */            HALCOMPO_FillRectangle(ScreenRect_p->Overlay_pp[0]->HalOverlay,&(Device_p->ReadParams.OutputBitmap), &(ScreenRect_p->Rect),                                   QueueUsed, IsTopField, ScreenRect_p->SrcSliceNbr, Device_p->ReadParams.ScreenHeight);        }        else        {            U32                     OffsetH, OffsetV, Passes;            STGXOBJ_Bitmap_t*       DstBitmap_p = &(Device_p->ReadParams.OutputBitmap);            STGXOBJ_Rectangle_t     DstRect;            PassParams_t            PassParams;            OffsetV = 0;            DstRect = ScreenRect_p->Rect;            /* Work out our preferred width of tile */            if (ScreenRect_p->TileWidth > ScreenRect_p->Rect.Width)            {                DstRect.Width = ScreenRect_p->Rect.Width;            }            else            {                DstRect.Width = ScreenRect_p->TileWidth;            }            /* Work out our preferred width of tile */            if (ScreenRect_p->TileHeight > ScreenRect_p->Rect.Height)            {                DstRect.Height = ScreenRect_p->Rect.Height;            }            else            {                DstRect.Height = ScreenRect_p->TileHeight;            }            if (ScreenRect_p->Complexity == 1) /* Opaque overlay */            {                /* Retrieve paramaters of passes to be processed */                GetPassParams(ScreenRect_p,&DstRect,&PassParams);                while (PassParams.VNbPass--)                {                    if (PassParams.VNbPass == 0)                    {                        /* Last pass - reduce the height to the remaining rectangle */                        DstRect.Height = ScreenRect_p->Rect.Height - OffsetV;                    }                    DstRect.PositionX = ScreenRect_p->Rect.PositionX;                    DstRect.Width     = PassParams.Width;                    OffsetH = 0;                    Passes = PassParams.HNbPass;                    while (Passes--)                    {                        if (Passes == 0)                        {                            /* Last pass - reduce the width to the remaining rectangle */                            DstRect.Width = ScreenRect_p->Rect.Width - OffsetH;                        }                        HALCOMPO_CopyRectangle(ScreenRect_p->Overlay_pp[0]->HalOverlay,&(Device_p->ReadParams.OutputBitmap),                                               &DstRect, FALSE, QueueUsed, IsTopField, ScreenRect_p->SrcSliceNbr,                                               Device_p->ReadParams.ScreenHeight, UseNonRecurrentCompositionList);                        OffsetH           += PassParams.Width;                        DstRect.PositionX += PassParams.Width;                    }                    OffsetV           += PassParams.Height;                    DstRect.PositionY += PassParams.Height;                }            }            else if ((ScreenRect_p->Complexity == 2) && (ScreenRect_p->Overlay_pp[1] == &(Device_p->BackgroundOverlay)))  /* Backgound color + overlay */            {                /* Retrieve paramaters of passes to be processed */                GetPassParams(ScreenRect_p,&DstRect,&PassParams);                while (PassParams.VNbPass--)                {                    if (PassParams.VNbPass == 0)                    {                        /* Last pass - reduce the height to the remaining rectangle */                        DstRect.Height = ScreenRect_p->Rect.Height - OffsetV;                    }                    DstRect.PositionX = ScreenRect_p->Rect.PositionX;                    DstRect.Width     = PassParams.Width;                    OffsetH = 0;                    Passes = PassParams.HNbPass;                    while (Passes--)                    {                        if (Passes == 0)                        {                            /* Last pass - reduce the width to the remaining rectangle */                            DstRect.Width = ScreenRect_p->Rect.Width - OffsetH;                        }                        /* Fill & blend with background  */                        HALCOMPO_FillBlendRectangle(ScreenRect_p->Overlay_pp[0]->HalOverlay,&(Device_p->ReadParams.OutputBitmap),                                                    &DstRect, FALSE, QueueUsed, IsTopField, ScreenRect_p->SrcSliceNbr,                                                    Device_p->ReadParams.ScreenHeight, UseNonRecurrentCompositionList);                        OffsetH           += PassParams.Width;                        DstRect.PositionX += PassParams.Width;                    }                    OffsetV           += PassParams.Height;                    DstRect.PositionY += PassParams.Height;                }            }            else /* Blend 2 or more overlays */            {                U32                   MaxSourceHeight;                U32                   DestinationBitmapSize;                BOOL                  FlickerFilterEnabled, UseCacheMemory;                /* Set cache size */                DestinationBitmapSize = Device_p->BlitterCacheBitmap.Size1;                UseCacheMemory = TRUE;                if ((Device_p->CompositionType == STCOMPO_COMPOSITION_FIELD_COMBINED) ||                    (Device_p->CompositionType == STCOMPO_COMPOSITION_FIELD_COMBINED_SDRAM))                {                    /* Test whether Flicker Filter is enabled for this viewport */                    FlickerFilterEnabled = HALCOMPO_IsFlickerFilterEnabled(ScreenRect_p->Overlay_pp[0]->HalOverlay);                    if ( FlickerFilterEnabled == TRUE )                    {                        /* Use default cache memory for flicker filter */                        DestinationBitmapSize = Device_p->BlitterCacheBitmap.Size1 * 2; /* The source will be down scaled by 2 at vertical half pixel positions */                    }                    else                    {                        if (Device_p->CompositionType == STCOMPO_COMPOSITION_FIELD_COMBINED_SDRAM)                        {                            /* In this case, no need to use cache buffer since blend operation is performed in one pass blit */                            UseCacheMemory = FALSE;                        }                    }                }                if (UseCacheMemory == TRUE)                {                    /* Determine DstRect.Height */                    MaxSourceHeight = DestinationBitmapSize / (DstRect.Width * 3);   /* Nb byte per pixel = 3 */                    /* MaxSourceHeight must be calculated taking in consideration that CacheHeight * CacheWidth * CachePitch <= CacheSize                     * if  (MaxSourceHeight is odd,  FirstDstLineIsTop and DisplayBuffer == BUFFER_TYPE_TOP)                     * CacheHeight = (MaxSourceHeight + 1)/2  Will be out of range so in this case we need to retrieve 1 to MaxSourceHeight*/                    if ((((MaxSourceHeight + 1)/2) * (DstRect.Width * 3)) >  Device_p->BlitterCacheBitmap.Size1)                    {                            MaxSourceHeight -=  MaxSourceHeight%2;                    }                    if (DstRect.Height > MaxSourceHeight)                    {                        DstRect.Height = MaxSourceHeight;                    }                    /* set Final cache */                    Device_p->BlitterCacheBitmap.Height = DstRect.Height;                    Device_p->BlitterCacheBitmap.Width  = DstRect.Width;                    Device_p->BlitterCacheBitmap.Pitch  = Device_p->BlitterCacheBitmap.Width * 3;   /* Nb byte per pixel = 3 */                }                /* Retrieve paramaters of passes to be processed */                GetPassParams(ScreenRect_p,&DstRect,&PassParams);                while (PassParams.VNbPass--)                {                    if (PassParams.VNbPass == 0)                    {                        /* Last pass - reduce the height to the remaining rectangle */                        DstRect.Height = ScreenRect_p->Rect.Height - OffsetV;                    }                    DstRect.PositionX = ScreenRect_p->Rect.PositionX;                    DstRect.Width     = PassParams.Width;                    OffsetH = 0;                    Passes = PassParams.HNbPass;                    while (Passes--)                    {                        if (Passes == 0)                        {                            /* Last pass - reduce the width to the remaining rectangle */                            DstRect.Width = ScreenRect_p->Rect.Width - OffsetH;                        }                        /* Fill & blend with background  */                        BlendOverlays(Device_p, ScreenRect_p, DstBitmap_p, &DstRect, &Device_p->BlitterCacheBitmap, IsTopField,                                      UseNonRecurrentCompositionList);                        OffsetH           += PassParams.Width;                        DstRect.PositionX += PassParams.Width;                    }                    OffsetV           += PassParams.Height;                    DstRect.PositionY += PassParams.Height;                }            }        }        /* Overwrite support */        ScreenRect_p = ScreenRect_p->NextRect_p;    }    if (Device_p->CompositionType == STCOMPO_COMPOSITION_FIELD_COMBINED_SDRAM)    {        HALCOMPO_AddNode(Device_p->HalCompoHandle, Device_p->ReadParams.ScreenHeight);    }    /* Release of the compostion list of operations  */    HALCOMPO_ReleaseCompositionList(Device_p->HalCompoHandle);    #ifdef COMPO_BLITTER_BENCHMARK         HALCOMPO_SetNbNodes(Device_p->HalCompoHandle);         HALCOMPO_NodeGenerationBlitterBenchEnd(QueueUsed);    #endif}/*******************************************************************************Name        : stcompo_CommitScreenComposition

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -