Permalink
Browse files

[Picture] add methods to CSlideShowPic for reuse a loaded picture.

  • Loading branch information...
1 parent 67ec367 commit c6446e2c600358bd90b05bd57a5e5bd2b092cadb @ulion committed Apr 4, 2013
Showing with 29 additions and 0 deletions.
  1. +24 −0 xbmc/pictures/SlideShowPicture.cpp
  2. +5 −0 xbmc/pictures/SlideShowPicture.h
@@ -78,10 +78,34 @@ void CSlideShowPic::Close()
m_bIsDirty = true;
}
+void CSlideShowPic::Reset(DISPLAY_EFFECT dispEffect, TRANSISTION_EFFECT transEffect)
+{
+ CSingleLock lock(m_textureAccess);
+ if (m_pImage)
+ SetTexture_Internal(m_iSlideNumber, m_pImage, dispEffect, transEffect);
+ else
+ Close();
+}
+
+bool CSlideShowPic::IsDisplayEffectNeedChange(DISPLAY_EFFECT newDispEffect) const
+{
+ if (m_displayEffect == newDispEffect)
+ return false;
+ if (newDispEffect == EFFECT_RANDOM && m_displayEffect != EFFECT_NONE && m_displayEffect != EFFECT_NO_TIMEOUT)
+ return false;
+ return true;
+}
+
void CSlideShowPic::SetTexture(int iSlideNumber, CBaseTexture* pTexture, DISPLAY_EFFECT dispEffect, TRANSISTION_EFFECT transEffect)
{
CSingleLock lock(m_textureAccess);
Close();
+ SetTexture_Internal(iSlideNumber, pTexture, dispEffect, transEffect);
+}
+
+void CSlideShowPic::SetTexture_Internal(int iSlideNumber, CBaseTexture* pTexture, DISPLAY_EFFECT dispEffect, TRANSISTION_EFFECT transEffect)
+{
+ CSingleLock lock(m_textureAccess);
m_bPause = false;
m_bNoEffect = false;
m_bTransistionImmediately = false;
@@ -52,6 +52,10 @@ class CSlideShowPic
void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
void Render();
void Close();
+ void Reset(DISPLAY_EFFECT dispEffect = EFFECT_RANDOM, TRANSISTION_EFFECT transEffect = FADEIN_FADEOUT);
+ DISPLAY_EFFECT DisplayEffect() const { return m_displayEffect; }
+ bool IsDisplayEffectNeedChange(DISPLAY_EFFECT newDispEffect) const;
+ bool IsStarted() const { return m_iCounter > 0; }
bool IsFinished() const { return m_bIsFinished;};
bool DrawNextImage() const { return m_bDrawNextImage;};
@@ -81,6 +85,7 @@ class CSlideShowPic
bool m_bCanMoveHorizontally;
bool m_bCanMoveVertically;
private:
+ void SetTexture_Internal(int iSlideNumber, CBaseTexture* pTexture, DISPLAY_EFFECT dispEffect = EFFECT_RANDOM, TRANSISTION_EFFECT transEffect = FADEIN_FADEOUT);
void UpdateVertices(float cur_x[4], float cur_y[4], const float new_x[4], const float new_y[4], CDirtyRegionList &dirtyregions);
void Render(float *x, float *y, CBaseTexture* pTexture, color_t color);
CBaseTexture *m_pImage;

0 comments on commit c6446e2

Please sign in to comment.