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.
11 #include "guilib/DirtyRegion.h"
12 #include "threads/CriticalSection.h"
13 #include "utils/ColorUtils.h"
17 #include "guilib/GUIShaderDX.h"
18 #include <wrl/client.h>
28 enum DISPLAY_EFFECT
{ EFFECT_NONE
= 0, EFFECT_FLOAT
, EFFECT_ZOOM
, EFFECT_RANDOM
, EFFECT_PANORAMA
, EFFECT_NO_TIMEOUT
};
29 enum TRANSITION_EFFECT
{ TRANSITION_NONE
= 0, FADEIN_FADEOUT
, CROSSFADE
, TRANSITION_ZOOM
, TRANSITION_ROTATE
};
33 TRANSITION_EFFECT type
= TRANSITION_NONE
;
41 void SetTexture(int iSlideNumber
,
42 std::unique_ptr
<CTexture
> pTexture
,
43 DISPLAY_EFFECT dispEffect
= EFFECT_RANDOM
,
44 TRANSITION_EFFECT transEffect
= FADEIN_FADEOUT
);
45 void UpdateTexture(std::unique_ptr
<CTexture
> pTexture
);
47 bool IsLoaded() const { return m_bIsLoaded
; }
48 void UnLoad() { m_bIsLoaded
= false; }
49 void Process(unsigned int currentTime
, CDirtyRegionList
&dirtyregions
);
52 void Reset(DISPLAY_EFFECT dispEffect
= EFFECT_RANDOM
, TRANSITION_EFFECT transEffect
= FADEIN_FADEOUT
);
53 DISPLAY_EFFECT
DisplayEffect() const { return m_displayEffect
; }
54 bool DisplayEffectNeedChange(DISPLAY_EFFECT newDispEffect
) const;
55 bool IsStarted() const { return m_iCounter
> 0; }
56 bool IsFinished() const { return m_bIsFinished
; }
57 bool DrawNextImage() const { return m_bDrawNextImage
; }
59 int GetWidth() const { return (int)m_fWidth
; }
60 int GetHeight() const { return (int)m_fHeight
; }
63 bool StartTransition();
64 int GetTransitionTime(int iType
) const;
65 void SetTransitionTime(int iType
, int iTime
);
67 int SlideNumber() const { return m_iSlideNumber
; }
69 void Zoom(float fZoomAmount
, bool immediate
= false);
70 void Rotate(float fRotateAngle
, bool immediate
= false);
71 void Pause(bool bPause
);
72 void SetInSlideshow(bool slideshow
);
73 void SetOriginalSize(int iOriginalWidth
, int iOriginalHeight
, bool bFullSize
);
74 bool FullSize() const { return m_bFullSize
; }
75 int GetOriginalWidth();
76 int GetOriginalHeight();
78 void Move(float dX
, float dY
);
79 float GetZoom() const { return m_fZoomAmount
; }
82 bool m_bCanMoveHorizontally
;
83 bool m_bCanMoveVertically
;
85 void SetTexture_Internal(int iSlideNumber
,
86 std::unique_ptr
<CTexture
> pTexture
,
87 DISPLAY_EFFECT dispEffect
= EFFECT_RANDOM
,
88 TRANSITION_EFFECT transEffect
= FADEIN_FADEOUT
);
89 void UpdateVertices(float cur_x
[4], float cur_y
[4], const float new_x
[4], const float new_y
[4], CDirtyRegionList
&dirtyregions
);
90 void Render(float* x
, float* y
, CTexture
* pTexture
, UTILS::COLOR::Color color
);
91 std::unique_ptr
<CTexture
> m_pImage
;
94 int m_iOriginalHeight
;
98 bool m_bDrawNextImage
;
100 std::string m_strFileName
;
103 UTILS::COLOR::Color m_alpha
= 0;
104 // stuff relative to middle position
114 float m_ax
[4]{}, m_ay
[4]{};
115 float m_sx
[4]{}, m_sy
[4]{};
116 float m_bx
[4]{}, m_by
[4]{};
117 float m_ox
[4]{}, m_oy
[4]{};
119 // transition and display effects
120 DISPLAY_EFFECT m_displayEffect
= EFFECT_NONE
;
121 TRANSITION m_transitionStart
;
122 TRANSITION m_transitionEnd
;
123 TRANSITION m_transitionTemp
; // used for rotations + zooms
124 float m_fAngle
; // angle (between 0 and 2pi to display the image)
125 float m_fTransitionAngle
;
126 float m_fTransitionZoom
;
132 bool m_bTransitionImmediately
;
134 CCriticalSection m_textureAccess
;
136 Microsoft::WRL::ComPtr
<ID3D11Buffer
> m_vb
;
137 bool UpdateVertexBuffer(Vertex
*vertices
);