| 1 |
/* |
| 2 |
* Copyright (C) 2017-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "cores/GameSettings.h" |
| 12 |
#include "cores/RetroPlayer/buffers/BaseRenderBuffer.h" |
| 13 |
#include "guilib/Texture.h" |
| 14 |
#include "guilib/TextureFormats.h" |
| 15 |
|
| 16 |
#include <memory> |
| 17 |
|
| 18 |
namespace KODI |
| 19 |
{ |
| 20 |
namespace RETRO |
| 21 |
{ |
| 22 |
class CRenderBufferGuiTexture : public CBaseRenderBuffer |
| 23 |
{ |
| 24 |
public: |
| 25 |
CRenderBufferGuiTexture(SCALINGMETHOD scalingMethod); |
| 26 |
~CRenderBufferGuiTexture() override = default; |
| 27 |
|
| 28 |
// implementation of IRenderBuffer via CBaseRenderBuffer |
| 29 |
bool Allocate(AVPixelFormat format, unsigned int width, unsigned int height) override; |
| 30 |
size_t GetFrameSize() const override; |
| 31 |
uint8_t* GetMemory() override; |
| 32 |
bool UploadTexture() override; |
| 33 |
void BindToUnit(unsigned int unit) override; |
| 34 |
|
| 35 |
// GUI texture interface |
| 36 |
CTexture* GetTexture() { return m_texture.get(); } |
| 37 |
|
| 38 |
protected: |
| 39 |
AVPixelFormat TranslateFormat(XB_FMT textureFormat); |
| 40 |
TEXTURE_SCALING TranslateScalingMethod(SCALINGMETHOD scalingMethod); |
| 41 |
|
| 42 |
// Texture parameters |
| 43 |
SCALINGMETHOD m_scalingMethod; |
| 44 |
XB_FMT m_textureFormat = XB_FMT_UNKNOWN; |
| 45 |
std::unique_ptr<CTexture> m_texture; |
| 46 |
}; |
| 47 |
|
| 48 |
} // namespace RETRO |
| 49 |
} // namespace KODI |