本文整理汇总了C++中CDirtyRegionList类的典型用法代码示例。如果您正苦于以下问题:C++ CDirtyRegionList类的具体用法?C++ CDirtyRegionList怎么用?C++ CDirtyRegionList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDirtyRegionList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Solve
void CGreedyDirtyRegionSolver::Solve(const CDirtyRegionList &input, CDirtyRegionList &output)
{
for (unsigned int i = 0; i < input.size(); i++)
{
CDirtyRegion possibleUnionRegion;
int possibleUnionNbr = -1;
float possibleUnionCost = 100000.0f;
CDirtyRegion currentRegion = input[i];
for (unsigned int j = 0; j < output.size(); j++)
{
CDirtyRegion temporaryUnion = output[j];
temporaryUnion.Union(currentRegion);
float temporaryCost = m_costPerArea * (temporaryUnion.Area() - output[j].Area());
if (temporaryCost < possibleUnionCost)
{
// TODO if the temporaryCost is 0 then we could skip checking the other regions since there exist no better solution
possibleUnionRegion = temporaryUnion;
possibleUnionNbr = j;
possibleUnionCost = temporaryCost;
}
}
float newRegionTotalCost = m_costPerArea * currentRegion.Area() + m_costNewRegion;
if (possibleUnionNbr >= 0 && possibleUnionCost < newRegionTotalCost)
output[possibleUnionNbr] = possibleUnionRegion;
else
output.push_back(currentRegion);
}
}
示例2: assert
void CGUIWindowManager::Process(unsigned int currentTime)
{
assert(g_application.IsCurrentThread());
CSingleLock lock(g_graphicsContext);
CDirtyRegionList dirtyregions;
CGUIWindow* pWindow = GetWindow(GetActiveWindow());
if (pWindow)
pWindow->DoProcess(currentTime, dirtyregions);
// process all dialogs - visibility may change etc.
for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
{
CGUIWindow *pWindow = (*it).second;
if (pWindow && pWindow->IsDialog())
pWindow->DoProcess(currentTime, dirtyregions);
}
if (g_application.m_AppActive)
{
for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); itr++)
m_tracker.MarkDirtyRegion(*itr);
}
}
示例3: ResetScissors
bool CRenderSystemGLES::DestroyRenderSystem()
{
CLog::Log(LOGDEBUG, "GUI Shader - Destroying Shader : %p", m_pGUIshader);
if (m_pGUIshader)
{
for (int i = 0; i < SM_ESHADERCOUNT; i++)
{
if (m_pGUIshader[i])
{
m_pGUIshader[i]->Free();
delete m_pGUIshader[i];
m_pGUIshader[i] = NULL;
}
}
delete[] m_pGUIshader;
m_pGUIshader = NULL;
}
ResetScissors();
CDirtyRegionList dirtyRegions;
CDirtyRegion dirtyWindow(g_graphicsContext.GetViewWindow());
dirtyRegions.push_back(dirtyWindow);
ClearBuffers(0);
glFinish();
PresentRenderImpl(true);
m_bRenderCreated = false;
return true;
}
示例4: DoProcess
// the main processing routine.
// 1. animate and set animation transform
// 2. if visible, process
// 3. reset the animation transform
void CGUIControl::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
CRect dirtyRegion = m_renderRegion;
bool changed = m_bInvalidated;
changed |= Animate(currentTime);
m_cachedTransform = g_graphicsContext.AddTransform(m_transform);
if (m_hasCamera)
g_graphicsContext.SetCameraPosition(m_camera);
if (IsVisible())
{
Process(currentTime, dirtyregions);
m_bInvalidated = false;
}
changed |= m_controlIsDirty;
if (changed || dirtyRegion != m_renderRegion)
{
dirtyRegion.Union(m_renderRegion);
dirtyregions.push_back(dirtyRegion);
}
if (m_hasCamera)
g_graphicsContext.RestoreCameraPosition();
g_graphicsContext.RemoveTransform();
m_controlIsDirty = false;
}
示例5: DoProcess
void CGUIDialogBusy::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
bool visible = g_windowManager.GetTopMostModalDialogID() == WINDOW_DIALOG_BUSY;
if(!visible && m_bLastVisible)
dirtyregions.push_back(m_renderRegion);
m_bLastVisible = visible;
CGUIDialog::DoProcess(currentTime, dirtyregions);
}
示例6: assert
bool CGUIWindowManager::Render()
{
assert(g_application.IsCurrentThread());
CSingleLock lock(g_graphicsContext);
CDirtyRegionList dirtyRegions = m_tracker.GetDirtyRegions();
bool hasRendered = false;
// If we visualize the regions we will always render the entire viewport
if (g_advancedSettings.m_guiVisualizeDirtyRegions || g_advancedSettings.m_guiAlgorithmDirtyRegions == DIRTYREGION_SOLVER_NONE)
{
RenderPass();
hasRendered = true;
}
else
{
for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
{
if (i->IsEmpty())
continue;
g_graphicsContext.SetScissors(*i);
RenderPass();
hasRendered = true;
}
g_graphicsContext.ResetScissors();
}
if (g_advancedSettings.m_guiVisualizeDirtyRegions)
{
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
const CDirtyRegionList &markedRegions = m_tracker.GetMarkedRegions();
for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); i++)
CGUITexture::DrawQuad(*i, 0x0fff0000);
for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
CGUITexture::DrawQuad(*i, 0x4c00ff00);
}
m_tracker.CleanMarkedRegions();
return hasRendered;
}
示例7: Process
void CGUIListGroup::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
CServiceBroker::GetWinSystem()->GetGfxContext().SetOrigin(m_posX, m_posY);
CRect rect;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
control->UpdateVisibility(m_item);
unsigned int oldDirty = dirtyregions.size();
control->DoProcess(currentTime, dirtyregions);
if (control->IsVisible() || (oldDirty != dirtyregions.size())) // visible or dirty (was visible?)
rect.Union(control->GetRenderRegion());
}
CServiceBroker::GetWinSystem()->GetGfxContext().RestoreOrigin();
CGUIControl::Process(currentTime, dirtyregions);
m_renderRegion = rect;
m_item = NULL;
}
示例8: Process
void CGUIControlGroup::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
CPoint pos(GetPosition());
g_graphicsContext.SetOrigin(pos.x, pos.y);
CRect rect;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
control->UpdateVisibility();
unsigned int oldDirty = dirtyregions.size();
control->DoProcess(currentTime, dirtyregions);
if (control->IsVisible() || (oldDirty != dirtyregions.size())) // visible or dirty (was visible?)
rect.Union(control->GetRenderRegion());
}
g_graphicsContext.RestoreOrigin();
CGUIControl::Process(currentTime, dirtyregions);
m_renderRegion = rect;
}
示例9: UpdateVertices
void CSlideShowPic::UpdateVertices(float cur_x[4], float cur_y[4], const float new_x[4], const float new_y[4], CDirtyRegionList &dirtyregions)
{
const size_t count = sizeof(float)*4;
if(memcmp(cur_x, new_x, count)
|| memcmp(cur_y, new_y, count)
|| m_bIsDirty)
{
dirtyregions.push_back(CDirtyRegion(GetRectangle(cur_x, cur_y)));
dirtyregions.push_back(CDirtyRegion(GetRectangle(new_x, new_y)));
memcpy(cur_x, new_x, count);
memcpy(cur_y, new_y, count);
}
}
示例10: DoProcess
void CGUIDialog::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
UpdateVisibility();
// if we were running but now we're not, mark us dirty
if (!m_active && m_wasRunning)
dirtyregions.push_back(m_renderRegion);
if (m_active)
CGUIWindow::DoProcess(currentTime, dirtyregions);
m_wasRunning = m_active;
}
示例11: DoProcess
void CGUIDialogBusy::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
bool visible = g_windowManager.GetTopMostModalDialogID() == WINDOW_DIALOG_BUSY;
if(!visible && m_bLastVisible)
dirtyregions.push_back(m_renderRegion);
m_bLastVisible = visible;
// update the progress control if available
const CGUIControl *control = GetControl(PROGRESS_CONTROL);
if (control && control->GetControlType() == CGUIControl::GUICONTROL_PROGRESS)
{
CGUIProgressControl *progress = (CGUIProgressControl *)control;
progress->SetPercentage(m_progress);
progress->SetVisible(m_progress > -1);
}
CGUIDialog::DoProcess(currentTime, dirtyregions);
}
示例12: Process
void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList ®ions)
{
const RESOLUTION_INFO res = g_graphicsContext.GetResInfo();
// reset the screensaver if we're in a slideshow
// (unless we are the screensaver!)
if (m_bSlideShow && !m_bPause && !g_application.IsInScreenSaver())
g_application.ResetScreenSaver();
int iSlides = m_slides.size();
if (!iSlides) return ;
// if we haven't processed yet, we should mark the whole screen
if (!HasProcessed())
regions.push_back(CRect(0.0f, 0.0f, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight()));
if (m_iCurrentSlide < 0 || m_iCurrentSlide >= static_cast<int>(m_slides.size()))
m_iCurrentSlide = 0;
if (m_iNextSlide < 0 || m_iNextSlide >= static_cast<int>(m_slides.size()))
m_iNextSlide = GetNextSlide();
// Create our background loader if necessary
if (!m_pBackgroundLoader)
{
m_pBackgroundLoader = new CBackgroundPicLoader();
if (!m_pBackgroundLoader)
{
throw 1;
}
m_pBackgroundLoader->Create(this);
}
bool bSlideShow = m_bSlideShow && !m_bPause && !m_bPlayingVideo;
if (bSlideShow && m_slides.at(m_iCurrentSlide)->HasProperty("unplayable"))
{
m_iNextSlide = GetNextSlide();
if (m_iCurrentSlide == m_iNextSlide)
return;
m_iCurrentSlide = m_iNextSlide;
m_iNextSlide = GetNextSlide();
}
if (m_bErrorMessage)
{ // we have an error when loading either the current or next picture
// check to see if we have a picture loaded
CLog::Log(LOGDEBUG, "We have an error loading picture %d!", m_pBackgroundLoader->SlideNumber());
if (m_iCurrentSlide == m_pBackgroundLoader->SlideNumber())
{
if (m_Image[m_iCurrentPic].IsLoaded())
{
// current image was already loaded, so we can ignore this error.
m_bErrorMessage = false;
}
else
{
CLog::Log(LOGERROR, "Error loading the current image %d: %s", m_iCurrentSlide, m_slides.at(m_iCurrentSlide)->GetPath().c_str());
if (!m_slides.at(m_iCurrentPic)->IsVideo())
{
// try next if we are in slideshow
CLog::Log(LOGINFO, "set image %s unplayable", m_slides.at(m_iCurrentSlide)->GetPath().c_str());
m_slides.at(m_iCurrentSlide)->SetProperty("unplayable", true);
}
if (m_bLoadNextPic || (bSlideShow && !m_bPause && !m_slides.at(m_iCurrentPic)->IsVideo()))
{
// change to next item, wait loading.
m_iCurrentSlide = m_iNextSlide;
m_iNextSlide = GetNextSlide();
m_bErrorMessage = false;
}
// else just drop through - there's nothing we can do (error message will be displayed)
}
}
else if (m_iNextSlide == m_pBackgroundLoader->SlideNumber())
{
CLog::Log(LOGERROR, "Error loading the next image %d: %s", m_iNextSlide, m_slides.at(m_iNextSlide)->GetPath().c_str());
// load next image failed, then skip to load next of next if next is not video.
if (!m_slides.at(m_iNextSlide)->IsVideo())
{
CLog::Log(LOGINFO, "set image %s unplayable", m_slides.at(m_iNextSlide)->GetPath().c_str());
m_slides.at(m_iNextSlide)->SetProperty("unplayable", true);
// change to next item, wait loading.
m_iNextSlide = GetNextSlide();
}
else
{ // prevent reload the next pic and repeat fail.
m_iLastFailedNextSlide = m_iNextSlide;
}
m_bErrorMessage = false;
}
else
{ // Non-current and non-next slide, just ignore error.
CLog::Log(LOGERROR, "Error loading the non-current non-next image %d/%d: %s", m_iNextSlide, m_pBackgroundLoader->SlideNumber(), m_slides.at(m_iNextSlide)->GetPath().c_str());
m_bErrorMessage = false;
}
}
if (m_bErrorMessage)
{ // hack, just mark it all
regions.push_back(CRect(0.0f, 0.0f, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight()));
return;
//.........这里部分代码省略.........
示例13: Solve
void CFillViewportOnChangeRegionSolver::Solve(const CDirtyRegionList &input, CDirtyRegionList &output)
{
if (input.size() > 0)
output.assign(1,g_graphicsContext.GetViewWindow());
}
示例14: Process
void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList ®ions)
{
// reset the screensaver if we're in a slideshow
// (unless we are the screensaver!)
if (m_bSlideShow && !g_application.IsInScreenSaver())
g_application.ResetScreenSaver();
int iSlides = m_slides->Size();
if (!iSlides) return ;
// if we haven't rendered yet, we should mark the whole screen
if (!m_hasRendered)
regions.push_back(CRect(0.0f, 0.0f, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight()));
if (m_iNextSlide < 0 || m_iNextSlide >= m_slides->Size())
m_iNextSlide = 0;
if (m_iCurrentSlide < 0 || m_iCurrentSlide >= m_slides->Size())
m_iCurrentSlide = 0;
// Create our background loader if necessary
if (!m_pBackgroundLoader)
{
m_pBackgroundLoader = new CBackgroundPicLoader();
if (!m_pBackgroundLoader)
{
throw 1;
}
m_pBackgroundLoader->Create(this);
}
bool bSlideShow = m_bSlideShow && !m_bPause && !m_bPlayingVideo;
if (m_bErrorMessage)
{ // we have an error when loading either the current or next picture
// check to see if we have a picture loaded
CLog::Log(LOGDEBUG, "We have an error loading a picture!");
if (m_Image[m_iCurrentPic].IsLoaded())
{ // Yes. Let's let it transistion out, wait for it to be released, then try loading again.
CLog::Log(LOGERROR, "Error loading the next image %s", m_slides->Get(m_iNextSlide)->GetPath().c_str());
if (!bSlideShow)
{ // tell the pic to start transistioning out now
m_Image[m_iCurrentPic].StartTransistion();
m_Image[m_iCurrentPic].SetTransistionTime(1, IMMEDIATE_TRANSISTION_TIME); // only 20 frames for the transistion
}
m_bWaitForNextPic = true;
m_bErrorMessage = false;
}
else
{ // No. Not much we can do here. If we're in a slideshow, we mayaswell move on to the next picture
// change to next image
if (bSlideShow)
{
CLog::Log(LOGERROR, "Error loading the current image %s", m_slides->Get(m_iCurrentSlide)->GetPath().c_str());
m_iCurrentSlide = m_iNextSlide;
m_iNextSlide = GetNextSlide();
ShowNext();
m_bErrorMessage = false;
}
else if (m_bLoadNextPic)
{
m_iCurrentSlide = m_iNextSlide;
m_iNextSlide = GetNextSlide();
m_bErrorMessage = false;
}
// else just drop through - there's nothing we can do (error message will be displayed)
}
}
if (m_bErrorMessage)
{ // hack, just mark it all
regions.push_back(CRect(0.0f, 0.0f, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight()));
return;
}
if (!m_Image[m_iCurrentPic].IsLoaded() && !m_pBackgroundLoader->IsLoading())
{ // load first image
CLog::Log(LOGDEBUG, "Loading the current image %s", m_slides->Get(m_iCurrentSlide)->GetPath().c_str());
m_bWaitForNextPic = false;
m_bLoadNextPic = false;
// load using the background loader
int maxWidth, maxHeight;
GetCheckedSize((float)g_settings.m_ResInfo[m_Resolution].iWidth * zoomamount[m_iZoomFactor - 1],
(float)g_settings.m_ResInfo[m_Resolution].iHeight * zoomamount[m_iZoomFactor - 1],
maxWidth, maxHeight);
if (!m_slides->Get(m_iCurrentSlide)->IsVideo())
m_pBackgroundLoader->LoadPic(m_iCurrentPic, m_iCurrentSlide, m_slides->Get(m_iCurrentSlide)->GetPath(), maxWidth, maxHeight);
}
// check if we should discard an already loaded next slide
if (m_bLoadNextPic && m_Image[1 - m_iCurrentPic].IsLoaded() && m_Image[1 - m_iCurrentPic].SlideNumber() != m_iNextSlide)
{
m_Image[1 - m_iCurrentPic].Close();
}
// if we're reloading an image (for better res on zooming we need to close any open ones as well)
if (m_bReloadImage && m_Image[1 - m_iCurrentPic].IsLoaded() && m_Image[1 - m_iCurrentPic].SlideNumber() != m_iCurrentSlide)
{
m_Image[1 - m_iCurrentPic].Close();
}
if (m_bReloadImage)
//.........这里部分代码省略.........
示例15: Process
void CGUIWindowKaraokeLyrics::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
dirtyregions.push_back(CRect(0.0f, 0.0f, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight()));
}