Skip to content

Commit

Permalink
changing alpha means we need to mark picture dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Jun 30, 2011
1 parent c5a8562 commit e891d28
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions xbmc/pictures/SlideShowPicture.cpp
Expand Up @@ -213,20 +213,21 @@ void CSlideShowPic::UpdateVertices(float cur_x[4], float cur_y[4], const float n
void CSlideShowPic::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) void CSlideShowPic::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{ {
if (!m_pImage || !m_bIsLoaded || m_bIsFinished) return ; if (!m_pImage || !m_bIsLoaded || m_bIsFinished) return ;
color_t alpha = m_alpha;
if (m_iCounter <= m_transistionStart.length) if (m_iCounter <= m_transistionStart.length)
{ // do start transistion { // do start transistion
if (m_transistionStart.type == CROSSFADE) if (m_transistionStart.type == CROSSFADE)
{ // fade in at 1x speed { // fade in at 1x speed
m_alpha = (color_t)((float)m_iCounter / (float)m_transistionStart.length * 255.0f); alpha = (color_t)((float)m_iCounter / (float)m_transistionStart.length * 255.0f);
} }
else if (m_transistionStart.type == FADEIN_FADEOUT) else if (m_transistionStart.type == FADEIN_FADEOUT)
{ // fade in at 2x speed, then keep solid { // fade in at 2x speed, then keep solid
m_alpha = (color_t)((float)m_iCounter / (float)m_transistionStart.length * 255.0f * 2); alpha = (color_t)((float)m_iCounter / (float)m_transistionStart.length * 255.0f * 2);
if (m_alpha > 255) m_alpha = 255; if (alpha > 255) alpha = 255;
} }
else // m_transistionEffect == TRANSISTION_NONE else // m_transistionEffect == TRANSISTION_NONE
{ {
m_alpha = 0xFF; // opaque alpha = 0xFF; // opaque
} }
} }
bool bPaused = m_bPause | (m_fZoomAmount != 1.0f); bool bPaused = m_bPause | (m_fZoomAmount != 1.0f);
Expand Down Expand Up @@ -320,18 +321,23 @@ void CSlideShowPic::Process(unsigned int currentTime, CDirtyRegionList &dirtyreg
m_bDrawNextImage = true; m_bDrawNextImage = true;
if (m_transistionEnd.type == CROSSFADE) if (m_transistionEnd.type == CROSSFADE)
{ // fade out at 1x speed { // fade out at 1x speed
m_alpha = 255 - (color_t)((float)(m_iCounter - m_transistionEnd.start) / (float)m_transistionEnd.length * 255.0f); alpha = 255 - (color_t)((float)(m_iCounter - m_transistionEnd.start) / (float)m_transistionEnd.length * 255.0f);
} }
else if (m_transistionEnd.type == FADEIN_FADEOUT) else if (m_transistionEnd.type == FADEIN_FADEOUT)
{ // keep solid, then fade out at 2x speed { // keep solid, then fade out at 2x speed
m_alpha = (color_t)((float)(m_transistionEnd.length - m_iCounter + m_transistionEnd.start) / (float)m_transistionEnd.length * 255.0f * 2); alpha = (color_t)((float)(m_transistionEnd.length - m_iCounter + m_transistionEnd.start) / (float)m_transistionEnd.length * 255.0f * 2);
if (m_alpha > 255) m_alpha = 255; if (alpha > 255) alpha = 255;
} }
else // m_transistionEffect == TRANSISTION_NONE else // m_transistionEffect == TRANSISTION_NONE
{ {
m_alpha = 0xFF; // opaque alpha = 0xFF; // opaque
} }
} }
if (alpha != m_alpha)
{
m_alpha = alpha;
m_bIsDirty = true;
}
if (m_displayEffect != EFFECT_NO_TIMEOUT || m_iCounter < m_transistionStart.length || m_iCounter >= m_transistionEnd.start || (m_iCounter >= m_transistionTemp.start && m_iCounter < m_transistionTemp.start + m_transistionTemp.length)) if (m_displayEffect != EFFECT_NO_TIMEOUT || m_iCounter < m_transistionStart.length || m_iCounter >= m_transistionEnd.start || (m_iCounter >= m_transistionTemp.start && m_iCounter < m_transistionTemp.start + m_transistionTemp.length))
{ {
/* this really annoying. there's non-stop logging when viewing a pic outside of the slideshow /* this really annoying. there's non-stop logging when viewing a pic outside of the slideshow
Expand Down

0 comments on commit e891d28

Please sign in to comment.