11#include "../../c-api/gui/controls/rendering.h"
13#include "../renderHelper.h"
58 m_controlHandle = m_interface->kodi_gui->window->get_control_render_addon(
59 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
61 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase,
62 m_controlHandle,
this, OnCreateCB,
63 OnRenderCB, OnStopCB, OnDirtyCB);
76 m_interface->kodi_gui->control_rendering->destroy(m_interface->kodiBase, m_controlHandle);
102 virtual bool Create(
int x,
int y,
int w,
int h, kodi::HardwareContext device) {
return false; }
135 virtual bool Dirty() {
return false; }
162 kodi::HardwareContext device),
167 if (!cbhdl || !CBCreate || !CBRender || !CBStop || !CBDirty)
173 m_interface->kodi_gui->control_rendering->set_callbacks(
174 m_interface->kodiBase, m_controlHandle, cbhdl, CBCreate, CBRender, CBStop, CBDirty);
183 static bool OnCreateCB(
184 KODI_GUI_CLIENT_HANDLE cbhdl,
int x,
int y,
int w,
int h, ADDON_HARDWARE_CONTEXT device)
186 static_cast<CRendering*
>(cbhdl)->m_renderHelper = kodi::gui::GetRenderHelper();
187 return static_cast<CRendering*
>(cbhdl)->Create(x, y, w, h, device);
190 static void OnRenderCB(KODI_GUI_CLIENT_HANDLE cbhdl)
192 if (!
static_cast<CRendering*
>(cbhdl)->m_renderHelper)
194 static_cast<CRendering*
>(cbhdl)->m_renderHelper->Begin();
195 static_cast<CRendering*
>(cbhdl)->Render();
196 static_cast<CRendering*
>(cbhdl)->m_renderHelper->End();
199 static void OnStopCB(KODI_GUI_CLIENT_HANDLE cbhdl)
201 static_cast<CRendering*
>(cbhdl)->Stop();
202 static_cast<CRendering*
>(cbhdl)->m_renderHelper =
nullptr;
205 static bool OnDirtyCB(KODI_GUI_CLIENT_HANDLE cbhdl)
207 return static_cast<CRendering*
>(cbhdl)->Dirty();
210 std::shared_ptr<kodi::gui::IRenderHelper> m_renderHelper;
Definition Rendering.h:47
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition addon_base.h:197
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition addon_base.h:193
virtual void Render()
Render process call from Kodi.
Definition Rendering.h:112
virtual bool Create(int x, int y, int w, int h, kodi::HardwareContext device)
To create rendering control on Add-on.
Definition Rendering.h:102
~CRendering() override
Destructor.
Definition Rendering.h:74
void SetIndependentCallbacks(kodi::gui::ClientHandle cbhdl, bool(*CBCreate)(kodi::gui::ClientHandle cbhdl, int x, int y, int w, int h, kodi::HardwareContext device), void(*CBRender)(kodi::gui::ClientHandle cbhdl), void(*CBStop)(kodi::gui::ClientHandle cbhdl), bool(*CBDirty)(kodi::gui::ClientHandle cbhdl))
If the class is used independent (with "new CRendering") and not as parent (with "cCLASS_own : CRende...
Definition Rendering.h:156
virtual bool Dirty()
Call from Kodi where add-on becomes asked about dirty rendering region.
Definition Rendering.h:135
CRendering(CWindow *window, int controlId)
Construct a new control.
Definition Rendering.h:56
virtual void Stop()
Call from Kodi to stop rendering process.
Definition Rendering.h:122
KODI_GUI_CLIENT_HANDLE ClientHandle
Handler for addon-sided processing class If the callback functions used by the window are not used di...
Definition Window.h:43
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1938