[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / pictures / SlideShowPicture.h
blob0c368e429f148dde420251dc11627761de47570d
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "guilib/DirtyRegion.h"
12 #include "threads/CriticalSection.h"
13 #include "utils/ColorUtils.h"
15 #include <memory>
16 #include <string>
18 class CTexture;
20 class CSlideShowPic
22 public:
23 enum DISPLAY_EFFECT { EFFECT_NONE = 0, EFFECT_FLOAT, EFFECT_ZOOM, EFFECT_RANDOM, EFFECT_PANORAMA, EFFECT_NO_TIMEOUT };
24 enum TRANSITION_EFFECT { TRANSITION_NONE = 0, FADEIN_FADEOUT, CROSSFADE, TRANSITION_ZOOM, TRANSITION_ROTATE };
26 struct TRANSITION
28 TRANSITION_EFFECT type = TRANSITION_NONE;
29 int start = 0;
30 int length = 0;
33 static std::unique_ptr<CSlideShowPic> CreateSlideShowPicture();
35 CSlideShowPic();
36 virtual ~CSlideShowPic();
38 void SetTexture(int iSlideNumber,
39 std::unique_ptr<CTexture> pTexture,
40 DISPLAY_EFFECT dispEffect = EFFECT_RANDOM,
41 TRANSITION_EFFECT transEffect = FADEIN_FADEOUT);
42 void UpdateTexture(std::unique_ptr<CTexture> pTexture);
44 bool IsLoaded() const { return m_bIsLoaded; }
45 void UnLoad() { m_bIsLoaded = false; }
46 void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
47 void Render();
48 void Close();
49 void Reset(DISPLAY_EFFECT dispEffect = EFFECT_RANDOM, TRANSITION_EFFECT transEffect = FADEIN_FADEOUT);
50 DISPLAY_EFFECT DisplayEffect() const { return m_displayEffect; }
51 bool DisplayEffectNeedChange(DISPLAY_EFFECT newDispEffect) const;
52 bool IsStarted() const { return m_iCounter > 0; }
53 bool IsFinished() const;
54 bool IsAnimating() const;
55 bool DrawNextImage() const { return m_bDrawNextImage; }
57 int GetWidth() const { return (int)m_fWidth; }
58 int GetHeight() const { return (int)m_fHeight; }
60 void Keep();
61 bool StartTransition();
62 int GetTransitionTime(int iType) const;
63 void SetTransitionTime(int iType, int iTime);
65 int SlideNumber() const { return m_iSlideNumber; }
67 void Zoom(float fZoomAmount, bool immediate = false);
68 void Rotate(float fRotateAngle, bool immediate = false);
69 void UpdateAlpha();
70 void Pause(bool bPause);
71 void SetInSlideshow(bool slideshow);
72 void SetOriginalSize(int iOriginalWidth, int iOriginalHeight, bool bFullSize);
73 bool FullSize() const { return m_bFullSize; }
74 int GetOriginalWidth();
75 int GetOriginalHeight();
77 void Move(float dX, float dY);
78 float GetZoom() const { return m_fZoomAmount; }
80 bool m_bIsComic;
81 bool m_bCanMoveHorizontally;
82 bool m_bCanMoveVertically;
84 protected:
85 virtual void Render(float* x, float* y, CTexture* pTexture, KODI::UTILS::COLOR::Color color) = 0;
87 private:
88 void SetTexture_Internal(int iSlideNumber,
89 std::unique_ptr<CTexture> pTexture,
90 DISPLAY_EFFECT dispEffect = EFFECT_RANDOM,
91 TRANSITION_EFFECT transEffect = FADEIN_FADEOUT);
92 void UpdateVertices(float cur_x[4], float cur_y[4], const float new_x[4], const float new_y[4], CDirtyRegionList &dirtyregions);
94 std::unique_ptr<CTexture> m_pImage;
96 int m_iOriginalWidth;
97 int m_iOriginalHeight;
98 int m_iSlideNumber;
99 bool m_bIsLoaded;
100 bool m_bDrawNextImage;
101 bool m_bIsDirty;
102 std::string m_strFileName;
103 float m_fWidth;
104 float m_fHeight;
105 KODI::UTILS::COLOR::Color m_alpha = 0;
106 // stuff relative to middle position
107 float m_fPosX;
108 float m_fPosY;
109 float m_fPosZ;
110 float m_fVelocityX;
111 float m_fVelocityY;
112 float m_fVelocityZ;
113 float m_fZoomAmount;
114 float m_fZoomLeft;
115 float m_fZoomTop;
116 float m_ax[4]{}, m_ay[4]{};
117 float m_sx[4]{}, m_sy[4]{};
118 float m_bx[4]{}, m_by[4]{};
119 float m_ox[4]{}, m_oy[4]{};
121 // transition and display effects
122 DISPLAY_EFFECT m_displayEffect = EFFECT_NONE;
123 TRANSITION m_transitionStart;
124 TRANSITION m_transitionEnd;
125 TRANSITION m_transitionTemp; // used for rotations + zooms
126 float m_fAngle; // angle (between 0 and 2pi to display the image)
127 float m_fTransitionAngle;
128 float m_fTransitionZoom;
129 int m_iCounter = 0;
130 int m_iTotalFrames;
131 bool m_bPause;
132 bool m_bNoEffect;
133 bool m_bFullSize;
134 bool m_bTransitionImmediately;
136 CCriticalSection m_textureAccess;